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

Internal wrapper around Eigen::VectorXd interface for univariate floating point data. The (frequently updated) full / partial residual used in sampling forests is stored internally as a ColumnVector by the sampling functions (see Forest Sampler API). More...

#include <data.h>

Public Member Functions

 ColumnVector (double *data_ptr, data_size_t num_row)
 Construct a new ColumnVector object from in-memory data buffer.
 
 ColumnVector (std::string filename, int32_t column_index, bool header=true, bool precise_float_parser=false)
 Construct a new ColumnMatrix object from CSV file.
 
double GetElement (data_size_t row)
 Returns the value stored at position row in the object's internal Eigen::VectorXd.
 
void SetElement (data_size_t row, double value)
 Returns the value stored at position row in the object's internal Eigen::VectorXd.
 
void LoadData (double *data_ptr, data_size_t num_row)
 Update the data in a ColumnVector object from an in-memory data buffer. This will erase the existing vector.
 
void AddToData (double *data_ptr, data_size_t num_row)
 Update the data in a ColumnVector object from an in-memory data buffer, by adding each value obtained in data_ptr to the existing values in the object's internal Eigen::VectorXd.
 
void SubtractFromData (double *data_ptr, data_size_t num_row)
 Update the data in a ColumnVector object from an in-memory data buffer, by subtracting each value obtained in data_ptr from the existing values in the object's internal Eigen::VectorXd.
 
void OverwriteData (double *data_ptr, data_size_t num_row)
 Update the data in a ColumnVector object from an in-memory data buffer, by substituting each value obtained in data_ptr for the existing values in the object's internal Eigen::VectorXd.
 
data_size_t NumRows ()
 Number of rows in the object's internal Eigen::VectorXd.
 
Eigen::VectorXd & GetData ()
 Return a reference to the object's internal Eigen::VectorXd, for interfaces that require a raw vector.
 

Detailed Description

Internal wrapper around Eigen::VectorXd interface for univariate floating point data. The (frequently updated) full / partial residual used in sampling forests is stored internally as a ColumnVector by the sampling functions (see Forest Sampler API).

Constructor & Destructor Documentation

◆ ColumnVector() [1/2]

StochTree::ColumnVector::ColumnVector ( double *  data_ptr,
data_size_t  num_row 
)

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

Parameters
data_ptrPointer to first element of a contiguous array of data storing a vector.
num_rowNumber of rows / elements in the vector.

◆ ColumnVector() [2/2]

StochTree::ColumnVector::ColumnVector ( std::string  filename,
int32_t  column_index,
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_indexInteger index of the column in filename to be unpacked as a vector.
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::ColumnVector::GetElement ( data_size_t  row)
inline

Returns the value stored at position row in the object's internal Eigen::VectorXd.

Parameters
rowRow number to query in the vector

◆ SetElement()

void StochTree::ColumnVector::SetElement ( data_size_t  row,
double  value 
)
inline

Returns the value stored at position row in the object's internal Eigen::VectorXd.

Parameters
rowRow number to query in the vector
valueNew value to write to element row of the object's internal Eigen::VectorXd.

◆ LoadData()

void StochTree::ColumnVector::LoadData ( double *  data_ptr,
data_size_t  num_row 
)

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

Parameters
data_ptrPointer to first element of a contiguous array of data storing a vector.
num_rowNumber of rows / elements in the vector.

◆ AddToData()

void StochTree::ColumnVector::AddToData ( double *  data_ptr,
data_size_t  num_row 
)

Update the data in a ColumnVector object from an in-memory data buffer, by adding each value obtained in data_ptr to the existing values in the object's internal Eigen::VectorXd.

Parameters
data_ptrPointer to first element of a contiguous array of data storing a vector.
num_rowNumber of rows / elements in the vector.

◆ SubtractFromData()

void StochTree::ColumnVector::SubtractFromData ( double *  data_ptr,
data_size_t  num_row 
)

Update the data in a ColumnVector object from an in-memory data buffer, by subtracting each value obtained in data_ptr from the existing values in the object's internal Eigen::VectorXd.

Parameters
data_ptrPointer to first element of a contiguous array of data storing a vector.
num_rowNumber of rows / elements in the vector.

◆ OverwriteData()

void StochTree::ColumnVector::OverwriteData ( double *  data_ptr,
data_size_t  num_row 
)

Update the data in a ColumnVector object from an in-memory data buffer, by substituting each value obtained in data_ptr for the existing values in the object's internal Eigen::VectorXd.

Parameters
data_ptrPointer to first element of a contiguous array of data storing a vector.
num_rowNumber of rows / elements in the vector.

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