MADNESS  0.10.1
projector.h
Go to the documentation of this file.
1 /*
2  * projector.h
3  *
4  * Created on: Jan 24, 2014
5  * Author: fbischoff
6  */
7 
8 #ifndef MADNESS_CHEM_PROJECTOR_H__INCLUDED
9 #define MADNESS_CHEM_PROJECTOR_H__INCLUDED
10 
11 #include <madness/mra/mra.h>
12 #include <type_traits>
13 
14 namespace madness {
15 
16 
17  class ProjectorBase {
18  protected:
19  /// a projector might work only on a subset of dimensions, e.g. P(1) | \psi(1,2) >
20  int particle=-1; // must only be 0 or 1!
21  public:
22  virtual ~ProjectorBase() {}
23  virtual void set_particle(const int p)
24  {
25  MADNESS_CHECK_THROW(p==0 or p==1, "particle must be 0 or 1");
26  particle=p;
27  }
28  virtual int get_particle() const {return particle;}
29  virtual std::string type() const = 0;
30  };
31 
32  template<typename T, std::size_t NDIM>
33  class CCPairFunction;
34 
35  template<typename T, std::size_t NDIM>
36  std::vector<CCPairFunction<T,NDIM>> apply(const ProjectorBase& P, const std::vector<CCPairFunction<T,NDIM>>& argument);
37 
38  /// simple projector class
39 
40  /// use this class to project a function or a set of functions on
41  /// another space of function. The projector can handle different sets of
42  /// functions for the bra and the ket space, e.g. in case of regularized
43  /// orbitals: |f> <-> <f|R^2
44  template<typename T, std::size_t NDIM>
45  class Projector : public ProjectorBase {
46 
48  typedef std::vector<funcT> vecfuncT;
49 
50  /// the space onto which the test functions will be projected: |ket>
51  std::vector<Function<T,NDIM> > mo_ket_;
52  /// the dual space onto which the test functions will be projected: <bra|
53  std::vector<Function<T,NDIM> > mo_bra_;
54 
55  public:
56 
58 
59  /// simple constructor with only one orbital to project
60 
61  /// bra and ket spaces are symmetric
63  mo_bra_(vecfuncT(1,mo)) {}
64 
65  /// simple constructor with only one orbital to project
66 
67  /// bra and ket spaces are not symmetric (e.g. |ket>^+ = <bra|R2 )
68  Projector(const funcT& bra, const funcT& ket) : mo_ket_(vecfuncT(1,ket))
69  , mo_bra_(vecfuncT(1,bra)) {
70  MADNESS_CHECK_THROW(mo_bra_.size()==mo_ket_.size(), "bra and ket spaces must have the same size in projector");
71  }
72 
73  /// constructor with a set of orbitals to project out
74 
75  /// bra and ket spaces are symmetric
77  MADNESS_CHECK_THROW(mo_bra_.size()==mo_ket_.size(), "bra and ket spaces must have the same size in projector");
78  }
79 
80  /// constructor with a set of orbitals to project out
81 
82  /// bra and ket spaces are not symmetric (e.g. |ket>^+ = <bra|R2 )
83  Projector(const vecfuncT& bra, const vecfuncT& ket) : mo_ket_(ket),
84  mo_bra_(bra) {
85  MADNESS_CHECK_THROW(mo_bra_.size()==mo_ket_.size(), "bra and ket spaces must have the same size in projector");
86  }
87 
88  void set_spaces(const vecfuncT& p) {
89  mo_bra_=p;
90  mo_ket_=p;
91  }
92 
93  void set_spaces(const vecfuncT& bra, const vecfuncT& ket) {
94  mo_bra_=bra;
95  mo_ket_=ket;
96  MADNESS_CHECK_THROW(mo_bra_.size()==mo_ket_.size(), "bra and ket spaces must have the same size in projector");
97  }
98 
99  virtual std::string type() const override {return "PProjector";}
100 
101  /// project f on p:
102 
103  /// \f[
104  /// | result > = \sum_p | p > <p|f>
105  /// \f]
106  /// @param[in] f the function to be projected
107  /// @return the projection of f on the space of p
108  funcT operator()(const funcT& f) const {
109  return this->operator()(vecfuncT(1,f)).front();
110  }
111 
112  /// project f on p:
113 
114  /// \f[
115  /// | result > = \sum_p | p > <p|f>
116  /// \f]
117  /// @param[in] f the vector of functions to be projected
118  /// @return the projection of f on the space of p
119  vecfuncT operator()(const vecfuncT& f) const {
120  if (f.size()==0) return vecfuncT();
121  World& world=f[0].world();
122  Tensor<T> ovlp=matrix_inner(world,mo_bra_,f);
123  vecfuncT result=transform(world,mo_ket_,ovlp,true);
124  truncate(world,result);
125  return result;
126  }
127 
128  /// apply 3D Projector to one particle of a 6D function
129  /// \f[
130  /// |result> = \sum_p |p(particle)> <p(particle)|f(1,2)>_{particle}
131  /// \f]
132  /// @param[in] f the 6D function to be projected
133  /// @param[in] the particle that is projected (0 or 1)
134  /// @return the projected function
135  template<std::size_t KDIM>
136  typename std::enable_if<KDIM==2*NDIM, Function<T,KDIM> >::type
137  operator()(const Function<T,KDIM>& f, int particle1=-1) const {
138  if (particle1==-1) particle1=get_particle();
139  MADNESS_CHECK_THROW(particle1 == 0 or particle1 == 1, "particle must be 0 or 1");
140  auto [left,right]=get_vectors_for_outer_product(f);
141  return hartree_product(left,right);
142  }
143 
144  /// apply the projection parts of the operator on a function f
145 
146  /// The operator applied on f(1,2) is
147  /// O(1)f(1,2) = \sum_i |i(1) > <i(1) | f(1,2)>_1 = \sum_i |i(1) f_i(2)>
148  /// return the lo-dim vectors i and f_i only, perform no outer product
149  std::pair<std::vector<Function<T,NDIM>>,std::vector<Function<T,NDIM>>>
151  World& world=f.world();
152  reconstruct(world, mo_bra_, false);
153  f.reconstruct(false);
154  reconstruct(world, mo_ket_, true);
155  std::vector<Function<T,NDIM>> projected;
156  for (const auto& i : mo_bra_) {
157  projected.push_back(f.project_out(i,particle));
158  }
159  if (particle==0) return std::make_pair(mo_ket_,projected);
160  else if (particle==1) return std::make_pair(projected,mo_ket_);
161  else {
162  MADNESS_EXCEPTION("confused particles in Projector::get_vector_for_outer_products",1);
163  }
164  }
165 
166  template<typename argT>
167  typename std::enable_if<!std::is_same<argT,Function<T,2*NDIM> >::value, argT>::type
168  operator()(const argT& argument) const {
169  return madness::apply(*this,argument);
170  }
171 
172  vecfuncT get_bra_vector() const {return mo_bra_;}
173 
174  vecfuncT get_ket_vector() const {return mo_ket_;}
175 
176  };
177 
178 
179  /// orthogonality projector
180 
181  /// projects out the space given in the constructor
182  /// \f[
183  /// |result> = |f> - \sum_p |p><p|f>
184  /// \f]
185  template<typename T, std::size_t NDIM>
186  class QProjector : public ProjectorBase {
187  typedef std::vector<Function<T,NDIM> > vecfuncT;
188 
189  public:
190 
191  /// default ctor
192  QProjector() = default;
193 
194  /// constructor with symmetric bra and ket spaces
195  [[deprecated]] QProjector(World& world, const vecfuncT& amo) : O(amo) {};
196 
197  /// constructor with asymmetric bra and ket spaces
198  [[deprecated]] QProjector(World& world, const vecfuncT& bra, const vecfuncT& ket)
199  : O(bra,ket) {};
200 
201  /// constructor with symmetric bra and ket spaces
202  QProjector(const vecfuncT& amo) : O(amo) {};
203 
204  /// constructor with asymmetric bra and ket spaces
205  QProjector(const vecfuncT& bra, const vecfuncT& ket)
206  : O(bra,ket) {};
207 
208  /// copy ctor
209  QProjector(const QProjector& other) = default;
210 
211  std::string type() const override {return "QProjector";}
212 
213  void set_spaces(const vecfuncT& p) {
214  O.set_spaces(p);
215  }
216 
217  void set_spaces(const vecfuncT& bra, const vecfuncT& ket) {
218  O.set_spaces(bra,ket);
219  }
220 
222  return (rhs-O(rhs)).truncate();
223  }
224 
225  vecfuncT operator()(const vecfuncT& rhs) const {
226  if (rhs.size()==0) return vecfuncT();
227  vecfuncT result=rhs-O(rhs);
228  truncate(result[0].world(),result);
229  return result;
230  }
231 
232  Function<T,2*NDIM> operator()(const Function<T,2*NDIM>& f, const size_t particle=-1) const {
233  return f-O(f,particle);
234  }
235 
236  template<typename argT>
237  argT operator()(const argT& argument) const {
238  return madness::apply(*this,argument);
239  }
240 
241  vecfuncT get_bra_vector() const {return O.get_bra_vector();}
242 
243  vecfuncT get_ket_vector() const {return O.get_ket_vector();}
244 
246 
247  void set_particle(const int p) override {
248  O.set_particle(p);
249  particle=p;
250  }
251 
252  int get_particle() const override {
253  return O.get_particle();
254  }
255 
256  private:
258  };
259 
260  /// a SO projector class
261 
262  /// The SO projector is defined as
263  /// Q12 = (1-O1)(1-O2),
264  /// O = \sum_i | i >< i |
265  /// where O1 and O2 are projectors for electron 1 and 2 on the occupied space
266  /// As a special case there might be a similarity transformed occupied
267  /// space, resulting in different bras and kets
268  template<typename T, std::size_t NDIM>
270 
271  typedef std::vector<Function<T,NDIM> > vecfuncT;
272 
273  public:
274 
275  /// default ctor
277 
278  std::string type() const override {return "SOProjector";}
279 
280  /// set the same spaces for the projectors for particle 1 and 2
281  void set_spaces(const vecfuncT& p) {
282  ket1_=p;
283  bra1_=p;
284  ket2_=p;
285  bra2_=p;
286  }
287 
288  /// set different spaces for the projectors for particle 1 and 2
289 
290  /// the SO projector is
291  /// Q12 = (1 - O1) (1 - O2)
292  /// O1 = \sum_i | ket1_i >< bra1_i |
293  /// O2 = \sum_i | ket2_i >< bra2_i |
294  /// this case occurs for a similarity transformed Q12
295  void set_spaces(const vecfuncT& bra1, const vecfuncT& ket1,
296  const vecfuncT& bra2, const vecfuncT& ket2) {
297  ket1_=ket1;
298  bra1_=bra1;
299  ket2_=ket2;
300  bra2_=bra2;
301  MADNESS_CHECK_THROW(ket1.size()==bra1.size(), "bra1 and ket1 spaces must have the same size in SOprojector");
302  MADNESS_CHECK_THROW(ket2.size()==bra2.size(), "bra2 and ket2 spaces must have the same size in SOprojector");
303  }
304 
305  /// return the orbital space for the ket of particle 1
306  vecfuncT ket1() const {return ket1_;}
307 
308  /// return the orbital space for the bra of particle 1
309  vecfuncT bra1() const {return bra1_;}
310 
311  /// return the orbital space for the ket of particle 2
312  vecfuncT ket2() const {return ket2_;}
313 
314  /// return the orbital space for the bra of particle 2
315  vecfuncT bra2() const {return bra2_;}
316 
317  void set_particle(const int p) override {
318  MADNESS_EXCEPTION("You cannot set a particle in the SO projector",1);
319  }
320 
321  template<typename argT>
322  argT operator()(const argT& argument) const {
323  return madness::apply(*this,argument);
324  }
325 
326  /// apply the projection parts of the strong orthogonality operator Q12 on a function f
327 
328  /// The SO operator is defined as 1-O1-O2+O1O2, where O1 and O2 are projectors
329  /// return the term -O1-O2+O1O2 only, such that Q12 f = 1 + outer(result.first,result.second)
330  std::pair<std::vector<Function<T,NDIM>>,std::vector<Function<T,NDIM>>>
332  // Eq. (A9): g_kl = < k(1) l(2) | f(1,2) >
333  // note no (kl) symmetry here!
334  reconstruct(world, bra1_, false);
335  reconstruct(world, bra2_, true);
336  Tensor<double> g_kl(bra1_.size(), bra2_.size());
337  for (size_t k = 0; k < bra1_.size(); ++k) {
338  for (size_t l = 0; l < bra2_.size(); ++l) {
341  g_kl(k, l) = inner(f, kl);
342  }
343  }
344 
345  // Eq. (A12)
346  // project out the mainly first particle: O1 (1 - 1/2 O2)
347  std::vector<Function<T, NDIM>> h2(bra1_.size());
348  std::vector<Function<T, NDIM>> h1(ket2_.size());
349  reconstruct(world, bra1_, false);
350  reconstruct(world, bra2_, true);
351  for (size_t k = 0; k < bra1_.size(); ++k) {
352 
353  // project out the mainly first particle: O1 (1 - 1/2 O2): first term
354  // Eq. (A10)
355  h2[k] = f.project_out(bra1_[k], 0);
356 
357  // project out the mainly second particle: O2 (1 - 1/2 O1): first term
358  // Eq. (A11)
359  std::size_t l = k;
360  h1[l] = f.project_out(bra2_[l], 1);
361 
362  }
363 
364  // Transforms a vector of functions according to new[i] = sum[j] old[j]*c[j,i]
365  // project out the mainly first particle: O1 (1 - 1/2 O2): second term
366  // Eq. (A12), (A13)
367  h2 -= transform(world, ket2_, 0.5 * transpose(g_kl), false); // ordering g(k,l) is correct
368  h1 -= transform(world, ket1_, 0.5 * g_kl, true); // ordering g(k,l) is correct
369  // aka
370  // for (size_t l=0; l<ket2_.size(); ++l) {
371  // h2[k]-=0.5*g_kl(k,l)*ket2_[l];
372  // }
373 
374  change_tree_state(h1, reconstructed, false);
375  change_tree_state(h2, reconstructed, false);
378  world.gop.fence();
379 
380  auto left=append(ket1_,h1);
381  auto right=append(h2,ket2_);
382  return std::make_pair(-1.0*left,right);
383  }
384 
385  /// apply the strong orthogonality operator Q12 on a function f
386 
387  /// notation of the equations follows
388  /// J. Chem. Phys., vol. 139, no. 11, p. 114106, 2013.
390 
391  // simple and it works for higher accuracies, but might be
392  // imprecise for lower accuracies
393 // return (f-O1(f)-O2(f)+O1(O2(f))).truncate().reduce_rank();
394 
395  auto [left,right]=get_vectors_for_outer_product(f);
396 
397  // temporarily tighten the threshold
399  double tight_thresh=thresh*0.1;
401 
402  auto tmp=hartree_product(left,right);
403  tmp.truncate(thresh*0.3);
404 
406  Function<T, 2 * NDIM> result = copy(f);
407  result+=tmp;
408  result.truncate(thresh).reduce_rank();
409  return result;
410  }
411 
412  private:
413 
414  /// the world
416 
417  /// the spaces of the projector of particles 1 and 2
418  std::vector<Function<T,NDIM> > ket1_, bra1_, ket2_, bra2_;
419 
420  };
421 
422 
423  /// an outer product of two projectors
424  template<typename projT, typename projQ>
425  class OuterProjector : public ProjectorBase {
426  projT projector0;
427  projQ projector1;
428  public:
429 
430  OuterProjector() = default;
431  OuterProjector(const projT& p0, const projQ& p1) : projector0(p0), projector1(p1) {
432  static_assert(std::is_base_of<ProjectorBase,projT>::value, "projT must be a ProjectorBase");
433  static_assert(std::is_base_of<ProjectorBase,projQ>::value, "projQ must be a ProjectorBase");
434  projector0.set_particle(0);
435  projector1.set_particle(1);
436  }
437 
438  std::string type() const override {
439  return "OuterProjector";
440  }
441 
442  template<typename resultT>
443  resultT operator()(const resultT& argument) const {
444 
445  if (projector0.type()=="PProjector") return projector1(projector0(argument));
446  return projector0(projector1(argument));
447  }
448  };
449 
450 // template<typename projT, typename projQ>
451 // OuterProjector<projT, projQ> outer(const projT& p0 , const projQ& p1) {
452 // return OuterProjector<projT, projQ>(p0, p1);
453 // }
454 
455  template<typename projT, typename projQ>
456  typename std::enable_if<std::is_base_of<ProjectorBase,projT>::value, OuterProjector<projT,projQ>>::type
457  outer(const projT& p0 , const projQ& p1) {
458  return OuterProjector<projT, projQ>(p0, p1);
459  }
460 }
461 
462 #endif /* PROJECTOR_H_ */
a 6D function, either in full or low rank form, possibly including an 2-particle function
Definition: ccpairfunction.h:373
Factory for facile setup of a CompositeFunctorInterface and its FuncImpl.
Definition: function_factory.h:321
CompositeFactory & particle2(const Function< T, MDIM > &f)
Definition: function_factory.h:400
CompositeFactory & particle1(const Function< T, MDIM > &f)
Definition: function_factory.h:384
static void set_thresh(double value)
Sets the default threshold.
Definition: funcdefaults.h:286
static const double & get_thresh()
Returns the default threshold.
Definition: funcdefaults.h:279
A multiresolution adaptive numerical function.
Definition: mra.h:122
Function< T, NDIM > & truncate(double tol=0.0, bool fence=true)
Truncate the function with optional fence. Compresses with fence if not compressed.
Definition: mra.h:602
an outer product of two projectors
Definition: projector.h:425
std::string type() const override
Definition: projector.h:438
resultT operator()(const resultT &argument) const
Definition: projector.h:443
OuterProjector(const projT &p0, const projQ &p1)
Definition: projector.h:431
projQ projector1
Definition: projector.h:427
projT projector0
Definition: projector.h:426
Definition: projector.h:17
int particle
a projector might work only on a subset of dimensions, e.g. P(1) | \psi(1,2) >
Definition: projector.h:20
virtual std::string type() const =0
virtual int get_particle() const
Definition: projector.h:28
virtual ~ProjectorBase()
Definition: projector.h:22
virtual void set_particle(const int p)
Definition: projector.h:23
simple projector class
Definition: projector.h:45
Projector(const Function< T, NDIM > &mo)
simple constructor with only one orbital to project
Definition: projector.h:62
std::pair< std::vector< Function< T, NDIM > >, std::vector< Function< T, NDIM > > > get_vectors_for_outer_product(const Function< T, 2 *NDIM > &f) const
apply the projection parts of the operator on a function f
Definition: projector.h:150
std::vector< Function< T, NDIM > > mo_ket_
the space onto which the test functions will be projected: |ket>
Definition: projector.h:51
std::vector< funcT > vecfuncT
Definition: projector.h:48
std::enable_if< KDIM==2 *NDIM, Function< T, KDIM > >::type operator()(const Function< T, KDIM > &f, int particle1=-1) const
Definition: projector.h:137
funcT operator()(const funcT &f) const
project f on p:
Definition: projector.h:108
void set_spaces(const vecfuncT &p)
Definition: projector.h:88
virtual std::string type() const override
Definition: projector.h:99
Projector(const funcT &bra, const funcT &ket)
simple constructor with only one orbital to project
Definition: projector.h:68
std::enable_if<!std::is_same< argT, Function< T, 2 *NDIM > >::value, argT >::type operator()(const argT &argument) const
Definition: projector.h:168
Projector(const vecfuncT &bra, const vecfuncT &ket)
constructor with a set of orbitals to project out
Definition: projector.h:83
vecfuncT operator()(const vecfuncT &f) const
project f on p:
Definition: projector.h:119
std::vector< Function< T, NDIM > > mo_bra_
the dual space onto which the test functions will be projected: <bra|
Definition: projector.h:53
vecfuncT get_bra_vector() const
Definition: projector.h:172
Function< T, NDIM > funcT
Definition: projector.h:47
vecfuncT get_ket_vector() const
Definition: projector.h:174
Projector()
Definition: projector.h:57
void set_spaces(const vecfuncT &bra, const vecfuncT &ket)
Definition: projector.h:93
Projector(const vecfuncT &p)
constructor with a set of orbitals to project out
Definition: projector.h:76
orthogonality projector
Definition: projector.h:186
QProjector(const vecfuncT &bra, const vecfuncT &ket)
constructor with asymmetric bra and ket spaces
Definition: projector.h:205
QProjector(const vecfuncT &amo)
constructor with symmetric bra and ket spaces
Definition: projector.h:202
void set_spaces(const vecfuncT &bra, const vecfuncT &ket)
Definition: projector.h:217
vecfuncT get_bra_vector() const
Definition: projector.h:241
QProjector(World &world, const vecfuncT &bra, const vecfuncT &ket)
constructor with asymmetric bra and ket spaces
Definition: projector.h:198
void set_particle(const int p) override
Definition: projector.h:247
argT operator()(const argT &argument) const
Definition: projector.h:237
std::vector< Function< T, NDIM > > vecfuncT
Definition: projector.h:187
int get_particle() const override
Definition: projector.h:252
QProjector(World &world, const vecfuncT &amo)
constructor with symmetric bra and ket spaces
Definition: projector.h:195
Function< T, 2 *NDIM > operator()(const Function< T, 2 *NDIM > &f, const size_t particle=-1) const
Definition: projector.h:232
Projector< T, NDIM > O
Definition: projector.h:257
void set_spaces(const vecfuncT &p)
Definition: projector.h:213
QProjector()=default
default ctor
vecfuncT get_ket_vector() const
Definition: projector.h:243
vecfuncT operator()(const vecfuncT &rhs) const
Definition: projector.h:225
Projector< T, NDIM > get_P_projector() const
Definition: projector.h:245
std::string type() const override
Definition: projector.h:211
Function< T, NDIM > operator()(const Function< T, NDIM > &rhs) const
Definition: projector.h:221
QProjector(const QProjector &other)=default
copy ctor
a SO projector class
Definition: projector.h:269
vecfuncT bra2() const
return the orbital space for the bra of particle 2
Definition: projector.h:315
std::vector< Function< T, NDIM > > vecfuncT
Definition: projector.h:271
Function< T, 2 *NDIM > operator()(const Function< T, 2 *NDIM > &f) const
apply the strong orthogonality operator Q12 on a function f
Definition: projector.h:389
std::string type() const override
Definition: projector.h:278
void set_spaces(const vecfuncT &bra1, const vecfuncT &ket1, const vecfuncT &bra2, const vecfuncT &ket2)
set different spaces for the projectors for particle 1 and 2
Definition: projector.h:295
StrongOrthogonalityProjector(World &world)
default ctor
Definition: projector.h:276
vecfuncT ket2() const
return the orbital space for the ket of particle 2
Definition: projector.h:312
std::pair< std::vector< Function< T, NDIM > >, std::vector< Function< T, NDIM > > > get_vectors_for_outer_product(const Function< T, 2 *NDIM > &f) const
apply the projection parts of the strong orthogonality operator Q12 on a function f
Definition: projector.h:331
vecfuncT bra1() const
return the orbital space for the bra of particle 1
Definition: projector.h:309
World & world
the world
Definition: projector.h:415
argT operator()(const argT &argument) const
Definition: projector.h:322
void set_particle(const int p) override
Definition: projector.h:317
std::vector< Function< T, NDIM > > bra2_
Definition: projector.h:418
vecfuncT ket1() const
return the orbital space for the ket of particle 1
Definition: projector.h:306
std::vector< Function< T, NDIM > > bra1_
Definition: projector.h:418
std::vector< Function< T, NDIM > > ket1_
the spaces of the projector of particles 1 and 2
Definition: projector.h:418
std::vector< Function< T, NDIM > > ket2_
Definition: projector.h:418
void set_spaces(const vecfuncT &p)
set the same spaces for the projectors for particle 1 and 2
Definition: projector.h:281
A tensor is a multidimension array.
Definition: tensor.h:317
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
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
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition: madness_exception.h:119
#define MADNESS_CHECK_THROW(condition, msg)
Check a condition — even in a release build the condition is always evaluated so it can have side eff...
Definition: madness_exception.h:210
Main include file for MADNESS and defines Function interface.
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
Function< T, KDIM+LDIM > hartree_product(const std::vector< Function< T, KDIM >> &left, const std::vector< Function< T, LDIM >> &right)
Performs a Hartree/outer product on the two given low-dimensional function vectors.
Definition: mra.h:1832
std::vector< Function< T, NDIM > > append(const std::vector< Function< T, NDIM > > &lhs, const std::vector< Function< T, NDIM > > &rhs)
combine two vectors
Definition: vmra.h:649
response_space apply(World &world, std::vector< std::vector< std::shared_ptr< real_convolution_3d >>> &op, response_space &f)
Definition: basic_operators.cc:39
void truncate(World &world, response_space &v, double tol, bool fence)
Definition: basic_operators.cc:30
const std::vector< Function< T, NDIM > > & change_tree_state(const std::vector< Function< T, NDIM >> &v, const TreeState finalstate, const bool fence=true)
change tree state of the functions
Definition: vmra.h:277
@ reconstructed
s coeffs at the leaves only
Definition: funcdefaults.h:59
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:2002
response_space transpose(response_space &f)
Definition: basic_operators.cc:10
NDIM & f
Definition: mra.h:2416
double inner(response_space &a, response_space &b)
Definition: response_functions.h:442
std::string type(const PairType &n)
Definition: PNOParameters.h:18
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
std::enable_if< std::is_base_of< ProjectorBase, projT >::value, OuterProjector< projT, projQ > >::type outer(const projT &p0, const projQ &p1)
Definition: projector.h:457
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
const std::vector< Function< T, NDIM > > & reconstruct(const std::vector< Function< T, NDIM > > &v)
reconstruct a vector of functions
Definition: vmra.h:156
static const double thresh
Definition: rk.cc:45
static const long k
Definition: rk.cc:44
Definition: lowrankfunction.h:332
int P
Definition: test_binsorter.cc:9