21 #ifndef GENERAL_MATRIX_1X2_IMPL_H 22 #define GENERAL_MATRIX_1X2_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_2X1_H 45 #include "SheafSystem/general_matrix_2x1.h" 48 #ifndef GENERAL_MATRIX_2X2_H 49 #include "SheafSystem/general_matrix_2x2.h" 52 #ifndef GENERAL_MATRIX_2X3_H 53 #include "SheafSystem/general_matrix_2x3.h" 57 #include "SheafSystem/std_sstream.h" 61 #include "SheafSystem/std_cmath.h" 67 using namespace sheaf;
109 template <
typename T>
126 template <
typename T>
133 require(nrow >= 0 && nrow < number_of_rows());
137 T* result = &components[row_index(nrow)];
148 template <
typename T>
155 require(nrow >= 0 && nrow < number_of_rows());
159 const T* result = &components[row_index(nrow)];
171 template <
typename T>
181 T* result = components;
193 template <
typename T>
195 operator
const T* ()
const 203 const T* result = components;
215 template <
typename T>
223 require(xrow >= 0 && xrow < number_of_rows());
233 ensure(result == number_of_columns()*xrow);
241 template <
typename T>
250 for(
int i=0; i<d(); ++i)
252 components[i] = xvalue;
257 ensure_for_all(i, 0, d(), components[i] == xvalue);
264 template <
typename T>
273 for(
int i=0; i<d(); ++i)
275 xresult.
components[i] = xscalar*components[i];
289 template <
typename T>
309 template <
typename T>
325 T b00 = xother[0][0];
326 T b10 = xother[1][0];
328 xresult = a00*b00 + a01*b10;
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>
477 template <
typename T>
488 xresult[0][0] = lm[0][0];
489 xresult[1][0] = lm[0][1];
498 template <
typename T>
523 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS 526 template <
typename T>
527 std::ostream& operator<<(std::ostream& xos, const general_matrix_1x2<T>& xm)
534 int ncols = xm.number_of_columns();
536 for(
int i=0; i<nrows; ++i)
538 for(
int j=0; j<ncols; ++j)
540 xos <<
" " << xm[i][j];
552 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS 559 #endif // GENERAL_MATRIX_1X2_IMPL_H T components[2]
Linear storage array.
general_matrix_2x1< T > transpose() const
The transpose of the matrix (auto-allocated).
T * operator[](int xrow)
Pointer to the first element in row xrow of this matrix. Facilitates accessing elements via matrix[i]...
static int number_of_rows()
The number of rows.
static int number_of_columns()
The number of columns.
General matrix with 1 row and 2 columns.
General matrix with 2 rows and 2 columns.
void assign(const T &xvalue)
Assign all elements of this matrix to the value xvalue.
static int number_of_columns()
The number of columns.
General matrix with 2 rows and 1 column.
static int number_of_rows()
The number of rows.
static int d()
Dimension of the underlying elements.
void multiply(const T &xscalar, general_matrix_1x2< T > &xresult) const
This matrix multiplied by a scalar (pre-allocated).
General matrix with 1 row and 3 columns.
Namespace for the sheaves component of the sheaf system.
General matrix with 2 rows and 3 columns.
static int number_of_columns()
The number of columns.
int row_index(int xrow) const
Index for row xrow in the linear storage array.
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.