1#ifndef LINEARALGEBRA_SRC_MOLPRO_LINALG_ARRAY_ARRAYHANDLERDDISK_H
2#define LINEARALGEBRA_SRC_MOLPRO_LINALG_ARRAY_ARRAYHANDLERDDISK_H
3#include <molpro/Profiler.h>
4#include <molpro/linalg/array/ArrayHandlerWithCopyFunc.h>
5#include <molpro/linalg/array/util/gemm.h>
12template <
class AL,
class AR = AL>
27 [directory](const AR &source) {
return AL::CreateTempCopy(source, directory); }) {}
38 void copy(AL &x,
const AR &y)
override {
62 gemm_outer_distr_distr(alphas, xx, yy);
68 return gemm_inner_distr_distr(xx, yy);
71 std::map<size_t, value_type_abs>
select_max_dot(
size_t n,
const AL &x,
const AR &y)
override {
72 return x.select_max_dot(n, y);
75 std::map<size_t, value_type_abs>
select(
size_t n,
const AL &x,
bool max =
false,
bool ignore_sign =
false)
override {
76 return x.select(n, max, ignore_sign);
Definition ArrayHandlerDDisk.h:13
ProxyHandle lazy_handle() override
Returns a lazy handle. Most implementations simply need to call the overload: return lazy_handle(*thi...
Definition ArrayHandlerDDisk.h:32
ArrayHandlerDDisk(const std::string &directory)
New arrays are created by AL::CreateTempCopy(), with any file in directory.
Definition ArrayHandlerDDisk.h:25
ArrayHandlerDDisk()
New arrays are created by AL::CreateTempCopy(), with any file next to that of the source,...
Definition ArrayHandlerDDisk.h:22
Matrix< value_type > gemm_inner(const CVecRef< AL > &xx, const CVecRef< AR > &yy) override
Definition ArrayHandlerDDisk.h:65
void gemm_outer(const Matrix< value_type > alphas, const CVecRef< AR > &xx, const VecRef< AL > &yy) override
Definition ArrayHandlerDDisk.h:60
std::map< size_t, value_type_abs > select(size_t n, const AL &x, bool max=false, bool ignore_sign=false) override
Select n indices with largest (or smallest) actual (or absolute) value.
Definition ArrayHandlerDDisk.h:75
std::map< size_t, value_type_abs > select_max_dot(size_t n, const AL &x, const AR &y) override
Select n indices with largest by absolute value contributions to the dot product.
Definition ArrayHandlerDDisk.h:71
void axpy(value_type alpha, const AR &x, AL &y) override
Definition ArrayHandlerDDisk.h:50
void fill(value_type alpha, AL &x) override
Definition ArrayHandlerDDisk.h:48
void copy(AL &x, const AR &y) override
Copy content of y into x.
Definition ArrayHandlerDDisk.h:38
void scal(value_type alpha, AL &x) override
Definition ArrayHandlerDDisk.h:43
ArrayHandlerDDisk(std::function< AL(const AR &)> copy_func)
Constructor taking a copy function, which can e.g. specify the file underlying the new array.
Definition ArrayHandlerDDisk.h:30
value_type dot(const AL &x, const AR &y) override
The hermitian inner product <x|y>: conjugate-linear in x, linear in y.
Definition ArrayHandlerDDisk.h:55
Base for handlers whose left arrays are created by a function given by the user.
Definition ArrayHandlerWithCopyFunc.h:16
A convenience wrapper around a pointer to the LazyHandle.
Definition ArrayHandler.h:392
Enhances various operations between pairs of arrays and allows dynamic code injection with uniform in...
Definition ArrayHandler.h:163
std::unique_ptr< Counter > m_counter
Definition ArrayHandler.h:177
typename array::mapped_or_value_type_t< AR > value_type_R
Definition ArrayHandler.h:181
typename array::mapped_or_value_type_t< AL > value_type_L
Definition ArrayHandler.h:180
decltype(value_type_L{} *value_type_R{}) value_type
Definition ArrayHandler.h:182
decltype(check_abs< value_type >()) value_type_abs
Definition ArrayHandler.h:183
virtual void error(const std::string &message)
Throws an error.
Definition ArrayHandler.h:276
Matrix container that allows simple data access, slicing, copying and resizing without loosing data.
Definition Matrix.h:32
static std::shared_ptr< Profiler > single()
Matrix< typename array::mapped_or_value_type_t< AL > > gemm_inner_distr_distr(const CVecRef< AL > &yy, const CVecRef< AD > &xx)
Definition gemm.h:338
void gemm_outer_distr_distr(const Matrix< typename array::mapped_or_value_type_t< AL > > alphas, const CVecRef< AD > &xx, const VecRef< AL > &yy)
Definition gemm.h:353
Definition ArrayHandler.h:19