SG++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sgpp::base::DataMatrix Class Reference

A class to store two-dimensional data. More...

#include <DataMatrix.hpp>

Public Member Functions

void abs ()
 Sets all elements to their absolute value. More...
 
void add (const DataMatrix &matr)
 Adds the values from another DataMatrix to the current values. More...
 
void addReduce (DataVector &reduction)
 Reduce the DataMatrix along the columns by adding all entries in one row. More...
 
void addReduce (DataVector &reduction, DataVector &beta, size_t start_beta)
 Reduce the DataMatrix along the columns by adding all entries in one row. More...
 
void addSize (size_t inc_nrows)
 Reserves memory for potentially inc_nrows new rows; the actual number of rows remains unchanged. More...
 
size_t appendCol (const DataVector &vec)
 Appends a new Col with data contained in DataVector vec and returns index of new col. More...
 
size_t appendRow ()
 Appends a new row and returns index of it. More...
 
size_t appendRow (const DataVector &vec)
 Appends a new row with data contained in DataVector vec and returns index of new row. More...
 
void componentwise_div (const DataMatrix &matr)
 Divides the current DataMatrix component-wise by another DataMatrix. More...
 
void componentwise_mult (const DataMatrix &matr)
 Multiplies the current DataMatrix component-wise with another DataMatrix. More...
 
void copyFrom (const DataMatrix &matr)
 Copies the data from another DataMatrix matr. More...
 
 DataMatrix ()
 Creates a empty two-dimensional DataMatrix. More...
 
 DataMatrix (size_t nrows, size_t ncols)
 Create a two-dimensional DataMatrix with nrows rows and ncols columns (uninitialized values). More...
 
 DataMatrix (size_t nrows, size_t ncols, double value)
 Create a two-dimensional DataMatrix with nrows rows and ncols columns and initializes all elements with the same value. More...
 
 DataMatrix (const DataMatrix &matr)
 Create a new DataMatrix that is a copy of matr. More...
 
 DataMatrix (double *input, size_t nrows, size_t ncols)
 Create a new DataMatrix from a double array. More...
 
void expand (const DataVector &expand)
 expands a given DataVector into a DataMatrix. More...
 
double get (size_t row, size_t col) const
 Returns the value of the element at position [row,col]. More...
 
void getColumn (size_t col, DataVector &vec) const
 Copies the values of a column to the DataVector vec. More...
 
size_t getInc () const
 Get the current number of rows by which the DataMatrix is extended, if appendRow() is called and no unused rows are left. More...
 
size_t getNcols () const
 Returns the number of columns of the DataMatrix. More...
 
size_t getNrows () const
 Returns the number of rows of the DataMatrix. More...
 
size_t getNumberNonZero () const
 Determines the number of non-zero elements in the vector. More...
 
double * getPointer ()
 Returns pointer to double array containing underlying data. More...
 
const double * getPointer () const
 Returns const pointer to double array containing underlying data. More...
 
void getRow (size_t row, DataVector &vec) const
 Copies the values of a row to the DataVector vec. More...
 
void getRow (size_t row, std::vector< double > &vec) const
 Copies the values of a row to the std::vector vec. More...
 
size_t getSize () const
 Returns the total number of (used) elements, i.e., getNrows()*getNCols() More...
 
size_t getUnused () const
 Returns the number of unused rows. More...
 
double max (size_t col) const
 Returns the maximum value of column col. More...
 
double max () const
 Returns the maximum over all entries. More...
 
double min (size_t col) const
 Returns the minimum value of column col. More...
 
double min () const
 Returns the minimum over all entries. More...
 
void minmax (size_t col, double *min, double *max) const
 Determines minimum and maximum of column col. More...
 
void minmax (double *min, double *max) const
 Determines minimum and maximum over all entries. More...
 
void mult (double scalar)
 Multiplies all elements by a constant factor. More...
 
void mult (const DataVector &x, DataVector &y)
 Multiplies the matrix with a vector x and stores the result in another vector y. More...
 
void normalizeDimension (size_t d)
 Normalizes the d-th dimension (entries in the d-th column) to \([0,1]\). More...
 
void normalizeDimension (size_t d, double border)
 Normalizes the d-th dimension (entries in the d-th column) to \([border,1-border]\). More...
 
double & operator() (size_t row, size_t col)
 Returns the value of the element at position [row,col]. More...
 
const double & operator() (size_t row, size_t col) const
 Returns the value of the element at position [row,col]. More...
 
DataMatrixoperator= (const DataMatrix &matr)
 Copies the data from another DataMatrix. More...
 
double & operator[] (size_t i)
 Returns the i-th element. More...
 
void resize (size_t nrows)
 Resizes the DataMatrix to nrows rows. More...
 
void resize (size_t nrows, size_t ncols)
 Resizes the DataMatrix to nrows rows and ncols columns. More...
 
void resizeQuadratic (size_t size)
 Resizes the quadratic DataMatrix to size rows and size columns. More...
 
void resizeToSubMatrix (size_t row_1, size_t col_1, size_t row_2, size_t col_2)
 Resize current matrix to the submatrix Mat[row_1:row_2, col_1:col_2]. More...
 
void resizeZero (size_t nrows)
 Resizes the DataMatrix to nrows rows. More...
 
void resizeZero (size_t nrows, size_t ncols)
 Resizes the DataMatrix to nrows rows and ncols columns. More...
 
void set (size_t row, size_t col, double value)
 Sets the element at position [row,col] to value. More...
 
void setAll (double value)
 Sets all entries of DataMatrix to value. More...
 
void setColumn (size_t col, const DataVector &vec)
 Sets a column of the DataMatrix to the values of a DataVector vec. More...
 
void setInc (size_t inc_rows)
 Sets the current number of rows by which the DataMatrix is extended, if appendRow() is called and no unused rows are left. More...
 
void setRow (size_t row, const DataVector &vec)
 Sets a row of the DataMatrix to the values of a DataVector vec. More...
 
void sqr ()
 Squares all elements of the DataMatrix. More...
 
void sqrt ()
 Takes the square root of all elements of the DataMatrix. More...
 
void sub (const DataMatrix &matr)
 Subtracts the values from another DataMatrix of the current values. More...
 
double sum () const
 Returns the sum of all elements. More...
 
void toFile (const std::string &fileName) const
 
void toString (std::string &text) const
 Writes the data stored in the DataMatrix into a string. More...
 
std::string toString () const
 Returns a description of the DataMatrix as a string. More...
 
void transpose ()
 Transposes this DataMatrix. More...
 
virtual ~DataMatrix ()
 Destructor. More...
 

Static Public Member Functions

static DataMatrix fromFile (const std::string &fileName)
 
static DataMatrix fromString (const std::string &serializedVector)
 

Detailed Description

A class to store two-dimensional data.

Typically, DataMatrix would contain a set of (d-dimensional) data or evaluation points, i.e., the DataMatrix consists of d columns, and each row is one of the points. Thus, typical functionality like obtaining the maximum for a certain dimension (or attribute), or normalizing all data points to the unit interval for a certain dimension are provided.

Constructor & Destructor Documentation

sgpp::base::DataMatrix::DataMatrix ( )

Creates a empty two-dimensional DataMatrix.

sgpp::base::DataMatrix::DataMatrix ( size_t  nrows,
size_t  ncols 
)

Create a two-dimensional DataMatrix with nrows rows and ncols columns (uninitialized values).

Parameters
nrowsNumber of rows
ncolsNumber of columns
sgpp::base::DataMatrix::DataMatrix ( size_t  nrows,
size_t  ncols,
double  value 
)

Create a two-dimensional DataMatrix with nrows rows and ncols columns and initializes all elements with the same value.

Parameters
nrowsNumber of rows
ncolsNumber of columns
valueValue for all entries

References setAll().

sgpp::base::DataMatrix::DataMatrix ( const DataMatrix matr)

Create a new DataMatrix that is a copy of matr.

Parameters
matrReference to another instance of DataMatrix
sgpp::base::DataMatrix::DataMatrix ( double *  input,
size_t  nrows,
size_t  ncols 
)

Create a new DataMatrix from a double array.

The double array contains the entries row-wise: x0_0,x0_1,...,x0_ncol-1, x1_0,x1_1,... ... xnrow_0, xnrow_1,...,xnrow_ncol-1

Parameters
inputdouble array that contains the data
nrowsnumber of rows
ncolsnumber of columns
sgpp::base::DataMatrix::~DataMatrix ( )
virtual

Destructor.

Member Function Documentation

void sgpp::base::DataMatrix::abs ( )

Sets all elements to their absolute value.

void sgpp::base::DataMatrix::addReduce ( DataVector reduction)

Reduce the DataMatrix along the columns by adding all entries in one row.

Parameters
reductionDataVector into which the reduce columns are stored

References sgpp::base::DataVector::getSize(), and sgpp::base::DataVector::set().

void sgpp::base::DataMatrix::addReduce ( DataVector reduction,
DataVector beta,
size_t  start_beta 
)

Reduce the DataMatrix along the columns by adding all entries in one row.

Parameters
reductionDataVector to which the reduce columns are added
betavector with length of number of columns beta[i] is multiplied to each element row[j][i]
start_betawhere to start using the beta coefficients

References sgpp::base::DataVector::getSize(), and sgpp::base::DataVector::set().

void sgpp::base::DataMatrix::addSize ( size_t  inc_nrows)

Reserves memory for potentially inc_nrows new rows; the actual number of rows remains unchanged.

Corresponds to a resize to nrows+inc_nrows new rows while leaving the current matrix' size unchanged.

Parameters
inc_nrowsNumber of additional rows for which storage is to be reserved.

Referenced by appendRow().

size_t sgpp::base::DataMatrix::appendCol ( const DataVector vec)

Appends a new Col with data contained in DataVector vec and returns index of new col.

Parameters
vecDataVector (length has to match getNcols()) with data
Returns
Index of new col

References sgpp::base::DataVector::getSize().

size_t sgpp::base::DataMatrix::appendRow ( const DataVector vec)

Appends a new row with data contained in DataVector vec and returns index of new row.

If the new row does not fit into the reserved memory, reserves memory for getIncRows() additional rows.

Parameters
vecDataVector (length has to match getNcols()) with data
Returns
Index of new row

References appendRow(), sgpp::base::DataVector::getPointer(), and sgpp::base::DataVector::getSize().

void sgpp::base::DataMatrix::componentwise_div ( const DataMatrix matr)

Divides the current DataMatrix component-wise by another DataMatrix.

Modifies the current values. Performs

for i from 1 to this.getTotalSize()
this[i] /= matr[i]

Note: No check for division by zero!

Parameters
matrthe DataMatrix which the current DataMatrix is divided by
void sgpp::base::DataMatrix::componentwise_mult ( const DataMatrix matr)

Multiplies the current DataMatrix component-wise with another DataMatrix.

Modifies the current values. Performs

for i from 1 to this.getSize()
this[i] *= matr[i]
Parameters
matrthe DataMatrix which is multiplied to current DataMatrix
void sgpp::base::DataMatrix::copyFrom ( const DataMatrix matr)

Copies the data from another DataMatrix matr.

Disregards the number of rows and columns set for the two matrices, i.e., just copies the data entry by entry (and row by row). If the dimensions match (nrows, ncols), the current DataMatrix is an exact copy of matr. If not, as many elements as possible are copied, and everything else is left untouched.

Parameters
matrThe source DataMatrix containing the data
void sgpp::base::DataMatrix::expand ( const DataVector expand)

expands a given DataVector into a DataMatrix.

Parameters
expandDataVector that should be expanded

References sgpp::base::DataVector::get(), and sgpp::base::DataVector::getSize().

DataMatrix sgpp::base::DataMatrix::fromFile ( const std::string &  fileName)
static

References f, and fromString().

DataMatrix sgpp::base::DataMatrix::fromString ( const std::string &  serializedVector)
static
double sgpp::base::DataMatrix::get ( size_t  row,
size_t  col 
) const
inline

Returns the value of the element at position [row,col].

Parameters
rowRow
colColumn
Returns
Value of the element

Referenced by sgpp::datadriven::AlgorithmAdaBoostBase::classif(), sgpp::datadriven::DataBasedRefinementFunctor::computeHkl(), sgpp::base::PrecisionConverter::convertDataMatrixToDataMatrixSP(), sgpp::datadriven::DensityEstimator::corrcoef(), sgpp::datadriven::Friedman1Generator::createData(), sgpp::datadriven::Friedman2Generator::createData(), sgpp::datadriven::Friedman3Generator::createData(), sgpp::datadriven::AlgorithmAdaBoostBase::doDiscreteAdaBoost(), sgpp::datadriven::AlgorithmAdaBoostBase::doRealAdaBoost(), sgpp::datadriven::OperationInverseRosenblattTransformationKDE::doShuffledTransformation(), sgpp::datadriven::OperationInverseRosenblattTransformationLinear::doTransformation(), sgpp::datadriven::OperationRosenblattTransformationLinear::doTransformation(), sgpp::datadriven::OperationInverseRosenblattTransformationKDE::doTransformation(), sgpp::datadriven::AlgorithmAdaBoostBase::getAccuracyBL(), sgpp::pde::OperationMatrixLTwoDotPeriodic::mult(), sgpp::pde::UpDownTwoOpDims::mult(), sgpp::pde::UpDownTwoOpDims::multParallelBuildingBlock(), sgpp::datadriven::OperationMultiEvalMPI::multSlave(), sgpp::base::HierarchisationModFundamentalSpline::operator()(), sgpp::base::HierarchisationFundamentalSpline::operator()(), sgpp::base::DehierarchisationFundamentalSpline::operator()(), sgpp::base::DehierarchisationModFundamentalSpline::operator()(), sgpp::pde::LaplaceEnhancedDownBBLinearBoundary::operator()(), sgpp::base::PredictiveRefinementIndicator::operator()(), and sgpp::datadriven::GaussianKDE::pdf().

void sgpp::base::DataMatrix::getColumn ( size_t  col,
DataVector vec 
) const

Copies the values of a column to the DataVector vec.

Parameters
colThe column
vecDataVector into which the data is written

References sgpp::base::DataVector::getSize().

Referenced by sgpp::datadriven::AlgorithmAdaBoostBase::doAdaBoostR2(), sgpp::datadriven::AlgorithmAdaBoostBase::doAdaBoostRT(), sgpp::optimization::OperationMultipleHierarchisationBsplineBoundary::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModWavelet::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationWavelet::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationWaveletBoundary::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationLinear::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationLinearBoundary::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModBspline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationBspline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModLinear::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationBsplineClenshawCurtis::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationLinearClenshawCurtis::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModBsplineClenshawCurtis::doDehierarchisation(), sgpp::base::OperationEval::eval(), sgpp::base::OperationEvalGradient::evalGradient(), sgpp::base::OperationEvalHessian::evalHessian(), sgpp::base::OperationEvalPartialDerivative::evalPartialDerivative(), sgpp::optimization::sle_solver::GaussianElimination::solve(), sgpp::optimization::sle_solver::Eigen::solve(), sgpp::optimization::sle_solver::Armadillo::solve(), sgpp::optimization::sle_solver::UMFPACK::solve(), and sgpp::optimization::sle_solver::SLESolver::solve().

size_t sgpp::base::DataMatrix::getInc ( ) const
inline

Get the current number of rows by which the DataMatrix is extended, if appendRow() is called and no unused rows are left.

Returns
Row increment
size_t sgpp::base::DataMatrix::getNcols ( ) const
inline

Returns the number of columns of the DataMatrix.

Returns
Number of columns

Referenced by sgpp::datadriven::DataBasedRefinementFunctor::computeH(), sgpp::datadriven::DataBasedRefinementFunctor::computeHkl(), sgpp::base::PrecisionConverter::convertDataMatrixSPToDataMatrix(), sgpp::base::PrecisionConverter::convertDataMatrixToDataMatrixSP(), sgpp::datadriven::DensityEstimator::corrcoef(), sgpp::datadriven::GaussianKDE::cov(), sgpp::datadriven::LearnerSGDE::cov(), sgpp::optimization::OperationMultipleHierarchisationBspline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationBsplineBoundary::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationLinear::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationLinearBoundary::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModBspline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModLinear::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModWavelet::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationWavelet::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationWaveletBoundary::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationBsplineClenshawCurtis::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationLinearClenshawCurtis::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModBsplineClenshawCurtis::doDehierarchisation(), sgpp::datadriven::OperationInverseRosenblattTransformationLinear::doTransformation(), sgpp::datadriven::OperationRosenblattTransformationLinear::doTransformation(), sgpp::base::OperationEvalModPolyNaive::eval(), sgpp::base::OperationEvalPolyBoundaryNaive::eval(), sgpp::base::OperationEvalPolyNaive::eval(), sgpp::base::OperationEvalLinearBoundaryNaive::eval(), sgpp::base::OperationEvalLinearNaive::eval(), sgpp::base::OperationEvalModLinearNaive::eval(), sgpp::base::OperationEvalLinearClenshawCurtisNaive::eval(), sgpp::base::OperationEval::eval(), sgpp::base::OperationEvalModWaveletNaive::eval(), sgpp::base::OperationEvalWaveletBoundaryNaive::eval(), sgpp::base::OperationEvalWaveletNaive::eval(), sgpp::base::OperationEvalBsplineBoundaryNaive::eval(), sgpp::base::OperationEvalModFundamentalSplineNaive::eval(), sgpp::base::OperationEvalBsplineClenshawCurtisNaive::eval(), sgpp::base::OperationEvalModBsplineNaive::eval(), sgpp::base::OperationEvalFundamentalSplineNaive::eval(), sgpp::base::OperationEvalModBsplineClenshawCurtisNaive::eval(), sgpp::base::OperationEvalBsplineNaive::eval(), sgpp::base::OperationEvalGradient::evalGradient(), sgpp::base::OperationEvalGradientWaveletNaive::evalGradient(), sgpp::base::OperationEvalGradientModWaveletNaive::evalGradient(), sgpp::base::OperationEvalGradientWaveletBoundaryNaive::evalGradient(), sgpp::base::OperationEvalGradientBsplineNaive::evalGradient(), sgpp::base::OperationEvalGradientFundamentalSplineNaive::evalGradient(), sgpp::base::OperationEvalGradientModBsplineNaive::evalGradient(), sgpp::base::OperationEvalGradientBsplineBoundaryNaive::evalGradient(), sgpp::base::OperationEvalGradientBsplineClenshawCurtisNaive::evalGradient(), sgpp::base::OperationEvalGradientModBsplineClenshawCurtisNaive::evalGradient(), sgpp::base::OperationEvalGradientModFundamentalSplineNaive::evalGradient(), sgpp::base::OperationEvalHessian::evalHessian(), sgpp::base::OperationEvalHessianModWaveletNaive::evalHessian(), sgpp::base::OperationEvalHessianWaveletNaive::evalHessian(), sgpp::base::OperationEvalHessianWaveletBoundaryNaive::evalHessian(), sgpp::base::OperationEvalHessianBsplineNaive::evalHessian(), sgpp::base::OperationEvalHessianModBsplineNaive::evalHessian(), sgpp::base::OperationEvalHessianModFundamentalSplineNaive::evalHessian(), sgpp::base::OperationEvalHessianBsplineBoundaryNaive::evalHessian(), sgpp::base::OperationEvalHessianBsplineClenshawCurtisNaive::evalHessian(), sgpp::base::OperationEvalHessianFundamentalSplineNaive::evalHessian(), sgpp::base::OperationEvalHessianModBsplineClenshawCurtisNaive::evalHessian(), sgpp::base::OperationEvalPartialDerivative::evalPartialDerivative(), sgpp::base::OperationEvalPartialDerivativeModWaveletNaive::evalPartialDerivative(), sgpp::base::OperationEvalPartialDerivativeWaveletBoundaryNaive::evalPartialDerivative(), sgpp::base::OperationEvalPartialDerivativeWaveletNaive::evalPartialDerivative(), sgpp::base::OperationEvalPartialDerivativeBsplineClenshawCurtisNaive::evalPartialDerivative(), sgpp::base::OperationEvalPartialDerivativeBsplineBoundaryNaive::evalPartialDerivative(), sgpp::base::OperationEvalPartialDerivativeBsplineNaive::evalPartialDerivative(), sgpp::base::OperationEvalPartialDerivativeFundamentalSplineNaive::evalPartialDerivative(), sgpp::base::OperationEvalPartialDerivativeModBsplineNaive::evalPartialDerivative(), sgpp::base::OperationEvalPartialDerivativeModFundamentalSplineNaive::evalPartialDerivative(), sgpp::base::OperationEvalPartialDerivativeModBsplineClenshawCurtisNaive::evalPartialDerivative(), sgpp::quadrature::SampleGenerator::getSamples(), sgpp::datadriven::GaussianKDE::initialize(), sgpp::datadriven::LearnerSGDE::initialize(), sgpp::datadriven::OperationMultiEvalStreaming::mult(), sgpp::pde::OperationMatrixLTwoDotExplicitPeriodic::mult(), sgpp::pde::OperationMatrixLTwoDotExplicitLinear::mult(), sgpp::pde::OperationMatrixLTwoDotExplicitLinearBoundary::mult(), sgpp::datadriven::OperationMultiEvalModMaskStreaming::mult(), sgpp::base::AlgorithmMultipleEvaluation< BASIS >::mult(), sgpp::base::AlgorithmDGEMV< BASIS >::mult(), sgpp::base::AlgorithmMultipleEvaluation< BASIS >::mult_transpose(), sgpp::base::AlgorithmDGEMV< BASIS >::mult_transposed(), sgpp::datadriven::OperationMultipleEvalSubspaceSimple::multImpl(), sgpp::datadriven::OperationMultipleEvalSubspaceCombined::multImpl(), sgpp::datadriven::OperationMultiEvalMPI::multSlave(), sgpp::datadriven::OperationMultiEvalStreaming::multTranspose(), sgpp::datadriven::OperationMultiEvalModMaskStreaming::multTranspose(), sgpp::datadriven::OperationMultiEvalStreamingBSplineOCL< T >::multTranspose(), sgpp::datadriven::OperationMultipleEvalSubspaceSimple::multTransposeImpl(), sgpp::datadriven::OperationMultipleEvalSubspaceCombined::multTransposeImpl(), sgpp::datadriven::OperationMultiEvalStreamingBSplineOCL< T >::OperationMultiEvalStreamingBSplineOCL(), sgpp::datadriven::OperationMultiEvalStreamingModOCLFastMultiPlatform< T >::OperationMultiEvalStreamingModOCLFastMultiPlatform(), sgpp::datadriven::OperationMultiEvalStreamingModOCLMaskMultiPlatform< T >::OperationMultiEvalStreamingModOCLMaskMultiPlatform(), sgpp::datadriven::OperationMultiEvalStreamingModOCLOpt< T >::OperationMultiEvalStreamingModOCLOpt(), sgpp::datadriven::OperationMultiEvalStreamingModOCLUnified< T >::OperationMultiEvalStreamingModOCLUnified(), sgpp::datadriven::StreamingOCLMultiPlatform::OperationMultiEvalStreamingOCLMultiPlatform< T >::OperationMultiEvalStreamingOCLMultiPlatform(), sgpp::datadriven::OperationMultipleEvalSubspaceSimple::OperationMultipleEvalSubspaceSimple(), sgpp::datadriven::DataBasedRefinementFunctor::operator()(), sgpp::base::HierarchisationModFundamentalSpline::operator()(), sgpp::base::HierarchisationFundamentalSpline::operator()(), sgpp::base::DehierarchisationFundamentalSpline::operator()(), sgpp::base::DehierarchisationModFundamentalSpline::operator()(), sgpp::datadriven::OperationMultipleEvalSubspaceCombined::padDataset(), sgpp::datadriven::PiecewiseConstantSmoothedRegressionMetaLearner::PiecewiseConstantSmoothedRegressionMetaLearner(), sgpp::datadriven::BatchLearner::predict(), sgpp::optimization::sle_solver::Armadillo::solve(), sgpp::optimization::sle_solver::Eigen::solve(), sgpp::optimization::sle_solver::UMFPACK::solve(), sgpp::optimization::sle_solver::SLESolver::solve(), sgpp::datadriven::DatasetTools::splitset(), sgpp::datadriven::test_dataset(), sgpp::datadriven::test_dataset_mse(), sgpp::datadriven::test_datasetWithCharacteristicNumber(), sgpp::datadriven::LearnerSGDE::train(), and sgpp::optimization::file_io::writeMatrix().

size_t sgpp::base::DataMatrix::getNrows ( ) const
inline

Returns the number of rows of the DataMatrix.

Returns
Number of rows

Referenced by sgpp::datadriven::AlgorithmAdaBoostBase::AlgorithmAdaBoostBase(), sgpp::datadriven::PiecewiseConstantSmoothedRegressionMetaLearner::calculateMSE(), sgpp::datadriven::AlgorithmAdaBoostBase::classif(), sgpp::datadriven::DataBasedRefinementFunctor::computeH(), sgpp::datadriven::DataBasedRefinementFunctor::computeHkl(), sgpp::base::PrecisionConverter::convertDataMatrixSPToDataMatrix(), sgpp::base::PrecisionConverter::convertDataMatrixToDataMatrixSP(), sgpp::datadriven::GaussianKDE::cov(), sgpp::datadriven::LearnerSGDE::cov(), sgpp::datadriven::AlgorithmAdaBoostBase::doAdaBoostR2(), sgpp::datadriven::AlgorithmAdaBoostBase::doAdaBoostRT(), sgpp::datadriven::AlgorithmAdaBoostBase::doDiscreteAdaBoost(), sgpp::datadriven::AlgorithmAdaBoostBase::doRealAdaBoost(), sgpp::datadriven::OperationInverseRosenblattTransformationKDE::doShuffledTransformation(), sgpp::datadriven::OperationInverseRosenblattTransformationLinear::doTransformation(), sgpp::datadriven::OperationRosenblattTransformationLinear::doTransformation(), sgpp::datadriven::OperationInverseRosenblattTransformationKDE::doTransformation(), sgpp::base::OperationEval::eval(), sgpp::base::OperationEvalGradient::evalGradient(), sgpp::base::OperationEvalHessian::evalHessian(), sgpp::base::OperationEvalPartialDerivative::evalPartialDerivative(), sgpp::pde::PDESolver::evaluateCuboid(), fromString(), sgpp::datadriven::DensitySystemMatrix::generateb(), sgpp::datadriven::LearnerBase::getAccuracy(), sgpp::datadriven::AlgorithmAdaBoostBase::getAccuracy(), sgpp::datadriven::AlgorithmAdaBoostBase::getAccuracyBL(), sgpp::datadriven::LearnerBase::getCassificatorQuality(), sgpp::optimization::FullSLE::getDimension(), sgpp::datadriven::PiecewiseConstantRegression::Node::getMSE(), sgpp::datadriven::AbstractOperationMultipleEvalSubspace::getPaddedDatasetSize(), sgpp::datadriven::OperationMultipleEvalSubspaceCombined::getPaddedDatasetSize(), sgpp::datadriven::AlgorithmAdaBoostBase::getROC(), sgpp::quadrature::SampleGenerator::getSamples(), sgpp::optimization::math::hessenbergForm(), sgpp::datadriven::OperationPiecewiseConstantRegression::hierarchize(), sgpp::optimization::math::householderTransformation(), sgpp::datadriven::GaussianKDE::initialize(), sgpp::datadriven::MetaLearner::learnAndCompareString(), sgpp::datadriven::MetaLearner::learnAndTestString(), sgpp::datadriven::OperationMultiEvalMPI::mult(), sgpp::pde::OperationMatrixLTwoDotExplicitPeriodic::mult(), sgpp::pde::OperationMatrixLTwoDotExplicitLinear::mult(), sgpp::pde::OperationMatrixLTwoDotExplicitLinearBoundary::mult(), sgpp::datadriven::DMSystemMatrix::mult(), sgpp::datadriven::OperationMultiEvalStreamingBSplineOCL< T >::OperationMultiEvalStreamingBSplineOCL(), sgpp::datadriven::OperationMultiEvalStreamingModOCLFastMultiPlatform< T >::OperationMultiEvalStreamingModOCLFastMultiPlatform(), sgpp::datadriven::OperationMultiEvalStreamingModOCLMaskMultiPlatform< T >::OperationMultiEvalStreamingModOCLMaskMultiPlatform(), sgpp::datadriven::OperationMultiEvalStreamingModOCLOpt< T >::OperationMultiEvalStreamingModOCLOpt(), sgpp::datadriven::OperationMultiEvalStreamingModOCLUnified< T >::OperationMultiEvalStreamingModOCLUnified(), sgpp::datadriven::StreamingOCLMultiPlatform::OperationMultiEvalStreamingOCLMultiPlatform< T >::OperationMultiEvalStreamingOCLMultiPlatform(), sgpp::base::PredictiveRefinementIndicator::operator()(), sgpp::optimization::optimizer::LogBarrier::optimize(), sgpp::optimization::optimizer::MultiStart::optimize(), sgpp::optimization::optimizer::SquaredPenalty::optimize(), sgpp::optimization::optimizer::AugmentedLagrangian::optimize(), sgpp::datadriven::OperationMultipleEvalSubspaceCombined::padDataset(), sgpp::datadriven::GaussianKDE::pdf(), sgpp::datadriven::LearnerLeastSquaresIdentity::postProcessing(), sgpp::datadriven::LearnerLeastSquaresIdentity::predict(), sgpp::datadriven::BatchLearner::predict(), sgpp::datadriven::LearnerBase::predict(), sgpp::optimization::math::QRDecomposition(), sgpp::optimization::math::schurDecomposition(), sgpp::datadriven::DatasetTools::splitset(), sgpp::datadriven::SystemMatrixLeastSquaresIdentity::SystemMatrixLeastSquaresIdentity(), sgpp::datadriven::test_calculateROCcurve(), sgpp::datadriven::test_dataset(), sgpp::datadriven::test_dataset_mse(), sgpp::datadriven::test_datasetWithCharacteristicNumber(), sgpp::datadriven::LearnerLeastSquaresIdentity::testRegular(), sgpp::datadriven::LearnerBase::train(), sgpp::pde::UpDownOneOpDimEnhanced::updown(), and sgpp::optimization::file_io::writeMatrix().

size_t sgpp::base::DataMatrix::getNumberNonZero ( ) const

Determines the number of non-zero elements in the vector.

Returns
The number of non-zero elements
const double * sgpp::base::DataMatrix::getPointer ( ) const

Returns const pointer to double array containing underlying data.

Returns
Const pointer to data
void sgpp::base::DataMatrix::getRow ( size_t  row,
DataVector vec 
) const

Copies the values of a row to the DataVector vec.

Parameters
rowThe row
vecDataVector into which the data is written

References sgpp::base::DataVector::getSize().

Referenced by sgpp::datadriven::PiecewiseConstantSmoothedRegressionMetaLearner::calculateMSE(), sgpp::datadriven::CrossValidation::calculateScore(), sgpp::datadriven::DataBasedRefinementFunctor::computeHkl(), sgpp::datadriven::AlgorithmAdaBoostBase::doAdaBoostR2(), sgpp::datadriven::AlgorithmAdaBoostBase::doAdaBoostRT(), sgpp::datadriven::AlgorithmAdaBoostBase::doDiscreteAdaBoost(), sgpp::quadrature::OperationQuadratureMCAdvanced::doQuadratureFunc(), sgpp::datadriven::AlgorithmAdaBoostBase::doRealAdaBoost(), sgpp::datadriven::OperationInverseRosenblattTransformationKDE::doShuffledTransformation(), sgpp::datadriven::OperationInverseRosenblattTransformationLinear::doTransformation(), sgpp::datadriven::OperationRosenblattTransformationLinear::doTransformation(), sgpp::datadriven::OperationInverseRosenblattTransformationKDE::doTransformation(), sgpp::datadriven::PiecewiseConstantRegression::Node::getMSE(), sgpp::datadriven::PiecewiseConstantRegression::Node::getSupportIndizes(), sgpp::datadriven::GaussianKDE::initialize(), sgpp::base::AlgorithmMultipleEvaluation< BASIS >::mult(), sgpp::base::AlgorithmDGEMV< BASIS >::mult(), sgpp::base::AlgorithmMultipleEvaluation< BASIS >::mult_transpose(), sgpp::base::AlgorithmDGEMV< BASIS >::mult_transposed(), sgpp::datadriven::OperationMultipleEvalSubspaceSimple::multImpl(), sgpp::datadriven::OperationMultipleEvalSubspaceSimple::multTransposeImpl(), sgpp::datadriven::OperationMultipleEvalSubspaceCombined::padDataset(), sgpp::datadriven::BatchLearner::predict(), sgpp::datadriven::DatasetTools::splitset(), sgpp::datadriven::test_dataset(), sgpp::datadriven::test_dataset_mse(), and sgpp::datadriven::test_datasetWithCharacteristicNumber().

void sgpp::base::DataMatrix::getRow ( size_t  row,
std::vector< double > &  vec 
) const

Copies the values of a row to the std::vector vec.

Parameters
rowThe row
vecstd::vector into which the data is written
size_t sgpp::base::DataMatrix::getUnused ( ) const
inline

Returns the number of unused rows.

Returns
number of unused rows
double sgpp::base::DataMatrix::max ( size_t  col) const

Returns the maximum value of column col.

Parameters
colNumber of the column
Returns
Maximum value

References max().

double sgpp::base::DataMatrix::max ( ) const

Returns the maximum over all entries.

Returns
Maximal value of all entries

Referenced by max().

double sgpp::base::DataMatrix::min ( size_t  col) const

Returns the minimum value of column col.

Parameters
colNumber of the column
Returns
Minimum value

References min().

double sgpp::base::DataMatrix::min ( ) const

Returns the minimum over all entries.

Returns
Minimal value of all entries

Referenced by min().

void sgpp::base::DataMatrix::minmax ( size_t  col,
double *  min,
double *  max 
) const

Determines minimum and maximum of column col.

Parameters
colNumber of the column
minReference variable for the minimum
maxReference variable for the maximum

Referenced by normalizeDimension().

void sgpp::base::DataMatrix::minmax ( double *  min,
double *  max 
) const

Determines minimum and maximum over all entries.

Parameters
minReference variable for the minimum
maxReference variable for the maximum
void sgpp::base::DataMatrix::mult ( double  scalar)
void sgpp::base::DataMatrix::mult ( const DataVector x,
DataVector y 
)

Multiplies the matrix with a vector x and stores the result in another vector y.

Parameters
[in]xvector to be multiplied
[out]yvector in which the result should be stored

References sgpp::base::DataVector::getSize().

Referenced by python.uq.estimators.DiscreteIntegralStrategy.DiscreteIntegralStrategy::estimate().

void sgpp::base::DataMatrix::normalizeDimension ( size_t  d)

Normalizes the d-th dimension (entries in the d-th column) to \([0,1]\).

Considers contents of DataMatrix as a d-dimensional dataset, one data point per row.

Parameters
dThe dimension (column) that should be normalized (starting with 0)

Referenced by sgpp::datadriven::Friedman2Generator::createData(), and sgpp::datadriven::Friedman3Generator::createData().

void sgpp::base::DataMatrix::normalizeDimension ( size_t  d,
double  border 
)

Normalizes the d-th dimension (entries in the d-th column) to \([border,1-border]\).

Considers contents of DataMatrix as a d-dimensional dataset, one data point per row.

Parameters
dThe dimension (column) that should be normalized (starting with 0)
borderWidth of the border

References minmax().

double& sgpp::base::DataMatrix::operator() ( size_t  row,
size_t  col 
)
inline

Returns the value of the element at position [row,col].

Parameters
rowRow
colColumn
Returns
reference to the element
const double& sgpp::base::DataMatrix::operator() ( size_t  row,
size_t  col 
) const
inline

Returns the value of the element at position [row,col].

Parameters
rowRow
colColumn
Returns
constant reference to the element
DataMatrix & sgpp::base::DataMatrix::operator= ( const DataMatrix matr)

Copies the data from another DataMatrix.

Dimensions have to match.

Parameters
matrthe DataMatrix containing the data
Returns
*this
double& sgpp::base::DataMatrix::operator[] ( size_t  i)
inline

Returns the i-th element.

For the 5th element in the third row, i would be 2*getNcols()+4.

Parameters
iposition of the element
Returns
data[i]
void sgpp::base::DataMatrix::resize ( size_t  nrows)

Resizes the DataMatrix to nrows rows.

DataMatrix::DataMatrix(DataMatrixDefinition& DataMatrixDef) { this->nrows = DataMatrixDef.nrows; this->ncols = DataMatrixDef.ncols; this->unused = DataMatrixDef.unused; this->data = DataMatrixDef.pointerToData; }.

All new additional entries are uninitialized. If nrows is smaller than the current number of rows, all superfluous entries are removed.

Parameters
nrowsNew number of rows of the DataMatrix

void DataMatrix::getDataMatrixDefinition(DataMatrixDefinition& DataMatrixDef) { DataMatrixDef.nrows = this->nrows; DataMatrixDef.ncols = this->ncols; DataMatrixDef.unused = this->unused; DataMatrixDef.pointerToData = this->data; }

Referenced by sgpp::datadriven::DataBasedRefinementFunctor::computeH(), sgpp::datadriven::LearnerSGDE::cov(), sgpp::datadriven::Friedman1Generator::createData(), sgpp::datadriven::Friedman2Generator::createData(), sgpp::datadriven::Friedman3Generator::createData(), sgpp::base::OperationEvalGradient::evalGradient(), sgpp::base::OperationEvalGradientWaveletNaive::evalGradient(), sgpp::base::OperationEvalGradientModWaveletNaive::evalGradient(), sgpp::base::OperationEvalGradientWaveletBoundaryNaive::evalGradient(), sgpp::base::OperationEvalGradientBsplineNaive::evalGradient(), sgpp::base::OperationEvalGradientModBsplineNaive::evalGradient(), sgpp::base::OperationEvalGradientBsplineBoundaryNaive::evalGradient(), sgpp::base::OperationEvalGradientFundamentalSplineNaive::evalGradient(), sgpp::base::OperationEvalGradientModFundamentalSplineNaive::evalGradient(), sgpp::base::OperationEvalGradientBsplineClenshawCurtisNaive::evalGradient(), sgpp::base::OperationEvalGradientModBsplineClenshawCurtisNaive::evalGradient(), sgpp::base::OperationEvalHessian::evalHessian(), sgpp::base::OperationEvalHessianModWaveletNaive::evalHessian(), sgpp::base::OperationEvalHessianWaveletNaive::evalHessian(), sgpp::base::OperationEvalHessianWaveletBoundaryNaive::evalHessian(), sgpp::base::OperationEvalHessianBsplineNaive::evalHessian(), sgpp::base::OperationEvalHessianModBsplineNaive::evalHessian(), sgpp::base::OperationEvalHessianFundamentalSplineNaive::evalHessian(), sgpp::base::OperationEvalHessianModFundamentalSplineNaive::evalHessian(), sgpp::base::OperationEvalHessianBsplineBoundaryNaive::evalHessian(), sgpp::base::OperationEvalHessianBsplineClenshawCurtisNaive::evalHessian(), sgpp::base::OperationEvalHessianModBsplineClenshawCurtisNaive::evalHessian(), fromString(), sgpp::base::EvalCuboidGenerator::getEvaluationCuboid(), sgpp::base::EvalCuboidGeneratorForStretching::getEvaluationCuboid(), sgpp::optimization::math::hessenbergForm(), sgpp::datadriven::Dataset::operator=(), sgpp::optimization::optimizer::CMAES::optimize(), sgpp::optimization::optimizer::AdaptiveGradientDescent::optimize(), sgpp::optimization::optimizer::Rprop::optimize(), sgpp::optimization::optimizer::BFGS::optimize(), sgpp::optimization::optimizer::GradientDescent::optimize(), sgpp::optimization::optimizer::NelderMead::optimize(), sgpp::optimization::optimizer::LogBarrier::optimize(), sgpp::optimization::optimizer::DifferentialEvolution::optimize(), sgpp::optimization::optimizer::NLCG::optimize(), sgpp::optimization::optimizer::MultiStart::optimize(), sgpp::optimization::optimizer::AugmentedLagrangian::optimize(), sgpp::optimization::optimizer::SquaredPenalty::optimize(), sgpp::optimization::optimizer::LevenbergMarquardt::optimize(), sgpp::optimization::optimizer::AdaptiveNewton::optimize(), sgpp::optimization::optimizer::Newton::optimize(), sgpp::optimization::math::QRDecomposition(), sgpp::optimization::file_io::readMatrix(), sgpp::optimization::math::schurDecomposition(), sgpp::optimization::sle_solver::Eigen::solve(), sgpp::optimization::sle_solver::Armadillo::solve(), sgpp::optimization::sle_solver::UMFPACK::solve(), sgpp::optimization::sle_solver::SLESolver::solve(), sgpp::datadriven::BatchLearner::stringToDataMatrix(), and sgpp::datadriven::test_calculateROCcurve().

void sgpp::base::DataMatrix::resize ( size_t  nrows,
size_t  ncols 
)

Resizes the DataMatrix to nrows rows and ncols columns.

All new additional entries are uninitialized. If nrows*ncols is smaller than the current number of entries, all superfluous entries are removed.

Parameters
nrowsNew number of rows of the DataMatrix
ncolsNew number of columns of the DataMatrix
void sgpp::base::DataMatrix::resizeQuadratic ( size_t  size)

Resizes the quadratic DataMatrix to size rows and size columns.

All new additional entries are uninitialized. If size is smaller than the current size of the quadratic DataMatrix, all superfluous entries are removed.

Parameters
sizeNew dimension of quadratic data DataMatrix
void sgpp::base::DataMatrix::resizeToSubMatrix ( size_t  row_1,
size_t  col_1,
size_t  row_2,
size_t  col_2 
)

Resize current matrix to the submatrix Mat[row_1:row_2, col_1:col_2].

Parameters
row_1,col_1corresponding to left upper index of desired submatrix
row_2,col_2corresponding to right lower index of desired submatrix
void sgpp::base::DataMatrix::resizeZero ( size_t  nrows)

Resizes the DataMatrix to nrows rows.

All new additional entries are set to zero. If nrows is smaller than the current number of rows, all superfluous entries are removed.

Parameters
nrowsNew number of rows of the DataMatrix
void sgpp::base::DataMatrix::resizeZero ( size_t  nrows,
size_t  ncols 
)

Resizes the DataMatrix to nrows rows and ncols columns.

All new additional entries are set to zero. If nrows*ncols is smaller than the current number of entries, all superfluous entries are removed.

Parameters
nrowsNew number of rows of the DataMatrix
ncolsNew number of columns of the DataMatrix
void sgpp::base::DataMatrix::set ( size_t  row,
size_t  col,
double  value 
)
inline
void sgpp::base::DataMatrix::setAll ( double  value)

Sets all entries of DataMatrix to value.

Parameters
valueNew value for all entries

Referenced by sgpp::datadriven::GaussianKDE::cov(), sgpp::datadriven::LearnerSGDE::cov(), DataMatrix(), sgpp::datadriven::AlgorithmAdaBoostBase::eval(), sgpp::base::OperationEvalGradientWaveletNaive::evalGradient(), sgpp::base::OperationEvalGradientModWaveletNaive::evalGradient(), sgpp::base::OperationEvalGradientWaveletBoundaryNaive::evalGradient(), sgpp::base::OperationEvalGradientBsplineNaive::evalGradient(), sgpp::base::OperationEvalGradientBsplineBoundaryNaive::evalGradient(), sgpp::base::OperationEvalGradientFundamentalSplineNaive::evalGradient(), sgpp::base::OperationEvalGradientModBsplineNaive::evalGradient(), sgpp::base::OperationEvalGradientModFundamentalSplineNaive::evalGradient(), sgpp::base::OperationEvalGradientModBsplineClenshawCurtisNaive::evalGradient(), sgpp::base::OperationEvalGradientBsplineClenshawCurtisNaive::evalGradient(), sgpp::base::OperationEvalHessianModWaveletNaive::evalHessian(), sgpp::base::OperationEvalHessianWaveletNaive::evalHessian(), sgpp::base::OperationEvalHessianWaveletBoundaryNaive::evalHessian(), sgpp::base::OperationEvalHessianModBsplineNaive::evalHessian(), sgpp::base::OperationEvalHessianBsplineNaive::evalHessian(), sgpp::base::OperationEvalHessianBsplineClenshawCurtisNaive::evalHessian(), sgpp::base::OperationEvalHessianFundamentalSplineNaive::evalHessian(), sgpp::base::OperationEvalHessianModFundamentalSplineNaive::evalHessian(), sgpp::base::OperationEvalHessianBsplineBoundaryNaive::evalHessian(), sgpp::base::OperationEvalHessianModBsplineClenshawCurtisNaive::evalHessian(), and sgpp::datadriven::BatchLearner::stringToDataMatrix().

void sgpp::base::DataMatrix::setColumn ( size_t  col,
const DataVector vec 
)

Sets a column of the DataMatrix to the values of a DataVector vec.

Parameters
colThe column which is to be overwritten
vecDataVector containing the data of the column

References sgpp::base::DataVector::get(), and sgpp::base::DataVector::getSize().

Referenced by sgpp::datadriven::DataBasedRefinementFunctor::computeH(), sgpp::datadriven::AlgorithmAdaBoostBase::doAdaBoostR2(), sgpp::datadriven::AlgorithmAdaBoostBase::doAdaBoostRT(), sgpp::optimization::OperationMultipleHierarchisationLinear::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationWavelet::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationWaveletBoundary::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationLinearBoundary::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationBspline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModWavelet::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModLinear::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModBspline::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationBsplineBoundary::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationBsplineClenshawCurtis::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationLinearClenshawCurtis::doDehierarchisation(), sgpp::optimization::OperationMultipleHierarchisationModBsplineClenshawCurtis::doDehierarchisation(), sgpp::datadriven::AlgorithmAdaBoostBase::doDiscreteAdaBoost(), sgpp::datadriven::AlgorithmAdaBoostBase::doRealAdaBoost(), sgpp::optimization::optimizer::CMAES::optimize(), sgpp::optimization::sle_solver::Armadillo::solve(), sgpp::optimization::sle_solver::Eigen::solve(), sgpp::optimization::sle_solver::UMFPACK::solve(), and sgpp::optimization::sle_solver::SLESolver::solve().

void sgpp::base::DataMatrix::setInc ( size_t  inc_rows)
inline

Sets the current number of rows by which the DataMatrix is extended, if appendRow() is called and no unused rows are left.

Defaults to 100.

Parameters
inc_rowsRow increment
void sgpp::base::DataMatrix::sqr ( )

Squares all elements of the DataMatrix.

void sgpp::base::DataMatrix::sqrt ( )

Takes the square root of all elements of the DataMatrix.

void sgpp::base::DataMatrix::sub ( const DataMatrix matr)

Subtracts the values from another DataMatrix of the current values.

Modifies the current values.

Parameters
matrThe DataMatrix which is subtracted from the current values
double sgpp::base::DataMatrix::sum ( ) const

Returns the sum of all elements.

Returns
The sum of all elements
void sgpp::base::DataMatrix::toFile ( const std::string &  fileName) const

References f, and toString().


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