1#ifndef CLASSIC_FMatrix_HH
2#define CLASSIC_FMatrix_HH
38template<
class T,
int R,
int C>
87template <
class T,
int R,
int C>
91template <
class T,
int R,
int C>
95template <
class T,
int R,
int C>
99template <
class T,
int R,
int C>
103template <
class T,
int R,
int C>
107template <
class T,
int R,
int C>
111template <
class T,
int R,
int C>
115template <
class T,
int R,
int C>
119template <
class T,
int C>
123template <
class T,
int C>
130template<
class T,
int R,
int C>
136template<
class T,
int R,
int C>
142template<
class T,
int R,
int C>
148template<
class T,
int R,
int C>
154template<
class T,
int R,
int C>
160template<
class T,
int R,
int C>
167template<
class T,
int R,
int C>
174template<
class T,
int R,
int C>
177 std::bind(std::multiplies<T>(), std::placeholders::_1, rhs));
182template<
class T,
int R,
int C>
185 std::bind(std::divides<T>(), std::placeholders::_1, rhs));
190template<
class T,
int R,
int C>
192 std::transform(this->
begin(), this->
end(), array.
begin(), this->begin(),
198template<
class T,
int R,
int C>
200 std::transform(this->
begin(), this->
end(), array.
begin(), this->begin(),
206template <
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));
221template<
class T,
int R,
int C>
224 std::transform(rhs.
begin(), rhs.
end(), result.
begin(), std::negate<T>());
229template<
class T,
int R,
int C>
232 return result += rhs;
236template<
class T,
int R,
int C>
239 return result -= rhs;
243template <
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));
260template<
class T,
int R,
int C>
264 for(
int i = 0; i <
R; ++i) {
273template<
class T,
int R,
int C>
277 for(
int j = 0; j < C; j++) {
278 result[j] = std::inner_product(lhs.
begin(), lhs.
end(),
286template<
class T,
int R,
int C>
289 return result *= rhs;
293template<
class T,
int R,
int C>
296 return result *= lhs;
300template<
class T,
int R,
int C>
303 return result /= rhs;
310template<
class T,
int C>
313 for(
int i = 0; i < C; i++) result[i][i] += rhs;
318template<
class T,
int C>
321 for(
int i = 0; i < C; i++) result[i][i] -= rhs;
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.
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
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.