Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends
Cube< eT > Class Template Reference

Dense cube class. More...

#include <Cube_bones.hpp>

Inheritance diagram for Cube< eT >:
Inheritance graph
[legend]

List of all members.

Classes

class  fixed

Public Types

typedef const eT * const_iterator
typedef const eT * const_slice_iterator
typedef eT elem_type
 the type of elements stored in the cube
typedef eT * iterator
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 * slice_iterator

Public Member Functions

arma_inline arma_warn_unused eT & at (const uword i)
 linear element accessor (treats the cube as a vector); no bounds check.
arma_inline arma_warn_unused eT at (const uword i) const
 linear element accessor (treats the cube as a vector); no bounds check
arma_inline arma_warn_unused eT & at (const uword in_row, const uword in_col, const uword in_slice)
 element accessor; no bounds check
arma_inline arma_warn_unused eT at (const uword in_row, const uword in_col, const uword in_slice) const
 element accessor; no bounds check
iterator begin ()
const_iterator begin () const
slice_iterator begin_slice (const uword slice_num)
const_slice_iterator begin_slice (const uword slice_num) const
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
 Cube ()
 Cube (const uword in_rows, const uword in_cols, const uword in_slices)
 construct the cube to have user specified dimensions
 Cube (eT *aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices, const bool copy_aux_mem=true, const bool strict=true)
 Cube (const eT *aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices)
 Cube (const Cube &m)
 construct a cube from a given cube
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)
template<typename gen_type >
 Cube (const GenCube< eT, gen_type > &X)
 create a cube from OpCube, i.e. run the previously delayed unary operations
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 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 op_type >
 Cube (const mtOpCube< eT, T1, op_type > &X)
 EXPERIMENTAL.
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 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 glue_type >
 Cube (const mtGlueCube< eT, T1, T2, glue_type > &X)
 EXPERIMENTAL.
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
iterator end ()
const_iterator end () const
slice_iterator end_slice (const uword slice_num)
const_slice_iterator end_slice (const uword slice_num) const
const Cubefill (const eT val)
 fill the cube with the specified value
void impl_print (const std::string &extra_text) const
void impl_print (std::ostream &user_stream, const std::string &extra_text) const
void impl_raw_print (const std::string &extra_text) const
void impl_raw_print (std::ostream &user_stream, const std::string &extra_text) const
arma_inline arma_warn_unused bool in_range (const uword i) const
 returns true if the given index is currently in range
arma_inline arma_warn_unused bool in_range (const span &x) const
 returns true if the given start and end indices are currently in range
arma_inline arma_warn_unused bool in_range (const uword in_row, const uword in_col, const uword in_slice) const
 returns true if the given location is currently in range
arma_warn_unused bool in_range (const span &row_span, const span &col_span, const span &slice_span) const
template<typename T1 , typename T2 >
void init (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
void insert_slices (const uword slice_num, const uword N, const bool set_to_zero=true)
template<typename T1 >
void insert_slices (const uword row_num, const BaseCube< eT, T1 > &X)
arma_inline arma_warn_unused bool is_empty () const
 returns true if the cube has no elements
arma_inline arma_warn_unused bool is_finite () const
 returns true if all of the elements are finite
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
arma_warn_unused eT max () const
eT max (uword &index_of_max_val) const
eT max (uword &row_of_max_val, uword &col_of_max_val, uword &slice_of_max_val) const
arma_inline arma_warn_unused eT * memptr ()
 returns a pointer to array of eTs used by the cube
arma_inline arma_warn_unused
const eT * 
memptr () const
 returns a pointer to array of eTs used by the cube
arma_warn_unused eT min () const
eT min (uword &index_of_min_val) const
eT min (uword &row_of_min_val, uword &col_of_min_val, uword &slice_of_min_val) const
const Cubeones ()
const Cubeones (const uword in_rows, const uword in_cols, const uword in_slices)
const Cubeoperator%= (const Cube &m)
 in-place element-wise cube multiplication
const Cubeoperator%= (const subview_cube< eT > &X)
 in-place element-wise cube mutiplication (using a subcube on the right-hand-side)
template<typename gen_type >
const Cubeoperator%= (const GenCube< eT, gen_type > &X)
template<typename T1 , typename op_type >
const Cubeoperator%= (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 eop_type >
const Cubeoperator%= (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 op_type >
const Cubeoperator%= (const mtOpCube< eT, T1, op_type > &X)
 EXPERIMENTAL.
template<typename T1 , typename T2 , typename glue_type >
const Cubeoperator%= (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 eglue_type >
const Cubeoperator%= (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 glue_type >
const Cubeoperator%= (const mtGlueCube< eT, T1, T2, glue_type > &X)
 EXPERIMENTAL.
subview_cube< eT > operator() (const span &row_span, const span &col_span, const span &slice_span)
const subview_cube< eT > operator() (const span &row_span, const span &col_span, const span &slice_span) const
arma_inline arma_warn_unused eT & operator() (const uword i)
 linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline arma_warn_unused eT operator() (const uword i) const
 linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline arma_warn_unused eT & operator() (const uword in_row, const uword in_col, const uword in_slice)
 element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline arma_warn_unused eT operator() (const uword in_row, const uword in_col, const uword in_slice) const
 element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
arma_inline const Cubeoperator*= (const eT val)
 In-place multiplication of all elements of the cube with a scalar.
arma_inline const Cubeoperator++ ()
 prefix ++
arma_inline void operator++ (int)
 postfix ++ (must not return the object by reference)
arma_inline const Cubeoperator+= (const eT val)
 In-place addition of a scalar to all elements of the cube.
const Cubeoperator+= (const Cube &m)
 in-place cube addition
const Cubeoperator+= (const subview_cube< eT > &X)
 in-place cube addition (using a subcube on the right-hand-side)
template<typename gen_type >
const Cubeoperator+= (const GenCube< eT, gen_type > &X)
template<typename T1 , typename op_type >
const Cubeoperator+= (const OpCube< T1, op_type > &X)
 in-place cube addition, with the right-hand-side operand having delayed operations
template<typename T1 , typename eop_type >
const Cubeoperator+= (const eOpCube< T1, eop_type > &X)
 in-place cube addition, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_type >
const Cubeoperator+= (const mtOpCube< eT, T1, op_type > &X)
 EXPERIMENTAL.
template<typename T1 , typename T2 , typename glue_type >
const Cubeoperator+= (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 eglue_type >
const Cubeoperator+= (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 glue_type >
const Cubeoperator+= (const mtGlueCube< eT, T1, T2, glue_type > &X)
 EXPERIMENTAL.
arma_inline const Cubeoperator-- ()
 prefix --
arma_inline void operator-- (int)
 postfix -- (must not return the object by reference)
arma_inline const Cubeoperator-= (const eT val)
 In-place subtraction of a scalar from all elements of the cube.
const Cubeoperator-= (const Cube &m)
 in-place cube subtraction
const Cubeoperator-= (const subview_cube< eT > &X)
 in-place cube subtraction (using a subcube on the right-hand-side)
template<typename gen_type >
const Cubeoperator-= (const GenCube< eT, gen_type > &X)
template<typename T1 , typename op_type >
const Cubeoperator-= (const OpCube< T1, op_type > &X)
 in-place cube subtraction, with the right-hand-side operand having delayed operations
template<typename T1 , typename eop_type >
const Cubeoperator-= (const eOpCube< T1, eop_type > &X)
 in-place cube subtraction, with the right-hand-side operand having delayed operations
template<typename T1 , typename op_type >
const Cubeoperator-= (const mtOpCube< eT, T1, op_type > &X)
 EXPERIMENTAL.
template<typename T1 , typename T2 , typename glue_type >
const Cubeoperator-= (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 eglue_type >
const Cubeoperator-= (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 glue_type >
const Cubeoperator-= (const mtGlueCube< eT, T1, T2, glue_type > &X)
 EXPERIMENTAL.
arma_inline const Cubeoperator/= (const eT val)
 In-place division of all elements of the cube with a scalar.
const Cubeoperator/= (const Cube &m)
 in-place element-wise cube division
const Cubeoperator/= (const subview_cube< eT > &X)
 in-place element-wise cube division (using a subcube on the right-hand-side)
template<typename gen_type >
const Cubeoperator/= (const GenCube< eT, gen_type > &X)
template<typename T1 , typename op_type >
const Cubeoperator/= (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 >
const Cubeoperator/= (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 op_type >
const Cubeoperator/= (const mtOpCube< eT, T1, op_type > &X)
 EXPERIMENTAL.
template<typename T1 , typename T2 , typename glue_type >
const Cubeoperator/= (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 >
const Cubeoperator/= (const eGlueCube< T1, T2, eglue_type > &X)
 in-place cube element-wise division, with the right-hand-side operands having delayed operations
template<typename T1 , typename T2 , typename glue_type >
const Cubeoperator/= (const mtGlueCube< eT, T1, T2, glue_type > &X)
 EXPERIMENTAL.
arma_inline const Cubeoperator= (const eT val)
const Cubeoperator= (const Cube &m)
 construct a cube from a given cube
const Cubeoperator= (const subview_cube< eT > &X)
 construct a cube from a subview_cube instance (e.g. construct a cube from a delayed subcube operation)
template<typename gen_type >
const Cubeoperator= (const GenCube< eT, gen_type > &X)
template<typename T1 , typename op_type >
const Cubeoperator= (const OpCube< T1, op_type > &X)
 create a cube from OpCube, i.e. run the previously delayed unary operations
template<typename T1 , typename eop_type >
const Cubeoperator= (const eOpCube< T1, eop_type > &X)
 create a cube from eOpCube, i.e. run the previously delayed unary operations
template<typename T1 , typename op_type >
const Cubeoperator= (const mtOpCube< eT, T1, op_type > &X)
 EXPERIMENTAL.
template<typename T1 , typename T2 , typename glue_type >
const Cubeoperator= (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 eglue_type >
const Cubeoperator= (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 glue_type >
const Cubeoperator= (const mtGlueCube< eT, T1, T2, glue_type > &X)
 EXPERIMENTAL.
arma_inline arma_warn_unused eT & operator[] (const uword i)
 linear element accessor (treats the cube as a vector); no bounds check.
arma_inline arma_warn_unused eT operator[] (const uword i) const
 linear element accessor (treats the cube as a vector); no bounds check
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
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
const Cuberandn ()
const Cuberandn (const uword in_rows, const uword in_cols, const uword in_slices)
const Cuberandu ()
const Cuberandu (const uword in_rows, const uword in_cols, const uword in_slices)
void reset ()
void reshape (const uword in_rows, const uword in_cols, const uword in_slices, const uword dim=0)
 change the cube to have user specified dimensions (data is preserved)
void resize (const uword in_rows, const uword in_cols, const uword in_slices)
 change the cube to have user specified dimensions (data is preserved)
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
template<typename T1 >
void set_imag (const BaseCube< pod_type, T1 > &X)
template<typename T1 >
void set_imag (const BaseCube< typename Cube< eT >::pod_type, T1 > &X)
template<typename T1 >
void set_real (const BaseCube< pod_type, T1 > &X)
template<typename T1 >
void set_real (const BaseCube< typename Cube< eT >::pod_type, T1 > &X)
void set_size (const uword in_rows, const uword in_cols, const uword in_slices)
 change the cube to have user specified dimensions (data is not preserved)
void shed_slice (const uword slice_num)
 remove specified slice
void shed_slices (const uword in_slice1, const uword in_slice2)
 remove specified slices
arma_inline Mat< eT > & slice (const uword in_slice)
 provide the reference to the matrix representing a single slice
arma_inline const Mat< eT > & slice (const uword in_slice) const
 provide the reference to the matrix representing a single slice
arma_inline arma_warn_unused eT * slice_colptr (const uword in_slice, const uword in_col)
 returns a pointer to array of eTs used by the specified slice in the cube
arma_inline arma_warn_unused
const eT * 
slice_colptr (const uword in_slice, const uword in_col) const
 returns a pointer to array of eTs used by the specified slice in the cube
arma_inline arma_warn_unused eT * slice_memptr (const uword slice)
 returns a pointer to array of eTs used by the specified slice in the cube
arma_inline arma_warn_unused
const eT * 
slice_memptr (const uword slice) const
 returns a pointer to array of eTs used by the specified slice in the cube
arma_inline subview_cube< eT > slices (const uword in_slice1, const uword in_slice2)
 creation of subview_cube (subcube comprised of specified slices)
arma_inline const subview_cube
< eT > 
slices (const uword in_slice1, const uword in_slice2) const
 creation of subview_cube (subcube comprised of specified slices)
arma_inline subview_cube< eT > subcube (const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2)
 creation of subview_cube (generic subcube)
arma_inline const subview_cube
< eT > 
subcube (const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2) const
 creation of subview_cube (generic subcube)
subview_cube< eT > subcube (const span &row_span, const span &col_span, const span &slice_span)
 creation of subview_cube (generic subcube)
const subview_cube< eT > subcube (const span &row_span, const span &col_span, const span &slice_span) const
 creation of subview_cube (generic subcube)
const Cubezeros ()
const Cubezeros (const uword in_rows, const uword in_cols, const uword in_slices)
 ~Cube ()

Public Attributes

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)
const uword mem_state
const uword n_cols
 number of columns in each slice (read-only)
const uword n_elem
 number of elements in the cube (read-only)
const uword n_elem_slice
 DEPRECATED: do not use this member variable -- it will be _removed_ in version 3.0.
const uword n_rows
 number of rows in each slice (read-only)
const uword n_slices
 number of slices in the cube (read-only)

Protected Member Functions

void create_mat ()
void delete_mat ()
template<typename T1 , typename T2 >
void init (const BaseCube< pod_type, T1 > &A, const BaseCube< pod_type, T2 > &B)
void init_cold ()
void init_warm (const uword in_rows, const uword in_cols, const uword in_slices)
void steal_mem (Cube &X)

Protected Attributes

arma_aligned Mat< eT > * mat_ptrs_local [Cube_prealloc::mat_ptrs_size]
arma_aligned eT mem_local [Cube_prealloc::mem_n_elem]

Friends

class glue_join
class op_reshape
class op_resize

Detailed Description

template<typename eT>
class Cube< eT >

Dense cube class.

Definition at line 30 of file Cube_bones.hpp.


Member Typedef Documentation

template<typename eT>
typedef const eT* Cube< eT >::const_iterator

Definition at line 265 of file Cube_bones.hpp.

template<typename eT>
typedef const eT* Cube< eT >::const_slice_iterator

Definition at line 268 of file Cube_bones.hpp.

template<typename eT>
typedef eT Cube< eT >::elem_type

the type of elements stored in the cube

Definition at line 34 of file Cube_bones.hpp.

template<typename eT>
typedef eT* Cube< eT >::iterator

Definition at line 264 of file Cube_bones.hpp.

template<typename eT>
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 35 of file Cube_bones.hpp.

template<typename eT>
typedef eT* Cube< eT >::slice_iterator

Definition at line 267 of file Cube_bones.hpp.


Constructor & Destructor Documentation

template<typename eT>
template<typename T1 , typename T2 >
Cube< eT >::Cube ( const BaseCube< pod_type, T1 > &  A,
const BaseCube< pod_type, T2 > &  B 
) [inline, explicit]

Member Function Documentation

template<typename eT>
template<typename T1 , typename T2 >
void Cube< eT >::init ( const BaseCube< pod_type, T1 > &  A,
const BaseCube< pod_type, T2 > &  B 
) [inline, protected]
template<typename eT>
template<typename T1 >
void Cube< eT >::set_imag ( const BaseCube< pod_type, T1 > &  X) [inline]
template<typename eT>
template<typename T1 >
void Cube< eT >::set_real ( const BaseCube< pod_type, T1 > &  X) [inline]

Friends And Related Function Documentation

template<typename eT>
friend class glue_join [friend]

Definition at line 326 of file Cube_bones.hpp.

template<typename eT>
friend class op_reshape [friend]

Definition at line 327 of file Cube_bones.hpp.

template<typename eT>
friend class op_resize [friend]

Definition at line 328 of file Cube_bones.hpp.


Member Data Documentation

template<typename eT>
arma_aligned const Mat<eT>** const Cube< eT >::mat_ptrs

pointer to an array containing pointers to Mat instances (one for each slice)

Definition at line 50 of file Cube_bones.hpp.

template<typename eT>
arma_aligned Mat<eT>* Cube< eT >::mat_ptrs_local[Cube_prealloc::mat_ptrs_size] [protected]

Definition at line 54 of file Cube_bones.hpp.

template<typename eT>
arma_aligned const eT* const Cube< eT >::mem

pointer to the memory used by the cube (memory is read-only)

Definition at line 51 of file Cube_bones.hpp.

template<typename eT>
arma_aligned eT Cube< eT >::mem_local[Cube_prealloc::mem_n_elem] [protected]

Definition at line 55 of file Cube_bones.hpp.

template<typename eT>
const uword Cube< eT >::mem_state

Definition at line 42 of file Cube_bones.hpp.

template<typename eT>
const uword Cube< eT >::n_cols

number of columns in each slice (read-only)

Definition at line 38 of file Cube_bones.hpp.

template<typename eT>
const uword Cube< eT >::n_elem

number of elements in the cube (read-only)

Definition at line 41 of file Cube_bones.hpp.

template<typename eT>
const uword Cube< eT >::n_elem_slice

DEPRECATED: do not use this member variable -- it will be _removed_ in version 3.0.

Definition at line 39 of file Cube_bones.hpp.

template<typename eT>
const uword Cube< eT >::n_rows

number of rows in each slice (read-only)

Definition at line 37 of file Cube_bones.hpp.

template<typename eT>
const uword Cube< eT >::n_slices

number of slices in the cube (read-only)

Definition at line 40 of file Cube_bones.hpp.


The documentation for this class was generated from the following files:


armadillo_matrix
Author(s): Conrad Sanderson - NICTA (www.nicta.com.au), (Wrapper by Sjoerd van den Dries)
autogenerated on Tue Jan 7 2014 11:42:07