21 #ifndef ANTISYMMETRIC_MATRIX_3X3_IMPL_H 22 #define ANTISYMMETRIC_MATRIX_3X3_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_3X3_H 37 #include "SheafSystem/antisymmetric_matrix_3x3.h" 40 #ifndef GENERAL_MATRIX_1x3_H 41 #include "SheafSystem/general_matrix_1x3.h" 44 #ifndef GENERAL_MATRIX_3X2_H 45 #include "SheafSystem/general_matrix_3x2.h" 48 #ifndef GENERAL_MATRIX_3X1_H 49 #include "SheafSystem/general_matrix_3x1.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;
75 antisymmetric_matrix_3x3<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[0][2] = lm[0][2];
278 result[1][0] = -lm[0][1];
280 result[1][2] = lm[1][2];
282 result[2][0] = -lm[0][2];
283 result[2][1] = -lm[1][2];
288 ensure(unexecutable(
"result == *this"));
296 template <
typename T>
303 require(xrow >= 0 && xrow < number_of_rows());
339 template <
typename T>
346 require(xcolumn >= 0 && xcolumn < number_of_columns());
360 else if(xcolumn == 1)
381 template <
typename T>
448 template <
typename T>
468 template <
typename T>
479 components[0] = xvalue;
480 components[1] = xvalue;
481 components[2] = xvalue;
489 template <
typename T>
510 template <
typename T>
532 template <
typename T>
541 post_fatal_error_message(
"No inverse; determinant is zero.");
549 template <
typename T>
569 template <
typename T>
582 ensure(result ==
false);
590 template <
typename T>
601 xresult.
components[0] = xscalar*components[0];
602 xresult.
components[1] = xscalar*components[1];
603 xresult.
components[2] = xscalar*components[2];
616 template <
typename T>
636 template <
typename T>
660 T b00 = xother[0][0];
661 T b10 = xother[1][0];;
662 T b20 = xother[2][0];
668 xresult[0][0] = a01*b10 + a02*b20;
669 xresult[1][0] = a10*b00 + a12*b20;
670 xresult[2][0] = a20*b00 + a21*b10;
679 template <
typename T>
699 template <
typename T>
723 T b00 = xother[0][0];
724 T b01 = xother[0][1];
726 T b10 = xother[1][0];;
727 T b11 = xother[1][1];
729 T b20 = xother[2][0];
730 T b21 = xother[2][1];
741 xresult[0][0] = a01*b10 + a02*b20;
742 xresult[0][1] = a01*b11 + a02*b21;
744 xresult[1][0] = a10*b00 + a12*b20;
745 xresult[1][1] = a10*b01 + a12*b21;
747 xresult[2][0] = a20*b00 + a21*b10;
748 xresult[2][1] = a20*b01 + a21*b11;
757 template <
typename T>
777 template <
typename T>
801 T b00 = xother[0][0];
802 T b01 = xother[0][1];
803 T b02 = xother[0][2];
805 T b10 = xother[1][0];;
806 T b11 = xother[1][1];
807 T b12 = xother[1][2];
809 T b20 = xother[2][0];
810 T b21 = xother[2][1];
811 T b22 = xother[2][2];
825 xresult[0][0] = a01*b10 + a02*b20;
826 xresult[0][1] = a01*b11 + a02*b21;
827 xresult[0][2] = a01*b12 + a02*b22;
829 xresult[1][0] = a10*b00 + a12*b20;
830 xresult[1][1] = a10*b01 + a12*b21;
831 xresult[1][2] = a10*b02 + a12*b22;
833 xresult[2][0] = a20*b00 + a21*b10;
834 xresult[2][1] = a20*b01 + a21*b11;
835 xresult[2][2] = a20*b02 + a21*b12;
845 template <
typename T>
865 template <
typename T>
890 T b01 = xother[0][1];
891 T b02 = xother[0][2];
894 T b12 = xother[1][2];
911 xresult[0][0] = a01*b10 + a02*b20;
912 xresult[0][1] = a02*b21;
913 xresult[0][2] = a01*b12;
915 xresult[1][0] = a12*b20;
916 xresult[1][1] = a10*b01 + a12*b21;
917 xresult[1][2] = a10*b02;
919 xresult[2][0] = a21*b10;
920 xresult[2][1] = a20*b01;
921 xresult[2][2] = a20*b02 + a21*b12;
930 template <
typename T>
950 template <
typename T>
963 ensure(xresult == 0);
969 template <
typename T>
990 template <
typename T>
1003 xresult[0][1] = -lm[0][1];
1004 xresult[0][2] = -lm[0][2];
1005 xresult[1][2] = -lm[1][2];
1014 template <
typename T>
1037 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS 1040 template <
typename T>
1041 std::ostream& operator<<(std::ostream& xos, const antisymmetric_matrix_3x3<T>& xm)
1051 int ncols = xm.number_of_columns();
1053 for(
int i=0; i<nrows; ++i)
1055 for(
int j=0; j<ncols; ++j)
1077 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS 1084 #endif // ANTISYMMETRIC_MATRIX_3X3_IMPL general_matrix_1x3< T > row(int xrow) const
A 1x3 matrix containing the elements or row xrow.
antisymmetric_matrix_3x3< T > inverse() const
The inverse of the matrix (auto-allocated).
static int number_of_rows()
The number of rows.
Antisymmetric matrix with 3 rows and 3 columns.
General matrix with 3 rows and 2 columns.
T components[3]
Linear storage array.
void assign(const T &xscalar)
Assign all elements of this matrix to the value xvalue.
antisymmetric_matrix_3x3< T > transpose() const
The transpose of the matrix (auto-allocated).
int row_index(int xrow) const
Index for row xrow in the linear storage array.
T trace() const
The trace of the matrix (auto-allocated).
void trace(const S0 &x0, SR &xresult, bool xauto_access)
void multiply(const T &xscalar, antisymmetric_matrix_3x3< T > &xresult) const
This matrix multiplied by a scalar (pre-allocated).
general_matrix_3x3< T > adjoint() const
The adjoint of the matrix (auto-allocated).
Row dofs type for class at2_e3.
General matrix with 3 rows and 1 column.
static int d()
Dimension of the underlying elements.
bool is_positive_definite() const
True if this matrix is positive definite. Always returns false for antisymmetric_matrices.
static int number_of_columns()
The number of columns.
general_matrix_3x1< T > column(int xcolumn) const
A 3x1 matrix containing the elements or column xcolumn.
T components[3]
Linear storage array.
T determinant() const
The determinant of the matrix (auto-allocated).
void determinant(const S0 &x0, SR &xresult, bool xauto_access)
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.
T * operator[](int xrow)
Pointer to the first element in row xrow of this matrix. Facilitates accessing elements via matrix[i]...
T components[3]
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.
SHEAF_DLL_SPEC void inverse(const gl2_lite &xlite, gl2_lite &xresult)
Inverse (pre-allocated version for volatile type).