10 #ifndef __RD_SQUARE_MATRIX_H__ 11 #define __RD_SQUARE_MATRIX_H__ 16 template <
typename TYPE>
27 :
Matrix<TYPE>(N, N, data){};
41 "Size mismatch during multiplication");
43 const TYPE *bData = B.
getData();
46 unsigned int idA, idAt, idC, idCt, idB;
47 TYPE *data = this->
d_data.get();
48 for (i = 0; i < this->
d_nRows; i++) {
51 for (j = 0; j < this->
d_nCols; j++) {
53 newData[idCt] = (TYPE)(0.0);
54 for (k = 0; k < this->
d_nCols; k++) {
56 idB = k * this->d_nRows + j;
57 newData[idCt] += (data[idAt] * bData[idB]);
61 boost::shared_array<TYPE> tsptr(newData);
69 unsigned int id1, id1t, id2;
71 TYPE *data = this->
d_data.get();
72 for (i = 1; i < this->
d_nRows; i++) {
74 for (j = 0; j < i; j++) {
76 id2 = j * this->d_nCols + i;
78 data[id1t] = data[id2];
SquareMatrix(unsigned int N, TYPE val)
unsigned int numRows() const
returns the number of rows
virtual SquareMatrix< TYPE > & operator*=(TYPE scale)
Multiplication by a scalar.
#define CHECK_INVARIANT(expr, mess)
virtual Matrix< TYPE > & operator*=(TYPE scale)
Multiplication by a scalar.
SquareMatrix()
brief Square matrix of size N
SquareMatrix< double > DoubleSquareMatrix
A matrix class for general, non-square matrices.
boost::shared_array< TYPE > DATA_SPTR
SquareMatrix(unsigned int N, typename Matrix< TYPE >::DATA_SPTR data)
virtual SquareMatrix< TYPE > & operator*=(const SquareMatrix< TYPE > &B)
In place matrix multiplication.
SquareMatrix(unsigned int N)
TYPE * getData()
returns a pointer to our data array
virtual SquareMatrix< TYPE > & transposeInplace()
In place matrix transpose.