Scopira
20080306
|
Classes | |
class | base_directio_slice |
class | const_islice_vec_iterator_g |
class | const_niterator |
class | const_nslice |
class | directio_slice |
class | directio_traints |
class | directio_traints< char > |
class | directio_traints< double > |
class | directio_traints< float > |
class | directio_traints< int > |
class | directio_traints< short > |
class | islice_vec_g |
class | islice_vec_iterator_g |
class | narray |
class | narray_delete_i |
class | narray_o |
class | nindex |
class | nindex< 1 > |
class | nindex< 2 > |
class | nindex< 3 > |
class | nindex< 4 > |
class | niterator |
class | nslice |
class | stringvector_o |
class | vecindex_sortable |
Typedefs | |
typedef narray< bool, 1 > | boolvec_t |
typedef narray< char, 1 > | charvec_t |
typedef narray< short, 1 > | shortvec_t |
typedef narray< int, 1 > | intvec_t |
typedef narray< float, 1 > | floatvec_t |
typedef narray< double, 1 > | doublevec_t |
typedef narray< bool, 2 > | boolmatrix_t |
typedef narray< char, 2 > | charmatrix_t |
typedef narray< short, 2 > | shortmatrix_t |
typedef narray< int, 2 > | intmatrix_t |
typedef narray< float, 2 > | floatmatrix_t |
typedef narray< double, 2 > | doublematrix_t |
typedef narray< bool, 3 > | boolcube_t |
typedef narray< char, 3 > | charcube_t |
typedef narray< short, 3 > | shortcube_t |
typedef narray< int, 3 > | intcube_t |
typedef narray< float, 3 > | floatcube_t |
typedef narray< double, 3 > | doublecube_t |
typedef narray< bool, 4 > | boolquad_t |
typedef narray< char, 4 > | charquad_t |
typedef narray< short, 4 > | shortquad_t |
typedef narray< int, 4 > | intquad_t |
typedef narray< float, 4 > | floatquad_t |
typedef narray< double, 4 > | doublequad_t |
typedef narray_o< bool, 1 > | boolvec_o |
typedef narray_o< char, 1 > | charvec_o |
typedef narray_o< short, 1 > | shortvec_o |
typedef narray_o< int, 1 > | intvec_o |
typedef narray_o< float, 1 > | floatvec_o |
typedef narray_o< double, 1 > | doublevec_o |
typedef narray_o< bool, 2 > | boolmatrix_o |
typedef narray_o< char, 2 > | charmatrix_o |
typedef narray_o< short, 2 > | shortmatrix_o |
typedef narray_o< int, 2 > | intmatrix_o |
typedef narray_o< float, 2 > | floatmatrix_o |
typedef narray_o< double, 2 > | doublematrix_o |
typedef narray_o< bool, 3 > | boolcube_o |
typedef narray_o< char, 3 > | charcube_o |
typedef narray_o< short, 3 > | shortcube_o |
typedef narray_o< int, 3 > | intcube_o |
typedef narray_o< float, 3 > | floatcube_o |
typedef narray_o< double, 3 > | doublecube_o |
typedef narray_o< bool, 4 > | boolquad_o |
typedef narray_o< char, 4 > | charquad_o |
typedef narray_o< short, 4 > | shortquad_o |
typedef narray_o< int, 4 > | intquad_o |
typedef narray_o< float, 4 > | floatquad_o |
typedef narray_o< double, 4 > | doublequad_o |
Functions | |
int | color_rgb (int r, int g, int b) |
converts a RGB triplet to a packed color | |
int | color_argb (int a, int r, int g, int b) |
converts a ARGB triplet to packed color | |
int | color_gray (int v) |
expand a single 0..255 to a packed color | |
int | color_alpha (int packedcol) |
extracts alpha | |
int | color_red (int packedcol) |
extracts red | |
int | color_green (int packedcol) |
extracts gree | |
int | color_blue (int packedcol) |
extracts blue | |
int | set_alpha (int packedcol, int a) |
sets | |
int | set_red (int packedcol, int r) |
sets | |
int | set_green (int packedcol, int g) |
sets | |
int | set_blue (int packedcol, int b) |
sets | |
int | clamp_color (int c) |
clamps this number between 0 and 255 | |
double | color_to_double (int c) |
convert a colour to doulbe (0..1)... basically, c/255 | |
int | color_to_gray (int c) |
convert colour into a 0..255 (mean) | |
int | color_scale (int factor, int packedcol) |
sclaes a color. factor is 1000 for no change (alpha aware) | |
int | layer_color (int basecolor, int layercolor) |
layers a colour (alpha aware) | |
void | fill_color_pick (nslice< int > target, int offset=0) |
set colors, suitable for picking | |
void | fill_color_gradient (nslice< int > target, int startpcol, int endpcol) |
set a gradient (alpha aware) | |
void | make_gray_palette (const nslice< int > &pal) |
makes a palette | |
void | make_red_palette (const nslice< int > &pal) |
makes a palette | |
void | make_green_palette (const nslice< int > &pal) |
makes a palette | |
void | make_blue_palette (const nslice< int > &pal) |
makes a palette | |
void | make_pick_palette (const nslice< int > &pal) |
makes a palette | |
void | make_heat_palette (const nslice< int > &pal) |
makes a palette | |
void | make_rainbow_palette (const nslice< int > &pal) |
makes a palette | |
void | make_bluered_palette (const nslice< int > &pal) |
makes a palette | |
void | make_bone_palette (const nslice< int > &pal) |
makes a palette | |
void | make_copper_palette (const nslice< int > &pal) |
makes a palette | |
void | make_spectra_palette (const nslice< int > &pal) |
makes a palette | |
void | make_opus_palette (const nslice< int > &pal) |
makes a palette | |
bool | save_directio_file_impl (const std::string &filename, short numdimen, const size_t *dimen, size_t elemsize, const char *id, const void *data) |
bool | load_directio_file_impl (const std::string &filename, short numdimen, size_t *dimen, size_t elemsize, const char *id, void *&outary) |
bool | bind_direct_file_impl (scopira::tool::fileflow *f, scopira::tool::byte_t *&baseary, size_t len, narray_delete_i *&func, bool readonly) |
bool | create_directio_file_impl (const std::string &filename, short numdimen, size_t *dimen, size_t elemsize, const char *id) |
bool | bind_directio_file_impl (const std::string &filename, short numdimen, size_t *dimen, size_t elemsize, const char *id, bool readonly, void *&outary, narray_delete_i *&outfunc) |
void | sync_directio_file (narray_delete_i *d) |
bool | query_directio_file (const std::string &filename, std::string &elementtype, std::vector< size_t > &dimen) |
template<class T , int DIM> | |
bool | load_directio_file (const std::string &filename, scopira::basekit::narray< T, DIM > &out) |
template<class T , int DIM> | |
bool | save_directio_file (const std::string &filename, const scopira::basekit::narray< T, DIM > &in) |
template<class T , int DIM> | |
bool | bind_direct_file (scopira::tool::fileflow *f, scopira::basekit::nindex< DIM > sz, scopira::basekit::narray< T, DIM > &out, bool readonly=false, scopira::tool::fileflow::offset_t skipb=0) |
template<class T , int DIM> | |
bool | create_directio_file (const std::string &filename, nindex< DIM > sz) |
template<class T , int DIM> | |
bool | bind_directio_file (const std::string &filename, narray< T, DIM > &out, bool readonly=false) |
template<class T , int DIM> | |
void | sync_directio_file (const narray< T, DIM > &out) |
template<class T > | |
T | sqr (T v) |
template<class T > | |
bool | is_equal (T v1, T v2) |
template<class T > | |
bool | is_zero (T v) |
bool | is_nan (double v) |
bool | is_nan (float v) |
int | is_inf (double v) |
see man isinf for the meanin of the return More... | |
int | is_inf (float v) |
template<class T > | |
T | sign (T v) |
int | factorial (int n, int m=0) |
int | binomial (int n, int i) |
template<class T , class SCA > | |
void | mul_matrix (T &dest, SCA d) |
template<class T , class T2 , class T3 > | |
void | mul_matrix (T &dest, const T2 &m1, const T3 &m2, bool t1=false, bool t2=false) |
template<class T > | |
bool | invert_matrix (T &dest, const T &src) |
template<class D , class S > | |
void | transpose_matrix (D &dest, const S &src) |
template<class SRC , class DEST > | |
void | resample_nn (DEST &dest, const SRC &src) |
template<class SRC , class DEST > | |
void | resample_linear (DEST &dest, const SRC &src) |
template<class T > | |
bool | lu_decomposition (narray< T, 2 > &dest, const narray< T, 2 > &src, narray< int > &idx, bool &odd) |
template<class T > | |
void | lu_backsubstitution (narray< T > &dest, const narray< T, 2 > &inv_a, const narray< int > &index) |
template<class T > | |
bool | svd (narray< T, 2 > &Mu, narray< T > &Vw, narray< T, 2 > &Mv) |
template<class T > | |
void | svd_backsubstitution (narray< T, 2 > &Mu, narray< T > &Vw, narray< T, 2 > &Mv, narray< T > &b, narray< T > &x) |
template<class DT > | |
DT | pythagorean (DT a, DT b) |
template<class T > | |
void | elim_hessian (narray< T, 2 > &matrix) |
template<class T > | |
void | eigen_hessenberg (narray< T, 2 > &matrix, narray< T > &eigen_real, narray< T > &eigen_imaginary) |
template<class T > | |
void | gauss_jordan (narray< T, 2 > &matrix, narray< T, 2 > &rhs) |
template<class T > | |
void | sort_covariance (narray< T, 2 > &matrix, narray< int > &fitted, int mfit) |
template<class T > | |
T | svd_sign (T v1, T v2) |
internal function for svd | |
template<int DIM> | |
bool | is_flat_stride (const nindex< DIM > &stride, const nindex< DIM > &size) |
template<class E > | |
void | print_element (scopira::tool::oflow_i &o, E el) |
element printing helper | |
template<> | |
void | print_element< long > (scopira::tool::oflow_i &o, long el) |
element printing helper (specialization) More... | |
template<> | |
void | print_element< unsigned long > (scopira::tool::oflow_i &o, unsigned long el) |
element printing helper (specialization) More... | |
template<> | |
void | print_element< int > (scopira::tool::oflow_i &o, int el) |
element printing helper (specialization) More... | |
template<> | |
void | print_element< unsigned int > (scopira::tool::oflow_i &o, unsigned int el) |
element printing helper (specialization) More... | |
template<> | |
void | print_element< short > (scopira::tool::oflow_i &o, short el) |
element printing helper (specialization) More... | |
template<> | |
void | print_element< char > (scopira::tool::oflow_i &o, char el) |
element printing helper (specialization) More... | |
template<> | |
void | print_element< double > (scopira::tool::oflow_i &o, double el) |
element printing helper (specialization) More... | |
template<> | |
void | print_element< float > (scopira::tool::oflow_i &o, float el) |
element printing helper (specialization) More... | |
template<class C > | |
scopira::tool::oflow_i & | print_vector_slice (scopira::tool::oflow_i &o, const const_nslice< C, 1 > &V) |
internal | |
template<class C > | |
scopira::tool::oflow_i & | print_matrix_slice (scopira::tool::oflow_i &o, const const_nslice< C, 2 > &M) |
internal | |
template<class C > | |
std::ostream & | print_vector_slice (std::ostream &o, const const_nslice< C, 1 > &V) |
internal | |
template<class C > | |
std::ostream & | print_matrix_slice (std::ostream &o, const const_nslice< C, 2 > &M) |
internal | |
template<class T > | |
void | add_scalar (T &v, typename T::data_type val) |
template<class T > | |
void | sub_scalar (T &v, typename T::data_type val) |
template<class T > | |
void | mul_scalar (T &v, typename T::data_type val) |
template<class T > | |
void | div_scalar (T &v, typename T::data_type val) |
template<class T > | |
void | invdiv_scalar (T &v, typename T::data_type val) |
template<class V , class T > | |
size_t | min (const V &v, T &out) |
template<class V , class T > | |
size_t | max (const V &v, T &out) |
template<class V , class T > | |
void | sum (const V &v, T &out) |
template<class V , class T > | |
void | mean (const V &v, T &out) |
template<class V , class T > | |
void | variance (const V &v, T &out) |
template<class V , class T > | |
void | stddev (const V &v, T &out) |
template<class LH , class RH > | |
void | add_vector (LH &target, const RH &delta) |
template<class LH , class RH > | |
void | sub_vector (LH &target, const RH &delta) |
template<class LH , class RH > | |
void | mul_vector (LH &target, const RH &delta) |
template<class LH , class RH > | |
void | div_vector (LH &target, const RH &delta) |
template<class LH , class RH > | |
void | abs_vector (LH &target, const RH &source) |
template<class V > | |
void | print_vector (scopira::tool::oflow_i &o, const V &vv) |
template<class T > | |
void | pearson_scalar (T &x, T &y, double &rho) |
template<class T > | |
void | construct_index (narray< T > &array, narray< int > &index) |
Variables | |
const double | tol_c = 0.0000001 |
const double | tinynum_c = 1.0e-20 |
const double | smallnum_c = 1.0e-5 |
narray_delete_i * | null_narray_delete |
narray_delete_i * | normal_narray_delete |
basekit provides basic math, array and direct I/O facilities.
typedef narray_o<bool,3> scopira::basekit::boolcube_o |
Simply typedef narray_o<bool,3> boolcube_o;
typedef narray<bool,3> scopira::basekit::boolcube_t |
Simply typedef narray<bool,3> boolcube_t;
typedef narray_o<bool,2> scopira::basekit::boolmatrix_o |
Simply typedef narray_o<bool,2> boolmatrix_o;
typedef narray<bool,2> scopira::basekit::boolmatrix_t |
Simply typedef narray<bool,2> boolmatrix_t;
typedef narray_o<bool,4> scopira::basekit::boolquad_o |
Simply typedef narray_o<bool,4> boolquad_o;
typedef narray<bool,4> scopira::basekit::boolquad_t |
Simply typedef narray<bool,4> boolquad_t;
typedef narray_o<bool,1> scopira::basekit::boolvec_o |
Simply typedef narray_o<bool,1> boolvec_o;
typedef narray<bool,1> scopira::basekit::boolvec_t |
Simply typedef narray<bool,1> boolvec_t;
typedef narray_o<char,3> scopira::basekit::charcube_o |
Simply typedef narray_o<char,3> charcube_o;
typedef narray<char,3> scopira::basekit::charcube_t |
Simply typedef narray<char,3> charcube_t;
typedef narray_o<char,2> scopira::basekit::charmatrix_o |
Simply typedef narray_o<char,2> charmatrix_o;
typedef narray<char,2> scopira::basekit::charmatrix_t |
Simply typedef narray<char,2> charmatrix_t;
typedef narray_o<char,4> scopira::basekit::charquad_o |
Simply typedef narray_o<char,4> charquad_o;
typedef narray<char,4> scopira::basekit::charquad_t |
Simply typedef narray<char,4> charquad_t;
typedef narray_o<char,1> scopira::basekit::charvec_o |
Simply typedef narray_o<char,1> charvec_o;
typedef narray<char,1> scopira::basekit::charvec_t |
Simply typedef narray<char,1> charvec_t;
typedef narray_o<double,3> scopira::basekit::doublecube_o |
Simply typedef narray_o<double,3> doublecube_o;
typedef narray<double,3> scopira::basekit::doublecube_t |
Simply typedef narray<double,3> doublecube_t;
typedef narray_o<double,2> scopira::basekit::doublematrix_o |
Simply typedef narray_o<double,2> doublematrix_o;
typedef narray<double,2> scopira::basekit::doublematrix_t |
Simply typedef narray<double,2> doublematrix_t;
typedef narray_o<double,4> scopira::basekit::doublequad_o |
Simply typedef narray_o<double,4> doublequad_o;
typedef narray<double,4> scopira::basekit::doublequad_t |
Simply typedef narray<double,4> doublequad_t;
typedef narray_o<double,1> scopira::basekit::doublevec_o |
Simply typedef narray_o<double,1> doublevec_o;
typedef narray<double,1> scopira::basekit::doublevec_t |
Simply typedef narray<double,1> doublevec_t;
typedef narray_o<float,3> scopira::basekit::floatcube_o |
Simply typedef narray_o<float,3> floatcube_o;
typedef narray<float,3> scopira::basekit::floatcube_t |
Simply typedef narray<float,3> floatcube_t;
typedef narray_o<float,2> scopira::basekit::floatmatrix_o |
Simply typedef narray_o<float,2> floatmatrix_o;
typedef narray<float,2> scopira::basekit::floatmatrix_t |
Simply typedef narray<float,2> floatmatrix_t;
typedef narray_o<float,4> scopira::basekit::floatquad_o |
Simply typedef narray_o<float,4> floatquad_o;
typedef narray<float,4> scopira::basekit::floatquad_t |
Simply typedef narray<float,4> floatquad_t;
typedef narray_o<float,1> scopira::basekit::floatvec_o |
Simply typedef narray_o<float,1> floatvec_o;
typedef narray<float,1> scopira::basekit::floatvec_t |
Simply typedef narray<float,1> floatvec_t;
typedef narray_o<int,3> scopira::basekit::intcube_o |
Simply typedef narray_o<int,3> intcube_o;
typedef narray<int,3> scopira::basekit::intcube_t |
Simply typedef narray<int,3> intcube_t;
typedef narray_o<int,2> scopira::basekit::intmatrix_o |
Simply typedef narray_o<int,2> intmatrix_o;
typedef narray<int,2> scopira::basekit::intmatrix_t |
Simply typedef narray<int,2> intmatrix_t;
typedef narray_o<int,4> scopira::basekit::intquad_o |
Simply typedef narray_o<int,4> intquad_o;
typedef narray<int,4> scopira::basekit::intquad_t |
Simply typedef narray<int,4> intquad_t;
typedef narray_o<int,1> scopira::basekit::intvec_o |
Simply typedef narray_o<int,1> intvec_o;
typedef narray<int,1> scopira::basekit::intvec_t |
Simply typedef narray<int,1> intvec_t;
typedef narray_o<short,3> scopira::basekit::shortcube_o |
Simply typedef narray_o<short,3> shortcube_o;
typedef narray<short,3> scopira::basekit::shortcube_t |
Simply typedef narray<short,3> shortcube_t;
typedef narray_o<short,2> scopira::basekit::shortmatrix_o |
Simply typedef narray_o<short,2> shortmatrix_o;
typedef narray<short,2> scopira::basekit::shortmatrix_t |
Simply typedef narray<short,2> shortmatrix_t;
typedef narray_o<short,4> scopira::basekit::shortquad_o |
Simply typedef narray_o<short,4> shortquad_o;
typedef narray<short,4> scopira::basekit::shortquad_t |
Simply typedef narray<short,4> shortquad_t;
typedef narray_o<short,1> scopira::basekit::shortvec_o |
Simply typedef narray_o<short,1> shortvec_o;
typedef narray<short,1> scopira::basekit::shortvec_t |
Simply typedef narray<short,1> shortvec_t;
void scopira::basekit::abs_vector | ( | LH & | target, |
const RH & | source | ||
) |
Calculates the absolute value of each element in source, and writes it to target.
target and source may be the same instance.
target | target iterator-supporting container |
source | iterator-supporting source vector |
Referenced by stddev().
void scopira::basekit::add_scalar | ( | T & | v, |
typename T::data_type | val | ||
) |
Adds val to every element in v. v can be any class that uses iterators.
v | the vector to operator one |
val | the value to add to each element in v |
void scopira::basekit::add_vector | ( | LH & | target, |
const RH & | delta | ||
) |
Adds each element in target to each element in delta
target | target iterator-supporting container |
delta | iterator-supporting delta vector |
Referenced by stddev().
bool scopira::basekit::bind_direct_file | ( | scopira::tool::fileflow * | f, |
scopira::basekit::nindex< DIM > | sz, | ||
scopira::basekit::narray< T, DIM > & | out, | ||
bool | readonly = false , |
||
scopira::tool::fileflow::offset_t | skipb = 0 |
||
) |
Binds the current file and offset to the output narray, at the given dimensions. f must be reference counted (and will be further reference counted.
Returns true on success.
References scopira::basekit::nindex< DIM >::product(), scopira::basekit::narray< T, DIM >::resize(), and scopira::basekit::narray< T, DIM >::resize_direct().
bool scopira::basekit::bind_directio_file | ( | const std::string & | filename, |
narray< T, DIM > & | out, | ||
bool | readonly = false |
||
) |
Binds an on disk DIO file to a narray.
This function uses the operating system's memory mapping facilities to map the "virtual array" to the disk file. As the elements in the array are accessed, the elements are loaded from disk. As they are written, the OS will queue disk writes.
The file must exist. If you need to create a new file, use scopira::basekit::create_directio_file.
filename | the filename |
out | the narray which will contain the loaded array. This variable must be initially empty. |
readonly | if true, this file will be loaded in readonly mode. |
References scopira::tool::fixed_array< size_t, DIM >::c_array(), scopira::basekit::narray< T, DIM >::get_direct(), and scopira::basekit::narray< T, DIM >::resize_direct().
int scopira::basekit::binomial | ( | int | n, |
int | i | ||
) |
Compute the binomial coefficient (n/(n-i, i)).
n | value n (total things) |
i | value i (choosen i at a time) |
Referenced by sign().
void scopira::basekit::construct_index | ( | narray< T > & | array, |
narray< int > & | index | ||
) |
Constructs an index for a vector
array | the vector to be sorted |
index | the index array |
References scopira::basekit::narray< T, DIM >::resize(), and scopira::basekit::narray< T, DIM >::size().
Referenced by stddev().
|
inline |
Creates a DIO file of the given type and dimensionality on disk. The element contents of the array on disk is undefined.
This function is used to create DIO files for scopira::basekit::bind_directio_file, as scopira::basekit::bind_directio_file can only bind to/open existing files.
filename | the filename |
sz | the dimensions of the array to create |
References scopira::tool::fixed_array< size_t, DIM >::c_array().
void scopira::basekit::div_scalar | ( | T & | v, |
typename T::data_type | val | ||
) |
Divides val to every element in v. v can be any class that uses iterators.
v | the vector to operator one |
val | the value to add to each element in v |
void scopira::basekit::div_vector | ( | LH & | target, |
const RH & | delta | ||
) |
Divides each element in target to each element in delta
target | target iterator-supporting container |
delta | iterator-supporting delta vector |
Referenced by stddev().
void scopira::basekit::eigen_hessenberg | ( | narray< T, 2 > & | matrix, |
narray< T > & | eigen_real, | ||
narray< T > & | eigen_imaginary | ||
) |
Calculates the eigenvalues of a Hessenberg matrix
matrix | the Hessenberg matrix |
eigen_real | the real parts of the eigenvalues |
eigen_imaginary | the imaginary parts of the eigenvalues |
References scopira::basekit::narray< T, DIM >::height().
void scopira::basekit::elim_hessian | ( | narray< T, 2 > & | matrix | ) |
Reduces a general matrix to Hessenberg form
matrix | the matrix to be reduced |
References scopira::basekit::narray< T, DIM >::height().
int scopira::basekit::factorial | ( | int | n, |
int | m = 0 |
||
) |
Compute the factorial of n. If m != 0, compute factorial of (n-m).
n | natural number n |
m | difference integer m, m < n. |
Referenced by sign().
void scopira::basekit::gauss_jordan | ( | narray< T, 2 > & | matrix, |
narray< T, 2 > & | rhs | ||
) |
Gauss-Jordan matrix inversion and linear equations solution The input matrix 'matrix' is replaced by its inverse, and the input matrix 'rhs' is replaced by the set of solution vectors
matrix | the matrix to be inverted |
rhs | the right hand side matrix of the linear equation |
References scopira::basekit::narray< T, DIM >::height(), max(), scopira::basekit::narray< T, DIM >::resize(), and scopira::basekit::narray< T, DIM >::width().
void scopira::basekit::invdiv_scalar | ( | T & | v, |
typename T::data_type | val | ||
) |
Inverse divides val to every element in v. v can be any class that uses iterators. To summarize, each element in v will be replaced by val/v
v | the vector to operator one |
val | the value to add to each element in v |
bool scopira::basekit::invert_matrix | ( | T & | dest, |
const T & | src | ||
) |
Inverts the matrix.
src | the source matrix |
dest | the output matrix |
References scopira::basekit::narray< T, DIM >::clear(), scopira::basekit::narray< T, DIM >::resize(), scopira::basekit::narray< T, DIM >::set(), and scopira::basekit::narray< T, DIM >::width().
|
inline |
bool scopira::basekit::is_flat_stride | ( | const nindex< DIM > & | stride, |
const nindex< DIM > & | size | ||
) |
Returns true if the given stride set is considered "flat". This allow for performance optimizations in nslice.
References scopira::tool::fixed_array< size_t, DIM >::size().
Referenced by scopira::basekit::const_nslice< T, DIM >::c_array(), scopira::basekit::nslice< T, DIM >::is_flat_stride(), and scopira::basekit::const_nslice< T, DIM >::is_flat_stride().
|
inline |
|
inline |
Is v infinity.
|
inline |
Is v NaN (not a number)
Referenced by is_zero().
|
inline |
Is v NaN (not a number)
References is_inf().
|
inline |
bool scopira::basekit::load_directio_file | ( | const std::string & | filename, |
scopira::basekit::narray< T, DIM > & | out | ||
) |
Reads an array from disk in DIO format.
filename | the filename |
out | the narray which will contain the loaded array. This variable must be initially empty. |
References scopira::tool::fixed_array< size_t, DIM >::c_array(), normal_narray_delete, and scopira::basekit::narray< T, DIM >::resize_direct().
void scopira::basekit::lu_backsubstitution | ( | narray< T > & | dest, |
const narray< T, 2 > & | inv_a, | ||
const narray< int > & | index | ||
) |
Linear equation solution, backsubstitution Solves the set of n linear equations a�x = b.
desc | the solution vector x |
inv_a | is the input matrix, which is the LU decomposition of a |
index | is the permutation vector returned by the LU decomposition. |
b | is the input right-hand side vector. |
References scopira::basekit::narray< T, DIM >::copy(), scopira::basekit::narray< T, DIM >::get(), scopira::basekit::narray< T, DIM >::set(), sum(), and scopira::basekit::narray< T, DIM >::width().
bool scopira::basekit::lu_decomposition | ( | narray< T, 2 > & | dest, |
const narray< T, 2 > & | src, | ||
narray< int > & | idx, | ||
bool & | odd | ||
) |
Calaculates the LU decomposition of a rowwise permutation of the input matrix src
dest | the output LU decomposition matrix |
src | the source matrix |
idx | is an output vector that records the row permutation effected by the partial pivoting |
odd | indicated whether the number of row interchanges was even or odd, respectively. |
References scopira::basekit::narray< T, DIM >::clear(), scopira::basekit::narray< T, DIM >::copy(), scopira::basekit::narray< T, DIM >::get(), max(), scopira::basekit::narray< T, DIM >::resize(), scopira::basekit::narray< T, DIM >::set(), sum(), tinynum_c, and scopira::basekit::narray< T, DIM >::width().
size_t scopira::basekit::max | ( | const V & | v, |
T & | out | ||
) |
Finds the maximum.
v | any container that has iteration facilities |
out | the output scalar |
Referenced by gauss_jordan(), and lu_decomposition().
void scopira::basekit::mean | ( | const V & | v, |
T & | out | ||
) |
Calculates the mean
v | any container that has iteration facilities |
out | the output scalar |
References sum().
Referenced by variance().
size_t scopira::basekit::min | ( | const V & | v, |
T & | out | ||
) |
Finds the minimum.
v | any container that has iteration facilities |
out | the output scalar |
void scopira::basekit::mul_matrix | ( | T & | dest, |
SCA | d | ||
) |
Multiple each element in the given matrix-like lass by the given scalar
dest | the matrix like class to operate on |
d | the value to multiple |
void scopira::basekit::mul_matrix | ( | T & | dest, |
const T2 & | m1, | ||
const T3 & | m2, | ||
bool | t1 = false , |
||
bool | t2 = false |
||
) |
Matrix-matrix copy, with inline transposing.
dest | the result/destination matrix. will be resized. |
m1 | the first matrix |
m2 | the second matrix |
t1 | transpose the 1st matrix |
t2 | transpose the 2nd matrix |
References sum().
void scopira::basekit::mul_scalar | ( | T & | v, |
typename T::data_type | val | ||
) |
Multiples val to every element in v. v can be any class that uses iterators.
v | the vector to operator one |
val | the value to add to each element in v |
void scopira::basekit::mul_vector | ( | LH & | target, |
const RH & | delta | ||
) |
Multiplies each element in target to each element in delta
target | target iterator-supporting container |
delta | iterator-supporting delta vector |
Referenced by stddev().
void scopira::basekit::pearson_scalar | ( | T & | x, |
T & | y, | ||
double & | rho | ||
) |
Calculates pearson.
Pearson coefficient of correlation.
x | first sample to compare |
y | second sample to compare |
rho | pearson correlation |
Referenced by stddev().
|
inline |
element printing helper (specialization)
internal print drivers. you may need to define more if you have your own types
|
inline |
element printing helper (specialization)
internal print drivers. you may need to define more if you have your own types
|
inline |
element printing helper (specialization)
internal print drivers. you may need to define more if you have your own types
References print_vector_slice().
|
inline |
element printing helper (specialization)
internal print drivers. you may need to define more if you have your own types
|
inline |
element printing helper (specialization)
internal print drivers. you may need to define more if you have your own types
|
inline |
element printing helper (specialization)
internal print drivers. you may need to define more if you have your own types
|
inline |
element printing helper (specialization)
internal print drivers. you may need to define more if you have your own types
|
inline |
element printing helper (specialization)
internal print drivers. you may need to define more if you have your own types
void scopira::basekit::print_vector | ( | scopira::tool::oflow_i & | o, |
const V & | vv | ||
) |
Prints all the elements in the given iterator supporting container
o | the output stream |
vv | the container that supports iteration |
Referenced by stddev().
DT scopira::basekit::pythagorean | ( | DT | a, |
DT | b | ||
) |
Computes Pythagorean Theorem: (a^2 + b^2)^0.5 without destructive underflow or overflow
bool scopira::basekit::query_directio_file | ( | const std::string & | filename, |
std::string & | elementtype, | ||
std::vector< size_t > & | dimen | ||
) |
The queries the DIO file for its dimensionality and element type information. It doesn't do any data loading.
filename | the filename |
elementtype | the element type (int32, float64, etc) |
dimen | the dimensions of the on disk file |
void scopira::basekit::resample_linear | ( | DEST & | dest, |
const SRC & | src | ||
) |
Resamples the src matrix to the destination matrix, using (not so fast) linear interpolation.
References is_equal(), and is_zero().
void scopira::basekit::resample_nn | ( | DEST & | dest, |
const SRC & | src | ||
) |
Resamples the src matrix to the destination matrix, using (fast) nearest neighbor.
bool scopira::basekit::save_directio_file | ( | const std::string & | filename, |
const scopira::basekit::narray< T, DIM > & | in | ||
) |
Writes an array to disk in DIO format.
filename | the filename |
out | the narray which will contain the loaded array. This variable must be initially empty. |
References scopira::basekit::narray< T, DIM >::c_array(), and scopira::basekit::narray< T, DIM >::dimen().
|
inline |
Returns the "sign" of v.
v | the number to test |
References binomial(), and factorial().
void scopira::basekit::sort_covariance | ( | narray< T, 2 > & | matrix, |
narray< int > & | fitted, | ||
int | mfit | ||
) |
Rearrange covariance matrix
matrix | the covariance matrix |
fitted | fitting coefficients |
mfit | (mfit?) |
References scopira::basekit::narray< T, DIM >::height().
|
inline |
Computes the sqrt of v
void scopira::basekit::stddev | ( | const V & | v, |
T & | out | ||
) |
Calculates standard deviation
v | any container that has iteration facilities |
out | the output scalar |
References abs_vector(), add_vector(), construct_index(), div_vector(), mul_vector(), pearson_scalar(), print_vector(), and sub_vector().
void scopira::basekit::sub_scalar | ( | T & | v, |
typename T::data_type | val | ||
) |
Subtracts val to every element in v. v can be any class that uses iterators.
v | the vector to operator one |
val | the value to add to each element in v |
void scopira::basekit::sub_vector | ( | LH & | target, |
const RH & | delta | ||
) |
Subtracts each element in target to each element in delta
target | target iterator-supporting container |
delta | iterator-supporting delta vector |
Referenced by stddev().
void scopira::basekit::sum | ( | const V & | v, |
T & | out | ||
) |
Calculates the sum
v | any container that has iteration facilities |
out | the output scalar |
Referenced by lu_backsubstitution(), lu_decomposition(), mean(), mul_matrix(), and variance().
bool scopira::basekit::svd | ( | narray< T, 2 > & | Mu, |
narray< T > & | Vw, | ||
narray< T, 2 > & | Mv | ||
) |
construct the singular value decomposition of the matrix u svd results are:Mv,Vw,Mu(src matrix modified) return false if was not able to perform svd.
Mu | M x M orthogonal matrix - u (src matrix modified) |
Vw | N diagonal vector of singular values |
Mv | N x M orthogonal matrix |
References scopira::basekit::narray< T, DIM >::clear(), scopira::basekit::narray< T, DIM >::height(), scopira::basekit::narray< T, DIM >::resize(), svd_sign(), and scopira::basekit::narray< T, DIM >::width().
void scopira::basekit::svd_backsubstitution | ( | narray< T, 2 > & | Mu, |
narray< T > & | Vw, | ||
narray< T, 2 > & | Mv, | ||
narray< T > & | b, | ||
narray< T > & | x | ||
) |
Solves linear equation for x using backsubstitution and the results of SVD Solves Dx = b where D has been decomposed int Mu,Vw and Mv. Solution is in x
Mu | orthoganal matrix from SVD |
Vw | vector of singular values from SVD |
Mv | orthoganal matrix from SVD |
b | right hand side data vector |
x | the solution |
References scopira::basekit::narray< T, DIM >::height(), scopira::basekit::narray< T, DIM >::resize(), and scopira::basekit::narray< T, DIM >::width().
void scopira::basekit::transpose_matrix | ( | D & | dest, |
const S & | src | ||
) |
Transposes a matrix.
src | the source matrix |
dest | the output matrix (cannot be the same as src) |
void scopira::basekit::variance | ( | const V & | v, |
T & | out | ||
) |
narray_delete_i* scopira::basekit::normal_narray_delete |
This special narray delete tells that narray to assume the array and "delete" it as per usual.
Referenced by load_directio_file(), and scopira::basekit::narray< scopira::tool::uuid >::resize_direct().
narray_delete_i* scopira::basekit::null_narray_delete |
A narray delete that does nothing.
Referenced by scopira::basekit::narray< scopira::tool::uuid >::resize().
const double scopira::basekit::smallnum_c = 1.0e-5 |
An arbitrary small number constant.
const double scopira::basekit::tinynum_c = 1.0e-20 |
An arbitrary tiny number constant.
Referenced by lu_decomposition().
const double scopira::basekit::tol_c = 0.0000001 |
The tolerance constant, as used in various functions.
Referenced by is_equal(), and is_zero().