29 [[maybe_unused]]
int Rows,
55 std::initializer_list<std::initializer_list<double>> values
95 std::initializer_list<std::initializer_list<double>> values
109 template <
int Cols>
bool operator==(
double values[][Cols])
const {
110 bool result = Cols ==
_cols;
120 std::string
toString(
bool addLineBreaks =
false)
const;
127 bool addLineBreaks =
false
131 const double*
data()
const {
return _m; }
136 void multiply(
double* result,
double* x);
159 double* __restrict__ result,
160 const double* __restrict__ x,
170 double* __restrict__ result,
171 const double* __restrict__ x,
188 int numberOfReplications,
189 int shiftAfterEveryReplication,
190 bool extendColumnsToAccommodateShifts
194 int numberOfReplications,
195 int shiftAfterEveryReplication,
196 bool extendColumnsToAccommodateShifts
211 void insertEmptyRows(
int number,
int where,
int repeatEveryKColumns = 0);
224 void scale(
double value);
tarch::la::DynamicMatrix operator*(const tarch::la::DynamicMatrix &A, const tarch::la::DynamicMatrix &B)
tarch::la::DynamicMatrix kroneckerProduct(const tarch::la::DynamicMatrix &lhs, const tarch::la::DynamicMatrix &rhs)
Wrapper around static routine, so I don't have to use full-qualified name.
My standard matrix is a matrix where the size is fixed at compile time.
double & operator()(int row, int col)
~DynamicMatrix()
Free the array on the heap.
void multiply(double *result, double *x)
void batchedMultiplyAoS(double *__restrict__ result, const double *__restrict__ x, int batchCount, int resultSize, int firstRow)
This operation assumes that x holds a whole batch of vectors in AoS format.
void insertEmptyRows(int number, int where, int repeatEveryKColumns=0)
static std::string vectorToString(double *values, int entries, bool addLineBreaks=false)
I often need this in combination with the toString() operation above.
void removeColumn(int number)
const double * data() const
void multiplyBySmallMatrix(double *result, const DynamicMatrix &matrix) const
void shiftColumnsRight(int shift, bool wrap=false)
DynamicMatrix & operator=(const DynamicMatrix &)=delete
bool operator==(double values[][Cols]) const
void shiftRowsDown(int shift, bool wrap=false)
Shift the rows to the right.
void insertEmptyColumns(int number, int where, int repeatEveryKColumns=0)
Insert zero columns.
void replicateRows(int blockSize, int numberOfReplications, int shiftAfterEveryReplication, bool extendColumnsToAccommodateShifts)
Split the matrix into blocks of rows of size blockSize.
DynamicMatrix(int rows, int cols)
Create empty matrix.
void replicateCols(int blockSize, int numberOfReplications, int shiftAfterEveryReplication, bool extendColumnsToAccommodateShifts)
int serialise(int row, int col) const
std::string toString(bool addLineBreaks=false) const
static tarch::la::DynamicMatrix id(int rows)
Create (square) identify matrix with rows rows and column.
static int serialise(int row, int col, int Rows, int Cols)
void scale(double value)
Scale all entries.
Vector< Rows, Scalar > col(const Matrix< Rows, Cols, Scalar > &matrix, int whichColumn)
Extract row from matrix.
bool equals(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs, const Scalar &tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares to matrices on equality by means of a numerical accuracy.
Vector< Cols, Scalar > row(const Matrix< Rows, Cols, Scalar > &matrix, int whichRow)
Extract row from matrix.
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.