eXpress “1.5”
|
frequencymatrix.h express More...
#include <frequencymatrix.h>
Public Member Functions | |
FrequencyMatrix () | |
Dummy FrequencyMatrix Constructor. | |
FrequencyMatrix (size_t m, size_t n, T alpha, bool logged=true) | |
FrequencyMatrix constructor initializes the matrix values to the given pseudo-counts. | |
T | operator() (size_t i, size_t j, bool normalized=true) const |
An accessor for the frequency at a given position in the matrix (logged if table is logged). | |
T | operator() (size_t k, bool normalized=true) const |
An accessor for the frequency at a given position in the flattened matrix (logged if table is logged). | |
void | increment (size_t i, size_t j, T incr_amt) |
A member function to increase the mass of a given position in the matrix. | |
void | increment (size_t k, T incr_amt) |
A member function to increase the mass of a given position in the flattened matrix (logged if table is logged). | |
T | sum (size_t i) const |
An accessor for the row sum (normalizer), (logged if table is logged). | |
size_t | argmax (size_t i) const |
A member function that finds and returns the argmax (index of mode) of the given distribution. | |
void | set_logged (bool logged) |
A member function that converts the table between log-space and non-log space. | |
void | fix () |
A member function that normalizes and "locks" the matrix values so that no changes can be made. | |
bool | is_fixed () const |
An accessor for the value of _fixed, which specifies whether or not the matrix has been fixed (irrevocable). |
frequencymatrix.h express
Created by Adam Roberts on 4/23/11. Copyright 2011 Adam Roberts. All rights reserved. The FrequencyMatrix class keeps track of the frequency parameters in order to allow for constant-time probability look-ups and updates. The table is 2D to allow multiple distributions to be stored in one FrequencyMatrix. The first dimension (rows) are the different distributions. Values are stored in log space by default.
Definition at line 27 of file frequencymatrix.h.
FrequencyMatrix< T >::FrequencyMatrix | ( | size_t | m, |
size_t | n, | ||
T | alpha, | ||
bool | logged = true |
||
) |
FrequencyMatrix constructor initializes the matrix values to the given pseudo-counts.
m | a size_t specifying the number of distributions (rows). |
n | a size_t specifying the number of values in each distribution (columns). |
alpha | the intial psuedo-counts (un-logged). |
logged | bool that specifies if the table is to be stored logged. |
Definition at line 143 of file frequencymatrix.h.
size_t FrequencyMatrix< T >::argmax | ( | size_t | i | ) | const |
A member function that finds and returns the argmax (index of mode) of the given distribution.
i | the distribution (row). |
Definition at line 217 of file frequencymatrix.h.
void FrequencyMatrix< T >::fix | ( | ) |
A member function that normalizes and "locks" the matrix values so that no changes can be made.
This allows for faster future lookups, but is irrevocable.
Definition at line 232 of file frequencymatrix.h.
void FrequencyMatrix< T >::increment | ( | size_t | k, |
T | incr_amt | ||
) |
A member function to increase the mass of a given position in the flattened matrix (logged if table is logged).
Does nothing if _fixed is true.
k | the array position. |
incr_amt | the amount to increase the mass by (logged if table is logged). |
Definition at line 189 of file frequencymatrix.h.
void FrequencyMatrix< T >::increment | ( | size_t | i, |
size_t | j, | ||
T | incr_amt | ||
) |
A member function to increase the mass of a given position in the matrix.
i | the distribution (row). |
j | the value (column). |
incr_amt | the amount to increase the mass by (logged if table is logged). |
Definition at line 171 of file frequencymatrix.h.
T FrequencyMatrix< T >::operator() | ( | size_t | k, |
bool | normalized = true |
||
) | const |
An accessor for the frequency at a given position in the flattened matrix (logged if table is logged).
k | the array position. |
normalized | a bool specifying whether or not the frequency should be normalized. |
Definition at line 166 of file frequencymatrix.h.
T FrequencyMatrix< T >::operator() | ( | size_t | i, |
size_t | j, | ||
bool | normalized = true |
||
) | const |
An accessor for the frequency at a given position in the matrix (logged if table is logged).
i | the distribution (row). |
j | the value (column). |
normalized | a bool specifying whether or not the frequency should be normalized. |
Definition at line 153 of file frequencymatrix.h.
void FrequencyMatrix< T >::set_logged | ( | bool | logged | ) |
A member function that converts the table between log-space and non-log space.
Does nothing if _fixed is true.
logged | bool specifying if the table should be converted to logged or non-logged space. |
Definition at line 194 of file frequencymatrix.h.
T FrequencyMatrix< T >::sum | ( | size_t | i | ) | const [inline] |
An accessor for the row sum (normalizer), (logged if table is logged).
i | the distribution (row). |
Definition at line 114 of file frequencymatrix.h.