#include <Matrix.h>
Public Member Functions | |
T & | at (int row, int col) |
const T & | at (int row, int col) const |
QVector< T > | columnAt (int col) const |
int | columnCount () const |
void | copyAt (int row, int col, const Matrix< T > &m) |
const T * | data () const |
T * | data () |
void | fill (const T &v) |
bool | fromString (const StringSection &s) |
void | identity () |
void | invert () |
Matrix () | |
Matrix (int ndim) | |
Matrix (int nrow, int ncol) | |
Matrix (const Matrix< T > &o) | |
void | mergeColumn (const Matrix< T > &col1, const Matrix< T > &col2) |
void | mergeRow (const Matrix< T > &row1, const Matrix< T > &row2) |
int | nextNullRow (int startRow) const |
bool | operator!= (const Matrix< T > &m) const |
Matrix< T > | operator* (const Matrix< T > &m) const |
void | operator*= (const Matrix< T > &m) |
Matrix< T > | operator+ (const Matrix< T > &m) const |
void | operator+= (const Matrix< T > &m) |
Matrix< T > | operator- (const Matrix< T > &m) const |
void | operator-= (const Matrix< T > &m) |
Matrix< T > | operator= (const Matrix< T > &m) |
bool | operator== (const Matrix< T > &m) const |
void | resize (int ndim) |
void | resize (int nrow, int ncol) |
QVector< T > | rowAt (int row) const |
int | rowCount () const |
Matrix< T > | sortedColumns (const PermutationVector &p) |
Matrix< T > | sortedRows (const PermutationVector &p) |
Matrix< T > | subMatrix (int rowStart, int colStart, int rowEnd, int colEnd) const |
QString | toString () const |
QString | toUserString (int precision=6, char format='g') const |
void | transpose () |
Matrix< T > | transposed () const |
void | zero () |
Protected Member Functions | |
void | swapRowColumn () |
Protected Attributes | |
QSharedDataPointer< MatrixData < T > > | _d |
Friends | |
class | MatrixColumnIterator< T > |
class | MatrixData< T > |
class | MatrixIterator< T > |
class | MatrixRowIterator< T > |
class | MutableMatrixColumnIterator< T > |
class | MutableMatrixIterator< T > |
class | MutableMatrixRowIterator< T > |
Template for implicitely shared matrix compatible with Lapack
LAPACK is assuming matrix stored in column vectors column
For a MxN matrix: a(1,1) ... a(m,1) a(1,2) ... a(m,2) ... a(1,n) ... a(m,n) first column second column last column
QGpCoreTools::Matrix< T >::Matrix | ( | ) | [inline] |
{_d=new MatrixData<T>;}
QGpCoreTools::Matrix< T >::Matrix | ( | int | ndim | ) | [inline] |
{_d=new MatrixData<T>; _d->resize(ndim);}
QGpCoreTools::Matrix< T >::Matrix | ( | int | nrow, |
int | ncol | ||
) | [inline] |
{_d=new MatrixData<T>; _d->resize(nrow, ncol);}
QGpCoreTools::Matrix< T >::Matrix | ( | const Matrix< T > & | o | ) | [inline] |
: _d(o._d) {}
T& QGpCoreTools::Matrix< T >::at | ( | int | row, |
int | col | ||
) | [inline] |
Referenced by QGpCoreTools::DoubleMatrix::eigenVectors(), PhaseShifter::initGrid(), QGpCoreTools::Covariance::matrix(), QGpCoreTools::SparseMatrix< T >::operator*(), QGpCoreTools::SparseMatrix< T >::operator==(), QGpCoreTools::SparseMatrix< T >::plainMatrix(), QGpCoreTools::SparseMatrix< T >::setPlainMatrix(), and PhaseShifter::value().
{return _d->at(row,col);}
const T& QGpCoreTools::Matrix< T >::at | ( | int | row, |
int | col | ||
) | const [inline] |
{return _d->at(row,col);}
QVector< T > QGpCoreTools::Matrix< T >::columnAt | ( | int | col | ) | const |
Returns column col as a QVector.
References QGpCoreTools::MatrixIterator< T >::hasNext(), and QGpCoreTools::MatrixIterator< T >::next().
Referenced by QGpCoreTools::Covariance::stddev2D().
{ QVector<T> r(rowCount()); MatrixColumnIterator<T> it(*this, col); int i=0; while(it.hasNext()) { r[i++]=*it.next(); } return r; }
int QGpCoreTools::Matrix< T >::columnCount | ( | ) | const [inline] |
Referenced by QGpCoreTools::Matrix2x2::Matrix2x2(), QGpCoreTools::Matrix3x3::Matrix3x3(), QGpCoreTools::Matrix4x4::Matrix4x4(), QGpCoreTools::MatrixColumnIterator< T >::MatrixColumnIterator(), QGpCoreTools::MatrixIterator< T >::MatrixIterator(), QGpCoreTools::MatrixRowIterator< T >::MatrixRowIterator(), QGpCoreTools::MutableMatrixColumnIterator< T >::MutableMatrixColumnIterator(), QGpCoreTools::MutableMatrixIterator< T >::MutableMatrixIterator(), QGpCoreTools::MutableMatrixRowIterator< T >::MutableMatrixRowIterator(), QGpCoreTools::SparseMatrix< T >::operator*(), QGpCoreTools::operator<<(), QGpCoreTools::SparseMatrix< T >::operator==(), and QGpCoreTools::SparseMatrix< T >::setPlainMatrix().
{return _d->columnCount();}
void QGpCoreTools::Matrix< T >::copyAt | ( | int | row, |
int | col, | ||
const Matrix< T > & | m | ||
) | [inline] |
{_d->copyAt(row, col, *m._d);}
const T* QGpCoreTools::Matrix< T >::data | ( | ) | const [inline] |
T* QGpCoreTools::Matrix< T >::data | ( | ) | [inline] |
{return _d->data();}
void QGpCoreTools::Matrix< T >::fill | ( | const T & | v | ) | [inline] |
{_d->fill(v);}
bool QGpCoreTools::Matrix< T >::fromString | ( | const StringSection & | s | ) | [inline] |
{return _d->fromString(s);}
void QGpCoreTools::Matrix< T >::identity | ( | ) | [inline] |
Referenced by GeopsyCore::RotateParameters::matrix().
{_d->identity();}
void QGpCoreTools::Matrix< T >::invert | ( | ) | [inline] |
Reimplemented in QGpCoreTools::DoubleMatrix.
{_d->invert();}
void QGpCoreTools::Matrix< T >::mergeColumn | ( | const Matrix< T > & | col1, |
const Matrix< T > & | col2 | ||
) | [inline] |
{_d->mergeColumn(*col1._d, *col2._d);}
void QGpCoreTools::Matrix< T >::mergeRow | ( | const Matrix< T > & | row1, |
const Matrix< T > & | row2 | ||
) | [inline] |
{_d->mergeRow(*row1._d, *row2._d);}
int QGpCoreTools::Matrix< T >::nextNullRow | ( | int | startRow | ) | const [inline] |
{return _d->nextNullRow(startRow);}
bool QGpCoreTools::Matrix< T >::operator!= | ( | const Matrix< T > & | m | ) | const [inline] |
{return !_d->operator==(*m._d);}
Matrix<T> QGpCoreTools::Matrix< T >::operator* | ( | const Matrix< T > & | m | ) | const [inline] |
{return _d->operator*(*m._d);}
void QGpCoreTools::Matrix< T >::operator*= | ( | const Matrix< T > & | m | ) | [inline] |
References QGpCoreTools::Matrix< T >::_d.
{ *this=_d->operator*( *m._d); }
Matrix<T> QGpCoreTools::Matrix< T >::operator+ | ( | const Matrix< T > & | m | ) | const [inline] |
{return _d->operator+(*m._d);}
void QGpCoreTools::Matrix< T >::operator+= | ( | const Matrix< T > & | m | ) | [inline] |
References QGpCoreTools::Matrix< T >::_d.
{ *this=_d->operator+( *m._d); }
Matrix<T> QGpCoreTools::Matrix< T >::operator- | ( | const Matrix< T > & | m | ) | const [inline] |
{return _d->operator-(*m._d);}
void QGpCoreTools::Matrix< T >::operator-= | ( | const Matrix< T > & | m | ) | [inline] |
References QGpCoreTools::Matrix< T >::_d.
{ *this=_d->operator-( *m._d); }
Matrix<T> QGpCoreTools::Matrix< T >::operator= | ( | const Matrix< T > & | m | ) | [inline] |
{_d=m._d; return *this;}
bool QGpCoreTools::Matrix< T >::operator== | ( | const Matrix< T > & | m | ) | const [inline] |
{return _d->operator==(*m._d);}
void QGpCoreTools::Matrix< T >::resize | ( | int | ndim | ) | [inline] |
Referenced by QGpCoreTools::operator>>().
{_d->resize(ndim);}
void QGpCoreTools::Matrix< T >::resize | ( | int | nrow, |
int | ncol | ||
) | [inline] |
{_d->resize(nrow, ncol);}
QVector< T > QGpCoreTools::Matrix< T >::rowAt | ( | int | row | ) | const |
Returns row row as a QVector.
References QGpCoreTools::MatrixIterator< T >::hasNext(), and QGpCoreTools::MatrixIterator< T >::next().
{ QVector<T> r(columnCount()); MatrixColumnIterator<T> it(*this, row); int i=0; while(it.hasNext()) { r[i++]=*it.next(); } return r; }
int QGpCoreTools::Matrix< T >::rowCount | ( | ) | const [inline] |
Referenced by QGpCoreTools::Matrix2x2::Matrix2x2(), QGpCoreTools::Matrix3x3::Matrix3x3(), QGpCoreTools::Matrix4x4::Matrix4x4(), QGpCoreTools::MatrixColumnIterator< T >::MatrixColumnIterator(), QGpCoreTools::MatrixIterator< T >::MatrixIterator(), QGpCoreTools::MatrixRowIterator< T >::MatrixRowIterator(), QGpCoreTools::MutableMatrixColumnIterator< T >::MutableMatrixColumnIterator(), QGpCoreTools::MutableMatrixIterator< T >::MutableMatrixIterator(), QGpCoreTools::MutableMatrixRowIterator< T >::MutableMatrixRowIterator(), QGpCoreTools::operator<<(), QGpCoreTools::SparseMatrix< T >::operator==(), and QGpCoreTools::SparseMatrix< T >::setPlainMatrix().
{return _d->rowCount();}
Matrix<T> QGpCoreTools::Matrix< T >::sortedColumns | ( | const PermutationVector & | p | ) | [inline] |
Referenced by QGpCoreTools::Matrix< Complex >::sortedColumns().
{return _d->sortedColumns(p);}
Matrix<T> QGpCoreTools::Matrix< T >::sortedRows | ( | const PermutationVector & | p | ) | [inline] |
Referenced by QGpCoreTools::Matrix< Complex >::sortedRows().
{return _d->sortedRows(p);}
Matrix<T> QGpCoreTools::Matrix< T >::subMatrix | ( | int | rowStart, |
int | colStart, | ||
int | rowEnd, | ||
int | colEnd | ||
) | const [inline] |
Referenced by QGpCoreTools::Matrix< Complex >::subMatrix().
{return _d->subMatrix(rowStart, colStart, rowEnd, colEnd);}
void QGpCoreTools::Matrix< T >::swapRowColumn | ( | ) | [inline, protected] |
{_d->swapRowColumn();}
QString QGpCoreTools::Matrix< T >::toString | ( | ) | const [inline] |
{return _d->toString();}
QString QGpCoreTools::Matrix< T >::toUserString | ( | int | precision = 6 , |
char | format = 'g' |
||
) | const [inline] |
void QGpCoreTools::Matrix< T >::transpose | ( | ) | [inline] |
{ *this=transposed();}
Matrix<T> QGpCoreTools::Matrix< T >::transposed | ( | ) | const [inline] |
Referenced by QGpCoreTools::Matrix< Complex >::transposed().
{return _d->transposed();}
void QGpCoreTools::Matrix< T >::zero | ( | ) | [inline] |
Referenced by QGpCoreTools::MatrixData< T >::operator*().
{_d->zero();}
friend class MatrixColumnIterator< T > [friend] |
friend class MatrixData< T > [friend] |
friend class MatrixIterator< T > [friend] |
friend class MatrixRowIterator< T > [friend] |
friend class MutableMatrixColumnIterator< T > [friend] |
friend class MutableMatrixIterator< T > [friend] |
friend class MutableMatrixRowIterator< T > [friend] |
QSharedDataPointer< MatrixData<T> > QGpCoreTools::Matrix< T >::_d [protected] |
Referenced by QGpCoreTools::Matrix< Complex >::copyAt(), QGpCoreTools::MatrixColumnIterator< T >::MatrixColumnIterator(), QGpCoreTools::MatrixIterator< T >::MatrixIterator(), QGpCoreTools::MatrixRowIterator< T >::MatrixRowIterator(), QGpCoreTools::Matrix< Complex >::mergeColumn(), QGpCoreTools::Matrix< Complex >::mergeRow(), QGpCoreTools::MutableMatrixIterator< T >::MutableMatrixIterator(), QGpCoreTools::Matrix< Complex >::operator!=(), QGpCoreTools::MatrixData< T >::operator*(), QGpCoreTools::Matrix< Complex >::operator*(), QGpCoreTools::Matrix< T >::operator*=(), QGpCoreTools::MatrixData< T >::operator+(), QGpCoreTools::Matrix< Complex >::operator+(), QGpCoreTools::Matrix< T >::operator+=(), QGpCoreTools::MatrixData< T >::operator-(), QGpCoreTools::Matrix< Complex >::operator-(), QGpCoreTools::Matrix< T >::operator-=(), QGpCoreTools::Matrix< Complex >::operator=(), QGpCoreTools::Matrix< Complex >::operator==(), QGpCoreTools::MatrixData< T >::sortedColumns(), QGpCoreTools::MatrixData< T >::sortedRows(), QGpCoreTools::MatrixData< T >::subMatrix(), and QGpCoreTools::MatrixData< T >::transposed().