ParMooN
 All Classes Functions Variables Friends Pages
rkmatrix.h
1 #ifndef RKMATRIX
2 #define RKMATRIX
3 #include "basictools.h"
4 // #include <mkl.h>
5 
6 #define RK_SVD_EPS 1.0e-16
7 #define RK_SVD_EPS2 1.0e-32
8 #define RK_SVD_EPS3 1.0e-64
9 
10 typedef class rkmatrix* prkmatrix;
11 
12 /* An rkmatrix with paramters k,rows,cols is a factorisation
13 a * transpose(b) with (rows x k) matrix 'a' and (cols x k) matrix 'b'. */
14 
15 class rkmatrix {
16 public:
17  rkmatrix() { rows = 0; cols = 0; rk = 0; k = 0; a = 0x0; b = 0x0; } ;
18  rkmatrix(int k_new, int rows_new, int cols_new) { k = k_new; rk = k_new; rows = rows_new; cols = cols_new; a = allocate_vector(rows * k); b = allocate_vector(cols * k); } ;
19  ~rkmatrix() { if(a) free_vector(a); if(b) free_vector(b); } ;
20 
21  int k; // allocated rank
22  int rk; // real rank
23  int rows;
24  int cols;
25  double* a;
26  double* b;
27 
28  void rkmatrix_times_vector(EvalMode mode, double* b, double* c, double alpha, double beta);
29  void rkmatrix_times_matrix(EvalMode mode, double* B, double* C, int n, double alpha, double beta);
30  double get_frobenius_norm();
31  int rk_svd(double* u, double* sigma, double* v);
32 };
33 
34 #endif
Definition: rkmatrix.h:15