libeblearn
|
#include <ebl_states.h>
Public Member Functions | |
fstate_idx () | |
Constructs a fstate_idx of order 0. | |
fstate_idx (intg s0) | |
Constructs a fstate_idx of order 1. | |
fstate_idx (intg s0, intg s1) | |
Constructs a fstate_idx of order 2. | |
fstate_idx (intg s0, intg s1, intg s2) | |
Constructs a fstate_idx of order 3. | |
fstate_idx (intg s0, intg s1, intg s2, intg s3, intg s4=-1, intg s5=-1, intg s6=-1, intg s7=-1) | |
Constructor. A fstate_idx can have up to 8 dimensions. | |
fstate_idx (const idxdim &d) | |
Constructor. Use the order and dimensions contained in passed idxdim d. | |
fstate_idx (intg n, fstate_idx< T > &fs) | |
fstate_idx (parameter< T, fstate_idx< T > > *st) | |
fstate_idx (parameter< T, fstate_idx< T > > *st, intg s0) | |
fstate_idx (parameter< T, fstate_idx< T > > *st, intg s0, intg s1) | |
fstate_idx (parameter< T, fstate_idx< T > > *st, intg s0, intg s1, intg s2) | |
fstate_idx (parameter< T, fstate_idx< T > > *st, intg s0, intg s1, intg s2, intg s3, intg s4=-1, intg s5=-1, intg s6=-1, intg s7=-1) | |
fstate_idx (parameter< T, fstate_idx< T > > *st, const idxdim &d) | |
fstate_idx (const idx< T > &x) | |
virtual void | clear () |
clear all buffers (x, dx and ddx). | |
virtual void | clear_x () |
clear x | |
virtual intg | nelements () |
return number of elements | |
virtual intg | footprint () |
return footprint in storages | |
virtual intg | size () |
same as footprint | |
virtual void | resize (intg s0=-1, intg s1=-1, intg s2=-1, intg s3=-1, intg s4=-1, intg s5=-1, intg s6=-1, intg s7=-1) |
resize. The order cannot be changed with this. | |
virtual void | resize (const idxdim &d) |
resize with dimensions contained in an idxdim. order cannot be changed. | |
virtual void | resize1 (intg dimn, intg size) |
virtual void | resize_as (fstate_idx &s) |
virtual void | resize_as_but1 (fstate_idx< T > &s, intg fixed_dim) |
fstate_idx< T > | select (int dimension, intg slice_index) |
fstate_idx< T > | narrow (int dimension, intg size, intg offset) |
fstate_idx< T > | make_copy () |
make a new copy of self | |
virtual fstate_idx< T > & | operator= (const fstate_idx< T > &other) |
virtual void | copy (fstate_idx< T > &cpy) |
Copy state 'cpy' into internal buffers. | |
virtual void | pretty () |
Prints idx metadata. | |
virtual void | print () |
Prints all elements. | |
Public Attributes | |
idx< T > | x |
state itself | |
idx< T > | dx |
gradient of loss with respect to state | |
idx< T > | ddx |
diag hessian of loss with respect to state |
A class that stores a vector/tensor state.
ebl::fstate_idx< T >::fstate_idx | ( | ) |
Constructs a fstate_idx of order 0.
constructors from specific dimensions
ebl::fstate_idx< T >::fstate_idx | ( | intg | n, |
fstate_idx< T > & | fs | ||
) |
This constructor initializes each buffer to the same order as 'ms.x' but sets all dimensions to 'n'.
ebl::fstate_idx< T >::fstate_idx | ( | parameter< T, fstate_idx< T > > * | st | ) |
constructors from specific dimensions using a fparameter Constructs a fstate_idx of order 0, by appending the fstate_idx into the same Srg as the fparameter passed as argument. This is useful for allocating multiple fstate_idx inside a fparameter. If st is null, it is just ignore and behaves as regular constructor.
ebl::fstate_idx< T >::fstate_idx | ( | parameter< T, fstate_idx< T > > * | st, |
intg | s0 | ||
) |
Constructs a fstate_idx of order 1, by appending the fstate_idx into the same Srg as the fparameter passed as argument. This is useful for allocating multiple fstate_idx inside a fparameter. If st is null, it is just ignore and behaves as regular constructor.
ebl::fstate_idx< T >::fstate_idx | ( | parameter< T, fstate_idx< T > > * | st, |
intg | s0, | ||
intg | s1 | ||
) |
Constructs a fstate_idx of order 2, by appending the fstate_idx into the same Srg as the fparameter passed as argument. This is useful for allocating multiple fstate_idx inside a fparameter. If st is null, it is just ignore and behaves as regular constructor.
ebl::fstate_idx< T >::fstate_idx | ( | parameter< T, fstate_idx< T > > * | st, |
intg | s0, | ||
intg | s1, | ||
intg | s2 | ||
) |
Constructs a fstate_idx of order 3, by appending the fstate_idx into the same Srg as the fparameter passed as argument. This is useful for allocating multiple fstate_idx inside a fparameter. If st is null, it is just ignore and behaves as regular constructor.
ebl::fstate_idx< T >::fstate_idx | ( | parameter< T, fstate_idx< T > > * | st, |
intg | s0, | ||
intg | s1, | ||
intg | s2, | ||
intg | s3, | ||
intg | s4 = -1 , |
||
intg | s5 = -1 , |
||
intg | s6 = -1 , |
||
intg | s7 = -1 |
||
) |
Constructs a fstate_idx of order up to 8, by appending the fstate_idx into the same Srg as the fparameter passed as argument. This is useful for allocating multiple fstate_idx inside a fparameter. If st is null, it is just ignore and behaves as regular constructor.
ebl::fstate_idx< T >::fstate_idx | ( | parameter< T, fstate_idx< T > > * | st, |
const idxdim & | d | ||
) |
Constructs a fstate_idx using the order and dimensions contained in passed idxdim d, by appending the fstate_idx into the same Srg as the fparameter passed as argument. This is useful for allocating multiple fstate_idx inside a fparameter. If st is null, it is just ignore and behaves as regular constructor.
ebl::fstate_idx< T >::fstate_idx | ( | const idx< T > & | x | ) |
constructors from other fstate_idx Constructs a fstate_idx from an existing idx. Note: the data pointed to by idxs is not copied, we only create new idx pointing to the same data.
void ebl::fstate_idx< T >::clear | ( | ) | [virtual] |
clear all buffers (x, dx and ddx).
clear methods
Reimplemented from ebl::state.
Reimplemented in ebl::bstate_idx< T >, ebl::bbstate_idx< T >, ebl::bstate_idx< Tdata >, ebl::bstate_idx< Tds2 >, ebl::bstate_idx< Tnet >, ebl::bbstate_idx< Tdata >, ebl::bbstate_idx< Tds2 >, and ebl::bbstate_idx< Tnet >.
fstate_idx< T > ebl::fstate_idx< T >::make_copy | ( | ) |
make a new copy of self
copy methods
Reimplemented in ebl::bstate_idx< T >, ebl::bbstate_idx< T >, ebl::bstate_idx< Tdata >, ebl::bstate_idx< Tds2 >, ebl::bstate_idx< Tnet >, ebl::bbstate_idx< Tdata >, ebl::bbstate_idx< Tds2 >, and ebl::bbstate_idx< Tnet >.
fstate_idx< T > ebl::fstate_idx< T >::narrow | ( | int | dimension, |
intg | size, | ||
intg | offset | ||
) |
Same as idx::narrow(), applied to internal buffers. This returns a state_idx pointing to the same data as current state, but pointing to a slice of it.
dimension | The dimension to slice. |
slice_index | The size of the slize to return. |
offset | The offset to start slicing. |
Reimplemented in ebl::bstate_idx< T >, ebl::bbstate_idx< T >, ebl::bstate_idx< Tdata >, ebl::bstate_idx< Tds2 >, ebl::bstate_idx< Tnet >, ebl::bbstate_idx< Tdata >, ebl::bbstate_idx< Tds2 >, and ebl::bbstate_idx< Tnet >.
intg ebl::fstate_idx< T >::nelements | ( | ) | [virtual] |
return number of elements
information methods
fstate_idx< T > & ebl::fstate_idx< T >::operator= | ( | const fstate_idx< T > & | other | ) | [virtual] |
Assignment operator, involves assignment of internal idx (avoid using this in critical loops).
void ebl::fstate_idx< T >::pretty | ( | ) | [virtual] |
Prints idx metadata.
info printing methods
Reimplemented in ebl::bstate_idx< T >, ebl::bbstate_idx< T >, ebl::bstate_idx< Tdata >, ebl::bstate_idx< Tds2 >, ebl::bstate_idx< Tnet >, ebl::bbstate_idx< Tdata >, ebl::bbstate_idx< Tds2 >, and ebl::bbstate_idx< Tnet >.
void ebl::fstate_idx< T >::resize | ( | intg | s0 = -1 , |
intg | s1 = -1 , |
||
intg | s2 = -1 , |
||
intg | s3 = -1 , |
||
intg | s4 = -1 , |
||
intg | s5 = -1 , |
||
intg | s6 = -1 , |
||
intg | s7 = -1 |
||
) | [virtual] |
resize. The order cannot be changed with this.
resize methods
Reimplemented in ebl::bstate_idx< T >, ebl::bbstate_idx< T >, ebl::bstate_idx< Tdata >, ebl::bstate_idx< Tds2 >, ebl::bstate_idx< Tnet >, ebl::bbstate_idx< Tdata >, ebl::bbstate_idx< Tds2 >, and ebl::bbstate_idx< Tnet >.
void ebl::fstate_idx< T >::resize1 | ( | intg | dimn, |
intg | size | ||
) | [virtual] |
resize one dimension <dimn> with size <size>. The order cannot be changed.
Reimplemented in ebl::bstate_idx< T >, ebl::bbstate_idx< T >, ebl::bstate_idx< Tdata >, ebl::bstate_idx< Tds2 >, ebl::bstate_idx< Tnet >, ebl::bbstate_idx< Tdata >, ebl::bbstate_idx< Tds2 >, and ebl::bbstate_idx< Tnet >.
void ebl::fstate_idx< T >::resize_as | ( | fstate_idx< T > & | s | ) | [virtual] |
resizes this fstate_idx with same sizes a <s>. Both fstate_idx are required to have the same order.
void ebl::fstate_idx< T >::resize_as_but1 | ( | fstate_idx< T > & | s, |
intg | fixed_dim | ||
) | [virtual] |
same as resize_as but leave dimension <fixed_dim> untouched. Both fstate_idx are required to have the same order.
fstate_idx< T > ebl::fstate_idx< T >::select | ( | int | dimension, |
intg | slice_index | ||
) |
slicing methods Same as idx::select(), applied to internal buffers. This returns a state_idx pointing to the same data as current state, but pointing to a slice of it.
dimension | The dimension to slice. |
slice_index | The slice to return. |
slicing methods
Reimplemented in ebl::bstate_idx< T >, ebl::bbstate_idx< T >, ebl::bstate_idx< Tdata >, ebl::bstate_idx< Tds2 >, ebl::bstate_idx< Tnet >, ebl::bbstate_idx< Tdata >, ebl::bbstate_idx< Tds2 >, and ebl::bbstate_idx< Tnet >.
idx<T> ebl::fstate_idx< T >::x |
state itself
member variables