Dense cube class. More...
#include <Cube_proto.hpp>
Public Types | |
typedef eT | elem_type |
the type of elements stored in the cube | |
typedef get_pod_type< eT >::result | pod_type |
if eT is non-complex, pod_type is same as eT. otherwise, pod_type is the underlying type used by std::complex | |
typedef eT * | iterator |
typedef const eT * | const_iterator |
typedef eT * | slice_iterator |
typedef const eT * | const_slice_iterator |
Public Member Functions | |
~Cube () | |
Cube () | |
Cube (const u32 in_rows, const u32 in_cols, const u32 in_slices) | |
construct the cube to have user specified dimensions | |
Cube (eT *aux_mem, const u32 aux_n_rows, const u32 aux_n_cols, const u32 aux_n_slices, const bool copy_aux_mem=true) | |
construct a cube from a given auxiliary array of eTs. //! if copy_aux_mem is true, new memory is allocated and the array is copied. //! if copy_aux_mem is false, the auxiliary array is used directly (without allocating memory and copying). //! note that in the latter case //! the default is to copy the array. | |
Cube (const eT *aux_mem, const u32 aux_n_rows, const u32 aux_n_cols, const u32 aux_n_slices) | |
construct a cube from a given auxiliary read-only array of eTs. //! the array is copied. | |
arma_inline const Cube & | operator= (const eT val) |
Set the cube to be equal to the specified scalar. //! NOTE: the size of the cube will be 1x1x1. | |
arma_inline const Cube & | operator+= (const eT val) |
In-place addition of a scalar to all elements of the cube. | |
arma_inline const Cube & | operator-= (const eT val) |
In-place subtraction of a scalar from all elements of the cube. | |
arma_inline const Cube & | operator*= (const eT val) |
In-place multiplication of all elements of the cube with a scalar. | |
arma_inline const Cube & | operator/= (const eT val) |
In-place division of all elements of the cube with a scalar. | |
Cube (const Cube &m) | |
construct a cube from a given cube | |
const Cube & | operator= (const Cube &m) |
construct a cube from a given cube | |
const Cube & | operator+= (const Cube &m) |
in-place cube addition | |
const Cube & | operator-= (const Cube &m) |
in-place cube subtraction | |
const Cube & | operator%= (const Cube &m) |
in-place element-wise cube multiplication | |
const Cube & | operator/= (const Cube &m) |
in-place element-wise cube division | |
template<typename T1 , typename T2 > | |
Cube (const BaseCube< pod_type, T1 > &A, const BaseCube< pod_type, T2 > &B) | |
Cube (const subview_cube< eT > &X) | |
construct a cube from a subview_cube instance (e.g. construct a cube from a delayed subcube operation) | |
const Cube & | operator= (const subview_cube< eT > &X) |
construct a cube from a subview_cube instance (e.g. construct a cube from a delayed subcube operation) | |
const Cube & | operator+= (const subview_cube< eT > &X) |
in-place cube addition (using a subcube on the right-hand-side) | |
const Cube & | operator-= (const subview_cube< eT > &X) |
in-place cube subtraction (using a subcube on the right-hand-side) | |
const Cube & | operator%= (const subview_cube< eT > &X) |
in-place element-wise cube mutiplication (using a subcube on the right-hand-side) | |
const Cube & | operator/= (const subview_cube< eT > &X) |
in-place element-wise cube division (using a subcube on the right-hand-side) | |
arma_inline Mat< eT > & | slice (const u32 in_slice) |
provide the reference to the matrix representing a single slice | |
arma_inline const Mat< eT > & | slice (const u32 in_slice) const |
provide the reference to the matrix representing a single slice | |
arma_inline subview_cube< eT > | slices (const u32 in_slice1, const u32 in_slice2) |
creation of subview_cube (subcube comprised of specified slices) | |
arma_inline const subview_cube < eT > | slices (const u32 in_slice1, const u32 in_slice2) const |
creation of subview_cube (subcube comprised of specified slices) | |
arma_inline subview_cube< eT > | subcube (const u32 in_row1, const u32 in_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u32 in_slice2) |
creation of subview_cube (generic subcube) | |
arma_inline const subview_cube < eT > | subcube (const u32 in_row1, const u32 in_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u32 in_slice2) const |
creation of subview_cube (generic subcube) | |
template<typename T1 , typename op_type > | |
Cube (const OpCube< T1, op_type > &X) | |
create a cube from OpCube, i.e. run the previously delayed unary operations | |
template<typename T1 , typename op_type > | |
const Cube & | operator= (const OpCube< T1, op_type > &X) |
create a cube from OpCube, i.e. run the previously delayed unary operations | |
template<typename T1 , typename op_type > | |
const Cube & | operator+= (const OpCube< T1, op_type > &X) |
in-place cube addition, with the right-hand-side operand having delayed operations | |
template<typename T1 , typename op_type > | |
const Cube & | operator-= (const OpCube< T1, op_type > &X) |
in-place cube subtraction, with the right-hand-side operand having delayed operations | |
template<typename T1 , typename op_type > | |
const Cube & | operator%= (const OpCube< T1, op_type > &X) |
in-place cube element-wise multiplication, with the right-hand-side operand having delayed operations | |
template<typename T1 , typename op_type > | |
const Cube & | operator/= (const OpCube< T1, op_type > &X) |
in-place cube element-wise division, with the right-hand-side operand having delayed operations | |
template<typename T1 , typename eop_type > | |
Cube (const eOpCube< T1, eop_type > &X) | |
create a cube from eOpCube, i.e. run the previously delayed unary operations | |
template<typename T1 , typename eop_type > | |
const Cube & | operator= (const eOpCube< T1, eop_type > &X) |
create a cube from eOpCube, i.e. run the previously delayed unary operations | |
template<typename T1 , typename eop_type > | |
const Cube & | operator+= (const eOpCube< T1, eop_type > &X) |
in-place cube addition, with the right-hand-side operand having delayed operations | |
template<typename T1 , typename eop_type > | |
const Cube & | operator-= (const eOpCube< T1, eop_type > &X) |
in-place cube subtraction, with the right-hand-side operand having delayed operations | |
template<typename T1 , typename eop_type > | |
const Cube & | operator%= (const eOpCube< T1, eop_type > &X) |
in-place cube element-wise multiplication, with the right-hand-side operand having delayed operations | |
template<typename T1 , typename eop_type > | |
const Cube & | operator/= (const eOpCube< T1, eop_type > &X) |
in-place cube element-wise division, with the right-hand-side operand having delayed operations | |
template<typename T1 , typename T2 , typename glue_type > | |
Cube (const GlueCube< T1, T2, glue_type > &X) | |
create a cube from Glue, i.e. run the previously delayed binary operations | |
template<typename T1 , typename T2 , typename glue_type > | |
const Cube & | operator= (const GlueCube< T1, T2, glue_type > &X) |
create a cube from Glue, i.e. run the previously delayed binary operations | |
template<typename T1 , typename T2 , typename glue_type > | |
const Cube & | operator+= (const GlueCube< T1, T2, glue_type > &X) |
in-place cube addition, with the right-hand-side operands having delayed operations | |
template<typename T1 , typename T2 , typename glue_type > | |
const Cube & | operator-= (const GlueCube< T1, T2, glue_type > &X) |
in-place cube subtraction, with the right-hand-side operands having delayed operations | |
template<typename T1 , typename T2 , typename glue_type > | |
const Cube & | operator%= (const GlueCube< T1, T2, glue_type > &X) |
in-place cube element-wise multiplication, with the right-hand-side operands having delayed operations | |
template<typename T1 , typename T2 , typename glue_type > | |
const Cube & | operator/= (const GlueCube< T1, T2, glue_type > &X) |
in-place cube element-wise division, with the right-hand-side operands having delayed operations | |
template<typename T1 , typename T2 , typename eglue_type > | |
Cube (const eGlueCube< T1, T2, eglue_type > &X) | |
create a cube from eGlue, i.e. run the previously delayed binary operations | |
template<typename T1 , typename T2 , typename eglue_type > | |
const Cube & | operator= (const eGlueCube< T1, T2, eglue_type > &X) |
create a cube from Glue, i.e. run the previously delayed binary operations | |
template<typename T1 , typename T2 , typename eglue_type > | |
const Cube & | operator+= (const eGlueCube< T1, T2, eglue_type > &X) |
in-place cube addition, with the right-hand-side operands having delayed operations | |
template<typename T1 , typename T2 , typename eglue_type > | |
const Cube & | operator-= (const eGlueCube< T1, T2, eglue_type > &X) |
in-place cube subtraction, with the right-hand-side operands having delayed operations | |
template<typename T1 , typename T2 , typename eglue_type > | |
const Cube & | operator%= (const eGlueCube< T1, T2, eglue_type > &X) |
in-place cube element-wise multiplication, with the right-hand-side operands having delayed operations | |
template<typename T1 , typename T2 , typename eglue_type > | |
const Cube & | operator/= (const eGlueCube< T1, T2, eglue_type > &X) |
in-place cube element-wise division, with the right-hand-side operands having delayed operations | |
arma_inline eT & | operator[] (const u32 i) |
linear element accessor (treats the cube as a vector); no bounds check. | |
arma_inline eT | operator[] (const u32 i) const |
linear element accessor (treats the cube as a vector); no bounds check | |
arma_inline eT & | operator() (const u32 i) |
linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_NO_DEBUG is defined | |
arma_inline eT | operator() (const u32 i) const |
linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_NO_DEBUG is defined | |
arma_inline eT & | at (const u32 in_row, const u32 in_col, const u32 in_slice) |
element accessor; no bounds check | |
arma_inline eT | at (const u32 in_row, const u32 in_col, const u32 in_slice) const |
element accessor; no bounds check | |
arma_inline eT & | operator() (const u32 in_row, const u32 in_col, const u32 in_slice) |
element accessor; bounds checking not done when ARMA_NO_DEBUG is defined | |
arma_inline eT | operator() (const u32 in_row, const u32 in_col, const u32 in_slice) const |
element accessor; bounds checking not done when ARMA_NO_DEBUG is defined | |
arma_inline const Cube & | operator++ () |
prefix ++ | |
arma_inline void | operator++ (int) |
postfix ++ (must not return the object by reference) | |
arma_inline const Cube & | operator-- () |
prefix -- | |
arma_inline void | operator-- (int) |
postfix -- (must not return the object by reference) | |
arma_inline bool | is_finite () const |
returns true if all of the elements are finite | |
arma_inline eT * | memptr () |
returns a pointer to array of eTs used by the cube | |
arma_inline const eT * | memptr () const |
returns a pointer to array of eTs used by the cube | |
arma_inline eT * | slice_memptr (const u32 slice) |
returns a pointer to array of eTs used by the specified slice in the cube | |
arma_inline const eT * | slice_memptr (const u32 slice) const |
returns a pointer to array of eTs used by the specified slice in the cube | |
arma_inline eT * | slice_colptr (const u32 in_slice, const u32 in_col) |
returns a pointer to array of eTs used by the specified slice in the cube | |
arma_inline const eT * | slice_colptr (const u32 in_slice, const u32 in_col) const |
returns a pointer to array of eTs used by the specified slice in the cube | |
void | print (const std::string extra_text="") const |
print contents of the cube (to the cout stream), //! optionally preceding with a user specified line of text. //! the precision and cell width are modified. //! on return, the stream's flags are restored to their original values. | |
void | print (std::ostream &user_stream, const std::string extra_text="") const |
print contents of the cube to a user specified stream, //! optionally preceding with a user specified line of text. //! the precision and cell width are modified. //! on return, the stream's flags are restored to their original values. | |
void | raw_print (const std::string extra_text="") const |
print contents of the cube (to the cout stream), //! optionally preceding with a user specified line of text. //! the stream's flags are used as is and are not modified //! (i.e. the precision and cell width are not modified). | |
void | raw_print (std::ostream &user_stream, const std::string extra_text="") const |
print contents of the cube to a user specified stream, //! optionally preceding with a user specified line of text. //! the stream's flags are used as is and are not modified. //! (i.e. the precision and cell width are not modified). | |
void | set_size (const u32 in_rows, const u32 in_cols, const u32 in_slices) |
change the cube to have user specified dimensions (data is not preserved) | |
template<typename eT2 > | |
void | copy_size (const Cube< eT2 > &m) |
change the cube (without preserving data) to have the same dimensions as the given cube | |
void | fill (const eT val) |
fill the cube with the specified value | |
void | zeros () |
void | zeros (const u32 in_rows, const u32 in_cols, const u32 in_slices) |
void | ones () |
void | ones (const u32 in_rows, const u32 in_cols, const u32 in_slices) |
void | reset () |
bool | save (const std::string name, const file_type type=arma_binary, const bool print_status=true) const |
save the cube to a file | |
bool | save (std::ostream &os, const file_type type=arma_binary, const bool print_status=true) const |
save the cube to a stream | |
bool | load (const std::string name, const file_type type=auto_detect, const bool print_status=true) |
load a cube from a file | |
bool | load (std::istream &is, const file_type type=auto_detect, const bool print_status=true) |
load a cube from a stream | |
bool | quiet_save (const std::string name, const file_type type=arma_binary) const |
save the cube to a file, without printing any error messages | |
bool | quiet_save (std::ostream &os, const file_type type=arma_binary) const |
save the cube to a stream, without printing any error messages | |
bool | quiet_load (const std::string name, const file_type type=auto_detect) |
load a cube from a file, without printing any error messages | |
bool | quiet_load (std::istream &is, const file_type type=auto_detect) |
load a cube from a stream, without printing any error messages | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
slice_iterator | begin_slice (const u32 slice_num) |
const_slice_iterator | begin_slice (const u32 slice_num) const |
slice_iterator | end_slice (const u32 slice_num) |
const_slice_iterator | end_slice (const u32 slice_num) const |
template<typename T1 , typename T2 > | |
Cube (const BaseCube< typename Cube< eT >::pod_type, T1 > &A, const BaseCube< typename Cube< eT >::pod_type, T2 > &B) | |
for constructing a complex cube out of two non-complex cubes | |
Public Attributes | |
const u32 | n_rows |
number of rows in each slice (read-only) | |
const u32 | n_cols |
number of columns in each slice (read-only) | |
const u32 | n_elem_slice |
number of elements in each slice (read-only) | |
const u32 | n_slices |
number of slices in the cube (read-only) | |
const u32 | n_elem |
number of elements in the cube (read-only) | |
const bool | use_aux_mem |
true if externally managed memory is being used (read-only) | |
arma_aligned const Mat< eT > **const | mat_ptrs |
pointer to an array containing pointers to Mat instances (one for each slice) | |
arma_aligned const eT *const | mem |
pointer to the memory used by the cube (memory is read-only) | |
Protected Member Functions | |
void | init (const u32 in_rows, const u32 in_cols, const u32 in_slices) |
internal cube construction; if the requested size is small enough, memory from the stack is used. //! otherwise memory is allocated via 'new' | |
void | init (const Cube &x) |
construct a cube from a given cube | |
void | delete_mat () |
void | create_mat () |
Protected Attributes | |
arma_aligned Mat< eT > * | mat_ptrs_local [16] |
arma_aligned eT | mem_local [64] |
Dense cube class.
Definition at line 23 of file Cube_proto.hpp.
the type of elements stored in the cube
Definition at line 27 of file Cube_proto.hpp.
typedef get_pod_type<eT>::result Cube< eT >::pod_type |
if eT is non-complex, pod_type is same as eT. otherwise, pod_type is the underlying type used by std::complex
Definition at line 28 of file Cube_proto.hpp.
Definition at line 179 of file Cube_proto.hpp.
typedef const eT* Cube< eT >::const_iterator |
Definition at line 180 of file Cube_proto.hpp.
typedef eT* Cube< eT >::slice_iterator |
Definition at line 182 of file Cube_proto.hpp.
typedef const eT* Cube< eT >::const_slice_iterator |
Definition at line 183 of file Cube_proto.hpp.
Cube< eT >::Cube | ( | const BaseCube< pod_type, T1 > & | A, | |
const BaseCube< pod_type, T2 > & | B | |||
) | [inline, explicit] |
number of rows in each slice (read-only)
Definition at line 30 of file Cube_proto.hpp.
Referenced by op_reshape::apply(), eop_cube_core< eop_cube_type >::apply_inplace_div(), eglue_cube_core< eglue_type >::apply_inplace_div(), eop_cube_core< eop_cube_type >::apply_inplace_minus(), eglue_cube_core< eglue_type >::apply_inplace_minus(), eop_cube_core< eop_cube_type >::apply_inplace_plus(), eglue_cube_core< eglue_type >::apply_inplace_plus(), eop_cube_core< eop_cube_type >::apply_inplace_schur(), eglue_cube_core< eglue_type >::apply_inplace_schur(), arma_assert_same_size(), Cube< eT >::at(), Cube< eT >::copy_size(), Cube< eT >::create_mat(), subview_cube< eT >::div_inplace(), subview_cube< eT >::extract(), Cube< eT >::init(), diskio::load_arma_ascii(), subview_cube< eT >::minus_inplace(), Cube< eT >::operator()(), subview_cube< eT >::plus_inplace(), diskio::save_arma_ascii(), diskio::save_arma_binary(), diskio::save_ppm_binary(), diskio::save_raw_ascii(), subview_cube< eT >::schur_inplace(), Cube< eT >::slice_colptr(), Cube< eT >::slices(), Cube< eT >::subcube(), and Cube< eT >::~Cube().
number of columns in each slice (read-only)
Definition at line 31 of file Cube_proto.hpp.
Referenced by op_reshape::apply(), eop_cube_core< eop_cube_type >::apply_inplace_div(), eglue_cube_core< eglue_type >::apply_inplace_div(), eop_cube_core< eop_cube_type >::apply_inplace_minus(), eglue_cube_core< eglue_type >::apply_inplace_minus(), eop_cube_core< eop_cube_type >::apply_inplace_plus(), eglue_cube_core< eglue_type >::apply_inplace_plus(), eop_cube_core< eop_cube_type >::apply_inplace_schur(), eglue_cube_core< eglue_type >::apply_inplace_schur(), arma_assert_same_size(), Cube< eT >::copy_size(), Cube< eT >::create_mat(), subview_cube< eT >::div_inplace(), subview_cube< eT >::extract(), Cube< eT >::init(), diskio::load_arma_ascii(), subview_cube< eT >::minus_inplace(), Cube< eT >::operator()(), subview_cube< eT >::plus_inplace(), diskio::save_arma_ascii(), diskio::save_arma_binary(), diskio::save_ppm_binary(), diskio::save_raw_ascii(), subview_cube< eT >::schur_inplace(), Cube< eT >::slices(), Cube< eT >::subcube(), and Cube< eT >::~Cube().
const u32 Cube< eT >::n_elem_slice |
number of elements in each slice (read-only)
Definition at line 32 of file Cube_proto.hpp.
Referenced by Cube< eT >::at(), Cube< eT >::end_slice(), Cube< eT >::init(), Cube< eT >::operator()(), Cube< eT >::slice_colptr(), Cube< eT >::slice_memptr(), and Cube< eT >::~Cube().
number of slices in the cube (read-only)
Definition at line 33 of file Cube_proto.hpp.
Referenced by op_reshape::apply(), eop_cube_core< eop_cube_type >::apply_inplace_div(), eglue_cube_core< eglue_type >::apply_inplace_div(), eop_cube_core< eop_cube_type >::apply_inplace_minus(), eglue_cube_core< eglue_type >::apply_inplace_minus(), eop_cube_core< eop_cube_type >::apply_inplace_plus(), eglue_cube_core< eglue_type >::apply_inplace_plus(), eop_cube_core< eop_cube_type >::apply_inplace_schur(), eglue_cube_core< eglue_type >::apply_inplace_schur(), arma_assert_same_size(), Cube< eT >::begin_slice(), Cube< eT >::copy_size(), Cube< eT >::create_mat(), Cube< eT >::delete_mat(), subview_cube< eT >::div_inplace(), Cube< eT >::end_slice(), subview_cube< eT >::extract(), Cube< eT >::init(), diskio::load_arma_ascii(), diskio::load_raw_ascii(), subview_cube< eT >::minus_inplace(), Cube< eT >::operator()(), subview_cube< eT >::plus_inplace(), arma_ostream::print(), diskio::save_arma_ascii(), diskio::save_arma_binary(), diskio::save_ppm_binary(), diskio::save_raw_ascii(), subview_cube< eT >::schur_inplace(), Cube< eT >::slice(), Cube< eT >::slices(), Cube< eT >::subcube(), and Cube< eT >::~Cube().
number of elements in the cube (read-only)
Definition at line 34 of file Cube_proto.hpp.
Referenced by abs(), op_reshape::apply(), Cube< eT >::Cube(), Cube< eT >::end(), Cube< eT >::fill(), conv_to< Cube< out_eT > >::from(), Cube< eT >::init(), Cube< eT >::is_finite(), diskio::load_arma_binary(), operator%(), Cube< eT >::operator%=(), Cube< eT >::operator()(), Cube< eT >::operator*=(), operator+(), Cube< eT >::operator+=(), operator-(), Cube< eT >::operator-=(), operator/(), Cube< eT >::operator/=(), Cube_aux::postfix_mm(), Cube_aux::postfix_pp(), Cube_aux::prefix_mm(), Cube_aux::prefix_pp(), arma_ostream::print(), diskio::save_arma_binary(), and Cube< eT >::~Cube().
const bool Cube< eT >::use_aux_mem |
true if externally managed memory is being used (read-only)
Definition at line 35 of file Cube_proto.hpp.
Referenced by Cube< eT >::init(), and Cube< eT >::~Cube().
pointer to an array containing pointers to Mat instances (one for each slice)
Definition at line 37 of file Cube_proto.hpp.
Referenced by Cube< eT >::create_mat(), Cube< eT >::delete_mat(), Cube< eT >::slice(), and Cube< eT >::~Cube().
pointer to the memory used by the cube (memory is read-only)
Definition at line 38 of file Cube_proto.hpp.
Referenced by Cube< eT >::at(), Cube< eT >::Cube(), Cube< eT >::init(), Cube< eT >::is_finite(), Cube< eT >::memptr(), Cube< eT >::operator()(), Cube< eT >::operator=(), Cube< eT >::operator[](), diskio::save_arma_binary(), Cube< eT >::slice_colptr(), Cube< eT >::slice_memptr(), and Cube< eT >::~Cube().
arma_aligned Mat<eT>* Cube< eT >::mat_ptrs_local[16] [protected] |
Definition at line 41 of file Cube_proto.hpp.
Referenced by Cube< eT >::create_mat(), and Cube< eT >::delete_mat().
Definition at line 42 of file Cube_proto.hpp.
Referenced by Cube< eT >::init(), and Cube< eT >::~Cube().