7template<
int Rows,
int Cols,
typename Scalar>
13template<
int Rows,
int Cols,
typename Scalar>
15 for (
int i=0; i < Rows*Cols; i++) {
16 _values[i] = initialValue;
22template<
int Rows,
int Cols,
typename Scalar>
25 for (
typename std::initializer_list<Scalar>::const_iterator p = values.begin(); p!=values.end(); p++) {
32template<
int Rows,
int Cols,
typename Scalar>
38template<
int Rows,
int Cols,
typename Scalar>
44template<
int Rows,
int Cols,
typename Scalar>
50template<
int Rows,
int Cols,
typename Scalar>
52 std::ostringstream os;
54 for (
int i=0; i < Rows; i++) {
56 for (
int j=0; j < Cols; j++) {
57 os << _values[i * Cols + j];
72template<
int Rows,
int Cols,
typename Scalar>
74 std::ostringstream os;
76 os << std::setiosflags(std::ios::fixed) << std::setprecision(numberOfDigits);
77 for (
int i=0; i < Rows; i++) {
79 for (
int j=0; j < Cols; j++) {
83 os << _values[i * Cols + j];
98template<
int Rows,
int Cols,
typename Scalar>
99template <
typename NewScalarType>
102 for (
int i=0; i < Rows; i++) {
103 for (
int j=0; j < Cols; j++) {
104 result(j,i) = operator()(j,i);
std::string toString() const
std::string toPrettyString(int numberOfDigits=4) const
int cols() const
Returns the number of columns in the matrix.
Matrix()
Constructs a non-initialized matrix.
int size() const
Returns the number of total elements in the matrix.
tarch::la::Matrix< Rows, Cols, NewScalarType > convertScalar() const
int rows() const
Returns the number of rows in the matrix.
double abs(double value)
Returns the absolute value of a type by redirecting to std::abs.