28 lr2(
Index r, array<Index,2> N,
stloc sl=
stloc::host) :
S({r,r},sl),
X({N[0],r},sl),
V({N[1],r},sl) {}
30 lr2(
Index r,
Index r_max, array<Index,2> N,
stloc sl=
stloc::host) :
S({r,r},sl),
X({N[0],r_max},{N[0],r},sl),
V({N[1],r_max},{N[1],r},sl) {}
73template<
class T,
class IP>
83template<
class T,
class IP>
95template<
class T,
class IP>
136template<
class T,
class IP>
144 array<double,3> h_xx, array<double,3> h_vv,
181 curandGenerator_t gen;
Provides shared types, platform headers, and basic definitions.
Declares CUDA kernels for elementwise operations and numerical updates.
Declares dense matrix and vector operations, including BLAS wrappers.
Core namespace for Ensign's numerical algorithms and data structures.
std::function< T(T *, T *)> inner_product_from_weight(const T *w, Index N)
Return an inner product function object for use in, e.g., in gram_schmidt.
double lr_inner_product(const lr2< T > &A, const lr2< T > &B, T w, const Ensign::Matrix::blas_ops &blas)
Computes the inner product of two low-rank representations.
void initialize(lr2< T > &lr, vector< const T * > X, vector< const T * > V, IP inner_product_X, IP inner_product_V, const Ensign::Matrix::blas_ops &blas)
Initializes (an already allocated) lr2 to .
void lr_mul(const lr2< T > &A, const lr2< T > &B, lr2< T > &out, IP inner_product_X, IP inner_product_V, const Ensign::Matrix::blas_ops &blas)
Multiplies two low-rank representations together.
void lr_add(T alpha, const lr2< T > &A, T beta, const lr2< T > &B, lr2< T > &out, IP inner_product_X, IP inner_product_V, const Ensign::Matrix::blas_ops &blas)
Add two low-rank representations together.
std::function< T(T *, T *)> inner_product_from_const_weight(T w, Index N)
Return an inner product function object for use in, e.g., in gram_schmidt.
void lr_truncate(const lr2< T > &in, lr2< T > &out, const Ensign::Matrix::blas_ops &blas)
Truncate a low-rank representation inplace to a fixed rank r.
double lr_norm_sq(const lr2< T > &A, const Ensign::Matrix::blas_ops &blas)
Computes the norm of a low-rank representations.
Provides contiguous multidimensional arrays for CPU and GPU storage.
Provides matrix and vector operations with optional GPU execution.
void matmul(const multi_array< T, 2 > &a, const multi_array< T, 2 > &b, multi_array< T, 2 > &c) const
Matrix multiplication (computes c = a b)
void matmul_transb(const multi_array< T, 2 > &a, const multi_array< T, 2 > &b, multi_array< T, 2 > &c) const
Matrix multiplication with second matrix transposed (computes c = a b^T)
Class to store the low-rank factors (X, S, V) that are used in the computation.
multi_array< T, 2 > full(const Ensign::Matrix::blas_ops &blas) const
Computes the full matrix (can be very expensive and should not be used in production code)
lr2(stloc sl=stloc::host)
lr2(Index r, array< Index, 2 > N, stloc sl=stloc::host)
lr2(Index r, Index r_max, array< Index, 2 > N, stloc sl=stloc::host)
void update_info(Index r)
void resize(Index r, array< Index, 2 > N)
Dense d-dimensional array stored contiguously in column-major order (i.e.
array< Index, d > shape() const
void update_shape(array< Index, d > _e)
void resize(array< Index, d > _e)
Orthogonalizes Q and returns the corresponding upper triangular matrix R.
void gram_schmidt(multi_array< double, 2 > &Q, multi_array< double, 2 > &R, double w)
void operator()(multi_array< double, 2 > &Q, multi_array< double, 2 > &R, double *w)
void operator()(multi_array< double, 2 > &Q, multi_array< double, 2 > &R, std::function< double(double *, double *)> inner_product)
void operator()(multi_array< double, 2 > &Q, multi_array< double, 2 > &R, double w)
void gram_schmidt(multi_array< double, 2 > &Q, multi_array< double, 2 > &R, std::function< double(double *, double *)> inner_product)
orthogonalize(const Ensign::Matrix::blas_ops *_blas)