21 #ifndef GENERAL_MATRIX_2X1_IMPL_H 22 #define GENERAL_MATRIX_2X1_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>
323 int nra = number_of_rows();
324 int nca = number_of_columns();
327 for(
int i=0; i<nra; ++i)
329 for(
int j=0; j<ncb; ++j)
333 for(
int k=0; k<nca; ++k)
335 sum += lm[i][k]*xother[k][j];
349 template <
typename T>
369 template <
typename T>
383 int nra = number_of_rows();
384 int nca = number_of_columns();
387 for(
int i=0; i<nra; ++i)
389 for(
int j=0; j<ncb; ++j)
393 for(
int k=0; k<nca; ++k)
395 sum += lm[i][k]*xother[k][j];
409 template <
typename T>
429 template <
typename T>
440 xresult[0][0] = lm[0][0];
441 xresult[0][1] = lm[1][0];
450 template <
typename T>
474 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS 477 template <
typename T>
478 std::ostream& operator<<(std::ostream& xos, const general_matrix_2x1<T>& xm)
485 int ncols = xm.number_of_columns();
487 for(
int i=0; i<nrows; ++i)
489 for(
int j=0; j<ncols; ++j)
491 xos <<
" " << xm[i][j];
503 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS 510 #endif // GENERAL_MATRIX_2X1_IMPL_H static int number_of_columns()
The number of columns.
static int d()
Dimension of the underlying elements.
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.
General matrix with 1 row and 2 columns.
General matrix with 2 rows and 2 columns.
void multiply(const T &xscalar, general_matrix_2x1< T > &xresult) const
This matrix multiplied by a scalar (pre-allocated).
T components[2]
Linear storage array.
static int number_of_columns()
The number of columns.
int row_index(int xrow) const
Index for row xrow in the linear storage array.
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.
general_matrix_1x2< T > transpose() const
The transpose of the matrix (auto-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.
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.
void assign(const T &xvalue)
Assign all elements of this matrix to the value xvalue.