1 #ifndef CLASSIC_FMatrix_HH
2 #define CLASSIC_FMatrix_HH
38 template<
class T,
int R,
int C>
87 template <
class T,
int R,
int C>
91 template <
class T,
int R,
int C>
95 template <
class T,
int R,
int C>
99 template <
class T,
int R,
int C>
103 template <
class T,
int R,
int C>
107 template <
class T,
int R,
int C>
111 template <
class T,
int R,
int C>
115 template <
class T,
int R,
int C>
119 template <
class T,
int C>
123 template <
class T,
int C>
130 template<
class T,
int R,
int C>
136 template<
class T,
int R,
int C>
142 template<
class T,
int R,
int C>
148 template<
class T,
int R,
int C>
154 template<
class T,
int R,
int C>
160 template<
class T,
int R,
int C>
167 template<
class T,
int R,
int C>
174 template<
class T,
int R,
int C>
177 std::bind(std::multiplies<T>(), std::placeholders::_1, rhs));
182 template<
class T,
int R,
int C>
185 std::bind(std::divides<T>(), std::placeholders::_1, rhs));
190 template<
class T,
int R,
int C>
192 std::transform(this->
begin(), this->
end(), array.
begin(), this->begin(),
198 template<
class T,
int R,
int C>
200 std::transform(this->
begin(), this->
end(), array.
begin(), this->begin(),
206 template <
class T,
int R,
int C>
210 for(
int i = 0; i <
R; ++i) {
211 std::copy(this->row_begin(i), this->row_end(i), result.
col_begin(i));
221 template<
class T,
int R,
int C>
224 std::transform(rhs.
begin(), rhs.
end(), result.
begin(), std::negate<T>());
229 template<
class T,
int R,
int C>
232 return result += rhs;
236 template<
class T,
int R,
int C>
239 return result -= rhs;
243 template <
class T,
int R,
int I,
int C>
247 for(
int i = 0; i <
R; i++) {
251 for(
int j = 0; j < C; j++) {
252 result(i, j) = std::inner_product(i1, i2, rhs.
col_begin(j),
T(0));
260 template<
class T,
int R,
int C>
264 for(
int i = 0; i <
R; ++i) {
273 template<
class T,
int R,
int C>
277 for(
int j = 0; j < C; j++) {
278 result[j] = std::inner_product(lhs.
begin(), lhs.
end(),
286 template<
class T,
int R,
int C>
289 return result *= rhs;
293 template<
class T,
int R,
int C>
296 return result *= lhs;
300 template<
class T,
int R,
int C>
303 return result /= rhs;
310 template<
class T,
int C>
313 for(
int i = 0; i < C; i++) result[i][i] += rhs;
318 template<
class T,
int C>
321 for(
int i = 0; i < C; i++) result[i][i] -= rhs;
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
FMatrix< T, R, C > operator+(const FMatrix< T, R, C > &, const FMatrix< T, R, C > &)
Add.
FMatrix< T, R, C > operator/(const FMatrix< T, R, C > &, const T &)
Matrix divided by scalar.
FMatrix< T, R, C > operator-(const FMatrix< T, R, C > &)
Unary minus.
FVector< T, R > operator*(const FMatrix< T, R, C > &, const FVector< T, C > &)
Multiply by column vector.
iterator end()
Get iterator pointing past end of array.
iterator begin()
Get iterator pointing to beginning of array.
A templated representation for 2-dimensional arrays.
iterator end()
Get pointer past end of data.
row_iterator row_end(int r)
Get row iterator.
const FArray2D< T, M, N > & operator=(const FArray2D< T, M, N > &)
Assignment.
col_iterator col_begin(int c)
Get column iterator.
const T * const_row_iterator
Iterator for access by rows.
row_iterator row_begin(int r)
Get row iterator.
iterator begin()
Get beginning of data.
A templated representation for matrices.
FMatrix & operator+=(const FMatrix &)
Add matrix and assign.
FMatrix & operator-=(const FMatrix &)
Subtract ,atrix and assign.
FMatrix & operator/=(const T &)
Divide by scalar and assign.
FMatrix(const FArray2D< T, R, C > &)
Conversion from two-dimensional array.
FMatrix(const T *t)
Constructor.
FMatrix(const T &t)
Constructor.
FMatrix & operator=(const FArray2D< T, R, C > &)
Convert and assign.
FMatrix & operator*=(const T &)
Multiply by scalar and assign.
FMatrix< T, C, R > transpose() const
FMatrix transpose.
FMatrix(const FMatrix &)
Copy constructor.
FMatrix & operator=(const FMatrix &)
Assignment.
FMatrix()
Default constructor.
A templated representation for vectors.