📄 matvec.hpp
字号:
// $mat\matvec.hpp 1.5 milbo$// Warning: this is raw research code -- expect it to be quite messy.//// milbo dec05 durban#if !defined(matvec_hpp)#define matvec_hpp#include <iostream>#include <fstream>#include <iomanip>#include <vector>#include <string>#include <math.h>#include <stdlib.h>#include <assert.h>#pragma warning(disable:4786) // MSC compiler: disable warnings about extremely long variable names in STL#include "cvec.hpp"#include "mat.hpp"using namespace GslMat;using namespace std;typedef cvec<Mat> MatVec; // a vector of matrices (in C parlance, an array of Mats)typedef cvec<Vec> VecVec; // a vector of vectors (identical to MatVec, but intent of programmer is slightly different)typedef cvec<MatView> MatViewVec; // a vector of matrix views (in C parlance, an array of MatViews)typedef cvec<string> StringVec; // a vector of strings (in C parlance, an array of strings)#define MAT_NO_CHECK_SAME_DIM 0 // values for fCheckSameDim#define MAT_CHECK_SAME_DIM 1#define MAT_NO_VERBOSE_AT_VEC_LEVEL 0 // values for fVerboseAtVecLev#define MAT_VERBOSE_AT_VEC_LEVEL 1#define MAT_NO_VERBOSE_AT_MAT_LEVEL 0 // values for fVerboseAtMatLev#define MAT_VERBOSE_AT_MAT_LEVEL 1#define MAT_NO_FREE 0 // values for fFree#define MAT_FREE 1#define MAT_REGEX_STRING 0 // values for fPlainString#define MAT_PLAIN_STRING 1#define FNAME_OFFSET 5 // offset of filename in string preceding each shapevoid ReadMatVec(MatVec *pMatV, StringVec *pStringV, // out const char *sFile, FILE *pFile=NULL, // in const char *sTagRegExp=NULL, // in: only read matrices whose tag strings match this regular expression (default is all) unsigned Mask1=0, unsigned Mask2=0, // in: only read matrices where Attr&Mask1 == Mask2 (Attr is hex part of tag string) int nWantedMats=0, // in: 0 means read all, n means read up to n matrices bool fCheckSameDim=false, bool fVerboseAtVecLev=false, bool fVerboseAtMatLev=false); // invoid PrintMatVec(MatVec &MatV, const char sMsg[]=NULL, const char sFormat[]=NULL, const char *sFile=NULL, FILE *pFile=NULL, int nMax=NULL, bool fPrintRowIndex=NULL);void PrintMatVec(MatViewVec &MatV, const char sMsg[]=NULL, const char sFormat[]=NULL, const char *sFile=NULL, FILE *pFile=NULL, int nMax=NULL, bool fPrintRowIndex=NULL);void AllocMatVec(MatVec &MatV, size_t nMats, size_t nrows, size_t ncols, bool fClear=true);void ReadSelectedMat(Mat &M, char sTag[], // out const char sMatFile[], FILE *pMatFile, int iWantedMat, // in bool fCheckSameDim=false, bool fVerbose=false, bool fPrintAssociatedString=false); // inint iReadSelectedMatGivenRegExp(Mat &M, char sTag[], // out const char sMatFile[], FILE *pMatFile, // in const char sTagRegExp[], bool fPlainString=false, // in bool fVerbose=false, bool fPrintAssociatedString=false); // invoid WriteMatVec(const MatVec MatV, const char *sFile, FILE *pFile, const char *sMatVecComment=NULL, const char *sMatComment=NULL, StringVec *pTagStrings=NULL, bool fVerbose=false, char *sFormat=NULL);void WriteMatVecAsCArray(const MatVec &MatV, const char sArrayName[], const char *sFile, FILE *pFile=NULL, const char *sType="double", bool fVerbose=false, bool fLimitOutputWidth=true);void BuildMatIndexFile(const char sMatFile[], const char *sIndexFile=NULL, bool fVerbose=false);#endif // matvec_hpp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -