5#ifndef SRC_APPS_MOLRESPONSE_RESPONSE_FUNCTIONS_H_ 
    6#define SRC_APPS_MOLRESPONSE_RESPONSE_FUNCTIONS_H_ 
   80        this->num_states = y.
size();
 
 
   95      this->num_states = y.
size();
 
   96      this->num_orbitals = y[0].size();
 
 
  116      for (
auto &state : 
x)
 
 
  139      return ((
a.size() == 
b.size()) && (
a.size_orbitals() == 
b.size_orbitals()));
 
 
  144      World &world = 
x[0][0].world();
 
 
  156         bool fence = 
false)
 const 
  158      auto &world = 
x[0][0].world();
 
  160      std::transform(
x.begin(), 
x.end(), result.
x.begin(), [&](
const auto &
xi)
 
  161                     { return madness::copy(world, xi, pmap, fence); });
 
 
  173      auto &world = 
A.x[
A.active.front()][0].world();
 
  174      for (
auto &i : 
A.active)
 
 
  186      auto result = 
A.copy();
 
  187      auto &world = result.x[
A.active.front()][0].world();
 
  188      result.active = 
A.active;
 
  189      for (
auto &i : result.active)
 
  191        result.x[i] = 
func(
A.x[i]);
 
 
  206      auto &world = result.
x[
A.active.front()][0].world();
 
  208      for (
const auto &i : result.
active)
 
  210        auto ax = result.
x[i];
 
  212        result.
x[i] = 
func(ax, bx);
 
 
  223      auto &world = 
A.x[
A.active.front()][0].world();
 
  224      for (
const auto &i : 
A.active)
 
 
  242      result.active = rhs_y.
active;
 
 
  258      auto result = this->
copy();
 
  259      result.active = rhs_y.
active;
 
  261      result.from_vector(result.to_vector() - rhs_y.
to_vector());
 
 
  329      World &world = 
a[
a.active.front()][0].world();
 
  333      result.active = 
a.active;
 
  334      result.from_vector(
a.to_vector() * 
f);
 
  339        return mul(world, 
f, 
vi, 
false);
 
 
  362      result.from_vector(this->
to_vector() * f);
 
  368        return mul(world, 
f, 
vi, 
false);
 
 
  379      World &world = 
a[0][0].world();
 
 
  391      auto &world = 
b[
b.active.front()][0].world();
 
  392      this->active = 
b.active;
 
  400        gaxpy(world, 1.0, 
a, 1.0, 
g, 
false);
 
 
  448    const auto begin()
 const { 
return x.begin(); }
 
  450    [[nodiscard]] 
const auto end()
 const { 
return x.end(); }
 
  459      auto &world = 
x[0][0].world();
 
  462        x[i] = ::madness::zero_functions<double, 3>(world, 
num_orbitals, 
false);
 
 
  470      auto &world = 
x[
active.front()][0].world();
 
 
  481      auto &world = 
x[
active.front()][0].world();
 
 
  494      auto &world = 
x[
active.front()][0].world();
 
 
  510      auto &world = 
x[0][0].world();
 
 
  535      for (
size_t b = 0; 
b < 
a.size(); ++
b)
 
  537        for (
size_t k = 0; 
b < 
a.size_orbitals(); ++
k)
 
 
  555            ::madness::zero_functions<double, 3>(world, 
num_orbitals, 
false);
 
 
  570      World &world = 
a[0][0].world();
 
  572      auto dim_a1 = 
a.
size();
 
  574      auto dim_b1 = 
b.size();
 
  580        for (
size_t i = 0; i < dim_a1; i++)
 
  584        for (
size_t i = 0; i < dim_b1; i++)
 
 
  602      int n = 
static_cast<int>(
active.size());
 
  608      for (
const auto &ai : 
active)
 
  610        for (
int j = 0; j < 
m; j++)
 
  612          auto xindex = (i * 
m) + j;
 
  613          rf[xindex] = 
x[ai][j];
 
 
  626      for (
const auto &ai : 
active)
 
  628        for (
int j = 0; j < 
m; j++)
 
  630          auto xindex = (i * 
m) + j;
 
  632          x[ai][j] = rf[xindex];
 
 
 
  648    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:100
A multiresolution adaptive numerical function.
Definition mra.h:139
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:69
A tensor is a multidimensional array.
Definition tensor.h:317
Interface to be provided by any process map.
Definition worlddc.h:122
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:330
WorldGopInterface & gop
Global operations.
Definition world.h:207
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:28
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
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:1795
std::vector< vector_real_function_3d > response_matrix
Definition response_functions.h:20
void truncate(World &world, response_space &v, double tol, bool fence)
Definition basic_operators.cc:31
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:707
void compress(World &world, const std::vector< Function< T, NDIM > > &v, bool fence=true)
Compress a vector of functions.
Definition vmra.h:149
const std::vector< Function< T, NDIM > > & reconstruct(const std::vector< Function< T, NDIM > > &v)
reconstruct a vector of functions
Definition vmra.h:162
double norm2(World &world, const std::vector< Function< T, NDIM > > &v)
Computes the 2-norm of a vector of functions.
Definition vmra.h:871
std::vector< real_function_3d > vector_real_function_3d
Definition functypedefs.h:94
std::shared_ptr< FunctionFunctorInterface< double, 3 > > func(new opT(g))
NDIM & f
Definition mra.h:2528
NDIM const Function< R, NDIM > & g
Definition mra.h:2528
double inner(response_space &a, response_space &b)
Definition response_functions.h:640
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
Function< T, NDIM > copy(const Function< T, NDIM > &f, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool fence=true)
Create a new copy of the function with different distribution and optional fence.
Definition mra.h:2096
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:244
auto transposeResponseMatrix(const response_matrix &x) -> response_matrix
Definition x_space.cc:157
static const double b
Definition nonlinschro.cc:119
static const double a
Definition nonlinschro.cc:118
Implements most functionality of separated operators.
static const double m
Definition relops.cc:9
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:27
response_space()
default Construct a new response space object num_states(0) num_orbitals(0) x() default constructor o...
Definition response_functions.h:48
response_space operator-(const response_space &rhs_y) const
Definition response_functions.h:253
friend bool same_size(const response_space &a, const response_space &b)
Definition response_functions.h:137
response_space & operator+=(const response_space &b)
Definition response_functions.h:388
Tensor< double > norm2()
Definition response_functions.h:508
void push_back(const vector_real_function_3d &f)
Definition response_functions.h:409
const vector_real_function_3d & operator[](size_t i) const
Definition response_functions.h:167
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:68
friend response_space operator*(const response_space &a, const Function< double, 3 > &f)
Definition response_functions.h:325
response_space(const response_matrix &x)
Construct a new response space object from vector of functions.
Definition response_functions.h:129
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:198
response_space copy(const std::shared_ptr< WorldDCPmapInterface< Key< 3 > > > &pmap, bool fence=false) const
Definition response_functions.h:155
response_space operator+(const response_space &rhs_y) const
Definition response_functions.h:235
auto to_vector() const -> vector_real_function_3d
Definition response_functions.h:599
void reset_active()
Definition response_functions.h:50
size_t num_orbitals
Definition response_functions.h:36
friend auto inplace_unary_apply(response_space &A, const std::function< void(vector_real_function_3d &)> &func)
Definition response_functions.h:169
friend auto binary_inplace(response_space &A, const response_space &B, const T &func)
Definition response_functions.h:219
friend bool operator==(const response_space &a, const response_space &y)
Definition response_functions.h:531
response_space & operator=(const response_space &y)
Definition response_functions.h:75
friend response_space operator*(const response_space &y, double a)
Definition response_functions.h:270
response_space & operator*=(double a)
Definition response_functions.h:311
size_t num_states
vector of vector of real 3d functions
Definition response_functions.h:35
friend response_space operator*(const response_space &a, const Tensor< double > &b)
Definition response_functions.h:374
const auto begin() const
Definition response_functions.h:448
void compress_rf() const
Definition response_functions.h:466
void truncate_rf(double tol)
Definition response_functions.h:492
void reconstruct_rf()
Definition response_functions.h:477
friend response_space operator*(double a, response_space &y)
Definition response_functions.h:292
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:181
void zero()
Definition response_functions.h:457
void pop_back()
Definition response_functions.h:424
response_space(World &world, size_t num_states, size_t num_orbitals)
Construct a new response space with zero functions.
Definition response_functions.h:112
friend Tensor< double > response_space_inner(const response_space &a, const response_space &b)
Definition response_functions.h:560
response_space operator*(const Function< double, 3 > &f)
Definition response_functions.h:353
auto from_vector(const vector_real_function_3d &rf) -> void
Definition response_functions.h:620
size_t size() const
Definition response_functions.h:452
void truncate_rf()
Definition response_functions.h:490
vector_real_function_3d & operator[](size_t i)
Definition response_functions.h:166
response_space copy() const
Definition response_functions.h:142
auto end()
Definition response_functions.h:446
friend response_space operator*(const Function< double, 3 > &f, const response_space &a)
Definition response_functions.h:346
const auto end() const
Definition response_functions.h:450
void scale(Tensor< double > &mat)
Definition response_functions.h:524
auto begin()
Definition response_functions.h:444
size_t size_orbitals() const
Definition response_functions.h:454
response_matrix x
Definition response_functions.h:37
std::list< size_t > active
Definition response_functions.h:38
response_space & operator=(const response_matrix &y)
Definition response_functions.h:92
static response_space zero_functions(World &world, size_t num_states, size_t num_orbitals)
Definition response_functions.h:547
void clear()
Definition response_functions.h:437