libidx
|
#include <idxspec.h>
Public Member Functions | |
virtual | ~idxspec () |
the destructor of idxspec deallocates the dim and mod arrays. | |
const idxspec & | operator= (const idxspec &src) |
assignment operator overloading. | |
void | copy (const idxspec &src) |
copy idxspec src into current idxspec | |
idxspec (const idxspec &src) | |
copy constructor from idxspec src | |
idxspec () | |
idxspec (intg o) | |
Creates an idxspec0 with offset o. | |
idxspec (intg o, intg size0) | |
Creates an idxspec1 with offset o. | |
idxspec (intg o, intg size0, intg size1) | |
Creates an idxspec2 with offset o. | |
idxspec (intg o, intg size0, intg size1, intg size2) | |
Creates an idxspec3 with offset o. | |
idxspec (intg o, intg s0, intg s1, intg s2, intg s3, intg s4=-1, intg s5=-1, intg s6=-1, intg s7=-1) | |
Generic constructor with offset. | |
idxspec (intg o, int n, intg *ldim, intg *lmod) | |
idxspec (intg o, const idxdim &d) | |
intg | getoffset () const |
return the offset of idxspec | |
void | add_offset (intg n) |
Adds 'n' to current offset. | |
int | getndim () const |
return the order (number of dimensions). | |
intg | footprint () const |
intg | nelements () const |
total number of elements accessed by idxspec | |
bool | contiguousp () const |
void | pretty (FILE *f) const |
pretty-prints the idxspec on the specified file. | |
void | pretty (std::ostream &out) const |
idxspec | select (int d, intg i) |
intg | select_into (idxspec *dst, int d, intg n) const |
intg | select_inplace (int d, intg i) |
idxspec | narrow (int d, intg s, intg o) |
intg | narrow_into (idxspec *dst, int d, intg s, intg o) |
intg | narrow_inplace (int d, intg s, intg o) |
idxspec | transpose (int d1, int d2) |
transpose: transpose dimensions d1 and d2. | |
idxspec | transpose (int *p) |
transpose all dimensions through permutation matrix p. | |
int | transpose_into (idxspec *dst, int d1, int d2) |
int | transpose_into (idxspec *dst, int *p) |
int | transpose_inplace (int d1, int d2) |
int | transpose_inplace (int *p) |
idxspec | unfold (int d, intg k, intg s) |
intg | unfold_into (idxspec *dst, int d, intg k, intg s) |
intg | unfold_inplace (int d, intg k, intg s) |
Friends | |
class | idxd |
class | idxiter |
class | idxlooper |
class | contiguous_idxiter |
class | noncontiguous_idxiter |
class | idx |
bool | same_dim (idxspec &s1, idxspec &s2) |
EXPORT std::ostream & | operator<< (std::ostream &out, idxspec &d) |
idxspec print operator. | |
EXPORT std::ostream & | operator<< (std::ostream &out, const idxspec &d) |
idxspec print operator. | |
EXPORT std::string & | operator<< (std::string &out, idxspec &d) |
idxspec print operator. |
idxspec contains all the characteristics of an idx, except the storage. It includes the order (number of dimensions) the offset, and the dim and mod arrays. having an idxspec class separate from idx allows us to write generic manipulation functions that do not depend on the type of the storage.
ebl::idxspec::idxspec | ( | ) |
specific constructors for each number of dimensions This creates an idxspec0 with offset 0. This can be used to build an empty/blank idxspec.
ebl::idxspec::idxspec | ( | intg | o, |
int | n, | ||
intg * | ldim, | ||
intg * | lmod | ||
) |
Creates an idxspec of order n from arrays of dims and mods. The arrays are copied.
ebl::idxspec::idxspec | ( | intg | o, |
const idxdim & | d | ||
) |
construct an idxspec from an array of dimensions contained in an idxdim, with offset o
bool ebl::idxspec::contiguousp | ( | ) | const |
returns true if the idxspec elements are in a continuous chunk of memory. This is useful to optimize iterators over the data.
intg ebl::idxspec::footprint | ( | ) | const |
return the memory footprint, including the offset. The storage of an idx containing this idxspec must be have at least this size.
idxspec ebl::idxspec::narrow | ( | int | d, |
intg | s, | ||
intg | o | ||
) |
narrow: return a new idxspec in which the d-th dimension has been reduced to size s, starting at item o. In other words, if m is an idxspec of order 2 of size (10,4), the call idxspec p = m.narrow(0,6,2) will set p to an idxspec or order 2 of size (6,4) whose rows are rows 2 to 7 of m.
intg ebl::idxspec::narrow_inplace | ( | int | d, |
intg | s, | ||
intg | o | ||
) |
narrow_inplace: same as narrow, but modifies the current idxspec.
intg ebl::idxspec::narrow_into | ( | idxspec * | dst, |
int | d, | ||
intg | s, | ||
intg | o | ||
) |
narrow_into: same as narrow, but modifies an existing idxspec instead of returning a new one.
void ebl::idxspec::pretty | ( | FILE * | f | ) | const |
pretty-prints the idxspec on the specified file.
print methods
idxspec ebl::idxspec::select | ( | int | d, |
intg | i | ||
) |
manipulation methods Returns a new idxspec corresponding to a slice of the current idxspec with slice i in dimension d. In other words, if m is an idxspec of order 2 of size (10,4), the call idxspec p = m.select(0,3) will set p to an idxspec or order 1 containing the 4-th row of m.
intg ebl::idxspec::select_inplace | ( | int | d, |
intg | i | ||
) |
select_inplace: same as select, but modifies the current idxspec.
intg ebl::idxspec::select_into | ( | idxspec * | dst, |
int | d, | ||
intg | n | ||
) | const |
select_into: same as select, but modifies an existing idxspec instead of returning a new one.
int ebl::idxspec::transpose_inplace | ( | int | d1, |
int | d2 | ||
) |
transpose_inplace: same as transpose, but modifies the current idxspec.
int ebl::idxspec::transpose_inplace | ( | int * | p | ) |
transpose_inplace: same as transpose, but modifies the current idxspec.
int ebl::idxspec::transpose_into | ( | idxspec * | dst, |
int * | p | ||
) |
same as transpose, but modifies an existing idxspec instead of returning a new one.
int ebl::idxspec::transpose_into | ( | idxspec * | dst, |
int | d1, | ||
int | d2 | ||
) |
same as transpose, but modifies an existing idxspec instead of returning a new one.
idxspec ebl::idxspec::unfold | ( | int | d, |
intg | k, | ||
intg | s | ||
) |
unfold: prepare an idxspec for a convolution. Returns an idx on the same storage as m (pointing to the same data) with an added dimension at the end obtained by "unfolding" the n -th dimension. The size of the new dimension is k. This essentially manipulates the mod array to make convolutions look like matrix-vector multiplies.
intg ebl::idxspec::unfold_inplace | ( | int | d, |
intg | k, | ||
intg | s | ||
) |
unfold_into: same as unfold, but modifies the current idxspec.
intg ebl::idxspec::unfold_into | ( | idxspec * | dst, |
int | d, | ||
intg | k, | ||
intg | s | ||
) |
same as unfold, but modifies an existing idxspec instead of returning a new one.
friend class idxd [friend] |
friends
return true if two idxspec have the same dimensions, i.e. if all their dimensions are equal (regardless of strides).