32#ifndef MADNESS_MRA_OPERATOR_H__INCLUDED
33#define MADNESS_MRA_OPERATOR_H__INCLUDED
56 template<
typename T, std::
size_t NDIM>
59 template<
typename T, std::
size_t NDIM>
60 class SeparatedConvolution;
62 template<
typename T, std::
size_t NDIM>
65 template <
typename T,
typename R, std::
size_t NDIM, std::
size_t KDIM>
67 apply(
const SeparatedConvolution<T,KDIM>&
op,
const std::vector< Function<R,NDIM> >
f);
69 template<
typename T, std::
size_t NDIM>
70 std::vector<CCPairFunction<T,NDIM>>
apply(
const SeparatedConvolution<T,NDIM>&
op,
const std::vector<CCPairFunction<T,NDIM>>& argument);
72 template<
typename T, std::
size_t NDIM>
73 std::vector<CCPairFunction<T,NDIM>>
apply(
const SeparatedConvolution<T,NDIM/2>&
op,
const std::vector<CCPairFunction<T,NDIM>>& argument);
75 template<
typename T, std::
size_t NDIM>
76 CCPairFunction<T,NDIM>
apply(
const SeparatedConvolution<T,NDIM>&
op,
const CCPairFunction<T,NDIM>& argument);
78 template<
typename T, std::
size_t NDIM>
79 CCPairFunction<T,NDIM>
apply(
const SeparatedConvolution<T,NDIM/2>&
op,
const CCPairFunction<T,NDIM>& argument);
83 template <
typename Q, std::
size_t NDIM>
92 template <
typename Q, std::
size_t NDIM>
94 std::vector< SeparatedConvolutionInternal<Q,NDIM> >
muops;
141 template <std::
size_t NDIM>
144 double reach2 = 0.0, diag2 = 0.0;
145 for (std::size_t
d = 0;
d !=
NDIM; ++
d) {
146 const double w = cell_width(
long(
d));
148 if (lattice_ranges[
d].infinite())
continue;
149 const double r = (lattice_ranges[
d].get_range() + 1) *
w;
152 return reach2 > 0.0 ? std::sqrt(reach2) : std::sqrt(diag2);
155 template <
typename Q, std::
size_t NDIM>
172 std::array<KernelRange, NDIM>
range;
190 mutable std::vector< ConvolutionND<Q,NDIM> >
ops;
194 const std::vector<long>
vk;
195 const std::vector<long>
v2k;
196 const std::vector<Slice>
s0;
210 if (
p!=1 and
p!=2)
throw std::runtime_error(
"particle must be 1 or 2");
222 const std::vector<ConvolutionND<Q,NDIM>>&
get_ops()
const {
return ops; }
252 const std::array<LatticeRange, NDIM>& lattice_ranges) {
256 double hi = cell_width.
normf();
259 bool lattice_summed_any = std::any_of(
260 lattice_ranges.begin(), lattice_ranges.end(), [](
const LatticeRange&
b){ return static_cast<bool>(b); });
261 bool infinite_summed_any =
false;
262 for (
size_t i = 0; i <
NDIM; i++) {
263 if (lattice_ranges[i].infinite() &&
info.
range[i].infinite()) {
264 infinite_summed_any =
true;
272 std::array<LatticeRange, NDIM> summed_ranges = lattice_ranges;
273 for (
size_t i = 0; i <
NDIM; i++) {
274 if (lattice_ranges[i].infinite() &&
info.
range[i].finite())
294 fit.truncate_mixed_expansion(coeff, expnt, summed_ranges, cell_width,
info.
lo, hi_fin,
info.
thresh);
299 const long nkept = coeff.
dim(0), nfull = full_coeff.
dim(0);
300 MADNESS_CHECK(nkept <= nfull && (nkept == 0 || (expnt(nkept - 1) == full_expnt(nkept - 1))));
301 std::vector<double> dc, de;
302 for (
long i = 0; i < nfull; ++i) {
303 const double diff = full_coeff(i) - (i < nkept ? coeff(i) : 0.0);
304 if (
diff != 0.0) { dc.push_back(
diff); de.push_back(full_expnt(i)); }
313 result.
coeff = coeff;
314 result.
expnt = expnt;
352 template <
typename T,
typename R>
363 for (std::size_t i=0; i<
NDIM; ++i) size *= dimk;
364 long dimi = size/dimk;
369 mTxmq(dimi, trans[0].r, dimk, w1,
f.ptr(), trans[0].U, dimk);
371 size = trans[0].r * size / dimk;
373 for (std::size_t
d=1;
d<
NDIM; ++
d) {
374 mTxmq(dimi, trans[
d].r, dimk, w2, w1, trans[
d].U, dimk);
375 size = trans[
d].r * size / dimk;
385 for (std::size_t
d=0;
d<
NDIM; ++
d) {
387 dimi = size/trans[
d].r;
388 mTxmq(dimi, dimk, trans[
d].r, w2, w1, trans[
d].VT);
389 size = dimk*size/trans[
d].r;
403 template <
typename T,
typename R>
412 result2.
scale(mufac);
420 template <
typename T,
typename R>
438 for (std::size_t i=0; i<
NDIM; ++i) size *= dimk;
439 long dimi = size/dimk;
444 mTxmq(dimi, trans[0].r, dimk, w1,
f.ptr(), trans[0].U, dimk);
445 size = trans[0].r * size / dimk;
447 for (std::size_t
d=1;
d<
NDIM; ++
d) {
448 mTxmq(dimi, trans[
d].r, dimk, w2, w1, trans[
d].U, dimk);
449 size = trans[
d].r * size / dimk;
459 for (std::size_t
d=0;
d<
NDIM; ++
d) {
461 dimi = size/trans[
d].r;
462 mTxmq(dimi, dimk, trans[
d].r, w2, w1, trans[
d].VT);
463 size = dimk*size/trans[
d].r;
480 template <
typename T>
496 for (std::size_t
d=0;
d<
NDIM; ++
d) Rnorm *= ops_1d[
d]->Rnorm;
498 if (at.
r_term and (Rnorm > 1.e-20)) {
500 const auto tol_Rs = tol/(Rnorm*
NDIM);
507 if (
NDIM==1) break_even = long(0.5*twok);
508 else if (
NDIM==2) break_even = long(0.6*twok);
509 else if (
NDIM==3) break_even=long(0.65*twok);
510 else break_even=long(0.7*twok);
511 bool rank_is_zero =
false;
512 for (std::size_t
d=0;
d<
NDIM; ++
d) {
514 for (r=0; r<twok; ++r) {
515 if (ops_1d[
d]->Rs[r] < tol_Rs)
break;
517 if (r >= break_even) {
519 trans[
d].
U = ops_1d[
d]->R.ptr();
525 r = std::max(2L,r+(r&1L));
532 trans[
d].
U = ops_1d[
d]->RU.ptr();
533 trans[
d].
VT = ops_1d[
d]->RVT.ptr();
535 trans2[
d]=ops_1d[
d]->R;
546 for (std::size_t
d=0;
d<
NDIM; ++
d) Tnorm *= ops_1d[
d]->Tnorm;
548 if (at.
t_term and (Tnorm>0.0)) {
549 const auto tol_Ts = tol/(Tnorm*
NDIM);
552 if (
NDIM==1) break_even = long(0.5*
k);
553 else if (
NDIM==2) break_even = long(0.6*
k);
554 else if (
NDIM==3) break_even=long(0.65*
k);
555 else break_even=long(0.7*
k);
556 bool rank_is_zero =
false;
557 for (std::size_t
d=0;
d<
NDIM; ++
d) {
559 for (r=0; r<
k; ++r) {
560 if (ops_1d[
d]->Ts[r] < tol_Ts)
break;
562 if (r >= break_even) {
564 trans[
d].
U = ops_1d[
d]->T.ptr();
570 r = std::max(2L,r+(r&1L));
577 trans[
d].
U = ops_1d[
d]->TU.ptr();
578 trans[
d].
VT = ops_1d[
d]->TVT.ptr();
580 trans2[
d]=ops_1d[
d]->T;
591 template <
typename T>
608 for (std::size_t
d=0;
d<
NDIM; ++
d) Rnorm *= ops_1d[
d]->Rnorm;
609 if (Rnorm == 0.0)
return;
611 if (Rnorm > 1.e-20) {
613 tol = tol/(Rnorm*
NDIM);
623 for (std::size_t
d=0;
d<
NDIM; ++
d) {
639 trans2[
d]=ops_1d[
d]->R;
645 for (std::size_t
d=0;
d<
NDIM; ++
d) Tnorm *= ops_1d[
d]->Tnorm;
647 if (n > 0 and (Tnorm>1.e-20)) {
654 for (std::size_t
d=0;
d<
NDIM; ++
d) {
670 trans2[
d]=ops_1d[
d]->T;
690 double prod=1.0,
sum=0.0;
691 for (std::size_t
d=0;
d<
NDIM; ++
d) {
692 double a =
ops[
d]->NSnormf;
693 double b =
ops[
d]->Tnormf;
694 double aa = std::min(
a,
b);
695 double bb = std::max(
a,
b);
697 if (bb > 0.0)
sum +=(
aa/bb);
723 for (
size_t d=0;
d<
NDIM; ++
d) {
724 double dff_tmp = ops_1d[
d]->
N_diff;
725 double duu_tmp = ops_1d[
d]->
N_diff;
726 double udf_tmp = ops_1d[
d]->
N_diff;
729 for (
size_t dd=0; dd<
NDIM; ++dd) {
731 dff_tmp *= ops_1d[dd]->
N_F;
732 duu_tmp *= ops_1d[dd]->
N_up;
734 udf_tmp *= ops_1d[dd]->
N_F;
735 for (
size_t ddd=0; ddd<
NDIM; ++ddd) {
736 if (ddd!=dd) udf += udf_tmp * ops_1d[ddd]->
N_up;
747 for (
int i=1; i<static_cast<int>(
NDIM)-1; ++i)
factorial*=
double(i);
774 for (std::size_t
d=0;
d<
NDIM; ++
d) {
812 for (std::size_t
d=0;
d<
NDIM; ++
d) {
817 op.ops[
d] =
ops[
mu].getop(
d)->mod_nonstandard(op_key);
856 const double munorm =
op.muops[
mu].norm;
857 norm += munorm*munorm;
879 for (
size_t i=0; i<
NDIM; ++i) t[i]=t[i]%2;
893 const double munorm =
op.muops[
mu].norm;
894 norm += munorm*munorm;
906 for (std::size_t
d=1;
d<
NDIM; ++
d) {
919 template<
typename T,
size_t FDIM>
936 for (
int i=0; i<
k; ++i) identity(i,i)=1.0;
942 for (
size_t ii=0; ii<
NDIM; ++ii) matrices[ii+
NDIM]=identity;
944 for (
size_t ii=0; ii<
NDIM; ++ii) matrices[ii]=identity;
962 template<
typename T,
size_t FDIM>
971 for (
size_t ii=0; ii<FDIM; ++ii) matrices[ii]=
h[key.
translation()[ii]%2];
982 for (
int d = 0;
d !=
NDIM; ++
d) {
983 for(
const auto &
op:
ops) {
995 for (
int d = 0;
d !=
NDIM; ++
d) {
996 for (
const auto &
op :
ops) {
998 ops[0].lattice_summed());
1005 for (
const auto&
op :
ops)
1006 for (std::size_t
d = 0;
d !=
NDIM; ++
d) {
1007 const auto op1d =
op.getop(
d);
1009 "SeparatedConvolution: a term omits lattice images (LatticeImages), but the operator was not built as rest-of-crystal (OperatorInfo::images_only)");
1033 ,
rank(argops.size())
1039 for (
unsigned int mu=0;
mu < argops.size(); ++
mu) {
1063 ,
rank(argops.size())
1088 range =
info.template range_as_array<NDIM>();
1128 const std::array<LatticeRange, NDIM>& lattice_range,
1129 const std::array<KernelRange, NDIM>&
range,
1133 const int rank0 = coeff.
dim(0);
1135 std::vector<std::size_t> per;
1136 for (std::size_t
d = 0;
d <
NDIM; ++
d)
if (lattice_range[
d]) per.push_back(
d);
1138 "images_only: the operator has no lattice-summed axis, so there are no images to sum");
1142 for (std::size_t
d = 0;
d <
NDIM; ++
d)
1144 "images_only: a range-restricted kernel is not supported");
1145 const int npat = (1 << per.size()) - 1;
1146 const int ndropped = dropped_coeff.
size() ? int(dropped_coeff.
dim(0)) : 0;
1148 ops.resize(std::size_t(rank0) * npat + ndropped);
1153 const Q c = std::pow(sqrt(e_mu/
pi),
static_cast<int>(
NDIM));
1155 for (std::size_t
d = 0;
d <
NDIM; ++
d) {
1157 if (lattice_range[
d]) {
1158 const int bit = int(std::find(per.begin(), per.end(),
d) - per.begin());
1162 lattice_range[
d], bloch_k[
d],
range[
d], images));
1165 for (
int pat = 1; pat <= npat; ++pat)
1166 for (
int mu = 0;
mu < rank0; ++
mu)
1167 set_term(
ops[std::size_t(pat - 1) * rank0 +
mu], coeff(
mu), expnt(
mu), pat);
1168 for (
int mu = 0;
mu < ndropped; ++
mu)
1169 set_term(
ops[std::size_t(rank0) * npat +
mu], -dropped_coeff(
mu), dropped_expnt(
mu), 0);
1188 ,
rank(coeff.dim(0))
1202 Q c = std::pow(sqrt(expnt(
mu)/
pi),
static_cast<int>(
NDIM));
1208 for (std::size_t
d=0;
d<
NDIM; ++
d) {
1210 lattice_range[
d], bloch_k[
d],
range[
d]));
1219 timer_full.
print(
"op full tensor ");
1277 return getop(n,
d, source_key)->norm;
1295 double result = 0.0;
1296 std::size_t nadjacent = 0;
1297 for (
const auto&
d : disp) {
1299 result = std::max(result,
norm(n,
d, source_key));
1303 MADNESS_CHECK_THROW(nadjacent > 0,
"SeparatedConvolution::norm_bound: the rest-of-crystal displacements do not start with the image-adjacent ones (see Displacements::sort_displacements_images)");
1314 template<
size_t FDIM>
1315 typename std::enable_if<FDIM!=NDIM, Key<NDIM> >
::type
1331 template<
size_t FDIM>
1332 typename std::enable_if<FDIM==NDIM, Key<NDIM> >
::type
1344 template <
typename T,
size_t FDIM>
1350 template <
typename T,
size_t FDIM>
1360 template <
typename T,
size_t LDIM>
1372 template <
typename T,
size_t LDIM>
1381 template<
typename argT>
1394 template <
typename T>
1409 if (coeff.
dim(0) ==
k) {
1425 tol = 0.01*tol/
rank;
1448 if (muop.
norm > tol) {
1450 Q fac =
ops[
mu].getfac();
1456 r(
s0).gaxpy(1.0,r0,1.0);
1476 template<
typename T>
1487 const std::vector<Slice> s00(coeff.
ndim(),
Slice(0,
k-1));
1507 tol = tol/
rank*0.01;
1515 for (
int r=0; r<coeff.
rank(); ++r) {
1535 Q fac =
ops[
mu].getfac();
1537 tol/
std::abs(fac), fac, work1, work2);
1542 final.get_svdtensor().ref_vector(
particle()-1)(s)=result;
1557 final.reduce_rank(tol2*0.5);
1572 template <
typename T>
1576 double tol,
double tol2)
const {
1589 if (coeff.
dim(0) ==
k) {
1620 std::list<GenTensor<T> > r_list;
1621 std::list<GenTensor<T> > r0_list;
1630 if (muop.
norm > tol) {
1645 Q fac =
ops[
mu].getfac();
1647 tol/
std::abs(fac), fac, work1, work2);
1651 r_list.push_back(r);
1652 r0_list.push_back(r0);
1661 if (r_list.size()>0) r_list.front()(
s0)+=result0;
1680 template<
typename T>
1684 double tol,
double tol2)
const {
1687 if (2*
NDIM==coeff.
ndim())
return 1.5;
1696 const double full_operator_cost=
pow(coeff.
dim(0),
NDIM+1);
1697 const double low_operator_cost=
pow(coeff.
dim(0),
NDIM/2+1);
1698 const double low_reduction_cost=
pow(coeff.
dim(0),
NDIM/2);
1700 double full_cost=0.0;
1701 double low_cost=0.0;
1703 long initial_rank=0;
1704 long final_rank=sqrt(coeff.
size())*0.05;
1710 if (muop.
norm > tol) {
1716 initial_rank+=nterms;
1718 full_cost+=full_operator_cost;
1721 low_cost=initial_rank*low_operator_cost + initial_rank*final_rank*low_reduction_cost;
1725 if (low_cost>0.0) ratio=full_cost/low_cost;
1741 const Key<NDIM>&
shift,
double tol,
bool do_R,
bool do_T)
const {
1743 if (not (do_R or do_T)) {
1744 print(
"no operator requested in make_tt_representation??");
1756 for (std::size_t
d=0;
d<
NDIM; ++
d) Rnorm *=
op->muops[
mu].ops[
d]->Rnorm;
1757 if (Rnorm>1.e-20) hi=
mu;
1758 if ((Rnorm<1.e-20) and (
mu<hi))
lo=
mu;
1763 long rank_eff=(hi-
lo);
1765 if (do_R and do_T) {
1780 for (
int mu=
lo, r=0;
mu<hi; ++
mu, ++r) {
1782 const Q fac =
ops[
mu].getfac();
1783 const Slice sr0(step*r, step*r, 0);
1784 const Slice sr1(step*r+step-1,step*r+step-1,0);
1785 const Slice s00(0,
k-1,1);
1788 cores[0](
_,
_ ,sr0)=muop.
ops[0]->R;
1789 for (std::size_t idim=1; idim<
NDIM-1; ++idim) {
1790 cores[idim](sr0,
_ ,
_ ,sr0)=muop.
ops[idim]->R;
1796 cores[0](s00,s00,sr1)=muop.
ops[0]->T;
1797 for (std::size_t idim=1; idim<
NDIM-1; ++idim) {
1798 cores[idim](sr1,s00,s00,sr1)=muop.
ops[idim]->T;
1800 cores[
NDIM-1](sr1,s00,s00)=muop.
ops[
NDIM-1]->T*(-fac);
1851 MADNESS_EXCEPTION(
"unknown combination of SeparatedConvolutions: feel free to extend in operator.h",1);
1868 "SeparatedConvolution::combine: a rest-of-crystal operator (OperatorInfo::images_only) cannot be combined");
1870 for (std::size_t i = 0; i <
NDIM; ++i) {
1882 if (left and right) {
1883 return combine(*left, *right);
1907 const std::array<KernelRange, 3>& kernel_ranges = std::array<KernelRange, 3>(),
1911 lattice_ranges,
k,
false, bloch_k);
1924 const std::array<KernelRange, 3>& kernel_ranges = std::array<KernelRange, 3>(),
1928 lattice_ranges,
k,
false, bloch_k);
1958 template <std::
size_t NDIM>
1960 SeparatedConvolution<double,NDIM>
1965 if (world.
rank()==0)
print(
"the accuracy in BSHOperator is too small, tighten the threshold",eps);
1972 template <std::
size_t NDIM>
1974 SeparatedConvolution<double,NDIM>*
1979 if (world.
rank()==0)
print(
"the accuracy in BSHOperator is too small, tighten the threshold",eps);
1987 static inline SeparatedConvolution<double,3>
2002 const std::array<KernelRange, 3>& kernel_ranges = std::array<KernelRange, 3>(),
2008 lattice_ranges,
k,
false, bloch_k);
2018 const std::array<KernelRange, 3>& kernel_ranges = std::array<KernelRange, 3>(),
2024 lattice_ranges,
k,
false, bloch_k);
2028 static inline SeparatedConvolution<double,3>
2036 double mu,
double lo,
double eps,
2043 double mu,
double lo,
double eps,
2050 template<std::
size_t NDIM=3>
2052 double mu,
double lo,
double eps,
2061 template<std::
size_t NDIM>
2063 double mu,
double lo=0.0,
double eps=0.0,
2072 template<std::
size_t NDIM>
2074 double mu,
double lo=0.0,
double eps=0.0,
2083 template<std::
size_t NDIM>
2085 double mu,
double lo,
double eps,
2094 double mu,
double lo,
double eps,
2104 double mu,
double lo,
double eps,
2115 static inline SeparatedConvolution<double,3>
2126 static inline SeparatedConvolution<double,3>*
2138 static inline SeparatedConvolution<double,3>*
2150 static inline SeparatedConvolution<double,3>
2165 double exponent = 1.0/(2.0*eps);
2167 exponents(0
L) = exponent;
2168 coeffs(0
L)=
pow(exponent/M_PI,0.5*3.0);
2174 template<std::
size_t NDIM>
2180 double exponent = 1.0/(2.0*eps);
2182 exponents(0
L) = exponent;
2183 coeffs(0
L)=
pow(exponent/M_PI,0.5*
NDIM);
2197 double hi = cell_width.
normf();
2200 const auto lattice_summed_any = std::any_of(lattice_ranges.begin(), lattice_ranges.end(), [](
const auto&
b) { return static_cast<bool>(b);});
2201 const auto infinite_any = std::any_of(lattice_ranges.begin(), lattice_ranges.end(), [](
const auto&
b) { return b.infinite();});
2203 if (lattice_summed_any) {
2212 fit.truncate_mixed_expansion(coeff, expnt, lattice_ranges, cell_width,
lo, hi_fin, eps);
2225 std::vector< std::shared_ptr< SeparatedConvolution<double,3> > >
2235 double hi = width.
normf();
2237 const auto lattice_sum_any = std::any_of(lattice_ranges.begin(), lattice_ranges.end(), [](
const LatticeRange&
b){ return static_cast<bool>(b); });
2238 const auto infinite_any = std::any_of(lattice_ranges.begin(), lattice_ranges.end(), [](
const LatticeRange&
b){ return b.infinite(); });
2239 if (lattice_sum_any) {
2248 fit.truncate_mixed_expansion(coeff, expnt, lattice_ranges, width,
lo,
lattice_finite_reach(lattice_ranges, width), eps);
2251 int rank = coeff.
dim(0);
2253 std::vector<real_convolution_3d_ptr> gradG(3);
2256 std::vector<ConvolutionND<double, 3>> ops(rank);
2257 for (
int mu = 0;
mu < rank;
mu++) {
2259 double c = std::pow(sqrt(expnt(
mu) /
pi), 3);
2260 ops[
mu].setfac(coeff(
mu) /
c / width[
dir]);
2262 for (
int d = 0;
d < 3;
d++) {
2265 k, expnt(
mu) * width[
d] * width[
d], 0,
2266 lattice_ranges[
d]));
2269 k, expnt(
mu) * width[
dir] * width[
dir], 1,
2270 lattice_ranges[
dir]));
2285 std::vector< std::shared_ptr< SeparatedConvolution<double,3> > >
2296 double hi = width.
normf();
2298 bool lattice_sum_any = std::any_of(lattice_ranges.begin(), lattice_ranges.end(), [](
const LatticeRange&
b){ return b.get_range(); });
2299 const auto infinite_any = std::any_of(lattice_ranges.begin(), lattice_ranges.end(), [](
const LatticeRange&
b){ return b.infinite(); });
2300 if (lattice_sum_any) {
2309 fit.truncate_mixed_expansion(coeff, expnt, lattice_ranges, width,
lo,
lattice_finite_reach(lattice_ranges, width), eps);
2312 int rank = coeff.
dim(0);
2314 std::vector<real_convolution_3d_ptr> gradG(3);
2317 std::vector<ConvolutionND<double, 3>> ops(rank);
2318 for (
int mu = 0;
mu < rank;
mu++) {
2320 double c = std::pow(sqrt(expnt(
mu) /
pi), 3);
2321 ops[
mu].setfac(coeff(
mu) /
c / width[
dir]);
2323 for (
int d = 0;
d < 3;
d++) {
2326 k, expnt(
mu) * width[
d] * width[
d], 0,
2327 lattice_ranges[
d]));
2330 k, expnt(
mu) * width[
dir] * width[
dir], 1,
2331 lattice_ranges[
dir]));
2343 template <
class Archive,
class T, std::
size_t NDIM>
2352 template <
class Archive,
class T, std::
size_t NDIM>
double w(double t, double eps)
Definition DKops.h:22
double q(double t)
Definition DKops.h:18
Provides routines for internal use optimized for aligned data.
long dim(int i) const
Returns the size of dimension i.
Definition basetensor.h:147
long ndim() const
Returns the number of dimensions in the tensor.
Definition basetensor.h:144
long size() const
Returns the number of elements in the tensor.
Definition basetensor.h:138
Provides the common functionality/interface of all 1D convolutions.
Definition convolution1d.h:273
Array of 1D convolutions (one / dimension)
Definition convolution1d.h:612
void setop(int dim, const std::shared_ptr< Convolution1D< Q > > &op)
Definition convolution1d.h:629
void setfac(Q value)
Definition convolution1d.h:637
Holds displacements for applying operators to avoid replicating for all operators.
Definition displacements.h:80
const std::vector< Key< NDIM > > & get_disp(Level n, const array_of_bools< NDIM > &kernel_lattice_sum_axes)
Definition displacements.h:353
const std::vector< Key< NDIM > > & get_disp_images(Level n, const array_of_bools< NDIM > &kernel_lattice_sum_axes)
Definition displacements.h:372
FunctionCommonData holds all Function data common for given k.
Definition function_common_data.h:52
Tensor< double > h0
Definition function_common_data.h:105
Tensor< double > h1
Definition function_common_data.h:105
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:101
static const Tensor< double > & get_cell_width()
Returns the width of each user cell dimension.
Definition funcdefaults.h:390
A multiresolution adaptive numerical function.
Definition mra.h:140
static GFit BSHFit(double mu, double lo, double hi, double eps, bool prnt=false)
return a fit for the bound-state Helmholtz function
Definition gfit.h:119
static GFit CoulombFit(double lo, double hi, double eps, bool prnt=false)
return a fit for the Coulomb function
Definition gfit.h:104
Definition lowranktensor.h:59
long dim(const int i) const
return the number of entries in dimension i
Definition lowranktensor.h:391
long ndim() const
Definition lowranktensor.h:386
constexpr bool is_full_tensor() const
Definition gentensor.h:224
void reduce_rank(const double &)
Definition gentensor.h:217
long rank() const
Definition gentensor.h:212
long size() const
Definition lowranktensor.h:488
SVDTensor< T > & get_svdtensor()
Definition gentensor.h:228
const BaseTensor * ptr() const
might return a NULL pointer!
Definition lowranktensor.h:715
IsSupported< TensorTypeData< Q >, GenTensor< T > & >::type scale(Q fac)
Inplace multiplication by scalar of supported type (legacy name)
Definition lowranktensor.h:426
constexpr bool is_svd_tensor() const
Definition gentensor.h:222
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:71
Key< NDIM+LDIM > merge_with(const Key< LDIM > &rhs) const
merge with other key (ie concatenate), use level of rhs, not of this
Definition key.h:563
const Vector< Translation, NDIM > & translation() const
Definition key.h:175
void break_apart(Key< LDIM > &key1, Key< KDIM > &key2) const
break key into two low-dimensional keys
Definition key.h:500
Denotes lattice summation over range [-N, N]; N=0 is equivalent to including the simulation cell only...
Definition kernelrange.h:17
Tensor< T > & ref_vector(const unsigned int &idim)
return reference to one of the vectors F
Definition srconf.h:530
int dim_per_vector(int idim) const
return the number of physical dimensions
Definition srconf.h:665
static int max_sigma(const double &thresh, const long &rank, const Tensor< double > &w)
Definition srconf.h:109
Definition SVDTensor.h:42
Definition operator.h:156
double norm_bound(Level n, const Key< NDIM > &source_key) const
Definition operator.h:1289
SeparatedConvolution(World &world, const Tensor< Q > &coeff, const Tensor< double > &expnt, double lo, double thresh, const std::array< LatticeRange, NDIM > &lattice_ranges=FunctionDefaults< NDIM >::get_bc().lattice_range(), int k=FunctionDefaults< NDIM >::get_k(), bool doleaves=false, double mu=0.0)
Constructor for Gaussian Convolutions (mostly for backward compatability)
Definition operator.h:1173
Timer timer_low_transf
Definition operator.h:183
bool destructive_
destroy the argument or restore it (expensive for 6d functions)
Definition operator.h:177
GenTensor< TENSOR_RESULT_TYPE(T, Q)> apply2(const Key< NDIM > &source, const Key< NDIM > &shift, const GenTensor< T > &coeff, double tol, double tol2) const
apply this operator on coefficients in low rank form
Definition operator.h:1573
std::array< KernelRange, NDIM > range
kernel range is along axis d is limited by range[d] if it's nonnull
Definition operator.h:172
const array_of_bools< NDIM > & lattice_summed() const
Definition operator.h:1265
int particle_
must only be 1 or 2
Definition operator.h:176
void muopxv_fast2(Level n, const ConvolutionData1D< Q > *const ops_1d[NDIM], const GenTensor< T > &f, const GenTensor< T > &f0, GenTensor< TENSOR_RESULT_TYPE(T, Q)> &result, GenTensor< TENSOR_RESULT_TYPE(T, Q)> &result0, double tol, const Q mufac, GenTensor< TENSOR_RESULT_TYPE(T, Q)> &work1, GenTensor< TENSOR_RESULT_TYPE(T, Q)> &work2) const
Apply one of the separated terms, accumulating into the result.
Definition operator.h:592
const double & gamma() const
Definition operator.h:218
GenTensor< TENSOR_RESULT_TYPE(T, Q)> apply2_lowdim(const Key< NDIM > &source, const Key< NDIM > &shift, const GenTensor< T > &coeff, double tol, double tol2) const
apply this operator on only 1 particle of the coefficients in low rank form
Definition operator.h:1477
std::vector< ConvolutionND< Q, NDIM > > ops
ConvolutionND keeps data for 1 term, all dimensions, 1 displacement.
Definition operator.h:190
Function< TENSOR_RESULT_TYPE(T, Q), LDIM+LDIM > operator()(const Function< T, LDIM > &f1, const Function< Q, LDIM > &f2) const
apply this operator on a separable function f(1,2) = f(1) f(2)
Definition operator.h:1362
const SeparatedConvolutionData< Q, NDIM > * getop(Level n, const Key< NDIM > &d, const Key< NDIM > &source) const
get the data for all terms and all dimensions for one displacement
Definition operator.h:827
void set_domain_periodicity(const array_of_bools< NDIM > &domain_is_periodic)
Definition operator.h:1271
const double & mu() const
Definition operator.h:219
double munorm2(Level n, const ConvolutionData1D< Q > *ops[]) const
Definition operator.h:679
const bool & destructive() const
Definition operator.h:216
Timer timer_stats_accumulate
Definition operator.h:185
SimpleCache< SeparatedConvolutionData< Q, NDIM >, NDIM > data
cache for all terms, dims and displacements
Definition operator.h:199
std::enable_if< FDIM!=NDIM, Key< NDIM > >::type get_source_key(const Key< FDIM > key) const
return that part of a hi-dim key that serves as the base for displacements of this operator
Definition operator.h:1316
double munorm2_ns(Level n, const ConvolutionData1D< Q > *ops[]) const
Definition operator.h:687
std::enable_if< FDIM==NDIM, Key< NDIM > >::type get_source_key(const Key< FDIM > key) const
return that part of a hi-dim key that serves as the base for displacements of this operator
Definition operator.h:1333
static FitCoeffs make_coeff_for_operator(World &world, OperatorInfo &info, const std::array< LatticeRange, NDIM > &lattice_ranges)
Definition operator.h:251
virtual ~SeparatedConvolution()
Definition operator.h:1215
void muopxv_fast(ApplyTerms at, const ConvolutionData1D< Q > *const ops_1d[NDIM], const Tensor< T > &f, const Tensor< T > &f0, Tensor< TENSOR_RESULT_TYPE(T, Q)> &result, Tensor< TENSOR_RESULT_TYPE(T, Q)> &result0, const double tol, const Q mufac, Tensor< TENSOR_RESULT_TYPE(T, Q)> &work1, Tensor< TENSOR_RESULT_TYPE(T, Q)> &work2) const
Apply one of the separated terms, accumulating into the result.
Definition operator.h:481
SimpleCache< SeparatedConvolutionData< Q, NDIM >, 2 *NDIM > mod_data
cache for all terms, dims and displacements
Definition operator.h:200
argT operator()(const argT &argument) const
apply this onto another suitable argument, returning the same type
Definition operator.h:1382
Timer timer_full
Definition operator.h:182
const array_of_bools< NDIM > & func_domain_is_periodic() const
Definition operator.h:1268
SeparatedConvolution< Q, NDIM > & set_particle(const int p)
Definition operator.h:209
bool images_only_
OperatorInfo::images_only as consumed at construction; what the 1D factors were built with.
Definition operator.h:171
SeparatedConvolution(World &world, const std::vector< std::shared_ptr< Convolution1D< Q > > > &argops, long k=FunctionDefaults< NDIM >::get_k(), bool doleaves=false)
Definition operator.h:1020
Function< TENSOR_RESULT_TYPE(T, Q), LDIM+LDIM > operator()(const std::vector< Function< T, LDIM > > &f1, const std::vector< Function< Q, LDIM > > &f2) const
apply this operator on a sum of separable functions f(1,2) = \sum_i f_i(1) f_i(2)
Definition operator.h:1374
void init_lattice_summed()
Definition operator.h:993
Q opT
The apply function uses this to infer resultT=opT*inputT.
Definition operator.h:159
void initialize(const Tensor< Q > &coeff, const Tensor< double > &expnt, std::array< LatticeRange, NDIM > lattice_range, std::array< KernelRange, NDIM > range={}, const Vector< double, NDIM > &bloch_k=Vector< double, NDIM >(0.0))
Definition operator.h:1197
const SeparatedConvolutionInternal< Q, NDIM > getmuop(int mu, Level n, const Key< NDIM > &disp) const
get the transformation matrices for 1 term and all dimensions and one displacement
Definition operator.h:771
const SeparatedConvolutionData< Q, NDIM > * getop_ns(Level n, const Key< NDIM > &d) const
get the data for all terms and all dimensions for one displacement
Definition operator.h:841
const std::vector< long > v2k
Definition operator.h:195
const std::array< KernelRange, NDIM > & get_range() const
Definition operator.h:223
int get_rank() const
Definition operator.h:220
Function< TENSOR_RESULT_TYPE(T, Q), FDIM > operator()(const Function< T, FDIM > &f) const
apply this operator on a function f
Definition operator.h:1345
bool doleaves
If should be applied to leaf coefficients ... false by default.
Definition operator.h:163
void print_timer() const
Definition operator.h:1217
SeparatedConvolution(World &world, const std::vector< ConvolutionND< Q, NDIM > > &argops, long k=FunctionDefaults< NDIM >::get_k(), bool doleaves=false)
Definition operator.h:1049
const std::vector< Key< NDIM > > & get_disp(Level n) const
Definition operator.h:1235
void apply_transformation3(const Tensor< T > trans2[NDIM], const Tensor< T > &f, const Q mufac, Tensor< R > &result) const
accumulate into result
Definition operator.h:404
static SeparatedConvolution< Q, NDIM > combine(const SeparatedConvolution< Q, NDIM > &left, const SeparatedConvolution< Q, NDIM > &right)
Definition operator.h:1859
const std::vector< long > vk
Definition operator.h:194
double norm(Level n, const Key< NDIM > &d, const Key< NDIM > &source_key) const
return the operator norm for all terms, all dimensions and 1 displacement
Definition operator.h:1274
TensorTrain< double > make_tt_representation(const Key< NDIM > &source, const Key< NDIM > &shift, double tol, bool do_R, bool do_T) const
construct the tensortrain representation of the operator
Definition operator.h:1740
void reset_timer() const
Definition operator.h:1225
static OperatorInfo combine_OT(const SeparatedConvolution< Q, NDIM > &left, const SeparatedConvolution< Q, NDIM > &right)
return operator type and other info of the combined operator (e.g. fg = f(1,2)* g(1,...
Definition operator.h:1821
GenTensor< T > upsample(const Key< FDIM > &key, const GenTensor< T > &coeff) const
upsample the sum coefficients of level 1 to sum coeffs on level n+1
Definition operator.h:963
bool print_timings
Definition operator.h:178
Timer timer_low_accumulate
Definition operator.h:184
double estimate_costs(const Key< NDIM > &source, const Key< NDIM > &shift, const GenTensor< T > &coeff, double tol, double tol2) const
estimate the ratio of cost of full rank versus low rank
Definition operator.h:1681
bool range_restricted() const
Definition operator.h:224
int get_k() const
Definition operator.h:221
Tensor< TENSOR_RESULT_TYPE(T, Q)> apply(const Key< NDIM > &source, const Key< NDIM > &shift, const Tensor< T > &coeff, double tol) const
apply this operator on coefficients in full rank form
Definition operator.h:1395
double displacement_real_distsq(const Key< NDIM > &displacement) const
Definition operator.h:1251
const std::vector< Slice > s0
Definition operator.h:196
array_of_bools< NDIM > lattice_summed_
Definition operator.h:167
void apply_transformation2(Level n, long dimk, double tol, const Tensor< T > trans2[NDIM], const GenTensor< T > &f, GenTensor< R > &work1, GenTensor< R > &work2, const Q mufac, GenTensor< R > &result) const
don't accumulate, since we want to do this at apply()
Definition operator.h:421
const int & particle() const
Definition operator.h:208
std::vector< Function< TENSOR_RESULT_TYPE(T, Q), FDIM > > operator()(const std::vector< Function< T, FDIM > > &f) const
apply this on a vector of functions
Definition operator.h:1351
const bool & modified() const
Definition operator.h:205
const FunctionCommonData< Q, NDIM > & cdata
Definition operator.h:192
bool & modified()
Definition operator.h:204
const int k
Definition operator.h:191
friend SeparatedConvolution< Q, NDIM > combine(const std::shared_ptr< SeparatedConvolution< Q, NDIM > > left, const std::shared_ptr< SeparatedConvolution< Q, NDIM > > right)
combine 2 convolution operators to one
Definition operator.h:1879
OperatorInfo info
Definition operator.h:161
Key< NDIM > keyT
Definition operator.h:180
void init_range()
Definition operator.h:980
static const size_t opdim
Definition operator.h:181
bool & destructive()
Definition operator.h:215
void apply_transformation(long dimk, const Transformation trans[NDIM], const Tensor< T > &f, Tensor< R > &work1, Tensor< R > &work2, const Q mufac, Tensor< R > &result) const
Definition operator.h:353
void check_cubic()
Definition operator.h:902
void initialize_images_only(const Tensor< Q > &coeff, const Tensor< double > &expnt, const Tensor< double > &dropped_coeff, const Tensor< double > &dropped_expnt, const std::array< LatticeRange, NDIM > &lattice_range, const std::array< KernelRange, NDIM > &range, const Vector< double, NDIM > &bloch_k)
the rest-of-crystal operator: the lattice sum with the home cell (L = 0) removed
Definition operator.h:1126
bool modified_
use modified NS form
Definition operator.h:175
int rank
Definition operator.h:193
SeparatedConvolution(World &world, const OperatorInfo info1, const std::array< LatticeRange, NDIM > &lattice_ranges=FunctionDefaults< NDIM >::get_bc().lattice_range(), int k=FunctionDefaults< NDIM >::get_k(), bool doleaves=false, const Vector< double, NDIM > &bloch_k=Vector< double, NDIM >(0.0))
Definition operator.h:1075
GenTensor< T > partial_upsample(const Key< FDIM > &key, const GenTensor< T > &coeff, const int particle) const
upsample some of the dimensions of coeff to its child indicated by key
Definition operator.h:920
double munorm2_modified(Level n, const ConvolutionData1D< Q > *ops_1d[]) const
Definition operator.h:708
int & particle()
Definition operator.h:207
static bool can_combine(const SeparatedConvolution< Q, NDIM > &left, const SeparatedConvolution< Q, NDIM > &right)
Definition operator.h:1816
const std::vector< ConvolutionND< Q, NDIM > > & get_ops() const
Definition operator.h:222
std::uint64_t displacement_distsq(const Key< NDIM > &displacement) const
Definition operator.h:1259
const SeparatedConvolutionData< Q, NDIM > * getop_modified(Level n, const Key< NDIM > &disp, const Key< NDIM > &source) const
get the data for all terms and all dimensions for one displacement (modified NS form)
Definition operator.h:874
bool images_only() const
Definition operator.h:1241
array_of_bools< NDIM > func_domain_is_periodic_
ignore periodicity of BC when applying this to function
Definition operator.h:169
const SeparatedConvolutionInternal< Q, NDIM > getmuop_modified(int mu, Level n, const Key< NDIM > &disp, const Key< NDIM > &source) const
get the transformation matrices for 1 term and all dimensions and one displacement
Definition operator.h:800
Simplified interface around hash_map to cache stuff for 1D.
Definition simplecache.h:46
A slice defines a sub-range or patch of a dimension.
Definition slice.h:103
Definition tensortrain.h:123
std::enable_if<!std::is_arithmetic< R >::value, void >::type truncate(double eps)
recompress and truncate this TT representation
Definition tensortrain.h:882
TensorTrain< T > & make_operator()
convert this into an operator representation (r,k',k,r)
Definition tensortrain.h:1187
TensorTrain< T > & make_tensor()
convert this into a tensor representation (r,k,r)
Definition tensortrain.h:1175
A tensor is a multidimensional array.
Definition tensor.h:318
float_scalar_type normf() const
Returns the Frobenius norm of the tensor.
Definition tensor.h:1727
T * ptr()
Returns a pointer to the internal data.
Definition tensor.h:1841
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type scale(Q x)
Inplace multiplication by scalar of supported type (legacy name)
Definition tensor.h:687
Definition function_common_data.h:169
void print(std::string line="") const
print timer
Definition function_common_data.h:216
void accumulate(const double time) const
accumulate timer
Definition function_common_data.h:183
void reset() const
Definition function_common_data.h:210
A simple, fixed dimension vector.
Definition vector.h:64
Implements most parts of a globally addressable object (via unique ID).
Definition world_object.h:491
void process_pending()
To be called from derived constructor to process pending messages.
Definition world_object.h:787
A parallel world class.
Definition world.h:134
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:344
unsigned long id() const
Definition world.h:324
syntactic sugar for std::array<bool, N>
Definition array_of_bools.h:19
bool any() const
Definition array_of_bools.h:38
Defines common mathematical and physical constants.
Computes most matrix elements over 1D operators (including Gaussians)
static const double R
Definition csqrt.cc:46
double(* f1)(const coord_3d &)
Definition derivatives.cc:55
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition derivatives.cc:72
double(* f2)(const coord_3d &)
Definition derivatives.cc:56
static double lo
Definition dirac-hatom.cc:23
static double shift
Definition dirac-hatom.cc:19
fit isotropic functions to a set of Gaussians with controlled precision
static const double v
Definition hatom_sf_dirac.cc:20
Tensor< double > op(const Tensor< double > &x)
Definition kain.cc:508
static double pow(const double *a, const double *b)
Definition lda.h:74
#define max(a, b)
Definition lda.h:51
#define MADNESS_RESTRICT
Definition mTxmq.h:37
#define MADNESS_CHECK(condition)
Check a condition — even in a release build the condition is always evaluated so it can have side eff...
Definition madness_exception.h:182
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
#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
#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
constexpr double pi
Mathematical constant .
Definition constants.h:48
Namespace for all elements and tools of MADNESS.
Definition DFConvergence.h:9
static SeparatedConvolution< double, 3 > SlaterF12Operator(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Definition operator.h:2029
static SeparatedConvolution< double_complex, 3 > PeriodicBSHOperator3D(World &world, Vector< double, 3 > bloch_k, double mu, double lo, double eps, const std::array< KernelRange, 3 > &kernel_ranges=std::array< KernelRange, 3 >(), const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating separated kernel for convolution with exp(-mu*r)/(4*pi*r) in 3D.
Definition operator.h:1997
double lattice_finite_reach(const std::array< LatticeRange, NDIM > &lattice_ranges, const Tensor< double > &cell_width)
Convolutions in separated form (including Gaussian)
Definition operator.h:142
std::shared_ptr< real_convolution_3d > real_convolution_3d_ptr
Definition functypedefs.h:150
static double cpu_time()
Returns the cpu time in seconds relative to an arbitrary origin.
Definition timers.h:128
SeparatedConvolution< double, 3 > real_convolution_3d
Definition functypedefs.h:136
GenTensor< TENSOR_RESULT_TYPE(R, Q)> general_transform(const GenTensor< R > &t, const Tensor< Q > c[])
Definition gentensor.h:274
void fast_transpose(long n, long m, const T *a, T *MADNESS_RESTRICT b)
a(n,m) --> b(m,n) ... optimized for smallish matrices
Definition convolution1d.h:71
static SeparatedConvolution< double, NDIM > SmoothingOperator(World &world, double eps, const std::array< LatticeRange, NDIM > &lattice_ranges=FunctionDefaults< NDIM >::get_bc().lattice_range(), int k=FunctionDefaults< NDIM >::get_k())
Definition operator.h:2175
static SeparatedConvolution< double, 3 > F2GOperator(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating separated kernel for convolution with (1/(2 mu)*(1 - exp(-mu*r)))^2/r in ...
Definition operator.h:2151
static SeparatedConvolution< double, 3 > CoulombOperator(World &world, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating separated kernel for convolution with 1/r in 3D.
Definition operator.h:1934
static SeparatedConvolution< double_complex, 3 > * PeriodicHFExchangeOperatorPtr(World &world, Vector< double, 3 > bloch_k, double lo, double eps, const std::array< KernelRange, 3 > &kernel_ranges=std::array< KernelRange, 3 >(), const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Definition operator.h:1920
static SeparatedConvolution< double, NDIM > * BSHOperatorPtr(World &world, double mu, double lo, double eps, const std::array< LatticeRange, NDIM > &lattice_ranges=FunctionDefaults< NDIM >::get_bc().lattice_range(), int k=FunctionDefaults< NDIM >::get_k())
Factory function generating separated kernel for convolution with BSH kernel in general NDIM.
Definition operator.h:1975
static SeparatedConvolution< double, 3 > * F2GOperatorPtr(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating separated kernel for convolution with (1/(2 mu)*(1 - exp(-mu*r)))^2/r in ...
Definition operator.h:2139
int64_t Translation
Definition key.h:59
Key< NDIM > displacement(const Key< NDIM > &source, const Key< NDIM > &target)
given a source and a target, return the displacement in translation
Definition key.h:609
static SeparatedConvolution< double, 3 > * SlaterOperatorPtr(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Definition operator.h:2093
static SeparatedConvolution< double, 3 > SlaterF12sqOperator(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Definition operator.h:2035
static SeparatedConvolution< double, 3 > SmoothingOperator3D(World &world, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Definition operator.h:2160
static SeparatedConvolution< double, NDIM > * SlaterOperatorPtr_ND(World &world, double mu, double lo, double eps, const std::array< LatticeRange, NDIM > &lattice_ranges=FunctionDefaults< NDIM >::get_bc().lattice_range(), int k=FunctionDefaults< NDIM >::get_k())
Definition operator.h:2084
static const Slice _(0,-1, 1)
static SeparatedConvolution< double, 3 > * SlaterF12OperatorPtr(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating separated kernel for convolution with (1 - exp(-mu*r))/(2 mu) in 3D.
Definition operator.h:2103
int Level
Definition key.h:60
@ OT_FG12
1-exp(-r)
Definition operatorinfo.h:18
@ OT_SLATER
1/r
Definition operatorinfo.h:15
@ OT_GAUSS
exp(-r)
Definition operatorinfo.h:16
@ OT_BSH
(1-exp(-r))^2/r = 1/r + exp(-2r)/r - 2 exp(-r)/r
Definition operatorinfo.h:21
@ OT_F12
exp(-r2)
Definition operatorinfo.h:17
@ OT_F212
(1-exp(-r))/r
Definition operatorinfo.h:19
@ OT_UNDEFINED
Definition operatorinfo.h:12
@ OT_G12
indicates the identity
Definition operatorinfo.h:14
@ OT_F2G12
(1-exp(-r))^2
Definition operatorinfo.h:20
static SeparatedConvolution< double_complex, 3 > PeriodicHFExchangeOperator(World &world, Vector< double, 3 > bloch_k, double lo, double eps, const std::array< KernelRange, 3 > &kernel_ranges=std::array< KernelRange, 3 >(), const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Definition operator.h:1903
static std::vector< std::shared_ptr< SeparatedConvolution< double, 3 > > > GradBSHOperator(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating operator for convolution with grad(bsh) in 3D.
Definition operator.h:2286
static SeparatedConvolution< double, 3 > * SlaterF12sqOperatorPtr(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Definition operator.h:2042
TensorType
low rank representations of tensors (see gentensor.h)
Definition gentensor.h:120
@ TT_2D
Definition gentensor.h:120
NDIM & f
Definition mra.h:2664
static SeparatedConvolution< double, NDIM > SlaterOperator(World &world, double mu, double lo, double eps, const std::array< LatticeRange, NDIM > &lattice_ranges=FunctionDefaults< NDIM >::get_bc().lattice_range(), int k=FunctionDefaults< NDIM >::get_k())
Factory function generating separated kernel for convolution with exp(-mu*r) in 3D.
Definition operator.h:2051
GenTensor< T > reduce(std::list< GenTensor< T > > &addends, double, bool=false)
add all the GenTensors of a given list
Definition gentensor.h:246
LatticeImages
Which lattice translations a lattice-summed 1D kernel includes.
Definition convolution1d.h:260
@ home_only
R = 0 only; still lattice_summed(), so the displacements stay on the non-periodic domain.
@ exclude_home
R != 0 only.
@ all
R = -maxR..maxR, the ordinary lattice sum.
void print(const T &t, Ts &&... ts)
Print items to std::cout (items separated by spaces) and terminate with a new line.
Definition print.h:232
static SeparatedConvolution< double, NDIM > BSHOperator(World &world, double mu, double lo, double eps, const std::array< LatticeRange, NDIM > &lattice_ranges=FunctionDefaults< NDIM >::get_bc().lattice_range(), int k=FunctionDefaults< NDIM >::get_k())
Factory function generating separated kernel for convolution with BSH kernel in general NDIM.
Definition operator.h:1961
static SeparatedConvolution< double, 3 > * CoulombOperatorPtr(World &world, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating separated kernel for convolution with 1/r in 3D.
Definition operator.h:1947
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:896
static SeparatedConvolution< double, 3 > FGOperator(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating separated kernel for convolution with 1/(2 mu)*(1 - exp(-mu*r))/r in 3D.
Definition operator.h:2116
static SeparatedConvolution< double_complex, 3 > * PeriodicBSHOperatorPtr3D(World &world, Vector< double, 3 > bloch_k, double mu, double lo, double eps, const std::array< KernelRange, 3 > &kernel_ranges=std::array< KernelRange, 3 >(), const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating separated kernel for convolution with exp(-mu*r)/(4*pi*r) in 3D.
Definition operator.h:2013
static SeparatedConvolution< double, NDIM > GaussOperator(World &world, double mu, double lo=0.0, double eps=0.0, const std::array< LatticeRange, NDIM > &lattice_ranges=FunctionDefaults< NDIM >::get_bc().lattice_range(), int k=FunctionDefaults< NDIM >::get_k())
Factory function generating separated kernel for convolution with exp(-mu*r*r)
Definition operator.h:2062
static SeparatedConvolution< double, 3 > * BSHOperatorPtr3D(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating separated kernel for convolution with exp(-mu*r)/(4*pi*r) in 3D.
Definition operator.h:2190
static SeparatedConvolution< double, NDIM > * GaussOperatorPtr(World &world, double mu, double lo=0.0, double eps=0.0, const std::array< LatticeRange, NDIM > &lattice_ranges=FunctionDefaults< NDIM >::get_bc().lattice_range(), int k=FunctionDefaults< NDIM >::get_k())
Factory function generating separated kernel for convolution with exp(-mu*r*r) in 3D.
Definition operator.h:2073
static SeparatedConvolution< double, 3 > BSHOperator3D(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating separated kernel for convolution with exp(-mu*r)/(4*pi*r) in 3D.
Definition operator.h:1988
static SeparatedConvolution< double, 3 > * FGOperatorPtr(World &world, double mu, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating separated kernel for convolution with 1/(2 mu)*(1 - exp(-mu*r))/r in 3D.
Definition operator.h:2127
static std::vector< std::shared_ptr< SeparatedConvolution< double, 3 > > > GradCoulombOperator(World &world, double lo, double eps, const std::array< LatticeRange, 3 > &lattice_ranges=FunctionDefaults< 3 >::get_bc().lattice_range(), int k=FunctionDefaults< 3 >::get_k())
Factory function generating operator for convolution with grad(1/r) in 3D.
Definition operator.h:2226
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:2229
void mTxmq(long dimi, long dimj, long dimk, double *MADNESS_RESTRICT c, const double *a, const double *b, long ldb)
Explicit template specializations for homogeneous types (implemented in mTxmq.cc)
Definition mTxmq.cc:551
static const string dir
Definition corepotential.cc:249
static void aligned_axpy(long n, T *MADNESS_RESTRICT a, const T *MADNESS_RESTRICT b, Q s)
Definition aligned.h:75
static long abs(long a)
Definition tensor.h:219
static Function< T, NDIM > diff(const Function< T, NDIM > &f, int axis)
Definition navstokes_cosines.cc:119
const double mu
Definition navstokes_cosines.cc:95
static const double b
Definition nonlinschro.cc:119
static const double d
Definition nonlinschro.cc:121
static const double a
Definition nonlinschro.cc:118
double Q(double a)
Definition relops.cc:20
static const double c
Definition relops.cc:10
static const double L
Definition rk.cc:46
static const double thresh
Definition rk.cc:45
static const long k
Definition rk.cc:44
Definition test_ccpairfunction.cc:22
!!! Note that if Rnormf is zero then ALL of the tensors are empty
Definition convolution1d.h:163
double N_up
Definition convolution1d.h:174
double N_F
the norms according to Beylkin 2008, Eq. (21) ff
Definition convolution1d.h:174
double N_diff
Definition convolution1d.h:174
Definition convolution1d.h:1017
Definition operatorinfo.h:58
double hi
Definition operatorinfo.h:67
double thresh
Definition operatorinfo.h:65
OpType type
introspection
Definition operatorinfo.h:66
double mu
some introspection
Definition operatorinfo.h:63
bool images_only
Definition operatorinfo.h:74
std::vector< KernelRange > range
Definition operatorinfo.h:68
std::optional< bool > truncate_lowexp_gaussians
Definition operatorinfo.h:70
double lo
Definition operatorinfo.h:64
SeparatedConvolutionData keeps data for all terms, all dimensions.
Definition operator.h:93
std::vector< SeparatedConvolutionInternal< Q, NDIM > > muops
Definition operator.h:94
SeparatedConvolutionData(int rank)
Definition operator.h:97
double norm
Definition operator.h:95
SeparatedConvolutionData(const SeparatedConvolutionData< Q, NDIM > &q)
Definition operator.h:98
double norm
Definition operator.h:85
const ConvolutionData1D< Q > * ops[NDIM]
Definition operator.h:86
laziness for calling lists: which terms to apply
Definition operator.h:229
bool t_term
Definition operator.h:232
bool r_term
Definition operator.h:231
bool any_terms() const
Definition operator.h:233
ApplyTerms()
Definition operator.h:230
Definition operator.h:245
Tensor< double > coeff
Definition operator.h:246
Tensor< double > expnt
Definition operator.h:246
Tensor< double > dropped_expnt
Definition operator.h:247
Tensor< double > dropped_coeff
Definition operator.h:247
World & world
Memoized reference to the world to which this object belongs.
Definition world_object.h:348
World & get_world() const
Definition world_object.h:446
static void load(const Archive &ar, const SeparatedConvolution< T, NDIM > *&ptr)
Definition operator.h:2345
Default load of an object via serialize(ar, t).
Definition archive.h:667
static void store(const Archive &ar, const SeparatedConvolution< T, NDIM > *const &ptr)
Definition operator.h:2354
Default store of an object via serialize(ar, t).
Definition archive.h:612
Definition lowrankfunction.h:336
void doit(World &world)
Definition tdse.cc:921
Prototypes for a partial interface from Tensor to LAPACK.
int factorial(int n)
Definition test_BSHApply.cc:14
AtomicInt sum
Definition test_atomicint.cc:46
void e()
Definition test_sig.cc:75
double aa
Definition testbsh.cc:68
static const double pi
Definition testcosine.cc:6
std::vector< double > fit(size_t m, size_t n, const std::vector< double > N, const std::vector< double > &f)
Definition testfuns.cc:36
constexpr std::size_t NDIM
Definition testgconv.cc:54
double h(const coord_1d &r)
Definition testgconv.cc:175
double source(const coordT &r)
Definition testperiodic.cc:48
#define TENSOR_RESULT_TYPE(L, R)
This macro simplifies access to TensorResultType.
Definition type_data.h:205
#define PROFILE_MEMBER_FUNC(classname)
Definition worldprofile.h:210