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