![]() |
SG++-Doxygen-Documentation
|
A class to store three-dimensional data. More...
#include <DataTensor.hpp>
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. | |
A class to store three-dimensional data.
It can be thought of as a vector of matrices
sgpp::base::DataTensor::DataTensor | ( | ) |
Creates an empty two-dimensional DataTensor.
|
default |
Destructor.
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).
ndepth | depth of the tensor |
nrows | Number of rows of each entry matrix |
ncols | Number of columns of each entry matrix |
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.
ndepth | depth of the tensor |
nrows | Number of rows |
ncols | Number of columns |
value | Value for all entries |
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].
depth | Depth |
row | Row |
col | Column |
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.
depth | Depth of the matrix entry |
col | column of the matrix entry |
vec | DataVector in which the data is written |
References sgpp::base::DataVector::getSize().
void sgpp::base::DataTensor::getMatrix | ( | size_t | depth, |
sgpp::base::DataMatrix & | matrix | ||
) |
Retruns one of the matrix entries of the tensor.
depth | The depth |
matrix | DataMatrix 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().
|
inline |
Returns the number of columns of the DataTensor.
|
inline |
Returns the depth of the DataTensor.
|
inline |
Returns the number of rows of the DataTensor.
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.
depth | Depth of the matrix entry |
row | row of the matrix entry |
vec | DataVector in which the data is written |
Referenced by getMatrix().
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.
ndepth | New depth of the DataTensor |
nrows | New number of rows of the DataTensor |
ncols | New number of columns of the DataTensor |
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.
depth | Depth |
row | Row |
col | Column |
value | New value for element |
std::string sgpp::base::DataTensor::toString | ( | ) | const |
Returns a description of the DataTensor as a string.
References toString().
Referenced by python.controller.LearnerEventController.LearnerEventController::__repr__(), python.controller.SolverEventController.SolverEventController::__repr__(), python.learner.Learner.Learner::createMemento(), python.uq.learner.Learner.Learner::createMemento(), python.learner.formatter.GridFormatter.GridFormatter::serialize(), and toString().
void sgpp::base::DataTensor::toString | ( | std::string & | text | ) | const |
Writes the data stored in the DataTensor into a string.
text | String to which the data is written |
References h.
Referenced by python.controller.LearnerEventController.LearnerEventController::__repr__(), python.controller.SolverEventController.SolverEventController::__repr__(), python.learner.Learner.Learner::createMemento(), python.uq.learner.Learner.Learner::createMemento(), and python.learner.formatter.GridFormatter.GridFormatter::serialize().