libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
crn::MatrixDouble Class Reference

double matrix class More...

#include <CRNMatrixDouble.h>

+ Inheritance diagram for crn::MatrixDouble:
+ Collaboration diagram for crn::MatrixDouble:

Public Member Functions

 MatrixDouble (const Matrix< double > &m)
 
 MatrixDouble (Matrix< double > &&m)
 
 MatrixDouble (xml::Element &el)
 Defines a default constructor from xml element. More...
 
 MatrixDouble (const MatrixDouble &)=default
 
 MatrixDouble (MatrixDouble &&)=default
 
MatrixDoubleoperator= (const MatrixDouble &)=default
 
MatrixDoubleoperator= (MatrixDouble &&)=default
 
virtual ~MatrixDouble () override=default
 Destructor. More...
 
double CumulateSquaredCells () const
 Computes the sum of the squared elements. More...
 
SquareMatrixDouble MakeVectorRightAutoProduct () const
 Get the product of a column vector by its own transposed on the right side. More...
 
virtual void Deserialize (xml::Element &el)
 
virtual xml::Element Serialize (xml::Element &parent) const
 
- Public Member Functions inherited from crn::Matrix< double >
 Matrix (size_t nrow, size_t ncol, const double &value=double(0))
 Constructor. More...
 
 Matrix (const std::vector< std::vector< double >> &m)
 Constructor from std::vector matrix. More...
 
 Matrix (const std::vector< double > &vect, Orientation ori=Orientation::VERTICAL)
 Constructor from std::vector 1D vector. More...
 
 Matrix (std::vector< double > &&vect, Orientation ori=Orientation::VERTICAL)
 Constructor from std::vector 1D vector. More...
 
 Matrix (const Matrix &)=default
 
 Matrix (const Matrix< Y > &m)
 
 Matrix (Matrix &&)=default
 
virtual ~Matrix () override=default
 Destructor. More...
 
Matrixoperator= (const Matrix &)=default
 
Matrixoperator= (Matrix &&)=default
 
void Swap (Matrix &m)
 
size_t GetRows () const noexcept
 Returns the number of rows. More...
 
size_t GetCols () const noexcept
 Returns the number of columns. More...
 
const double & At (size_t pos) const noexcept
 
double & At (size_t pos) noexcept
 
const double & At (size_t r, size_t c) const noexcept
 
double & At (size_t r, size_t c) noexcept
 
void SetAll (const double &v)
 Set all elements. More...
 
void Negative ()
 Change sign for all elements. More...
 
void SetRow (size_t r, const std::vector< double > &row)
 Sets the values of a row. More...
 
void SetColum (size_t c, const std::vector< double > &col)
 Sets the values of a column. More...
 
void IncreaseElement (size_t r, size_t c, const double &delta)
 Increases the value of an element. More...
 
void IncreaseRow (size_t r, const double &v)
 Increase one row from matrix. More...
 
void IncreaseColumn (size_t c, const double &v)
 Increase one column from matrix. More...
 
Matrixoperator+= (const Matrix &m)
 
Matrixoperator-= (const Matrix &m)
 
Matrixoperator*= (const Matrix &m)
 
Matrixoperator*= (double d)
 Scaling. More...
 
bool operator== (const Matrix &m) const
 
bool operator!= (const Matrix &m) const
 
Matrixoperator/= (double d)
 Scaling. More...
 
void MultRow (size_t r, double v)
 Scale one row from matrix. More...
 
void MultColumn (size_t c, double v)
 Scale one column from matrix. More...
 
void CenterColumns ()
 Centers all columns by subtracting the mean for each column. More...
 
void ReduceColumns (bool centered=true)
 Reduces all columns by dividing by the standard deviation of each column. More...
 
void SwapRows (size_t r1, size_t r2)
 Swap two rows in matrix. More...
 
void SwapColumns (size_t c1, size_t c2)
 Swap two columns in matrix. More...
 
void NormalizeForConvolution ()
 Normalizes the matrix to be used for convolution. More...
 
TypeInfo< double >::SumType CumulateCells () const
 
double GetMin () const
 
double GetMax () const
 
std::pair< size_t, size_t > Argmin () const
 
std::pair< size_t, size_t > Argmax () const
 
Matrix MakeTranspose ()
 Create transposition. More...
 
virtual MatrixTranspose ()
 Inplace transposition. More...
 
Matrix MakeRowAsColumn (size_t r) const
 Creates a column matrix from a row. More...
 
Matrix MakeRow (size_t r) const
 Extract a row from current matrix. More...
 
Matrix MakeColumn (size_t k) const
 Extracts one column from matrix. More...
 
size_t ArgmaxInRow (size_t r) const
 Returns the row index of the maximal element in a row. More...
 
size_t ArgmaxInColumn (size_t c) const
 Returns the row index of the maximal element in a column. More...
 
size_t CountNullCellsInRow (size_t r) const
 Counts null cells in row. More...
 
size_t CountNullCellsInColumn (size_t c) const
 Counts null cells in column. More...
 
size_t CountNullCells () const
 
Matrix MakeColumnMeans () const
 
Matrix MakeColumnDeviations (const Matrix &means) const
 
Matrix MakeColumnDeviations (bool zero_means=false) const
 standard deviation of patterns stored as the rows of a data matrix More...
 
Matrix MakeCovariance () const
 
double * operator[] (size_t r)
 Returns a row. More...
 
const double * operator[] (size_t r) const
 Returns a row. More...
 
const std::vector< double > & Std () const &noexcept
 
std::vector< double > Std ()&&
 
IMG ToImage () const
 Converts to image. More...
 
String ToString () const
 Prints matrix into a string. More...
 
- Public Member Functions inherited from crn::Object
virtual ~Object ()=default
 

Static Public Member Functions

static MatrixDouble NewGaussianLine (double sigma)
 Creates a line matrix with a centered Gaussian. More...
 
static MatrixDouble NewGaussianLineDerivative (double sigma)
 Creates a line matrix with the derivative of a centered Gaussian. More...
 
static MatrixDouble NewGaussianLineSecondDerivative (double sigma)
 Creates a line matrix with the second derivative of a centered Gaussian. More...
 

Additional Inherited Members

- Protected Types inherited from crn::Matrix< double >
using datatype = std::vector< double >
 
- Protected Member Functions inherited from crn::Matrix< double >
bool areValidIndexes (size_t r, size_t c) const
 checks the validity of indexes More...
 
- Protected Attributes inherited from crn::Matrix< double >
datatype data
 
size_t rows
 
size_t cols
 

Detailed Description

double matrix class

Matrix containing doubles

Author
Yann LEYDIER
Date
August 2007
Version
0.2

Definition at line 42 of file CRNMatrixDouble.h.

Constructor & Destructor Documentation

crn::MatrixDouble::MatrixDouble ( const Matrix< double > &  m)
inline

Definition at line 46 of file CRNMatrixDouble.h.

crn::MatrixDouble::MatrixDouble ( Matrix< double > &&  m)
inline

Definition at line 47 of file CRNMatrixDouble.h.

crn::MatrixDouble::MatrixDouble ( xml::Element el)
inline

Defines a default constructor from xml element.

Definition at line 50 of file CRNMatrixDouble.h.

crn::MatrixDouble::MatrixDouble ( const MatrixDouble )
default
crn::MatrixDouble::MatrixDouble ( MatrixDouble &&  )
default
virtual crn::MatrixDouble::~MatrixDouble ( )
overridevirtualdefault

Destructor.

Member Function Documentation

double MatrixDouble::CumulateSquaredCells ( ) const

Computes the sum of the squared elements.

Compute the sum of the squared elements

Returns
the sum of the squared elements

Definition at line 36 of file CRNMatrixDouble.cpp.

void MatrixDouble::Deserialize ( xml::Element el)
virtual

Unsafe load from XML node

Author
Jean DUONG
Exceptions
ExceptionInvalidArgumentnot a MatrixDouble
ExceptionNotFoundcannot find attribute
ExceptionDomainwrong attribute or cannot find CDATA
ExceptionRuntimecannot convert CDATA
Parameters
[in]elthe element to load

Definition at line 191 of file CRNMatrixDouble.cpp.

SquareMatrixDouble MatrixDouble::MakeVectorRightAutoProduct ( ) const

Get the product of a column vector by its own transposed on the right side.

Get the product of a column vector by its own transposed on the right side

Exceptions
ExceptionDimensionthe matrix is not a column
Returns
the product of a column vector by its own transposed on the right side

Definition at line 156 of file CRNMatrixDouble.cpp.

MatrixDouble MatrixDouble::NewGaussianLine ( double  sigma)
static

Creates a line matrix with a centered Gaussian.

Create a line matrix containing a centred Gaussian curve

Exceptions
ExceptionDomainsigma is negative
Parameters
[in]sigmathe standard deviation of the Gaussian
Returns
the newly created matrix

Definition at line 61 of file CRNMatrixDouble.cpp.

MatrixDouble MatrixDouble::NewGaussianLineDerivative ( double  sigma)
static

Creates a line matrix with the derivative of a centered Gaussian.

Create a line matrix containing the derivative of a centred Gaussian curve

Exceptions
ExceptionDomainsigma is negative
Parameters
[in]sigmathe standard deviation of the Gaussian
Returns
the newly created matrix

Definition at line 88 of file CRNMatrixDouble.cpp.

MatrixDouble MatrixDouble::NewGaussianLineSecondDerivative ( double  sigma)
static

Creates a line matrix with the second derivative of a centered Gaussian.

Create a line matrix containing a centred Gaussian curve

Exceptions
ExceptionDomainsigma is negative
Parameters
[in]sigmathe standard deviation of the Gaussian
Returns
the newly created matrix

Definition at line 125 of file CRNMatrixDouble.cpp.

MatrixDouble& crn::MatrixDouble::operator= ( const MatrixDouble )
default
MatrixDouble& crn::MatrixDouble::operator= ( MatrixDouble &&  )
default
xml::Element MatrixDouble::Serialize ( xml::Element parent) const
virtual

Unsafe save

Author
Jean DUONG
Parameters
[in]parentthe parent element to which we will add the new element
Returns
The newly created element, nullptr if failed.

Definition at line 223 of file CRNMatrixDouble.cpp.


The documentation for this class was generated from the following files: