SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
sgpp::base::DataTensor Class Reference

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

#include <DataTensor.hpp>

Inheritance diagram for sgpp::base::DataTensor:

Public Member Functions

 DataTensor ()
 Creates an empty two-dimensional DataTensor.
 
 DataTensor (size_t ndepth, size_t nrows, size_t ncols)
 Create a thre-dimensional DataTensor of depth ndepth with nrows rows and ncols columns (uninitialized values).
 
 DataTensor (size_t ndepth, size_t nrows, size_t ncols, double value)
 Create a three-dimensional DataTensor of depth ndepth with nrows rows and ncols columns and initializes all elements with the same value.
 
double get (size_t depth, size_t row, size_t col)
 Returns the value of the element at position [depth,row,col].
 
void getColumn (size_t depth, size_t col, sgpp::base::DataVector &vec)
 Returns one column of one of the matrix entries of the tensor.
 
void getMatrix (size_t depth, sgpp::base::DataMatrix &matrix)
 Retruns one of the matrix entries of the tensor.
 
size_t getNcols () const
 Returns the number of columns of the DataTensor.
 
size_t getNdepth () const
 Returns the depth of the DataTensor.
 
size_t getNrows () const
 Returns the number of rows of the DataTensor.
 
void getRow (size_t depth, size_t row, sgpp::base::DataVector &vec)
 Returns one row of one of the matrix entries of the tensor.
 
void resize (size_t ndepth, size_t nrows, size_t ncols)
 Resizes the DataTensor to depth ndepth, nrows rows and ncols columns.
 
void set (size_t depth, size_t row, size_t col, double value)
 Sets the element at position [depth,row,col] to value.
 
std::string toString () const
 Returns a description of the DataTensor as a string.
 
void toString (std::string &text) const
 Writes the data stored in the DataTensor into a string.
 
 ~DataTensor ()=default
 Destructor.
 

Detailed Description

A class to store three-dimensional data.

It can be thought of as a vector of matrices

Constructor & Destructor Documentation

◆ DataTensor() [1/3]

sgpp::base::DataTensor::DataTensor ( )

Creates an empty two-dimensional DataTensor.

◆ ~DataTensor()

sgpp::base::DataTensor::~DataTensor ( )
default

Destructor.

◆ DataTensor() [2/3]

sgpp::base::DataTensor::DataTensor ( size_t  ndepth,
size_t  nrows,
size_t  ncols 
)

Create a thre-dimensional DataTensor of depth ndepth with nrows rows and ncols columns (uninitialized values).

Parameters
ndepthdepth of the tensor
nrowsNumber of rows of each entry matrix
ncolsNumber of columns of each entry matrix

◆ DataTensor() [3/3]

sgpp::base::DataTensor::DataTensor ( size_t  ndepth,
size_t  nrows,
size_t  ncols,
double  value 
)

Create a three-dimensional DataTensor of depth ndepth with nrows rows and ncols columns and initializes all elements with the same value.

Parameters
ndepthdepth of the tensor
nrowsNumber of rows
ncolsNumber of columns
valueValue for all entries

Member Function Documentation

◆ get()

double sgpp::base::DataTensor::get ( size_t  depth,
size_t  row,
size_t  col 
)

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

Parameters
depthDepth
rowRow
colColumn
Returns
Value of the element

◆ getColumn()

void sgpp::base::DataTensor::getColumn ( size_t  depth,
size_t  col,
sgpp::base::DataVector vec 
)

Returns one column of one of the matrix entries of the tensor.

Parameters
depthDepth of the matrix entry
colcolumn of the matrix entry
vecDataVector in which the data is written

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

◆ getMatrix()

void sgpp::base::DataTensor::getMatrix ( size_t  depth,
sgpp::base::DataMatrix matrix 
)

Retruns one of the matrix entries of the tensor.

Parameters
depthThe depth
matrixDataMatrix in which the data is written

References sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), getRow(), sgpp::base::DataMatrix::resize(), and sgpp::base::DataMatrix::setRow().

◆ getNcols()

size_t sgpp::base::DataTensor::getNcols ( ) const
inline

Returns the number of columns of the DataTensor.

Returns
Number of columns

◆ getNdepth()

size_t sgpp::base::DataTensor::getNdepth ( ) const
inline

Returns the depth of the DataTensor.

Returns
depth

◆ getNrows()

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

Returns the number of rows of the DataTensor.

Returns
Number of rows

◆ getRow()

void sgpp::base::DataTensor::getRow ( size_t  depth,
size_t  row,
sgpp::base::DataVector vec 
)

Returns one row of one of the matrix entries of the tensor.

Parameters
depthDepth of the matrix entry
rowrow of the matrix entry
vecDataVector in which the data is written

Referenced by getMatrix().

◆ resize()

void sgpp::base::DataTensor::resize ( size_t  ndepth,
size_t  nrows,
size_t  ncols 
)

Resizes the DataTensor to depth ndepth, 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.

Deprecated:
use resizeRowsCols
Parameters
ndepthNew depth of the DataTensor
nrowsNew number of rows of the DataTensor
ncolsNew number of columns of the DataTensor

◆ set()

void sgpp::base::DataTensor::set ( size_t  depth,
size_t  row,
size_t  col,
double  value 
)

Sets the element at position [depth,row,col] to value.

Parameters
depthDepth
rowRow
colColumn
valueNew value for element

◆ toString() [1/2]

◆ toString() [2/2]


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