discretize

Enums

enum roundDirection_t

Values:

enumerator TO_ZERO
enumerator FROM_ZERO
enumerator NEAR
class Discretize
#include <discretize.h>

This module discretizes data for output. It has the option to carry over discretization error or not.

Public Functions

Discretize()

The constructor initialies the random number generator used for the walks

Discretize(uint8_t numStates)

This lets the user initialized the discretization model to the right size

~Discretize()

The destructor is a placeholder for one that might do something

inline void setLSB(Eigen::VectorXd givenLSB)

Method determines the size of an output data bin (bit-value) making sure that zero is a possible output and giving proportionate numbers of bits to the size of max and min void.

Avoid calculating bit value (bin size) and just set it because a resolution is known

Parameters:

givenLSB

Returns:

void

void setRoundDirection(roundDirection_t direction)

Sets the round direction (toZero, fromZero, near) for discretization.

This method calculates the least significant bit size given the maximum state value, minimum state value, and number of bits to use..

Parameters:

direction

Returns:

void

Returns:

void

inline void setCarryError(bool carryErrorIn)

Sets the round direction (toZero, fromZero, near) for discretization.

Parameters:

carryErrorIn

Returns:

void

Eigen::VectorXd discretize(Eigen::VectorXd undiscretizedVector)

Discretizes the given truth vector according to a least significant bit (binSize)

Parameters:

undiscretizedVector

Returns:

vector of discretized values

inline Eigen::VectorXd getDiscretizationErrors()

Get the discretization errors.

Returns:

the errors due to discretization in a corresponding vector

Public Members

Eigen::VectorXd LSB

&#8212; size of bin, bit value, least significant bit

Private Members

roundDirection_t roundDirection

&#8212; Direction to round when discretizing. “toZero”, “fromZero”, and “near” are the options.

uint8_t numStates

&#8212; Number of states to be discretized (length of vector fed in)

Eigen::VectorXd discErrors

&#8212; Errors from discretization. Can be returned to adjusted integrated values.

bool carryError

&#8212; true if discError should be added next time around, false if not.