StochTree 0.0.1
Loading...
Searching...
No Matches
Public Member Functions | List of all members
StochTree::ColumnMatrix Class Reference

Internal wrapper around Eigen::MatrixXd interface for multidimensional floating point data. More...

#include <data.h>

Public Member Functions

 ColumnMatrix (double *data_ptr, data_size_t num_row, int num_col, bool is_row_major)
 Construct a new ColumnMatrix object from in-memory data buffer.
 
 ColumnMatrix (std::string filename, std::string column_index_string, bool header=true, bool precise_float_parser=false)
 Construct a new ColumnMatrix object from CSV file.
 
double GetElement (data_size_t row_num, int32_t col_num)
 Returns the value stored at (row, col) in the object's internal Eigen::MatrixXd.
 
void SetElement (data_size_t row_num, int32_t col_num, double value)
 Update an observation in the object's internal Eigen::MatrixXd to a new value.
 
void LoadData (double *data_ptr, data_size_t num_row, int num_col, bool is_row_major)
 Update the data in a ColumnMatrix object from an in-memory data buffer. This will erase the existing matrix.
 
data_size_t NumRows ()
 Number of rows in the object's internal Eigen::MatrixXd.
 
int NumCols ()
 Number of columns in the object's internal Eigen::MatrixXd.
 
Eigen::MatrixXd & GetData ()
 Return a reference to the object's internal Eigen::MatrixXd, for interfaces that require a raw matrix.
 

Detailed Description

Internal wrapper around Eigen::MatrixXd interface for multidimensional floating point data.

Constructor & Destructor Documentation

◆ ColumnMatrix() [1/2]

StochTree::ColumnMatrix::ColumnMatrix ( double *  data_ptr,
data_size_t  num_row,
int  num_col,
bool  is_row_major 
)

Construct a new ColumnMatrix object from in-memory data buffer.

Parameters
data_ptrPointer to first element of a contiguous array of data storing a matrix.
num_rowNumber of rows in the matrix.
num_colNumber of columns / covariates in the matrix.
is_row_majorWhether or not the data in data_ptr are organized in a row-major or column-major fashion.

◆ ColumnMatrix() [2/2]

StochTree::ColumnMatrix::ColumnMatrix ( std::string  filename,
std::string  column_index_string,
bool  header = true,
bool  precise_float_parser = false 
)

Construct a new ColumnMatrix object from CSV file.

Parameters
filenameName of the file (including any necessary path prefixes).
column_index_stringComma-delimited string listing columns to extract into covariates matrix.
headerWhether or not the file contains a header of column names / non-data.
precise_float_parserWhether floating point numbers in the CSV should be parsed precisely.

Member Function Documentation

◆ GetElement()

double StochTree::ColumnMatrix::GetElement ( data_size_t  row_num,
int32_t  col_num 
)
inline

Returns the value stored at (row, col) in the object's internal Eigen::MatrixXd.

Parameters
rowRow number to query in the matrix
colColumn number to query in the matrix

◆ SetElement()

void StochTree::ColumnMatrix::SetElement ( data_size_t  row_num,
int32_t  col_num,
double  value 
)
inline

Update an observation in the object's internal Eigen::MatrixXd to a new value.

Parameters
rowRow number to be overwritten.
colColumn number to be overwritten.
valueNew value to write in (row, col) in the object's internal Eigen::MatrixXd.

◆ LoadData()

void StochTree::ColumnMatrix::LoadData ( double *  data_ptr,
data_size_t  num_row,
int  num_col,
bool  is_row_major 
)

Update the data in a ColumnMatrix object from an in-memory data buffer. This will erase the existing matrix.

Parameters
data_ptrPointer to first element of a contiguous array of data storing a matrix.
num_rowNumber of rows in the matrix.
num_colNumber of columns / covariates in the matrix.
is_row_majorWhether or not the data in data_ptr are organized in a row-major or column-major fashion.

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