11#ifndef __RD_SQUARE_MATRIX_H__
12#define __RD_SQUARE_MATRIX_H__
17template <
typename TYPE>
28 :
Matrix<TYPE>(N, N, data) {}
44 "Size mismatch during multiplication");
46 const TYPE *bData = B.
getData();
49 unsigned int idA, idAt, idC, idCt, idB;
50 TYPE *data = this->
d_data.get();
51 for (i = 0; i < this->
d_nRows; i++) {
52 idA = i * this->d_nRows;
54 for (j = 0; j < this->
d_nCols; j++) {
56 newData[idCt] = (TYPE)(0.0);
57 for (k = 0; k < this->d_nCols; k++) {
59 idB = k * this->d_nRows + j;
60 newData[idCt] += (data[idAt] * bData[idB]);
64 boost::shared_array<TYPE> tsptr(newData);
72 unsigned int id1, id1t, id2;
74 TYPE *data = this->
d_data.get();
75 for (i = 1; i < this->
d_nRows; i++) {
77 for (j = 0; j < i; j++) {
79 id2 = j * this->d_nCols + i;
81 data[id1t] = data[id2];
#define CHECK_INVARIANT(expr, mess)
Matrix(unsigned int nRows, unsigned int nCols)
Initialize with a size.
TYPE * getData()
returns a pointer to our data array
unsigned int numRows() const
returns the number of rows
virtual Matrix< TYPE > & operator*=(TYPE scale)
Multiplication by a scalar.
boost::shared_array< TYPE > DATA_SPTR
SquareMatrix & operator=(const SquareMatrix< TYPE > &B)=default
SquareMatrix()
brief Square matrix of size N
SquareMatrix(const SquareMatrix &B)=default
SquareMatrix(unsigned int N, typename Matrix< TYPE >::DATA_SPTR data)
virtual SquareMatrix< TYPE > & transposeInplace()
In place matrix transpose.
SquareMatrix(unsigned int N, TYPE val)
virtual SquareMatrix< TYPE > & operator*=(const SquareMatrix< TYPE > &B)
In place matrix multiplication.
SquareMatrix< TYPE > & operator*=(TYPE scale) override
Multiplication by a scalar.
SquareMatrix & operator=(SquareMatrix< TYPE > &&B)=default
SquareMatrix(SquareMatrix< TYPE > &&B)=default
SquareMatrix(unsigned int N)
SquareMatrix< double > DoubleSquareMatrix