21 #ifndef ANTISYMMETRIC_MATRIX_2X2_IMPL_H 22 #define ANTISYMMETRIC_MATRIX_2X2_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 ANTISYMMETRIC_MATRIX_2X2_H 37 #include "SheafSystem/antisymmetric_matrix_2x2.h" 40 #ifndef GENERAL_MATRIX_1X2_H 41 #include "SheafSystem/general_matrix_1x2.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;
75 antisymmetric_matrix_2x2<T>::
82 T* lcomps =
const_cast<T*
>(components);
112 template <
typename T>
129 template <
typename T>
146 template <
typename T>
153 require(nrow >= 0 && nrow < number_of_rows());
157 T* result = &components[row_index(nrow)];
168 template <
typename T>
175 require(nrow >= 0 && nrow < number_of_rows());
179 const T* result = &components[row_index(nrow)];
191 template <
typename T>
201 T* result = components;
213 template <
typename T>
215 operator
const T* ()
const 223 const T* result = components;
235 template <
typename T>
243 require(xrow >= 0 && xrow < number_of_rows()-1);
247 int nrows = number_of_rows();
248 int result = (xrow*(2*nrows-1-xrow))/2 - 1 - xrow;
254 ensure(result == (xrow*(2*number_of_rows()-1-xrow))/2 - 1 - xrow);
262 template <
typename T>
275 result[0][1] = lm[0][1];
276 result[1][0] = -lm[0][1];
281 ensure(unexecutable(
"result == *this"));
289 template <
typename T>
296 require(xrow >= 0 && xrow < number_of_rows());
324 template <
typename T>
331 require(xcolumn >= 0 && xcolumn < number_of_columns());
359 template <
typename T>
378 xresult[0][1] = -a01;
379 xresult[1][0] = -a10;
389 template <
typename T>
404 xresult[0][1] = -components[0];
414 template <
typename T>
434 template <
typename T>
443 components[0] = xvalue;
453 template <
typename T>
462 T a01 = components[0];
473 template <
typename T>
495 template <
typename T>
507 double a01 = lm[0][1];
517 post_fatal_error_message(
"No inverse; determinant is zero.");
525 xresult[0][1] = -1.0/a01;
533 template <
typename T>
553 template <
typename T>
566 ensure(result ==
false);
575 template <
typename T>
584 xresult.
components[0] = xscalar*components[0];
597 template <
typename T>
616 template <
typename T>
635 T b00 = xother[0][0];
636 T b10 = xother[1][0];
641 xresult[0][0] = a01*b10;
642 xresult[1][0] = a10*b00;
651 template <
typename T>
671 template <
typename T>
690 T b00 = xother[0][0];
691 T b01 = xother[0][1];
692 T b10 = xother[1][0];
693 T b11 = xother[1][1];
700 xresult[0][0] = a01*b10;
701 xresult[0][1] = a01*b11;
703 xresult[1][0] = a10*b00;
704 xresult[1][1] = a10*b01;
714 template <
typename T>
734 template <
typename T>
753 T b00 = xother[0][0];
754 T b01 = xother[0][1];
755 T b02 = xother[0][2];
757 T b10 = xother[1][0];
758 T b11 = xother[1][1];
759 T b12 = xother[1][2];
769 xresult[0][0] = a01*b10;
770 xresult[0][1] = a01*b11;
771 xresult[0][2] = a01*b12;
773 xresult[1][0] = a10*b00;
774 xresult[1][1] = a10*b01;
775 xresult[1][2] = a10*b02;
784 template <
typename T>
804 template <
typename T>
824 T b01 = xother[0][1];
836 xresult[0][0] = -a01*b01;
839 xresult[1][1] = xresult[0][0];
848 template <
typename T>
868 template <
typename T>
881 ensure(xresult == 0);
887 template <
typename T>
908 template <
typename T>
920 xresult[0][1] = -components[0];
929 template <
typename T>
952 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS 955 template <
typename T>
956 std::ostream& operator<<(std::ostream& xos, const antisymmetric_matrix_2x2<T>& xm)
965 xos <<
" " << 0.0 <<
" " << xm[0][1] << std::endl;
966 xos <<
" " << -xm[0][1] <<
" " << 0.0 << std::endl;
975 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS 982 #endif // ANTISYMMETRIC_MATRIX_2X2_IMPL_H T determinant() const
The determinant of the matrix (auto-allocated).
static int number_of_columns()
The number of columns.
T components[2]
Linear storage array.
void multiply(const T &xscalar, antisymmetric_matrix_2x2< T > &xresult) const
This matrix multiplied by a scalar (pre-allocated).
T components[1]
Linear storage array.
static int d()
Dimension of the underlying elements.
general_matrix_1x2< T > row(int xrow) const
A 1x2 matrix containing the elements or row xrow.
General matrix with 1 row and 2 columns.
General matrix with 2 rows and 2 columns.
static int number_of_rows()
The number of rows.
T components[2]
Linear storage array.
general_matrix_2x2< T > adjoint() const
The adjoint of the matrix (auto-allocated).
antisymmetric_matrix_2x2< T > transpose() const
The transpose of the matrix (auto-allocated).
void trace(const S0 &x0, SR &xresult, bool xauto_access)
General matrix with 2 rows and 1 column.
Antisymmetric matrix with 2 rows and 2 columns.
Row dofs type for class at2_e2.
general_matrix_2x1< T > column(int xcolumn) const
A 2x1 matrix containing the elements or column xcolumn.
antisymmetric_matrix_2x2< T > adjoint() const
The adjoint of the matrix (auto-allocated).
void determinant(const S0 &x0, SR &xresult, bool xauto_access)
T * operator[](int xrow)
Pointer to the first element in row xrow of this matrix. Facilitates accessing elements via matrix[i]...
bool is_positive_definite() const
True if this matrix is positive definite. Always returns false for antisymmetric_matrices.
Namespace for the sheaves component of the sheaf system.
General matrix with 2 rows and 3 columns.
int row_index(int xrow) const
Index for row xrow in the linear storage array.
antisymmetric_matrix_2x2< T > inverse() const
The inverse of the matrix (auto-allocated).
void assign(const T &xscalar)
Assign all elements of this matrix to the value xvalue.
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.
SHEAF_DLL_SPEC void inverse(const gl2_lite &xlite, gl2_lite &xresult)
Inverse (pre-allocated version for volatile type).
T trace() const
The trace of the matrix (auto-allocated).