00001 #ifndef CROSS_HPP 00002 #define CROSS_HPP 00003 00004 #include "matrix.hpp" 00005 #include "skeleton.hpp" 00006 #include "indexlist.hpp" 00007 00021 //TODO: add set max_rank to allocate U, V and marked_index with this size 00023 00030 class Cross : public Skeleton { 00031 const Matrix& A; 00032 ReallocatableMatrix U; 00033 ReallocatableMatrix V; 00034 double fnorm2; /*||U * V.T||_F^2*/ 00035 double eps; 00036 00037 /* indexes from approximation process */ 00038 IndexList row_marked_index; 00039 IndexList col_marked_index; 00040 00041 /* recalculate frobenius norm after add one 00042 * column to u and v */ 00043 void RecalcFnorm(); 00044 00045 public: 00047 Cross(const Matrix& M); 00049 /* Calculate Cross approximation of mxn matrix M with stop criteria 00050 * eps * fnorm(U * V) >= |M_{ij}| * sqrt((m - rank) * (n - rank)). 00051 * \note Method may be called several times with different eps 00052 */ 00053 void Approximate(double _eps); 00055 double GetEps() const; 00056 unsigned GetNumRows() const; 00057 unsigned GetNumCols() const; 00058 double elem(unsigned i, unsigned j) const; 00060 const Matrix& GetM() const; 00061 const Matrix& GetU() const; 00062 const Matrix& GetV() const; 00064 ~Cross(); 00065 }; 00066 00067 #endif /* CROSS_HPP */