Lines Matching refs:MATRIX
46 * Matrix utilities
49 namespace matrix {
59 template<typename MATRIX>
60 MATRIX PURE inverse(const MATRIX& src) {
62 COMPILE_TIME_ASSERT_FUNCTION_SCOPE( MATRIX::COL_SIZE == MATRIX::ROW_SIZE );
64 typename MATRIX::value_type t;
65 const size_t N = MATRIX::col_size();
67 MATRIX tmp(src);
68 MATRIX inverse(1);
129 template <typename MATRIX>
130 MATRIX PURE transpose(const MATRIX& m) {
131 // for now we only handle square matrix transpose
132 COMPILE_TIME_ASSERT_FUNCTION_SCOPE( MATRIX::ROW_SIZE == MATRIX::COL_SIZE );
133 MATRIX result(MATRIX::NO_INIT);
134 for (size_t r=0 ; r<MATRIX::row_size() ; r++)
135 for (size_t c=0 ; c<MATRIX::col_size() ; c++)
141 template <typename MATRIX>
142 typename MATRIX::value_type PURE trace(const MATRIX& m) {
143 COMPILE_TIME_ASSERT_FUNCTION_SCOPE( MATRIX::ROW_SIZE == MATRIX::COL_SIZE );
144 typename MATRIX::value_type result(0);
145 for (size_t r=0 ; r<MATRIX::row_size() ; r++)
151 template <typename MATRIX>
152 typename MATRIX::col_type PURE diag(const MATRIX& m) {
153 COMPILE_TIME_ASSERT_FUNCTION_SCOPE( MATRIX::ROW_SIZE == MATRIX::COL_SIZE );
154 typename MATRIX::col_type result(MATRIX::col_type::NO_INIT);
155 for (size_t r=0 ; r<MATRIX::row_size() ; r++)
160 template <typename MATRIX>
161 String8 asString(const MATRIX& m) {
163 for (size_t c=0 ; c<MATRIX::col_size() ; c++) {
165 for (size_t r=0 ; r<MATRIX::row_size() ; r++) {
173 }; // namespace matrix
207 // matrix * matrix, result is a matrix of the same type than the lhs matrix
210 return matrix::multiply<BASE<T> >(lhs, rhs);
216 * TMatSquareFunctions implements functions on a matrix of type BASE<T>.
239 friend BASE<T> PURE inverse(const BASE<T>& m) { return matrix::inverse(m); }
240 friend BASE<T> PURE transpose(const BASE<T>& m) { return matrix::transpose(m); }
241 friend T PURE trace(const BASE<T>& m) { return matrix::trace(m); }
248 return matrix::asString( static_cast< const BASE<T>& >(*this) );