- Timestamp:
- 07/24/09 08:53:22 (15 years ago)
- Location:
- library
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/math/square_mat.h
r384 r427 31 31 mat ltuinv( const mat &L ); 32 32 33 /*! \brief Virtualclass for representation of double symmetric matrices in square-root form.33 /*! \brief Abstract class for representation of double symmetric matrices in square-root form. 34 34 35 35 All operations defined on this class should be optimized for the chosen decomposition. … … 97 97 int cols() const {return dim;}; 98 98 99 //! Reimplementing common functions of mat: cols().99 //! Reimplementing common functions of mat: rows(). 100 100 int rows() const {return dim;}; 101 101 … … 187 187 All inplace operations modifies only these and the need to compose and decompose the matrix is avoided. 188 188 */ 189 class ldmat: sqmat189 class ldmat: public sqmat 190 190 { 191 191 public: … … 218 218 double invqform (const vec &v ) const; 219 219 void clear(); 220 int cols() const;221 int rows() const;222 220 vec sqrt_mult ( const vec &v ) const; 223 221 … … 284 282 //!mapping of negative add operation to operators 285 283 inline ldmat& ldmat::operator -= ( const ldmat &ldA ) {this->add ( ldA,-1.0 );return *this;} 286 //!access function287 inline int ldmat::cols() const {return dim;}288 //!access function289 inline int ldmat::rows() const {return dim;}290 284 291 285 /*! @} */ -
library/tests/square_mat_test.cpp
r426 r427 32 32 33 33 TMatrix sqmat(A); 34 CHECK_EQUAL(sz, sqmat.rows()); 35 CHECK_EQUAL(sz, sqmat.cols()); 36 34 37 mat res = sqmat.to_mat(); 35 38 CHECK_CLOSE(A, res, epsilon); … … 45 48 double d = det(A); 46 49 CHECK_CLOSE(log(d), sqmat.logdet(), epsilon); 50 51 double q = sqmat.qform(ones(sz)); 52 CHECK_CLOSE(sumsum(A), q, epsilon); 53 54 q = sqmat.qform(v); 55 double r = (A * v) * v; 56 CHECK_CLOSE(r, q, epsilon); 57 58 sqmat2 = sqmat; 59 sqmat2.clear(); 60 CHECK_EQUAL(0, sqmat2.qform(ones(sz))); 47 61 } 48 62