21 #ifndef GSLPP_MATRIX_HH 22 #define GSLPP_MATRIX_HH 26 #include <gsl/gsl_matrix.h> 36 m_current(begin ? m->data : m->data + m->size1 * m->tda),
38 m_row_jump(m->tda - m->size2)
61 if(m_current_column == m_matrix->size2) {
62 m_current += m_row_jump;
80 size_t m_current_column;
92 m_current(begin ? m->data : m->data + m->size1 * m->tda),
94 m_row_jump(m->tda - m->size2)
99 m_matrix(other.m_matrix),
100 m_current(other.m_current),
101 m_current_column(other.m_current_column),
102 m_row_jump(other.m_row_jump)
125 if(m_current_column == m_matrix->size2) {
126 m_current += m_row_jump;
127 m_current_column = 0;
141 const gsl_matrix *m_matrix;
142 const double *m_current;
143 size_t m_current_column;
171 Matrix(
size_t rows,
size_t columns,
bool clean);
179 Matrix(
size_t rows,
size_t columns,
double init);
188 Matrix(
size_t rows,
size_t columns,
const double *init);
212 Matrix(
const gsl_matrix* m);
218 Matrix transposed()
const;
238 void reset(
size_t rows,
size_t columns,
bool clean);
246 void reset(
size_t rows,
size_t columns,
double init);
267 void set(
size_t i,
size_t j,
double x);
276 double operator ()(
size_t i,
size_t j)
const;
281 operator gsl_matrix *();
286 operator const gsl_matrix *()
const;
292 Matrix column_covariance()
const;
298 Matrix row_covariance()
const;
334 void set_row(
int r,
const Vector& row);
356 void set_column(
int c,
const Vector& col);
379 double dot_row(
int r,
const Vector& v)
const;
389 double dot_column(
int c,
const Vector& col)
const;
395 void print(std::ostream& os)
const;
403 gsl_matrix_sub(*
this, rhs);
413 gsl_matrix_add(*
this, rhs);
423 gsl_matrix_scale(*
this, rhs);
427 bool is_valid()
const;
429 bool is_writable()
const;
432 gsl_matrix *m_matrix;
433 const gsl_matrix *m_const_matrix;
470 class iterator_traits<
gsl::const_matrix_iterator > {
480 class iterator_traits<
gsl::matrix_iterator > {
void EXPORT_GSL matrix_inv_sqrt(Matrix &m)
const_matrix_iterator const_iterator
const_matrix_iterator(const gsl_matrix *m, bool begin)
EXPORT_2D C2DFVectorfield & operator+=(C2DFVectorfield &a, const C2DFVectorfield &b)
bool EXPORT_GSL operator!=(const matrix_iterator &lhs, const matrix_iterator &rhs)
vector_iterator operator+(const vector_iterator &it, int dist)
vector_iterator operator-(const vector_iterator &it, int dist)
void print(std::ostream &os) const
matrix_iterator(gsl_matrix *m, bool begin)
std::ostream & operator<<(std::ostream &os, const Matrix &m)
forward_iterator_tag iterator_category
forward_iterator_tag iterator_category
const_matrix_iterator(const matrix_iterator &other)
Matrix EXPORT_GSL operator*(const Matrix &lhs, const Matrix &rhs)
bool EXPORT_GSL operator==(const matrix_iterator &lhs, const matrix_iterator &rhs)