Go to the documentation of this file.00001 #ifndef SVDLIB_H
00002 #define SVDLIB_H
00003
00004 #ifndef FALSE
00005 # define FALSE 0
00006 #endif
00007 #ifndef TRUE
00008 # define TRUE 1
00009 #endif
00010
00011
00012 typedef struct smat *SMat;
00013 typedef struct dmat *DMat;
00014 typedef struct svdrec *SVDRec;
00015
00016
00017 struct smat {
00018 long rows;
00019 long cols;
00020 long vals;
00021 long *pointr;
00022 long *rowind;
00023 double *value;
00024 };
00025
00026
00027 struct dmat {
00028 long rows;
00029 long cols;
00030 double **value;
00031 };
00032
00033 struct svdrec {
00034 int d;
00035 DMat Ut;
00036
00037 double *S;
00038 DMat Vt;
00039
00040 };
00041
00042
00043
00044
00045
00046 extern char *SVDVersion;
00047
00048
00049 extern long SVDVerbosity;
00050
00051
00052 enum svdCounters {SVD_MXV, SVD_COUNTERS};
00053 extern long SVDCount[SVD_COUNTERS];
00054 extern void svdResetCounters(void);
00055
00056 enum svdFileFormats {SVD_F_STH, SVD_F_ST, SVD_F_SB, SVD_F_DT, SVD_F_DB};
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 #define SVD_IS_SPARSE(format) ((format >= SVD_F_STH) && (format <= SVD_F_SB))
00068
00069
00070
00071
00072
00073 extern DMat svdNewDMat(int rows, int cols);
00074
00075 extern void svdFreeDMat(DMat D);
00076
00077
00078 SMat svdNewSMat(int rows, int cols, int vals);
00079
00080 void svdFreeSMat(SMat S);
00081
00082
00083 SVDRec svdNewSVDRec(void);
00084
00085 void svdFreeSVDRec(SVDRec R);
00086
00087
00088 DMat svdConvertStoD(SMat S);
00089
00090 SMat svdConvertDtoS(DMat D);
00091
00092
00093 DMat svdTransposeD(DMat D);
00094
00095 SMat svdTransposeS(SMat S);
00096
00097
00098 extern void svdWriteDenseArray(double *a, int n, char *filename, char binary);
00099
00100 extern double *svdLoadDenseArray(char *filename, int *np, char binary);
00101
00102
00103 extern SMat svdLoadSparseMatrix(char *filename, int format);
00104
00105 extern DMat svdLoadDenseMatrix(char *filename, int format);
00106
00107
00108 extern void svdWriteDenseMatrix(DMat A, char *filename, int format);
00109
00110 extern void svdWriteSparseMatrix(SMat A, char *filename, int format);
00111
00112
00113
00114 extern SVDRec svdLAS2(SMat A, long dimensions, long iterations, double end[2],
00115 double kappa);
00116
00117 extern SVDRec svdLAS2A(SMat A, long dimensions);
00118
00119 #endif