21 #ifndef GENERAL_MATRIX_1X3_IMPL_H 22 #define GENERAL_MATRIX_1X3_IMPL_H 24 #ifndef SHEAF_DLL_SPEC_H 25 #include "SheafSystem/sheaf_dll_spec.h" 28 #ifndef ASSERT_CONTRACT_H 29 #include "SheafSystem/assert_contract.h" 32 #ifndef ERROR_MESSAGE_H 33 #include "SheafSystem/error_message.h" 36 #ifndef GENERAL_MATRIX_1X2_H 37 #include "SheafSystem/general_matrix_1x2.h" 40 #ifndef GENERAL_MATRIX_1X3_H 41 #include "SheafSystem/general_matrix_1x3.h" 44 #ifndef GENERAL_MATRIX_3X1_H 45 #include "SheafSystem/general_matrix_3x1.h" 48 #ifndef GENERAL_MATRIX_3X2_H 49 #include "SheafSystem/general_matrix_3x2.h" 52 #ifndef GENERAL_MATRIX_3X3_H 53 #include "SheafSystem/general_matrix_3x3.h" 57 #include "SheafSystem/std_sstream.h" 61 #include "SheafSystem/std_cmath.h" 67 using namespace sheaf;
108 template <
typename T>
125 template <
typename T>
132 require(nrow >= 0 && nrow < number_of_rows());
136 T* result = &components[row_index(nrow)];
147 template <
typename T>
154 require(nrow >= 0 && nrow < number_of_rows());
158 const T* result = &components[row_index(nrow)];
170 template <
typename T>
180 T* result = components;
192 template <
typename T>
194 operator
const T* ()
const 202 const T* result = components;
214 template <
typename T>
222 require(xrow >= 0 && xrow < number_of_rows());
226 int result = number_of_columns()*xrow;
230 ensure(result == number_of_columns()*xrow);
238 template <
typename T>
247 for(
int i=0; i<d(); ++i)
249 components[i] = xvalue;
254 ensure_for_all(i, 0, d(), components[i] == xvalue);
262 template <
typename T>
271 for(
int i=0; i<d(); ++i)
273 xresult.
components[i] = xscalar*components[i];
287 template <
typename T>
307 template <
typename T>
324 T b00 = xother[0][0];
325 T b10 = xother[1][0];
326 T b20 = xother[2][0];
328 xresult = a00*b00 + a01*b10 + a02*b20;
337 template <
typename T>
357 template <
typename T>
371 int nra = number_of_rows();
372 int nca = number_of_columns();
375 for(
int i=0; i<nra; ++i)
377 for(
int j=0; j<ncb; ++j)
381 for(
int k=0; k<nca; ++k)
383 sum += lm[i][k]*xother[k][j];
397 template <
typename T>
417 template <
typename T>
431 int nra = number_of_rows();
432 int nca = number_of_columns();
435 for(
int i=0; i<nra; ++i)
437 for(
int j=0; j<ncb; ++j)
441 for(
int k=0; k<nca; ++k)
443 sum += lm[i][k]*xother[k][j];
457 template <
typename T>
478 template <
typename T>
489 xresult[0][0] = lm[0][0];
490 xresult[1][0] = lm[0][1];
491 xresult[2][0] = lm[0][2];
500 template <
typename T>
524 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS 527 template <
typename T>
528 std::ostream& operator<<(std::ostream& xos, const general_matrix_1x3<T>& xm)
535 int ncols = xm.number_of_columns();
537 for(
int i=0; i<nrows; ++i)
539 for(
int j=0; j<ncols; ++j)
541 xos <<
" " << xm[i][j];
553 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS 560 #endif // GENERAL_MATRIX_1X3_IMPL_H static int number_of_columns()
The number of columns.
int row_index(int xrow) const
Index for row xrow in the linear storage array.
General matrix with 3 rows and 2 columns.
General matrix with 1 row and 2 columns.
static int number_of_rows()
The number of rows.
void multiply(const T &xscalar, general_matrix_1x3< T > &xresult) const
This matrix multiplied by a scalar (pre-allocated).
static int number_of_columns()
The number of columns.
T * operator[](int xrow)
Pointer to the first element in row xrow of this matrix. Facilitates accessing elements via matrix[i]...
General matrix with 3 rows and 1 column.
void assign(const T &xvalue)
Assign all elements of this matrix to the value xvalue.
static int number_of_rows()
The number of rows.
T components[3]
Linear storage array.
static int number_of_columns()
The number of columns.
General matrix with 3 rows and 3 columns.
General matrix with 1 row and 3 columns.
Namespace for the sheaves component of the sheaf system.
general_matrix_3x1< T > transpose() const
The transpose of the matrix (auto-allocated).
static int d()
Dimension of the underlying elements.
SHEAF_DLL_SPEC void multiply(const vd &x0, const vd_value_type &x1, vd &xresult, bool xauto_access)
Vector x0 multiplied by scalar x1 (pre-allocated version for persistent types).
Namespace for the fiber_bundles component of the sheaf system.