Go to the documentation of this file.
48 mstart(start), mextent(extent), mstride(stride)
64 mstart(start), mextent(-1), mstride(stride)
74 mstart(0), mextent(-1), mstride(stride)
111 assert( fin < max_size );
122 mstart(p.mstart + n.mstart*p.mstride),
124 mstride(p.mstride*n.mstride)
138 assert(
mstart<=prev_fin );
156 assert( p.
mstart <= fin );
157 assert( fin <= prev_fin );
230 mrange(0,1), mdata(&const_cast<
Numeric&>(a))
238 mrange(0,0), mdata(NULL)
246 const Range& range) :
285 for ( ; i!=end ; ++i )
287 os <<
" " << setw(3) << *i;
301 throw runtime_error(
"Creating a VectorView from a const Vector is not allowed.");
465 for ( ; i!=e ; ++i,++s )
480 for ( ; i!=e ; ++i,++s )
495 for ( ; i!=e ; ++i,++s )
510 for ( ; i!=e ; ++i,++s )
530 throw runtime_error(
"A VectorView can only be converted to a plain C-array if mrange.mstart == 0 and mrange.mstride == 1");
544 throw runtime_error(
"A VectorView can only be converted to a plain C-array if mrange.mstart == 0 and mrange.mstride == 1");
569 const Range& range) :
602 memcpy((
void *)target.
mx,
606 for ( ; origin!=end ; ++origin,++target )
615 for ( ; target!=end ; ++target )
811 const Range& c)
const
865 mrr(0,0,1), mcr(0,0,1), mdata(NULL)
927 os << setw(3) << *ic;
930 for ( ; ic!=end_col ; ++ic )
932 os <<
" " << setw(3) << *ic;
936 for ( ; ir!=end_row ; ++ir )
944 os << setw(3) << *ic;
947 for ( ; ic!=end_col ; ++ic )
949 os <<
" " << setw(3) << *ic;
1127 for (
Iterator1D c = r->begin(); c!=ec ; ++c )
1140 for (
Iterator1D c = r->begin(); c!=ec ; ++c )
1153 for (
Iterator1D c = r->begin(); c!=ec ; ++c )
1166 for (
Iterator1D c = r->begin(); c!=ec ; ++c )
1182 throw runtime_error(
"A MatrixView can only be converted to a plain C-array if mrr.mstart == 0 and mrr.mstride == mcr.extent and mcr.mstart == 0 and mcr.mstride == 1");
1197 throw runtime_error(
"A MatrixView can only be converted to a plain C-array if mrr.mstart == 0 and mrr.mstride == mcr.extent and mcr.mstart == 0 and mcr.mstride == 1");
1210 for ( ; r!=er ; ++r,++sr )
1215 for ( ; c!=ec ; ++c,++sc )
1229 for ( ; r!=er ; ++r,++sr )
1234 for ( ; c!=ec ; ++c,++sc )
1248 for ( ; r!=er ; ++r,++sr )
1253 for ( ; c!=ec ; ++c,++sc )
1267 for ( ; r!=er ; ++r,++sr )
1272 for ( ; c!=ec ; ++c,++sc )
1286 for ( ; r!=er ; ++r,++sc )
1302 for ( ; r!=er ; ++r,++sc )
1318 for ( ; r!=er ; ++r,++sc )
1334 for ( ; r!=er ; ++r,++sc )
1396 for ( ; origin!=end ; ++origin,++target )
1401 for ( ; o!=e ; ++o,++t )
1411 for ( ; target!=end ; ++target )
1415 for ( ; t!=e ; ++t )
1461 Range( 0, m.nrows(), m.ncols() ),
1462 Range( 0, m.ncols() ) )
1471 Range( 0, m.nrows(), m.ncols() ),
1472 Range( 0, m.ncols() ) )
1592 for ( ; ai!=ae ; ++ai, ++bi )
1593 res += (*ai) * (*bi);
1614 assert(
M.mcr.mextent != 0 &&
M.mrr.mextent != 0);
1617 Numeric *mdata =
M.mdata +
M.mcr.mstart +
M.mrr.mstart;
1630 *yelem = *melem * *xelem;
1635 melem +=
M.mcr.mstride;
1637 *yelem += *melem * *xelem;
1640 mdata +=
M.mrr.mstride;
1670 for ( ; ai!=ae ; ++ai, ++bi )
1679 for ( ; aci!=ace ; ++aci, ++cti )
1683 *aci = (*bi) * (*cti);
1729 double (&my_func)(
double),
1738 for ( ; xi!=xe; ++xi, ++yi )
1761 double (&my_func)(
double),
1771 for ( ; rx!=rxe; ++rx, ++ry )
1776 for ( ; cx!=cxe; ++cx, ++cy )
1790 for ( ; xi!=xe ; ++xi )
1808 for ( ; rx!=rxe ; ++rx )
1813 for ( ; cx!=cxe ; ++cx )
1830 for ( ; xi!=xe ; ++xi )
1848 for ( ; rx!=rxe ; ++rx )
1853 for ( ; cx!=cxe ; ++cx )
1870 for ( ; xi!=xe ; ++xi )
mean += *xi;
1886 for ( ; rx!=rxe ; ++rx )
1891 for ( ; cx!=cxe ; ++cx )
mean += *cx;
1921 for ( ; i!=e ; ++i,++target )
Numeric operator()(Index r, Index c) const
Plain const index operator.
void transform(VectorView y, double(&my_func)(double), ConstVectorView x)
A generic transform function for vectors, which can be used to implement mathematical functions opera...
Numeric * mx
Current position.
VectorView()
Default constructor.
The declarations of all the exception classes.
MatrixView & operator=(const ConstMatrixView &v)
Assignment operator.
Vector()
Default constructor.
The constant iterator class for sub vectors.
MatrixView()
Default constructor.
Numeric * mdata
Pointer to the plain C array that holds the data.
void resize(Index n)
Resize function.
Numeric max(const ConstVectorView &x)
Max function, vector version.
ConstVectorView()
Default constructor.
MatrixView & operator+=(Numeric x)
Addition of scalar.
Index nrows() const
Returns the number of rows.
Range mrange
The range of mdata that is actually used.
Index mstart
The start index.
MatrixView & operator-=(Numeric x)
Subtraction of scalar.
MatrixView & operator/=(Numeric x)
Division by scalar.
Range mcr
The column range of mdata that is actually used.
VectorView & operator=(const ConstVectorView &v)
Assignment operator.
VectorView operator/=(Numeric x)
Division by scalar.
Range mrr
The row range of mdata that is actually used.
ConstIterator1D end() const
Return const iterator behind last element.
ConstIterator2D begin() const
Return const iterator to first row.
ConstIterator2D end() const
Return const iterator behind last row.
void mult(VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
Matrix Vector multiplication.
virtual ~Matrix()
Destructor for Matrix.
Vector & operator=(const Vector &v)
Assignment from another Vector.
Index ncols() const
Returns the number of columns.
The iterator class for sub vectors.
Index nelem() const
Returns the number of elements.
virtual ~Vector()
Destructor for Vector.
Numeric mean(const ConstVectorView &x)
Mean function, vector version.
ConstIterator1D begin() const
Return const iterator to first element.
Range(Index start, Index extent, Index stride=1)
Numeric sum() const
The sum of all elements of a Vector.
NUMERIC Numeric
The type to use for all floating point numbers.
ConstMatrixView transpose(ConstMatrixView m)
Const version of transpose.
Numeric * mdata
Pointer to the plain C array that holds the data.
Numeric operator[](Index n) const
Plain const index operator.
Numeric operator()(Index r, Index c) const
Plain const index operator.
void resize(Index r, Index c)
Resize function.
ConstIterator1D begin() const
Return const iterator to first element.
The const row iterator class for sub matrices.
A constant view of a Matrix.
Numeric min(const ConstVectorView &x)
Min function, vector version.
Index mextent
The number of elements.
ConstIterator2D end() const
Return const iterator behind last row.
Matrix()
Default constructor.
VectorView operator*=(Numeric x)
Multiplication by scalar.
VectorView operator-=(Numeric x)
Subtraction of scalar.
ostream & operator<<(ostream &os, const ConstVectorView &v)
Output operator.
ConstMatrixView()
Default constructor.
ConstIterator2D begin() const
Return const iterator to first row.
Matrix & operator=(const Matrix &x)
Assignment operator from another matrix.
ConstIterator1D end() const
Return const iterator behind last element.
The row iterator class for sub matrices.
Numeric operator*(const ConstVectorView &a, const ConstVectorView &b)
Scalar product.
INDEX Index
The type to use for all integer numbers and indices.
Numeric debug_matrixview_get_elem(MatrixView &mv, Index r, Index c)
Helper function to access matrix elements.
MatrixView & operator*=(Numeric x)
Multiplication by scalar.
const Numeric * get_c_array() const
Conversion to plain C-array.
friend class ConstVectorView
void copy(ConstIterator1D origin, const ConstIterator1D &end, Iterator1D target)
Copy data between begin and end to target.
A constant view of a Vector.
VectorView operator+=(Numeric x)
Addition of scalar.
Index nelem() const
Number of elements.
const Numeric * mx
Current position.
const Numeric * get_c_array() const
Conversion to plain C-array.
Numeric operator[](Index n) const
Plain const index operator.