11 #ifndef __RD_SQUARE_MATRIX_H__ 12 #define __RD_SQUARE_MATRIX_H__ 17 template <
typename TYPE>
28 :
Matrix<TYPE>(N, N, data){};
42 "Size mismatch during multiplication");
44 const TYPE *bData = B.
getData();
47 unsigned int idA, idAt, idC, idCt, idB;
48 TYPE *data = this->
d_data.get();
49 for (i = 0; i < this->
d_nRows; i++) {
52 for (j = 0; j < this->
d_nCols; j++) {
54 newData[idCt] = (TYPE)(0.0);
55 for (k = 0; k < this->
d_nCols; k++) {
57 idB = k * this->d_nRows + j;
58 newData[idCt] += (data[idAt] * bData[idB]);
62 boost::shared_array<TYPE> tsptr(newData);
70 unsigned int id1, id1t, id2;
72 TYPE *data = this->
d_data.get();
73 for (i = 1; i < this->
d_nRows; i++) {
75 for (j = 0; j < i; j++) {
77 id2 = j * this->d_nCols + i;
79 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.