SheafSystem  0.0.0.0
symmetric_matrix_2x2.h
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
18 // Interface for symmetric_matrix_2x2 classes.
19 
20 #ifndef SYMMETRIC_MATRIX_2X2_H
21 #define SYMMETRIC_MATRIX_2X2_H
22 
23 #ifndef SHEAF_DLL_SPEC_H
24 #include "SheafSystem/sheaf_dll_spec.h"
25 #endif
26 
27 #ifndef STD_IOSTREAM_H
28 #include "SheafSystem/std_iostream.h"
29 #endif
30 
31 namespace fiber_bundle
32 {
33 
34 template <typename T> class general_matrix_1x2;
35 template <typename T> class general_matrix_2x1;
36 template <typename T> class general_matrix_2x2;
37 template <typename T> class general_matrix_2x3;
38 
39 template <typename T> class met_e2_row_dofs_type;
40 template <typename T> class st2_e2_row_dofs_type;
41 
42 //==============================================================================
43 //==============================================================================
44 
55 template <typename T>
56 class symmetric_matrix_2x2
57 {
58 public:
59 
63  operator met_e2_row_dofs_type<T>& () const;
64 
68  operator st2_e2_row_dofs_type<T>& () const;
69 
73  static int number_of_rows();
74 
78  static int number_of_columns();
79 
83  static int d();
84 
89  T* operator[](int xrow);
90 
95  const T* operator[](int xrow) const;
96 
101  operator T* ();
102 
107  operator const T* () const;
108 
112  int row_index(int xrow) const;
113 
117  operator general_matrix_2x2<T> () const;
118 
122  general_matrix_1x2<T> row(int xrow) const;
123 
127  general_matrix_2x1<T> column(int xcolumn) const;
128 
133 
134  //============================================================================
135  //============================================================================
136 
140  void adjoint(symmetric_matrix_2x2<T>& xresult) const;
141 
146 
150  void assign(const T& xscalar);
151 
155  void determinant(T& xresult) const;
156 
160  T determinant() const;
161 
165  void diagonalization(symmetric_matrix_2x2<T>& xresult) const;
166 
171 
175  void identity(symmetric_matrix_2x2<T>& xresult) const;
176 
181 
185  void inverse(symmetric_matrix_2x2<T>& xresult) const;
186 
191 
195  bool is_diagonal() const;
196 
200  bool is_identity() const;
201 
205  bool is_positive_definite() const;
206 
210  void multiply(const T& xscalar, symmetric_matrix_2x2<T>& xresult) const;
211 
215  symmetric_matrix_2x2<T> multiply(const T& xscalar) const;
216 
220  void multiply(const general_matrix_2x1<T>& xother,
221  general_matrix_2x1<T>& xresult) const;
222 
227 
231  void multiply(const general_matrix_2x2<T>& xother,
232  general_matrix_2x2<T>& xresult) const;
233 
238 
242  void multiply(const general_matrix_2x3<T>& xother,
243  general_matrix_2x3<T>& xresult) const;
244 
249 
255  void multiply(const symmetric_matrix_2x2<T>& xother,
256  general_matrix_2x2<T>& xresult) const;
257 
264 
268  void trace(T& xresult) const;
269 
273  T trace() const;
274 
278  void transpose(symmetric_matrix_2x2<T>& xresult) const;
279 
284 
291 
292 
293 protected:
294 private:
295 
296 };
297 
298 // =============================================================================
299 // NON-MEMBER FUNCTIONS
300 // =============================================================================
301 
305 template <typename T>
306 std::ostream& operator<<(std::ostream& xos, const symmetric_matrix_2x2<T>& xm);
307 
308 
309 } // namespace fiber_bundle
310 
311 #endif // ifndef SYMMETRIC_MATRIX_2X2_H
symmetric_matrix_2x2< T > inverse() const
The inverse of the matrix (auto-allocated).
symmetric_matrix_2x2< T > diagonalization() const
The diagonalization of the matrix (auto-allocated).
bool is_positive_definite() const
True if this matrix is positive definite.
T trace() const
The trace of the matrix (auto-allocated).
symmetric_matrix_2x2< T > adjoint() const
The adjoint of the matrix (auto-allocated).
static int d()
Dimension of the underlying elements.
T determinant() const
The determinant of the matrix (auto-allocated).
static int number_of_rows()
The number of rows.
General matrix with 2 rows and 2 columns.
static int number_of_columns()
The number of columns.
general_matrix_2x1< T > column(int xcolumn) const
A 2x1 matrix containing the elements or column xcolumn.
Symmetric matrix with 2 rows and 2 columns.
General matrix with 2 rows and 1 column.
symmetric_matrix_2x2< T > identity() const
The identity matrix (auto-allocated).
symmetric_matrix_2x2< T > transpose() const
The transpose of the matrix (auto-allocated).
general_matrix_1x2< T > row(int xrow) const
A 1x2 matrix containing the elements or row xrow.
General matrix with 2 rows and 3 columns.
void assign(const T &xscalar)
Assign all elements of this matrix to the value xvalue.
bool is_identity() const
True if this is an identity matrix.
bool is_diagonal() const
True if this matrix is diagonal.
T components[3]
Linear storage array.
Namespace for the fiber_bundles component of the sheaf system.
void multiply(const T &xscalar, symmetric_matrix_2x2< T > &xresult) const
This matrix multiplied by a scalar (pre-allocated).
T * operator[](int xrow)
Pointer to the first element in row xrow of this matrix. Facilitates accessing elements via matrix[i]...
int row_index(int xrow) const
Index for row xrow in the linear storage array.