1 #ifndef _theplu_yat_utility_matrix_
2 #define _theplu_yat_utility_matrix_
29 #include "Exception.h"
30 #include "StrideIterator.h"
32 #include "VectorConstView.h"
33 #include "VectorView.h"
35 #include <gsl/gsl_matrix.h>
133 Matrix(
const size_t& r,
const size_t& c,
double init_value=0);
173 explicit Matrix(std::istream &,
char sep=
'\0')
174 throw(utility::
IO_error, std::exception);
184 void all(const
double value);
293 bool equal(const
Matrix&, const
double precision=0) const;
312 void mul(const Matrix& b);
324 void resize(
size_t r,
size_t c,
double init_value=0);
329 size_t rows(
void) const;
363 void swap_rows(const
size_t i, const
size_t j);
385 double& operator()(
size_t row,
size_t column);
397 const
double& operator()(
size_t row,
size_t column) const;
410 bool operator==(const Matrix& other) const;
423 bool operator!=(const Matrix& other) const;
433 const Matrix& operator=(const Matrix& other);
446 const Matrix& operator+=(const Matrix& b);
454 const Matrix& operator+=(const
double d);
467 const Matrix& operator-=(const Matrix&);
475 const Matrix& operator-=(const
double d);
486 const Matrix& operator*=(const Matrix&);
496 const Matrix& operator*=(
double d);
511 gsl_matrix* create_gsl_matrix_copy(
void) const;
518 void delete_allocated_memory(
void);
524 gsl_matrix* blas_result_;
536 bool isnull(const Matrix&);
545 double max(const Matrix&);
554 double min(const Matrix&);
567 std::pair<
size_t,
size_t>&
min,
568 std::pair<
size_t,
size_t>&
max);
585 bool nan(const Matrix& templat, Matrix& flag);
596 void swap(Matrix&, Matrix&);
603 std::ostream& operator<< (std::ostream& s, const Matrix&);
619 Vector operator*(const VectorBase&, const Matrix&);
630 double trace(const Matrix&);
const VectorConstView column_const_view(size_t) const
double trace(const Matrix &)
Trace of matrix.
void mul(const Matrix &b)
const double & const_reference
Definition: Matrix.h:85
iterator end_row(size_t i)
StrideIterator< const double * > const_iterator
Definition: Matrix.h:95
This is the yat interface to gsl_vector_view.
Definition: VectorView.h:79
void resize(size_t r, size_t c, double init_value=0)
Resize Matrix.
iterator begin_row(size_t i)
StrideIterator< const double * > const_row_iterator
Definition: Matrix.h:115
bool nan(const Matrix &templat, Matrix &flag)
Create a Matrix flag indicating NaN's in another Matrix templat.
StrideIterator< double * > row_iterator
Definition: Matrix.h:110
double & reference
Definition: Matrix.h:78
void minmax_index(const Matrix &, std::pair< size_t, size_t > &min, std::pair< size_t, size_t > &max)
Locate the maximum and minimum element in the Matrix.
Matrix(void)
The default constructor.
void all(const double value)
Read-only view.
Definition: VectorConstView.h:55
iterator begin_column(size_t i)
double min(const Matrix &)
Get the minimum value of the Matrix.
double value_type
Definition: Matrix.h:71
This is the yat interface to GSL vector.
Definition: Vector.h:57
bool equal(const Matrix &, const double precision=0) const
Check whether matrices are equal within a user defined precision, set by precision.
void swap(Matrix &, Matrix &)
Exchange all elements between the matrices by copying.
This is the yat interface to GSL vector.
Definition: VectorBase.h:52
StrideIterator< const double * > const_column_iterator
Definition: Matrix.h:105
VectorView column_view(size_t i)
void div(const Matrix &b)
Class to report errors associated with IO operations.
Definition: Exception.h:109
VectorView row_view(size_t)
const VectorConstView row_const_view(size_t) const
Interface to GSL matrix.
Definition: Matrix.h:63
bool isnull(const Matrix &)
Check if all elements of the Matrix are zero.
const gsl_matrix * gsl_matrix_p(void) const
StrideIterator< double * > iterator
Definition: Matrix.h:90
StrideIterator< double * > column_iterator
Definition: Matrix.h:100
void swap_rows(const size_t i, const size_t j)
Swap rows i and j.
iterator end_column(size_t i)
void swap_columns(const size_t i, const size_t j)
Swap columns i and j.
void transpose(void)
Transpose the matrix.
Adaptor using a stride on underlying iterator.
Definition: StrideIterator.h:50
double max(const Matrix &)
Get the maximum value of the Matrix.
void swap_rowcol(const size_t i, const size_t j)
Swap row i and column j.
size_t columns(void) const