5#ifndef SRC_APPS_MOLRESPONSE_RESPONSE_FUNCTIONS_H_
6#define SRC_APPS_MOLRESPONSE_RESPONSE_FUNCTIONS_H_
51 for (
auto &ai:
active) { ai = i++; }
71 this->num_states = y.
size();
82 this->num_states = y.
size();
83 this->num_orbitals = y[0].size();
119 return ((
a.size() ==
b.size()) && (
a.size_orbitals() ==
b.size_orbitals()));
123 World &world =
x[0][0].world();
125 std::transform(
x.begin(),
x.end(), result.
x.begin(),
131 bool fence =
false)
const {
132 auto &world =
x[0][0].world();
134 std::transform(
x.begin(),
x.end(), result.
x.begin(),
135 [&](
const auto &
xi) { return madness::copy(world, xi, pmap, fence); });
146 auto &world =
A.x[0][0].world();
147 for (
auto &i:
A.active) {
func(
A.x[i]); }
155 auto result =
A.copy();
156 auto &world = result.x[0][0].world();
157 for (
auto &i: result.active) { result.x[i] =
func(
A.x[i]); }
170 auto &world = result.
x[0][0].world();
172 for (
const auto &i: result.
active) {
173 auto ax = result.
x[i];
175 result.
x[i] =
func(ax, bx);
184 auto &world =
A.x[0][0].world();
185 for (
const auto &i:
A.active) {
216 World &world = y.
x.at(0).at(0).world();
220 auto result = y.
copy();
226 World &world = y.
x.at(0).at(0).world();
230 auto result = y.
copy();
236 World &world = this->x[0][0].world();
247 World &world =
a.x.at(0).at(0).world();
249 return mul(world,
f,
vi,
false);
262 World &world =
x[0][0].world();
265 return mul(world,
f,
vi,
false);
274 World &world =
a[0][0].world();
285 auto &world =
x[0][0].world();
289 gaxpy(world, 1.0,
a, 1.0,
g,
false);
333 const auto begin()
const {
return x.begin(); }
335 [[nodiscard]]
const auto end()
const {
return x.end(); }
343 auto &world =
x[0][0].world();
344 std::generate(
x.begin(),
x.end(),
345 [&]() { return zero_functions<double, 3>(world, num_orbitals, true); });
356 auto &world =
x[0][0].world();
357 std::for_each(
x.begin(),
x.end(), [&](
auto &
xi) { compress(world, xi, true); });
362 auto &world =
x[0][0].world();
363 std::for_each(
x.begin(),
x.end(), [&](
auto &
xi) { reconstruct(world, xi, true); });
376 auto &world =
x[0][0].world();
377 std::for_each(
x.begin(),
x.end(), [&](
auto &
xi) { truncate(world, xi, tol, true); });
385 auto &world =
x[0][0].world();
404 for (
size_t b = 0;
b <
a.size(); ++
b) {
405 for (
size_t k = 0;
b <
a.size_orbitals(); ++
k) {
421 World &world =
a[0][0].world();
423 size_t dim_1 =
a.
size();
424 size_t dim_2 =
b[0].size();
428 for (
size_t i = 0; i < dim_1; i++) {
429 for (
size_t j = 0; j < dim_2; j++) {
436 for (
size_t p = 0;
p < dim_2;
p++) { result +=
matrix_inner(world, aT[
p], bT[
p]); }
450 for (
unsigned int i = 0; i <
a.size(); i++) {
Definition test_ar.cc:118
Definition test_ar.cc:141
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:204
A multiresolution adaptive numerical function.
Definition mra.h:122
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:66
A tensor is a multidimension array.
Definition tensor.h:317
Interface to be provided by any process map.
Definition worlddc.h:82
void fence(bool debug=false)
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition worldgop.cc:161
A parallel world class.
Definition world.h:132
ProcessID size() const
Returns the number of processes in this World (same as MPI_Comm_size()).
Definition world.h:328
WorldGopInterface & gop
Global operations.
Definition world.h:205
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition derivatives.cc:72
auto T(World &world, response_space &f) -> response_space
Definition global_functions.cc:34
static const long vi
Definition he.cc:17
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
Main include file for MADNESS and defines Function interface.
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
Function< TENSOR_RESULT_TYPE(L, R), NDIM > gaxpy_oop(TENSOR_RESULT_TYPE(L, R) alpha, const Function< L, NDIM > &left, TENSOR_RESULT_TYPE(L, R) beta, const Function< R, NDIM > &right, bool fence=true)
Returns new function alpha*left + beta*right optional fence and no automatic compression.
Definition mra.h:1917
response_space scale(response_space a, double b)
Function< TENSOR_RESULT_TYPE(Q, T), NDIM > mul(const Q alpha, const Function< T, NDIM > &f, bool fence=true)
Returns new function equal to alpha*f(x) with optional fence.
Definition mra.h:1701
std::vector< vector_real_function_3d > response_matrix
Definition response_functions.h:19
std::vector< Function< TENSOR_RESULT_TYPE(T, R), NDIM > > transform(World &world, const std::vector< Function< T, NDIM > > &v, const Tensor< R > &c, bool fence=true)
Transforms a vector of functions according to new[i] = sum[j] old[j]*c[j,i].
Definition vmra.h:689
double norm2(World &world, const std::vector< Function< T, NDIM > > &v)
Computes the 2-norm of a vector of functions.
Definition vmra.h:851
std::vector< real_function_3d > vector_real_function_3d
Definition functypedefs.h:79
std::shared_ptr< FunctionFunctorInterface< double, 3 > > func(new opT(g))
NDIM & f
Definition mra.h:2416
NDIM const Function< R, NDIM > & g
Definition mra.h:2416
double inner(response_space &a, response_space &b)
Definition response_functions.h:442
void matrix_inner(DistributedMatrix< T > &A, const std::vector< Function< T, NDIM > > &f, const std::vector< Function< T, NDIM > > &g, bool sym=false)
Definition distpm.cc:46
void gaxpy(const double a, ScalarResult< T > &left, const double b, const T &right, const bool fence=true)
the result type of a macrotask must implement gaxpy
Definition macrotaskq.h:140
auto transposeResponseMatrix(const response_matrix &x) -> response_matrix
Definition x_space.cc:145
static const double b
Definition nonlinschro.cc:119
static const double a
Definition nonlinschro.cc:118
Implements most functionality of separated operators.
static const long k
Definition rk.cc:44
const double xi
Exponent for delta function approx.
Definition siam_example.cc:60
Definition response_functions.h:25
response_space()
default Construct a new response space object num_states(0) num_orbitals(0) x() default constructor o...
Definition response_functions.h:46
response_space operator-(const response_space &rhs_y) const
Definition response_functions.h:206
friend bool same_size(const response_space &a, const response_space &b)
Definition response_functions.h:118
response_space & operator+=(const response_space &b)
Definition response_functions.h:283
Tensor< double > norm2()
Definition response_functions.h:384
void push_back(const vector_real_function_3d &f)
Definition response_functions.h:300
const vector_real_function_3d & operator[](size_t i) const
Definition response_functions.h:141
response_space(const response_space &y)
copy construct a new response space object we are using copying defined by std:vector we copy madness...
Definition response_functions.h:62
friend response_space operator*(const response_space &a, const Function< double, 3 > &f)
Definition response_functions.h:246
response_space(const response_matrix &x)
Construct a new response space object from vector of functions.
Definition response_functions.h:112
friend auto binary_apply(const response_space &A, const response_space &B, const std::function< vector_real_function_3d(vector_real_function_3d, vector_real_function_3d)> &func) -> response_space
Definition response_functions.h:163
response_space copy(const std::shared_ptr< WorldDCPmapInterface< Key< 3 > > > &pmap, bool fence=false) const
Definition response_functions.h:130
response_space operator+(const response_space &rhs_y) const
Definition response_functions.h:195
void reset_active()
Definition response_functions.h:48
size_t num_orbitals
Definition response_functions.h:34
friend auto inplace_unary_apply(response_space &A, const std::function< void(vector_real_function_3d &)> &func)
Definition response_functions.h:144
friend auto binary_inplace(response_space &A, const response_space &B, const T &func)
Definition response_functions.h:182
friend bool operator==(const response_space &a, const response_space &y)
Definition response_functions.h:402
response_space & operator=(const response_space &y)
Definition response_functions.h:68
friend response_space operator*(const response_space &y, double a)
Definition response_functions.h:215
response_space & operator*=(double a)
Definition response_functions.h:235
size_t num_states
vector of vector of real 3d functions
Definition response_functions.h:33
friend response_space operator*(const response_space &a, const Tensor< double > &b)
Definition response_functions.h:271
const auto begin() const
Definition response_functions.h:333
void truncate_rf(double tol)
Definition response_functions.h:375
void reconstruct_rf()
Definition response_functions.h:360
friend response_space operator*(double a, response_space &y)
Definition response_functions.h:225
friend auto oop_unary_apply(const response_space &A, const std::function< vector_real_function_3d(const vector_real_function_3d &)> &func) -> response_space
Definition response_functions.h:151
void zero()
Definition response_functions.h:342
void pop_back()
Definition response_functions.h:312
response_space(World &world, size_t num_states, size_t num_orbitals)
Construct a new response space with zero functions.
Definition response_functions.h:99
friend Tensor< double > response_space_inner(const response_space &a, const response_space &b)
Definition response_functions.h:414
response_space operator*(const Function< double, 3 > &f)
Definition response_functions.h:261
size_t size() const
Definition response_functions.h:337
void compress_rf()
Definition response_functions.h:354
void truncate_rf()
Definition response_functions.h:366
vector_real_function_3d & operator[](size_t i)
Definition response_functions.h:140
response_space copy() const
Definition response_functions.h:122
auto end()
Definition response_functions.h:331
friend response_space operator*(const Function< double, 3 > &f, const response_space &a)
Definition response_functions.h:256
const auto end() const
Definition response_functions.h:335
void scale(Tensor< double > &mat)
Definition response_functions.h:396
auto begin()
Definition response_functions.h:329
size_t size_orbitals() const
Definition response_functions.h:339
response_matrix x
Definition response_functions.h:35
std::list< size_t > active
Definition response_functions.h:36
response_space & operator=(const response_matrix &y)
Definition response_functions.h:80
void clear()
Definition response_functions.h:323