| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
#ifndef _MATRIXIO_H_ |
| 48 |
#define _MATRIXIO_H_ |
| 49 |
|
| 50 |
#include <stdio.h> |
| 51 |
#include <stdlib.h> |
| 52 |
#include "matrixMacros.h" |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
template <class real> |
| 57 |
int ReadMatrixFromDisk(const char * filename, int * m, int * n, real ** matrix); |
| 58 |
template <class real> |
| 59 |
int ReadMatrixFromDisk_(const char * filename, int * m, int * n, real ** matrix); |
| 60 |
|
| 61 |
int ReadMatrixSizeFromDisk(const char * filename, int * m, int * n); |
| 62 |
void ReadMatrixSizeFromDisk_(const char * filename, int * m, int * n); |
| 63 |
void ChangeMatrixHeader(const char * filename, int numRows, int numColumns); |
| 64 |
|
| 65 |
template <class real> |
| 66 |
int WriteMatrixToDisk(const char * filename, int m, int n, const real * matrix); |
| 67 |
template <class real> |
| 68 |
int WriteMatrixToDisk_(const char * filename, int m, int n, const real * matrix); |
| 69 |
|
| 70 |
template <class real> |
| 71 |
int AppendMatrixToDisk(const char * filename, int m, int n, const real * matrix); |
| 72 |
template <class real> |
| 73 |
int AppendMatrixToDisk_(const char * filename, int m, int n, const real * matrix); |
| 74 |
|
| 75 |
template <class real> |
| 76 |
int ReadMatrixFromDiskTextFile(const char * filename, int * m, int * n, real ** matrix); |
| 77 |
|
| 78 |
template <class real> |
| 79 |
int WriteMatrixToDiskTextFile(const char * filename, int m, int n, const real * matrix); |
| 80 |
|
| 81 |
|
| 82 |
template <class real> |
| 83 |
int ReadMatrixFromDiskListOfFiles(const char * fileList, int * m, int * n, real ** matrix); |
| 84 |
|
| 85 |
|
| 86 |
template <class real> |
| 87 |
void PrintMatrixInMathematicaFormat(int n, int r, real * U); |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
int Assert_(int a, int b, int assertionIdentifier); |
| 93 |
int Assert_(bool cond, int assertionIdentifier); |
| 94 |
|
| 95 |
|
| 96 |
void Abort_(const char * reason); |
| 97 |
void Abort_(const char * reason, int exitCode); |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
int OpenFile_(const char * filename, FILE ** fin, const char * mode); |
| 102 |
|
| 103 |
template <class real> |
| 104 |
int WriteMatrixToStream(FILE * file, int m, int n, const real * matrix); |
| 105 |
|
| 106 |
int WriteMatrixHeaderToStream(FILE * file, int m, int n); |
| 107 |
|
| 108 |
template <class real> |
| 109 |
int ReadMatrixFromStream(FILE * file, int m, int n, real * matrix); |
| 110 |
|
| 111 |
int ReadMatrixSizeFromStream(FILE * file, int * m, int * n); |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
template<class T> |
| 116 |
int ReadBinary(FILE * fin, T * data); |
| 117 |
template<class T> |
| 118 |
void ReadBinary_(FILE * fin, T * data); |
| 119 |
|
| 120 |
template<class T> |
| 121 |
int ReadBinaryBuffer(FILE * fin, int size, T * data); |
| 122 |
template<class T> |
| 123 |
void ReadBinaryBuffer_(FILE * fin, int size, T * data); |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
template <class real> |
| 128 |
int ReadModesFromDisk(const char * filename, int * n, int * r, real ** frequencies, real ** modes); |
| 129 |
|
| 130 |
int ReadModeInfoFromDisk(const char * filename, int * n, int * r); |
| 131 |
|
| 132 |
template <class real> |
| 133 |
int WriteModesToDisk(const char * filename, int n, int r, real * frequencies, real * modes); |
| 134 |
|
| 135 |
#endif |
| 136 |
|