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(const Eigen::Ref<const 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*/.

/*! Set a known least-significant-bit resolution directly.

    @param givenLSB Resolution for each state.
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.. / void setLSBByBits(uint8_t numBits, double min, double max);

/*!

Parameters:

direction

inline void setCarryError(bool carryErrorIn)

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

Parameters:

carryErrorIn

Eigen::VectorXd discretize(const Eigen::Ref<const Eigen::VectorXd> &undiscretizedVector)

Discretize a truth vector according to the least-significant-bit resolution.

Discretize a truth vector according to the least-significant-bit resolution.

Parameters:

undiscretizedVector – Truth values to discretize.

Returns:

Vector of discretized values.

inline const Eigen::VectorXd &getDiscretizationErrors() const

Get the current discretization errors.

Returns:

Reference to the error 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.