JWS C Library
C language utility library
|
00001 /* 00002 * This work is licensed under a Creative Commons 00003 * Attribution-Noncommercial-Share Alike 3.0 United States License. 00004 * 00005 * http://creativecommons.org/licenses/by-nc-sa/3.0/us/ 00006 * 00007 * You are free: 00008 * 00009 * to Share - to copy, distribute, display, and perform the work 00010 * to Remix - to make derivative works 00011 * 00012 * Under the following conditions: 00013 * 00014 * Attribution. You must attribute the work in the manner specified by the 00015 * author or licensor (but not in any way that suggests that they endorse you 00016 * or your use of the work). 00017 * 00018 * Noncommercial. You may not use this work for commercial purposes. 00019 * 00020 * Share Alike. If you alter, transform, or build upon this work, you may 00021 * distribute the resulting work only under the same or similar license to 00022 * this one. 00023 * 00024 * For any reuse or distribution, you must make clear to others the license 00025 * terms of this work. The best way to do this is by including this header. 00026 * 00027 * Any of the above conditions can be waived if you get permission from the 00028 * copyright holder. 00029 * 00030 * Apart from the remix rights granted under this license, nothing in this 00031 * license impairs or restricts the author's moral rights. 00032 */ 00033 00034 00046 #ifndef MATRIX_IO_H 00047 #define MATRIX_IO_H 00048 00049 00050 #include <jwsc/config.h> 00051 00052 #include <stdlib.h> 00053 #include <stdio.h> 00054 #include <inttypes.h> 00055 00056 #include "jwsc/base/error.h" 00057 #include "jwsc/math/complex.h" 00058 #include "jwsc/matrix/matrix.h" 00059 00060 00061 #ifdef __cplusplus 00062 namespace jwsc { 00063 extern "C" { 00064 #endif 00065 00066 00075 Error* read_matrix_u32(Matrix_u32** m_out, const char* fname); 00076 00078 Error* read_matrix_i32(Matrix_i32** m_out, const char* fname); 00079 00081 Error* read_matrix_i64(Matrix_i64** m_out, const char* fname); 00082 00084 Error* read_matrix_f(Matrix_f** m_out, const char* fname); 00085 00087 Error* read_matrix_d(Matrix_d** m_out, const char* fname); 00088 00090 Error* read_matrix_cf(Matrix_cf** m_out, const char* fname); 00091 00093 Error* read_matrix_cd(Matrix_cd** m_out, const char* fname); 00094 00108 Error* read_matrix_fp_u32(Matrix_u32** m_out, FILE* fp); 00109 00111 Error* read_matrix_fp_i32(Matrix_i32** m_out, FILE* fp); 00112 00114 Error* read_matrix_fp_i64(Matrix_i64** m_out, FILE* fp); 00115 00117 Error* read_matrix_fp_f(Matrix_f** m_out, FILE* fp); 00118 00120 Error* read_matrix_fp_d(Matrix_d** m_out, FILE* fp); 00121 00123 Error* read_matrix_fp_cf(Matrix_cf** m_out, FILE* fp); 00124 00126 Error* read_matrix_fp_cd(Matrix_cd** m_out, FILE* fp); 00127 00141 Error* write_matrix_u32(const Matrix_u32* m, const char* fname); 00142 00144 Error* write_matrix_i32(const Matrix_i32* m, const char* fname); 00145 00147 Error* write_matrix_i64(const Matrix_i64* m, const char* fname); 00148 00150 Error* write_matrix_f(const Matrix_f* m, const char* fname); 00151 00153 Error* write_matrix_d(const Matrix_d* m, const char* fname); 00154 00156 Error* write_matrix_cf(const Matrix_cf* m, const char* fname); 00157 00159 Error* write_matrix_cd(const Matrix_cd* m, const char* fname); 00160 00174 Error* write_matrix_fp_u32(const Matrix_u32* m, FILE* fp); 00175 00177 Error* write_matrix_fp_i32(const Matrix_i32* m, FILE* fp); 00178 00180 Error* write_matrix_fp_i64(const Matrix_i64* m, FILE* fp); 00181 00183 Error* write_matrix_fp_f(const Matrix_f* m, FILE* fp); 00184 00186 Error* write_matrix_fp_d(const Matrix_d* m, FILE* fp); 00187 00189 Error* write_matrix_fp_cf(const Matrix_cf* m, FILE* fp); 00190 00192 Error* write_matrix_fp_cd(const Matrix_cd* m, FILE* fp); 00193 00207 Error* read_matrix_with_header_u32(Matrix_u32** m_out, const char* fname); 00208 00210 Error* read_matrix_with_header_i32(Matrix_i32** m_out, const char* fname); 00211 00213 Error* read_matrix_with_header_i64(Matrix_i64** m_out, const char* fname); 00214 00216 Error* read_matrix_with_header_f(Matrix_f** m_out, const char* fname); 00217 00219 Error* read_matrix_with_header_d(Matrix_d** m_out, const char* fname); 00220 00222 Error* read_matrix_with_header_cf(Matrix_cf** m_out, const char* fname); 00223 00225 Error* read_matrix_with_header_cd(Matrix_cd** m_out, const char* fname); 00226 00240 Error* read_matrix_with_header_fp_u32(Matrix_u32** m_out, FILE* fp); 00241 00243 Error* read_matrix_with_header_fp_i32(Matrix_i32** m_out, FILE* fp); 00244 00246 Error* read_matrix_with_header_fp_i64(Matrix_i64** m_out, FILE* fp); 00247 00249 Error* read_matrix_with_header_fp_f(Matrix_f** m_out, FILE* fp); 00250 00252 Error* read_matrix_with_header_fp_d(Matrix_d** m_out, FILE* fp); 00253 00255 Error* read_matrix_with_header_fp_cf(Matrix_cf** m_out, FILE* fp); 00256 00258 Error* read_matrix_with_header_fp_cd(Matrix_cd** m_out, FILE* fp); 00259 00273 Error* write_matrix_with_header_u32(const Matrix_u32* m, const char* fname); 00274 00276 Error* write_matrix_with_header_i32(const Matrix_i32* m, const char* fname); 00277 00279 Error* write_matrix_with_header_i64(const Matrix_i64* m, const char* fname); 00280 00282 Error* write_matrix_with_header_f(const Matrix_f* m, const char* fname); 00283 00285 Error* write_matrix_with_header_d(const Matrix_d* m, const char* fname); 00286 00288 Error* write_matrix_with_header_cf(const Matrix_cf* m, const char* fname); 00289 00291 Error* write_matrix_with_header_cd(const Matrix_cd* m, const char* fname); 00292 00304 Error* write_matrix_with_header_fp_u32(const Matrix_u32* m, FILE* fp); 00305 00307 Error* write_matrix_with_header_fp_i32(const Matrix_i32* m, FILE* fp); 00308 00310 Error* write_matrix_with_header_fp_i64(const Matrix_i64* m, FILE* fp); 00311 00313 Error* write_matrix_with_header_fp_f(const Matrix_f* m, FILE* fp); 00314 00316 Error* write_matrix_with_header_fp_d(const Matrix_d* m, FILE* fp); 00317 00319 Error* write_matrix_with_header_fp_cf(const Matrix_cf* m, FILE* fp); 00320 00322 Error* write_matrix_with_header_fp_cd(const Matrix_cd* m, FILE* fp); 00323 00327 #ifdef __cplusplus 00328 } 00329 } 00330 #endif 00331 00332 00333 #endif