ConicBundle
|
Basic types, constants and templates for simple linear algebra routines like BLAS level 1. More...
#include <limits.h>
#include <float.h>
#include <assert.h>
#include <random>
#include "gb_rand.hxx"
#include "CBconfig.hxx"
Go to the source code of this file.
Classes | |
struct | CH_Matrix_Classes::mat_less_index< Val > |
"less"-routine for sorting indices of value arrays by std::sort More... | |
struct | CH_Matrix_Classes::mat_greater_index< Val > |
"greater"-routine for sorting indices of value arrays by std::sort More... | |
class | CH_Matrix_Classes::MatrixError |
Such an object is generated and passed to MEmessage(), whenever an error occurs. It holds some output information on the error. More... | |
class | CH_Matrix_Classes::MErange |
Such an object is generated and passed to MEmessage() whenever some index is out of range. More... | |
class | CH_Matrix_Classes::MEmem |
Such an object is generated and passed to MEmessage() whenever a memory allocation fails. More... | |
class | CH_Matrix_Classes::MEdim |
Such an object is generated and passed to MEmessage() whenever matrix dimensions do not agree for a desired operation. More... | |
Namespaces | |
CH_Matrix_Classes | |
Matrix Classes and Linear Algebra. See Matrix Classes (namespace CH_Matrix_Classes) for a quick introduction. | |
Macros | |
#define | chk_init(x) |
CONICBUNDLE_DEBUG being undefined, the template function is removed. Otherwise it would check, whether x is initialized. | |
#define | chk_add(x, y) |
CONICBUNDLE_DEBUG being undefined, the template function is removed. Otherwise it would check, whether matrices x and y can be added. | |
#define | chk_rowseq(x, y) |
CONICBUNDLE_DEBUG being undefined, the template function is removed. Otherwise it would check, whether matrices x and y have the same row dimension. | |
#define | chk_colseq(x, y) |
CONICBUNDLE_DEBUG being undefined, the template function is removed. Otherwise it would check, whether matrices x and y have the same column dimension. | |
#define | chk_range(i, j, ubi, ubj) |
CONICBUNDLE_DEBUG being undefined, the template function is removed. Otherwise it would check, whether i and j fit into [0,ubi-1] amd [0,ubj-1] respectively. | |
#define | chk_set_init(x, y) |
CONICBUNDLE_DEBUG being undefined, the template function is removed. Otherwise it would allow to set the initialized flag of matrix x to value y. | |
#define | chk_single_range(i, ub) |
CONICBUNDLE_DEBUG being undefined, the template function is removed. Otherwise it would whether index i fits into [0,ub-1] and raise the MatrixError MErange if not. | |
Typedefs | |
typedef int | CH_Matrix_Classes::Integer |
all integer numbers in calculations and indexing are of this type | |
typedef double | CH_Matrix_Classes::Real |
all real numbers in calculations are of this type | |
Enumerations | |
enum | CH_Matrix_Classes::Mtype { CH_Matrix_Classes::MTglobalfun, CH_Matrix_Classes::MTindexmatrix, CH_Matrix_Classes::MTmatrix, CH_Matrix_Classes::MTsymmetric, CH_Matrix_Classes::MTsparse, CH_Matrix_Classes::MTsparsesym } |
serves for specifying the source (matrix class or function) of the error More... | |
enum | CH_Matrix_Classes::MEcode { CH_Matrix_Classes::ME_unspec, CH_Matrix_Classes::ME_range, CH_Matrix_Classes::ME_mem, CH_Matrix_Classes::ME_dim, CH_Matrix_Classes::ME_num, CH_Matrix_Classes::ME_warning } |
serves for specifying the error type. More... | |
Functions | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xea (Integer len, Val *x, const Val a) |
Set x[i]=a for len elements of the array x. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xea (Integer len, Val *x, const Integer incx, const Val a) |
Set x[i]=a for len elements of the array x incremented by incx. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xey (Integer len, Val *x, const Val *y) |
Copy an array of length len to destination x from source y. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xey (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy) |
Copy an array of length len to destination x (increment incx) from source y (increment incy). More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xmey (Integer len, Val *x, const Val *y) |
Set x[i]=-y[i] for len elements of the arrays x and y. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xmey (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy) |
Set x[i]=-y[i] for len elements of the arrays x and y incremented by incx and incy, respectively. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xemx (Integer len, Val *x) |
Set x[i]=-x[i] for an array of length len. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xemx (Integer len, Val *x, const Integer incx) |
Set x[i]=-x[i] for len elements of an array incremented by incx. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xemy (Integer len, Val *x, const Val *y) |
Set x[i]=-y[i] for len elements of the arrays x and y. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xemy (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy) |
Set x[i]=-y[i] for len elements of the arrays x and y incremented by incx and incy, respectively. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xeya (Integer len, Val *x, const Val *y, const Val a) |
Set x[i]=a*y[i] for len elements of the arrays x and y. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xeya (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy, const Val a) |
Set x[i]=a*y[i] for len elements of the arrays x and y incremented by incx and incy, respectively. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xpey (Integer len, Val *x, const Val *y) |
Set x[i]+=y[i] for len elements of the arrays x and y. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xpey (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy) |
Set x[i]+=y[i] for len elements of the arrays x and y incremented by incx and incy, respectively. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xhadey (Integer len, Val *x, const Val *y) |
Set x[i]*=y[i] for len elements of the arrays x and y. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xinvhadey (Integer len, Val *x, const Val *y) |
Set x[i]/=y[i] for len elements of the arrays x and y, no zero checking! More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xhadey (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy) |
Set x[i]*=y[i] for len elements of the arrays x and y incremented by incx and incy, respectively. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xinvhadey (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy) |
Set x[i]/=y[i] for len elements of the arrays x and y incremented by incx and incy, respectively, no zero checking! More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xpeya (Integer len, Val *x, const Val *y, const Val a) |
Set x[i]+=a*y[i] for len elements of the arrays x and y. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xpeya (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy, const Val a) |
Set x[i]+=a*y[i] for len elements of the arrays x and y incremented by incx and incy, respectively. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xbpeya (Integer len, Val *x, const Val *y, const Val a, const Val b) |
Set x[i]=a*y[i]+b*x[i] for len elements of the arrays x and y. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xbpeya (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy, const Val a, const Val b) |
Set x[i]=a*y[i]+b*x[i] for len elements of the arrays x and y incremented by incx and incy, respectively. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xpea (Integer len, Val *x, const Val a) |
Set x[i]+=a for len elements of the array x. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xpea (Integer len, Val *x, const Integer incx, const Val a) |
Set x[i]+=a for len elements of the array x incremented by incx. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xmultea (Integer len, Val *x, const Val a) |
Set x[i]*=a for len elements of the array x. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xmultea (Integer len, Val *x, const Integer incx, const Val a) |
Set x[i]*=a for len elements of the array x incremented by incx. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xdivea (Integer len, Val *x, const Val a) |
Set x[i]/=a for len elements of the array x. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xdivea (Integer len, Val *x, const Integer incx, const Val a) |
Set x[i]/=a for len elements of the array x incremented by incx. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xmodea (Integer len, Val *x, const Val a) |
Set x[i]%=a for len elements of the array x. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xmodea (Integer len, Val *x, const Integer incx, const Val a) |
Set x[i]%=a for len elements of the array x incremented by incx. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xeypz (Integer len, Val *x, const Val *y, const Val *z) |
Set x[i]=y[i]+z[i] for len elements of the arrays x, y and z. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xeypz (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy, const Val *z, const Integer incz) |
Set x[i]=y[i]+z[i] for len elements of the arrays x, y and z incremented by incx, incy, and incz, respectively. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xeymz (Integer len, Val *x, const Val *y, const Val *z) |
Set x[i]=y[i]-z[i] for len elements of the arrays x, y and z. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xeymz (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy, const Val *z, const Integer incz) |
Set x[i]=y[i]-z[i] for len elements of the arrays x, y and z incremented by incx, incy, and incz, respectively. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xeyapzb (Integer len, Val *x, const Val *y, const Val *z, const Val a, const Val b) |
Set x[i]=a*y[i]+b*z[i] for len elements of the arrays x, y and z. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_xeyapzb (Integer len, Val *x, const Integer incx, const Val *y, const Integer incy, const Val *z, const Integer incz, const Val a, const Val b) |
Set x[i]=a*y[i]+b*z[i] for len elements of the arrays x, y and z incremented by incx, incy, and incz, respectively. More... | |
template<class Val > | |
Val | CH_Matrix_Classes::mat_ip (Integer len, const Val *x, const Val *y, const Val *d=0) |
return sum(x[i]*y[i]) summing over len elements of the arrays x and y. More... | |
template<class Val > | |
Val | CH_Matrix_Classes::mat_ip (Integer len, const Val *x, const Integer incx, const Val *y, const Integer incy, const Val *d=0, const Integer incd=1) |
return sum(x[i]*y[i]) summing over len elements of the arrays x and y incremented by incx and incy, respectively. More... | |
template<class Val > | |
Val | CH_Matrix_Classes::mat_ip_dense_sparse (const Integer lenx, const Val *x, Integer leny, const Val *yval, const Integer *yind, const Val *d=0) |
return sum(x[yind[j]]*yval[j]) summing over elements of the dense array x and a sparse array representation of y. More... | |
template<class Val > | |
Val | CH_Matrix_Classes::mat_ip_sparse_sparse (const Integer lenx, const Val *xval, const Integer *xind, const Integer leny, const Val *yval, const Integer *yind, const Val *d) |
return sum(xval[i]*yval[j] for i,j with xind[i]==yind[j]) summing over elements of the sparse array representations of x and y. More... | |
template<class Val > | |
Val | CH_Matrix_Classes::mat_ip (Integer len, const Val *x) |
return sum(x[i]*x[i]) summing over len elements of the array x. More... | |
template<class Val > | |
Val | CH_Matrix_Classes::mat_ip (Integer len, const Val *x, const Integer incx) |
return sum(x[i]*x[i]) summing over len elements of the array x incremented by incx. More... | |
template<class Val > | |
Val | CH_Matrix_Classes::mat_sum (Integer len, const Val *x) |
returns sum(x[i]) over len elements of the array x. More... | |
template<class Val > | |
Val | CH_Matrix_Classes::mat_sum (Integer len, const Val *x, const Integer incx) |
returns sum(x[i]) over len elements of the array x incremented by incx. More... | |
template<class Val > | |
bool | CH_Matrix_Classes::mat_equal (Integer len, const Val *x, const Val *y) |
returns true if the elements of the arrays x and y are exactly equal. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_swap (Integer len, Val *x, Val *y) |
swap values x[i] and y[i] for len elements of the arrays x and y. More... | |
template<class Val > | |
void | CH_Matrix_Classes::mat_swap (Integer len, Val *x, const Integer incx, Val *y, const Integer incy) |
swap values x[i] and y[i] for len elements of the arrays x and y incremented by incx and incy, respectively. More... | |
int | CH_Matrix_Classes::MEmessage (const MatrixError &) |
displays an error message and terminates via abort() or returns 1 in case of warnings. | |
template<class Mat1 , class Mat2 > | |
void | CH_Matrix_Classes::chk_mult (const Mat1 &, const Mat2 &, int=0, int=0) |
CONICBUNDLE_DEBUG being undefined, the template function is removed. Otherwise it would check, whether matrices x and y can be multiplied. | |
Variables | |
const Integer | CH_Matrix_Classes::max_Integer = INT_MAX |
maximal attainable value by an Integer | |
const Integer | CH_Matrix_Classes::min_Integer = INT_MIN |
minimal attainable value by an Integer | |
const Real | CH_Matrix_Classes::max_Real = DBL_MAX |
maximal attainable value by a Real | |
const Real | CH_Matrix_Classes::min_Real = -DBL_MAX |
minimal attainable value by a Real | |
const Real | CH_Matrix_Classes::eps_Real = DBL_EPSILON |
machine epsilon for type Real | |
CH_Tools::GB_rand | CH_Matrix_Classes::mat_randgen |
common random number generator for use when a random matrix is generated. More... | |
std::default_random_engine | CH_Matrix_Classes::mat_std_randgen |
optional fast alternative random number generator from std | |
std::mt19937 | CH_Matrix_Classes::mat_mt_randgen |
optional high quality alternative random number generator from std | |
std::mt19937_64 | CH_Matrix_Classes::mat_mt64_randgen |
optional high quality alternative random number generator from std | |
std::ostream * | CH_Matrix_Classes::materrout |
if not zero, this is the output stream for runtime error messages, by default it is set to &std::cout | |
Basic types, constants and templates for simple linear algebra routines like BLAS level 1.