11 #ifndef PRIMATOLOGIST_MATH_MATRIX_H 12 #define PRIMATOLOGIST_MATH_MATRIX_H 14 #include <cartodata/volume/volume.h> 15 #include <cartobase/type/string_conversion.h> 65 MatrixBase(
const carto::VolumeRef<U> & volume );
105 double trace()
const;
130 template <
typename T,
typename U>
135 template <
typename T>
140 template <
typename T>
148 template <
typename T,
typename U>
152 template <
typename T,
typename U>
155 template <
typename T>
158 template <
typename T,
typename U>
162 template <
typename T,
typename U>
166 template <
typename T,
typename U>
170 template <
typename T,
typename U>
174 template <
typename T,
typename U>
178 template <
typename T,
typename U>
182 template <
typename T,
typename U>
186 template <
typename T,
typename U>
190 template <
typename T,
typename U>
194 template <
typename T,
typename U>
202 template <
typename T>
203 std::ostream &
operator<< ( std::ostream & out,
206 template <
typename T>
218 std::logic_error(
std::string(
"[aims::math::MatrixBase] Matrices " 219 "should have compatible numbers of rows and columns for a matrix " 220 "product. (") +
carto::toString(ncol) +
std::string(
" and ") +
221 carto::toString(nrow) +
std::string(
").") )
228 #endif // PRIMATOLOGIST_MATH_MATRIX_H MatrixBase< T > & invert()
Matrix inversion.
int size() const
Number of elements.
MatrixBase< T > asMatrix(carto::VolumeRef< T > &volume)
Interprets the volume as a matrix.
MatrixBase< T > operator-(const MatrixBase< T > &vol)
Returns a Matrix filled with opposite elements.
MatrixBase< double > VectorD
int nrow() const
Number of rows.
Matrix class implementing matrix operations.
This exception is thrown when an attempt is made at multiplying two matrices with incompatible dimens...
MatrixBase< typename carto::volumeutil::divides< T, U >::result_type > operator/(const MatrixBase< T > &vol, const U &value)
Matrix / Scalar.
MatrixBase< float > Vector
int ncol() const
Number of columns.
MatrixBase< double > MatrixD
MatrixBase< T > & transpose()
Matrix transposition.
double trace() const
Returns the trace of the matrix, i.e.
bool operator==(const MatrixBase< T > &vol, const MatrixBase< U > &other)
Returns true if the dimensions are the same and if all elements are equal.
MatrixBase< T > & operator=(const carto::VolumeRef< U > &matrix)
Assignment operator The content from other is entirely copied.
MatrixBase(int nrow=1, int ncol=1)
Standard constructor Allocate a matrix of size nrow x ncol.
MatrixBase< float > Matrix
MatrixBase< typename carto::volumeutil::plus< T, U >::result_type > operator+(const MatrixBase< T > &vol, const U &value)
Matrix + Scalar.
bool operator!=(const MatrixBase< T > &vol, const MatrixBase< U > &other)
Returns false if dimensions are not the same or if any couple of elements is not equal.
MatrixBase< T > & operator*=(const MatrixBase< U > &)
Matrix product.
incompatible_matrix_exception(int nrow, int ncol)
MatrixBase< typename carto::volumeutil::multiplies< T, U >::result_type > operator*(const MatrixBase< T > &a, const MatrixBase< U > &b)
Matrix product.
void write(const MatrixBase< T > &matrix, const std::string &file)
Write the matrix content in an image file.
std::ostream & operator<<(std::ostream &out, const MatrixBase< T > &matrix)
Print the matrix content on the standard output.