SheafSystem  0.0.0.0
general_matrix_2x1.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 general_matrix_2x1 classes.
19 
20 #ifndef GENERAL_MATRIX_2X1_H
21 #define GENERAL_MATRIX_2X1_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_1x3;
36 template <typename T> class general_matrix_2x2;
37 template <typename T> class general_matrix_2x3;
38 
39 //==============================================================================
40 //==============================================================================
41 
52 template <typename T>
53 class general_matrix_2x1
54 {
55 public:
56 
60  static int number_of_rows();
61 
65  static int number_of_columns();
66 
70  static int d();
71 
76  T* operator[](int xrow);
77 
82  const T* operator[](int xrow) const;
83 
88  operator T* ();
89 
94  operator const T* () const;
95 
99  int row_index(int xrow) const;
100 
105 
106  //============================================================================
107  //============================================================================
108 
112  void assign(const T& xvalue);
113 
117  void multiply(const T& xscalar, general_matrix_2x1<T>& xresult) const;
118 
122  general_matrix_2x1<T> multiply(const T& xscalar) const;
123 
127  void multiply(const general_matrix_1x2<T>& xother,
128  general_matrix_2x2<T>& xresult) const;
129 
134 
138  void multiply(const general_matrix_1x3<T>& xother,
139  general_matrix_2x3<T>& xresult) const;
140 
145 
149  void transpose(general_matrix_1x2<T>& xresult) const;
150 
155 
156 protected:
157 private:
158 
159 };
160 
161 // =============================================================================
162 // NON-MEMBER FUNCTIONS
163 // =============================================================================
164 
168 template <typename T>
169 std::ostream& operator<<(std::ostream& xos, const general_matrix_2x1<T>& xm);
170 
171 
172 } // namespace fiber_bundle
173 
174 #endif // ifndef GENERAL_MATRIX_2X1_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.
int row_index(int xrow) const
Index for row xrow in the linear storage array.
General matrix with 2 rows and 1 column.
general_matrix_1x2< T > transpose() const
The transpose of the matrix (auto-allocated).
General matrix with 1 row and 3 columns.
General matrix with 2 rows and 3 columns.
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.