32#ifndef MADNESS_TENSOR_TENSOR_H__INCLUDED
33#define MADNESS_TENSOR_TENSOR_H__INCLUDED
65#ifdef ENABLE_GENTENSOR
66#define HAVE_GENTENSOR 1
68#define HAVE_GENTENSOR 0
216#ifndef HAVE_STD_ABS_LONG
219 static long abs(
long a) {
220 return a>=0 ?
a : -
a;
225 static long abs(
long a) {
234#define IS_ODD(n) ((n)&0x1)
235#define IS_UNALIGNED(p) (((unsigned long)(p))&0x7)
239 template <
typename Q,
bool iscomplex>
247 template <
typename Q>
255 template <
typename Q>
264 template <
typename T=
int>
double mynorm(
int t) {
265 return double(t)*double(t);
268 template <
typename T> T
mynorm(std::complex<T> t) {
273 template <
class T>
class SliceTensor;
278#ifdef TENSOR_USE_SHARED_ALIGNED_ARRAY
279#define TENSOR_SHARED_PTR detail::SharedAlignedArray
288 template <
typename T>
class SharedAlignedArray {
291 void dec() {
if (
p && ((*cnt)-- == 1)) {free(
p);
p = 0;}}
292 void inc() {
if (
p) (*cnt)++;}
294 SharedAlignedArray() :
p(0), cnt(0) {}
295 T* allocate(std::size_t size,
unsigned int alignment) {
296 std::size_t
offset = (size*
sizeof(T)-1)/
sizeof(AtomicInt) + 1;
297 std::size_t nbyte = (
offset+1)*
sizeof(AtomicInt);
299 cnt = (AtomicInt*)(
p) +
offset;
303 SharedAlignedArray<T>& operator=(
const SharedAlignedArray<T>& other) {
304 if (
this != &other) {dec();
p = other.p; cnt = other.cnt; inc();}
307 void reset() {dec();
p = 0;}
308 ~SharedAlignedArray() {dec();}
312#define TENSOR_SHARED_PTR std::shared_ptr
337 for (
int i=0; i<nd; ++i) {
338 TENSOR_ASSERT(
d[i]>=0 &&
d[i]<268435456,
"invalid dimension size in new tensor",
d[i],0);
345#define TENSOR_ALIGNMENT 16
347#define TENSOR_ALIGNMENT 32
348#elif MADNESS_HAVE_AVX2
351#define TENSOR_ALIGNMENT 32
352#elif MADNESS_HAVE_AVX512
354#define TENSOR_ALIGNMENT 64
357#define TENSOR_ALIGNMENT 64
360#ifdef TENSOR_USE_SHARED_ALIGNED_ARRAY
362#elif defined WORLD_GATHER_MEM_STATS
374 std::printf(
"new failed nd=%ld type=%ld size=%ld\n", nd,
id(),
_size);
375 std::printf(
" %ld %ld %ld %ld %ld %ld\n",
376 d[0],
d[1],
d[2],
d[3],
d[4],
d[5]);
385 memset((
void *)
_p, 0,
_size*
sizeof(T));
492 explicit Tensor(
long d0,
long d1,
long d2) :
_p(0) {
503 explicit Tensor(
long d0,
long d1,
long d2,
long d3) :
_p(0) {
515 explicit Tensor(
long d0,
long d1,
long d2,
long d3,
long d4) :
_p(0) {
528 explicit Tensor(
long d0,
long d1,
long d2,
long d3,
long d4,
long d5) {
537 explicit Tensor(
const std::vector<long>&
d,
bool dozero=
true) :
_p(0) {
538 allocate(
d.size(),
d.size() ? &(
d[0]) : 0, dozero);
546 explicit Tensor(
long nd,
const long d[],
bool dozero=
true) :
_p(0) {
572 template <
typename Q>
582 template <
typename Q>
592 template <
typename Q>
604 template <
typename Q>
616 template <
typename Q>
629 template <
typename Q>
642 template <
typename Q>
655 template <
typename Q>
658 return (*
this) + (-x);
674 template <
typename Q>
685 template <
typename Q>
695 template <
typename Q>
706 template <
typename Q>
727 madness::RandomVector<T>(
size(),
ptr());
770#ifdef TENSOR_BOUNDS_CHECKING
782#ifdef TENSOR_BOUNDS_CHECKING
793#ifdef TENSOR_BOUNDS_CHECKING
804#ifdef TENSOR_BOUNDS_CHECKING
815#ifdef TENSOR_BOUNDS_CHECKING
827#ifdef TENSOR_BOUNDS_CHECKING
840#ifdef TENSOR_BOUNDS_CHECKING
854#ifdef TENSOR_BOUNDS_CHECKING
869#ifdef TENSOR_BOUNDS_CHECKING
885#ifdef TENSOR_BOUNDS_CHECKING
903#ifdef TENSOR_BOUNDS_CHECKING
922#ifdef TENSOR_BOUNDS_CHECKING
942#ifdef TENSOR_BOUNDS_CHECKING
963#ifdef TENSOR_BOUNDS_CHECKING
984 const T&
operator()(
long i,
long j,
long k,
long l,
long m,
long n)
const {
985#ifdef TENSOR_BOUNDS_CHECKING
1005#ifdef TENSOR_BOUNDS_CHECKING
1006 TENSOR_ASSERT(i>=0 && i<
_dim[0],
"non-PC general indexing bounds check failed dim=",
d,
this);
1021#ifdef TENSOR_BOUNDS_CHECKING
1022 TENSOR_ASSERT(i>=0 && i<
_dim[0],
"non-PC general indexing bounds check failed dim=",
d,
this);
1034 TENSOR_ASSERT(ind.size()>=(
unsigned int)
_ndim,
"invalid number of dimensions",ind.size(),
this);
1048 TENSOR_ASSERT(ind.size()>=(
unsigned int)
_ndim,
"invalid number of dimensions",ind.size(),
this);
1062 TENSOR_ASSERT(s.size()>=(
unsigned)(this->ndim()),
"invalid number of dimensions",
1072 TENSOR_ASSERT(s.size()>=(
unsigned)(this->ndim()),
"invalid number of dimensions",
1328 const Slice& s3)
const {
1342 Slice s[5] = {
s0,s1,s2,s3,s4};
1353 Slice s[5] = {
s0,s1,s2,s3,s4};
1364 Slice s[6] = {
s0,s1,s2,s3,s4,s5};
1376 Slice s[6] = {
s0,s1,s2,s3,s4,s5};
1407 return reshape(
d.size(),
d.size() ? &
d[0] : 0);
1415 return reshape(
d.size(),
d.size() ? &
d[0] : 0);
1441 long d[2] = {dim0,dim1};
1451 long d[2] = {dim0,dim1};
1462 long d[3] = {dim0,dim1,dim2};
1473 long d[3] = {dim0,dim1,dim2};
1485 long d[4] = {dim0,dim1,dim2,dim3};
1497 long d[4] = {dim0,dim1,dim2,dim3};
1510 long d[5] = {dim0,dim1,dim2,dim3,dim4};
1523 long d[5] = {dim0,dim1,dim2,dim3,dim4};
1537 long d[6] = {dim0,dim1,dim2,dim3,dim4,dim5};
1550 const Tensor<T> reshape(
long dim0,
long dim1,
long dim2,
long dim3,
long dim4,
long dim5)
const {
1551 long d[6] = {dim0,dim1,dim2,dim3,dim4,dim5};
1685 T result = *(this->
_p);
1687 for (
long i=0; i<
_ndim; ++i) ind[i]=0;
1690 if (result > *_p0) {
1692 for (
long i=0; i<nd; ++i) ind[i]=iter.ind[i];
1705 T result = *(this->
_p);
1707 for (
long i=0; i<
_ndim; ++i) ind[i]=0;
1710 if (result < *_p0) {
1712 for (
long i=0; i<nd; ++i) ind[i]=iter.ind[i];
1737 for (
long i=0; i<
_ndim; ++i) ind[i]=0;
1741 if (result > absval) {
1743 for (
long i=0; i<nd; ++i) ind[i]=iter.ind[i];
1758 for (
long i=0; i<
_ndim; ++i) ind[i]=0;
1762 if (result < absval) {
1764 for (
long i=0; i<nd; ++i) ind[i]=iter.ind[i];
1793 template <
typename opT>
1807 if (
alpha == T(1)) {
1811 else if (
beta == T(0)) {
1818 else if (
alpha == T(0)) {
1822 else if (
beta == T(0)) {
1831 }
else if (
beta == T(0)) {
1866 iterlevel, optimize,
fusedim, jdim);
1877 iterlevel, optimize,
fusedim, jdim);
1881 template <
class Q,
class R>
1889 iterlevel, optimize,
fusedim, jdim);
1908 std::ostream&
operator << (std::ostream& out,
const Tensor<T>& t);
1913 template <
class Archive,
typename T>
1928 template <
class Archive,
typename T>
1931 long sz = 0l,
id = 0l;
1933 if (
id != t.
id())
throw "type mismatch deserializing a tensor";
1938 if (sz != t.
size())
throw "size mismatch deserializing a tensor";
1952 template <
typename T,
typename Q>
1953 typename IsSupported < TensorTypeData<Q>, Tensor<T> >
::type
1961 template <
typename T,
typename Q>
1962 typename IsSupported < TensorTypeData<Q>, Tensor<T> >
::type
1970 template <
typename T,
typename Q>
1971 typename IsSupported < TensorTypeData<Q>, Tensor<T> >
::type
1995 template <
class Q,
class T>
2018 template <
class T,
class Q>
2075 long nd = 0,
size=1;
2076 for (
long i=0; i<t.
_ndim; ++i) {
2077 long start=s[i].start,
end=s[i].end, step=s[i].step;
2080 if (start < 0) start += this->
_dim[i];
2082 long len =
end-start+1;
2083 if (step) len /= step;
2087 end = start + (len-1)*step;
2092 TENSOR_ASSERT(start>=0 && start<this->
_dim[i],
"slice start invalid",start,
this);
2094 TENSOR_ASSERT(len>0,
"slice length must be non-zero",len,
this);
2100 this->
_dim[nd] = len;
2160 if (t.
size() == 0) {
2161 s <<
"[empty tensor]\n";
2166 long index_width = 0;
2167 for (
int i = 0; i<(t.
ndim()-1); ++i) {
2168 if (maxdim < t.
dim(i)) maxdim = t.
dim(i);
2172 else if (maxdim < 100)
2174 else if (maxdim < 1000)
2176 else if (maxdim < 10000)
2181 std::ios::fmtflags oldflags = s.setf(std::ios::scientific);
2182 long oldprec = s.precision();
2183 long oldwidth = s.width();
2187 const T*
p = iter._p0;
2188 long inc = iter._s0;
2189 long dimj = iter.dimj;
2190 s.unsetf(std::ios::scientific);
2192 for (
long i=0; i<iter.ndim; ++i) {
2193 s.width(index_width);
2200 s.setf(std::ios::fixed);
2201 for (
long j=0; j<dimj; ++j,
p+=inc) {
2208 s.unsetf(std::ios::scientific);
2211 s.setf(oldflags,std::ios::floatfield);
2212 s.precision(oldprec);
2224 long nd = left.
ndim() + right.
ndim();
2228 for (
long i = 0; i < left.
ndim(); ++i)
d[i] = left.
dim(i);
2229 for (
long i = 0; i < right.
ndim(); ++i)
d[i + left.
ndim()] = right.
dim(i);
2242 T *ptr = result.
ptr();
2247 for (iter.
reset(); iter.
_p0; ++iter) {
2248 long dimj = iter.
dimj;
2250 long Tstride = iter.
_s0;
2251 for (
long _j=0; _j<dimj; ++_j, _p0+=Tstride) {
2252 *ptr++ = val1 * (*_p0);
2267 template <
class T,
class Q>
2269 long k0=-1,
long k1=0) {
2272 long nd = left.
ndim() + right.
ndim() - 2;
2273 TENSOR_ASSERT(nd!=0,
"result is a scalar but cannot return one ... use dot",
2278 right.
dim(
k1), &left);
2281 "invalid number of dimensions in the result", nd,0);
2286 for (
long i=0; i<
k0; ++i)
d[i] = left.
dim(i);
2287 for (
long i=
k0+1; i<left.
ndim(); ++i)
d[i-1] = left.
dim(i);
2288 base = left.
ndim()-1;
2289 for (
long i=0; i<
k1; ++i)
d[i+base] = right.
dim(i);
2291 for (
long i=
k1+1; i<right.
ndim(); ++i)
d[i+base] = right.
dim(i);
2311 template <
class T,
class Q>
2319 resultT* ptr = result.
ptr();
2325 if (
k0==0 &&
k1==0) {
2327 long dimk = left.
dim(
k0);
2328 long dimj = right.
stride(0);
2329 long dimi = left.
stride(0);
2330 mTxm(dimi,dimj,dimk,ptr,left.
ptr(),right.
ptr());
2333 else if (
k0==(left.
ndim()-1) &&
k1==(right.
ndim()-1)) {
2335 long dimk = left.
dim(
k0);
2336 long dimi = left.
size()/dimk;
2337 long dimj = right.
size()/dimk;
2338 mxmT(dimi,dimj,dimk,ptr,left.
ptr(),right.
ptr());
2341 else if (
k0==0 &&
k1==(right.
ndim()-1)) {
2343 long dimk = left.
dim(
k0);
2344 long dimi = left.
stride(0);
2345 long dimj = right.
size()/dimk;
2349 else if (
k0==(left.
ndim()-1) &&
k1==0) {
2351 long dimk = left.
dim(
k0);
2352 long dimi = left.
size()/dimk;
2353 long dimj = right.
stride(0);
2354 mxm(dimi,dimj,dimk,ptr,left.
ptr(),right.
ptr());
2359 long dimj = left.
dim(
k0);
2363 iter0._p0; ++iter0) {
2365 long s0 = iter0._s0;
2366 for (iter1.
reset(); iter1.
_p0; ++iter1) {
2369 long s1 = iter1.
_s0;
2371 for (
long j=0; j<dimj; ++j,p0+=
s0,p1+=s1) {
2372 sum += (*p0) * (*p1);
2393 template <
class T,
class Q>
2396 TENSOR_ASSERT(
c.ndim() == 2,
"second argument must be a matrix",
c.ndim(),&
c);
2404 for (
long i=0; i<t.
ndim(); ++i) {
2405 result =
inner(result,
c,0,0);
2421 template <
class T,
class Q>
2425 for (
long i=0; i<t.
ndim(); ++i) {
2426 result =
inner(result,
c[i],0,0);
2459 template <
class T,
class Q>
2463 const Q *pc=
c.
ptr();
2464 resultT *t0=workspace.ptr(), *t1=result.ptr();
2467 t1 = workspace.ptr();
2470 long dimj =
c.dim(1);
2472 for (
int n=1; n<t.
ndim(); ++n) dimi *= dimj;
2474 mTxmq(dimi, dimj, dimj, t0, t.
ptr(), pc);
2475 for (
int n=1; n<t.
ndim(); ++n) {
2476 mTxmq(dimi, dimj, dimj, t1, t0, pc);
2495 Tensor<std::complex<R>>& result,
2496 Tensor<std::complex<R>>& workspace) {
2501 const R* pc =
c.ptr();
2502 const long ndim = t.
ndim();
2503 const long sz = t.
size();
2504 MADNESS_CHECK(result.size() >= sz && workspace.size() >= sz);
2506 long dimj =
c.dim(1);
2508 for (
int n = 1; n < ndim; ++n) dimi *= dimj;
2510 R* res_raw =
reinterpret_cast<R*
>(result.ptr());
2511 R* wrk_raw =
reinterpret_cast<R*
>(workspace.ptr());
2512 R* bufA = (ndim & 1) ? res_raw : wrk_raw;
2513 R* bufB = (ndim & 1) ? wrk_raw : res_raw;
2516 R* in_im = bufA + sz;
2518 R* out_im = bufB + sz;
2521 const R* t_raw =
reinterpret_cast<const R*
>(t.
ptr());
2522 for (
long i = 0; i < sz; ++i) {
2523 in_re[i] = t_raw[2 * i];
2524 in_im[i] = t_raw[2 * i + 1];
2527 for (
int n = 0; n < ndim; ++n) {
2528 mTxmq(dimi, dimj, dimj, out_re, in_re, pc);
2529 mTxmq(dimi, dimj, dimj, out_im, in_im, pc);
2530 std::swap(in_re, out_re);
2531 std::swap(in_im, out_im);
2535 for (
long i = 0; i < sz; ++i) {
2536 res_raw[2 * i] = in_re[i];
2537 res_raw[2 * i + 1] = in_im[i];
2562 template <
class T,
class Q>
2571 "general_fast_transform requires the matrix type not to "
2572 "promote the result past the tensor type");
2580 const long D = t.
ndim();
2586 long running = t.
size();
2587 long max_running = running;
2588 for (
long d = 0;
d <
D; ++
d) {
2591 running = (running /
c[
d].dim(0)) *
c[
d].dim(1);
2592 if (running > max_running) max_running = running;
2595 workspace.size() >= max_running);
2598 R* buf0 = workspace.ptr();
2599 R* buf1 = result.ptr();
2600 if (
D & 1) std::swap(buf0, buf1);
2606 for (
long d = 0;
d <
D; ++
d) {
2607 const long dimk =
c[
d].dim(0);
2608 const long dimj =
c[
d].dim(1);
2609 const long dimi = n / dimk;
2611 mTxmq(dimi, dimj, dimk, out, t.
ptr(),
c[
d].ptr());
2613 mTxmq(dimi, dimj, dimk, out, in_r,
c[
d].ptr());
2617 out = (out == buf0) ? buf1 : buf0;
2624 Tensor<std::complex<R>>&
2627 Tensor<std::complex<R>>& result,
2628 Tensor<std::complex<R>>& workspace) {
2633 const long D = t.
ndim();
2635 long running = t.
size();
2636 long max_running = running;
2637 for (
long d = 0;
d <
D; ++
d) {
2640 running = (running /
c[
d].dim(0)) *
c[
d].dim(1);
2641 if (running > max_running) max_running = running;
2644 workspace.size() >= max_running);
2650 R* res_raw =
reinterpret_cast<R*
>(result.ptr());
2651 R* wrk_raw =
reinterpret_cast<R*
>(workspace.ptr());
2652 R* bufA = (
D & 1) ? res_raw : wrk_raw;
2653 R* bufB = (
D & 1) ? wrk_raw : res_raw;
2656 R* bufA_im = bufA + max_running;
2658 R* bufB_im = bufB + max_running;
2661 const long sz0 = t.
size();
2662 const R* t_raw =
reinterpret_cast<const R*
>(t.
ptr());
2663 for (
long i = 0; i < sz0; ++i) {
2664 bufA_re[i] = t_raw[2 * i];
2665 bufA_im[i] = t_raw[2 * i + 1];
2670 R* out_re = bufB_re;
2671 R* out_im = bufB_im;
2674 for (
long d = 0;
d <
D; ++
d) {
2675 const long dimk =
c[
d].dim(0);
2676 const long dimj =
c[
d].dim(1);
2677 const long dimi = n / dimk;
2679 mTxmq(dimi, dimj, dimk, out_re, in_re,
c[
d].ptr());
2680 mTxmq(dimi, dimj, dimk, out_im, in_im,
c[
d].ptr());
2683 std::swap(in_re, out_re);
2684 std::swap(in_im, out_im);
2688 const long final_sz = n;
2689 for (
long i = 0; i < final_sz; ++i) {
2690 res_raw[2 * i] = in_re[i];
2691 res_raw[2 * i + 1] = in_im[i];
2699 template <
typename R>
2706 template <
typename R>
2722 template <
typename R>
2725 if (s.a.size() < need) {
2736 template <
typename R>
2738 eval_scratch_pool<R>().clear();
2797#undef TENSOR_SHARED_PTR
double q(double t)
Definition DKops.h:18
Provides routines for internal use optimized for aligned data.
Interface templates for the archives (serialization).
std::complex< double > double_complex
Definition cfft.h:14
The base class for tensors defines generic capabilities.
Definition basetensor.h:85
bool conforms(const BaseTensor *t) const
Returns true if this and *t are the same shape and size.
Definition basetensor.h:159
long dim(int i) const
Returns the size of dimension i.
Definition basetensor.h:147
bool iscontiguous() const
Returns true if the tensor refers to contiguous memory locations.
Definition basetensor.h:168
void mapdim_inplace(const std::vector< long > &map)
General permutation of dimensions.
Definition basetensor.cc:156
const long * dims() const
Returns the array of tensor dimensions.
Definition basetensor.h:153
long _stride[TENSOR_MAXDIM]
Increment between elements in each dimension.
Definition basetensor.h:97
long stride(int i) const
Returns the stride associated with dimension i.
Definition basetensor.h:150
long _size
Number of elements in the tensor.
Definition basetensor.h:93
long id() const
Returns the typeid of the tensor (c.f., TensorTypeData<T> )
Definition basetensor.h:141
void set_dims_and_size(long nd, const long d[])
Definition basetensor.h:99
long _id
Id from TensorTypeData<T> in type_data.h.
Definition basetensor.h:95
void splitdim_inplace(long i, long dimi0, long dimi1)
Splits dimension i.
Definition basetensor.cc:88
void swapdim_inplace(long i, long j)
Swaps the dimensions.
Definition basetensor.cc:124
void fusedim_inplace(long i)
Fuses dimensions i and i+1.
Definition basetensor.cc:107
long _dim[TENSOR_MAXDIM]
Size of each dimension.
Definition basetensor.h:96
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
void cycledim_inplace(long shift, long start, long end)
Cyclic shift of dimensions.
Definition basetensor.cc:134
long _ndim
Number of dimensions (-1=invalid; 0=no supported; >0=tensor)
Definition basetensor.h:94
void reshape_inplace(const std::vector< long > &d)
Reshapes the tensor inplace.
Definition basetensor.cc:76
Indexing a non-constant tensor with slices returns a SliceTensor.
Definition tensor.h:2058
virtual ~SliceTensor()
Definition tensor.h:2143
SliceTensor(const Tensor< T > &t, const Slice s[])
Definition tensor.h:2069
SliceTensor< T > & operator=(const SliceTensor< Q > &t)
Definition tensor.h:2122
SliceTensor< T > & operator=(const Tensor< Q > &t)
Definition tensor.h:2133
SliceTensor< T > & operator=(const SliceTensor< T > &t)
Definition tensor.h:2116
SliceTensor(const Tensor< T > &t, const std::array< Slice, TENSOR_MAXDIM > s)
Definition tensor.h:2065
SliceTensor< T > & operator=(const Tensor< T > &t)
Definition tensor.h:2127
SliceTensor< T > & operator=(const T &t)
Definition tensor.h:2138
A slice defines a sub-range or patch of a dimension.
Definition slice.h:103
Definition tensoriter.h:61
long dimj
Definition tensoriter.h:70
long _s0
Definition tensoriter.h:71
void reset()
Reset the iterator back to the start ...
Definition tensoriter.h:354
T * _p0
Definition tensoriter.h:66
Traits class to specify support of numeric types.
Definition type_data.h:56
A tensor is a multidimensional array.
Definition tensor.h:318
scalar_type absmax(long *ind=0) const
Return the absolute maximum value (and if ind is non-null, its index) in the Tensor.
Definition tensor.h:1755
void deallocate()
Definition tensor.h:398
T *MADNESS_RESTRICT _p
Definition tensor.h:322
Tensor< T > & operator=(T x)
Inplace fill tensor with scalar.
Definition tensor.h:554
const Tensor< T > swapdim(long idim, long jdim) const
Returns new view/tensor swaping dimensions i and j.
Definition tensor.h:1615
Tensor(const std::vector< long > &d, bool dozero=true)
Create and optionally zero new n-d tensor. This is the most general constructor.
Definition tensor.h:537
SliceTensor< T > operator()(const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3, const Slice &s4)
Return a 1-5d SliceTensor that views the specified range of the 5d Tensor.
Definition tensor.h:1338
const Tensor< T > operator()(const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3) const
Return a 1-4d constant Tensor that views the specified range of the 4d Tensor.
Definition tensor.h:1327
float_scalar_type normf() const
Returns the Frobenius norm of the tensor.
Definition tensor.h:1727
Tensor< T > & gaxpy(T alpha, const Tensor< T > &other, T beta)
Inplace generalized saxpy ... this = this*alpha + other*beta.
Definition tensor.h:1806
TensorIterator< T, Q > binary_iterator(const Tensor< Q > &q, long iterlevel=0, bool optimize=true, bool fusedim=true, long jdim=default_jdim) const
Return iterator over two tensors.
Definition tensor.h:1871
SliceTensor< T > operator()(long i, const Slice &s1, long k)
Return a 1d SliceTensor that views the specified range of the 3d Tensor.
Definition tensor.h:1276
Tensor(long d0, long d1)
Create and zero new 2-d tensor.
Definition tensor.h:482
const T * ptr() const
Returns a pointer to the internal data.
Definition tensor.h:1846
scalar_type absmin(long *ind=0) const
Return the absolute minimum value (and if ind is non-null, its index) in the Tensor.
Definition tensor.h:1734
Tensor< T > & unaryop(opT &op)
Inplace apply a unary function to each element of the tensor.
Definition tensor.h:1794
IsSupported< TensorTypeData< Q >, Tensor< TENSOR_RESULT_TYPE(T, Q)> >::type operator+(const Q &x) const
Add a scalar of the same type to all elements of a tensor producing a new tensor.
Definition tensor.h:644
Tensor< T > & fill(T x)
Inplace fill with a scalar (legacy name)
Definition tensor.h:563
const Tensor< T > operator()(long i, const Slice &s1, const Slice &s2) const
Return a 2d constant Tensor that views the specified range of the 3d Tensor.
Definition tensor.h:1206
Tensor< T > & operator+=(const Tensor< Q > &t)
Inplace addition of two tensors.
Definition tensor.h:573
Tensor< T > reshape(long dim0, long dim1, long dim2, long dim3, long dim4)
Returns new view/tensor rehaping to conforming 5-d tensor with given dimensions.
Definition tensor.h:1509
Tensor< T > swapdim(long idim, long jdim)
Returns new view/tensor swaping dimensions i and j.
Definition tensor.h:1606
const Tensor< T > flat() const
Returns new view/tensor rehshaping to flat (1-d) tensor.
Definition tensor.h:1562
T sum() const
Returns the sum of all elements of the tensor.
Definition tensor.h:1663
Tensor< T > reshape(int ndimnew, const long *d)
Returns new view/tensor reshaping size/number of dimensions to conforming tensor.
Definition tensor.h:1385
const T & operator[](long i) const
1-d indexing operation using [] without bounds checking.
Definition tensor.h:792
TensorIterator< T > unary_iterator(long iterlevel=0, bool optimize=true, bool fusedim=true, long jdim=default_jdim) const
Return iterator over single tensor.
Definition tensor.h:1861
Tensor< T > reshape(long dim0, long dim1)
Returns new view/tensor rehaping to conforming 2-d tensor with given dimensions.
Definition tensor.h:1440
TensorTypeData< T >::scalar_type scalar_type
C++ typename of the real type associated with a complex type.
Definition tensor.h:410
Tensor(long d0, long d1, long d2, long d3, long d4, long d5)
Create and zero new 6-d tensor.
Definition tensor.h:528
T type
C++ typename of this tensor.
Definition tensor.h:407
Tensor< TENSOR_RESULT_TYPE(T, Q) > operator+(const Tensor< Q > &t) const
Addition of two tensors to produce a new tensor.
Definition tensor.h:593
T & operator()(long i)
1-d indexing operation without bounds checking.
Definition tensor.h:803
SliceTensor< T > operator()(const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3)
Return a 1-4d SliceTensor that views the specified range of the 4d Tensor.
Definition tensor.h:1316
T & operator()(long i, long j, long k, long l, long m)
5-d indexing operation without bounds checking.
Definition tensor.h:921
T * ptr()
Returns a pointer to the internal data.
Definition tensor.h:1841
bool conforms(const Tensor< Q > &t) const
Test if *this and t conform.
Definition tensor.h:1658
const Tensor< T > mapdim(const std::vector< long > &map) const
Returns new view/tensor permuting the dimensions.
Definition tensor.h:1634
T & operator()(long i, long j)
2-d indexing operation without bounds checking.
Definition tensor.h:826
const Tensor< T > reshape(const std::vector< long > &d) const
Returns new view/tensor reshaping size/number of dimensions to conforming tensor.
Definition tensor.h:1414
Tensor< T > cycledim(long nshift, long start, long end)
Returns new view/tensor cycling the sub-dimensions (start,...,end) with shift steps.
Definition tensor.h:1642
const Tensor< T > operator()(const std::vector< Slice > &s) const
General slicing operation (const)
Definition tensor.h:1071
Tensor< T > & operator-=(const Tensor< Q > &t)
Inplace subtraction of two tensors.
Definition tensor.h:583
const Tensor< T > reshape(long dim0, long dim1, long dim2) const
Returns new view/tensor rehaping to conforming 3-d tensor with given dimensions.
Definition tensor.h:1472
const T & operator()(long i, long j, long k) const
3-d indexing operation without bounds checking.
Definition tensor.h:868
SliceTensor< T > operator()(long i, const Slice &s1)
Return a 1d SliceTensor that views the specified range of the 2d Tensor.
Definition tensor.h:1116
const Tensor< T > operator()(const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3, const Slice &s4, const Slice &s5) const
Return a 1-6d constant Tensor that views the specified range of the 6d Tensor.
Definition tensor.h:1372
Tensor< T > mapdim(const std::vector< long > &map)
Returns new view/tensor permuting the dimensions.
Definition tensor.h:1625
IsSupported< TensorTypeData< Q >, Tensor< TENSOR_RESULT_TYPE(T, Q)> >::type operator*(const Q &x) const
Multiplication of tensor by a scalar of a supported type to produce a new tensor.
Definition tensor.h:618
const Tensor< T > operator()(const std::array< Slice, TENSOR_MAXDIM > &s) const
General slicing operation (const)
Definition tensor.h:1089
SliceTensor< T > operator()(const Slice &s0, const Slice &s1, long k)
Return a 2d SliceTensor that views the specified range of the 3d Tensor.
Definition tensor.h:1236
const Tensor< T > reshape(int ndimnew, const long *d) const
Returns new view/tensor reshaping size/number of dimensions to conforming tensor.
Definition tensor.h:1396
const Tensor< T > fusedim(long i) const
Returns new view/tensor fusing contiguous dimensions i and i+1.
Definition tensor.h:1597
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type scale(Q x)
Inplace multiplication by scalar of supported type (legacy name)
Definition tensor.h:687
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type operator-=(const Q &x)
Inplace decrement by scalar of supported type.
Definition tensor.h:708
IsSupported< TensorTypeData< Q >, Tensor< TENSOR_RESULT_TYPE(T, Q)> >::type operator/(const Q &x) const
Divide tensor by a scalar of a supported type to produce a new tensor.
Definition tensor.h:631
SliceTensor< T > operator()(const Slice &s0, const Slice &s1)
Return a 2d SliceTensor that views the specified range of the 2d Tensor.
Definition tensor.h:1156
TensorTypeData< T >::float_scalar_type float_scalar_type
C++ typename of the floating point type associated with scalar real type.
Definition tensor.h:413
Tensor(const Tensor< T > &t)
Copy constructor is shallow (same as assignment)
Definition tensor.h:429
T & operator()(long i, long j, long k)
3-d indexing operation without bounds checking.
Definition tensor.h:853
const Tensor< T > operator()(const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3, const Slice &s4) const
Return a 1-5d constant Tensor that views the specified range of the 5d Tensor.
Definition tensor.h:1349
const Tensor< T > reshape(long dim0, long dim1, long dim2, long dim3) const
Returns new view/tensor rehaping to conforming 4-d tensor with given dimensions.
Definition tensor.h:1496
Tensor< T > operator-() const
Unary negation producing a new tensor.
Definition tensor.h:664
const T & operator()(long i, long j) const
2-d indexing operation without bounds checking.
Definition tensor.h:839
const Tensor< T > operator()(const Slice &s0, long j, long k) const
Return a 1d constant Tensor that views the specified range of the 3d Tensor.
Definition tensor.h:1306
T & operator()(long i, long j, long k, long l, long m, long n)
6-d indexing operation without bounds checking.
Definition tensor.h:962
SliceTensor< T > operator()(const Slice &s0, const Slice &s1, const Slice &s2, const Slice &s3, const Slice &s4, const Slice &s5)
Return a 1-6d SliceTensor that views the specified range of the 6d Tensor.
Definition tensor.h:1360
SliceTensor< T > operator()(const Slice &s0)
Return a 1d SliceTensor that views the specified range of the 1d Tensor.
Definition tensor.h:1096
SliceTensor< T > operator()(const Slice &s0, long j, long k)
Return a 1d SliceTensor that views the specified range of the 3d Tensor.
Definition tensor.h:1296
const T & operator()(const long ind[]) const
Politically incorrect general indexing operation without bounds checking.
Definition tensor.h:1017
Tensor< T > & emul(const Tensor< T > &t)
Inplace multiply by corresponding elements of argument Tensor.
Definition tensor.h:1800
Tensor< T > & operator=(const Tensor< T > &t)
Assignment is shallow (same as copy constructor)
Definition tensor.h:444
SliceTensor< T > operator()(long i, const Slice &s1, const Slice &s2)
Return a 2d SliceTensor that views the specified range of the 3d Tensor.
Definition tensor.h:1196
T & operator()(long i, long j, long k, long l)
4-d indexing operation without bounds checking.
Definition tensor.h:884
TENSOR_RESULT_TYPE(T, Q) trace(const Tensor< Q > &t) const
Return the trace of two tensors (no complex conjugate invoked)
Definition tensor.h:1778
SliceTensor< T > operator()(const std::array< Slice, TENSOR_MAXDIM > &s)
General slicing operation.
Definition tensor.h:1081
T max(long *ind=0) const
Return the maximum value (and if ind is non-null, its index) in the Tensor.
Definition tensor.h:1704
Tensor(long d0)
Create and zero new 1-d tensor.
Definition tensor.h:473
const T & operator()(long i, long j, long k, long l) const
4-d indexing operation without bounds checking.
Definition tensor.h:902
T product() const
Return the product of all elements of the tensor.
Definition tensor.h:1677
const T & operator()(long i, long j, long k, long l, long m) const
5-d indexing operation without bounds checking.
Definition tensor.h:941
T min(long *ind=0) const
Return the minimum value (and if ind is non-null, its index) in the Tensor.
Definition tensor.h:1684
Tensor< TENSOR_RESULT_TYPE(T, Q) > operator-(const Tensor< Q > &t) const
Subtraction of two tensors to produce a new tensor.
Definition tensor.h:605
const T & operator()(long i, long j, long k, long l, long m, long n) const
6-d indexing operation without bounds checking.
Definition tensor.h:984
T & operator()(const std::vector< long > ind)
General indexing operation with bounds checking.
Definition tensor.h:1033
Tensor< T > splitdim(long i, long dimi0, long dimi1)
Returns new view/tensor splitting dimension i as dimi0*dimi1 to produce conforming d+1 dimension tens...
Definition tensor.h:1570
virtual ~Tensor()
Definition tensor.h:1898
const Tensor< T > operator()(const Slice &s0) const
Return a 1d SliceTensor that views the specified range of the 1d Tensor.
Definition tensor.h:1106
void allocate(long nd, const long d[], bool dozero)
Definition tensor.h:325
const BaseTensor * base() const
Returns a pointer to the base class.
Definition tensor.h:1856
Tensor< T > reshape(long dim0, long dim1, long dim2, long dim3, long dim4, long dim5)
Returns new view/tensor rehaping to conforming 6-d tensor with given dimensions.
Definition tensor.h:1536
T sumsq() const
Returns the sum of the squares of the elements.
Definition tensor.h:1670
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type operator*=(const Q &x)
Inplace multiplication by scalar of supported type.
Definition tensor.h:676
const Tensor< T > operator()(const Slice &s0, long j) const
Return a 1d constant Tensor that views the specified range of the 2d Tensor.
Definition tensor.h:1146
T & operator[](long i)
1-d indexing operation using [] without bounds checking.
Definition tensor.h:781
Tensor< T > & screen(double x)
Inplace set elements of *this less than x in absolute magnitude to zero.
Definition tensor.h:759
const Tensor< T > cycledim(long nshift, long start, long end) const
Returns new view/tensor cycling the sub-dimensions (start,...,end) with shift steps.
Definition tensor.h:1650
const Tensor< T > splitdim(long i, long dimi0, long dimi1) const
Returns new view/tensor splitting dimension i as dimi0*dimi1 to produce conforming d+1 dimension tens...
Definition tensor.h:1579
Tensor(long d0, long d1, long d2, long d3)
Create and zero new 4-d tensor.
Definition tensor.h:503
Tensor(long d0, long d1, long d2)
Create and zero new 3-d tensor.
Definition tensor.h:492
const Tensor< T > reshape(long dim0, long dim1, long dim2, long dim3, long dim4, long dim5) const
Returns new view/tensor rehaping to conforming 6-d tensor with given dimensions.
Definition tensor.h:1550
const Tensor< T > reshape(long dim0) const
Returns new view/tensor rehapings to conforming 1-d tensor with given dimension.
Definition tensor.h:1430
bool has_data() const
Definition tensor.h:1903
Tensor< T > reshape(const std::vector< long > &d)
Returns new view/tensor reshaping size/number of dimensions to conforming tensor.
Definition tensor.h:1406
BaseTensor * base()
Returns a pointer to the base class.
Definition tensor.h:1851
const TensorIterator< T > & end() const
End point for forward iteration.
Definition tensor.h:1893
Tensor< T > reshape(long dim0, long dim1, long dim2)
Returns new view/tensor rehaping to conforming 3-d tensor with given dimensions.
Definition tensor.h:1461
Tensor< T > reshape(long dim0, long dim1, long dim2, long dim3)
Returns new view/tensor rehaping to conforming 4-d tensor with given dimensions.
Definition tensor.h:1484
SliceTensor< T > operator()(const Slice &s0, const Slice &s1, const Slice &s2)
Return a 3d SliceTensor that views the specified range of the 3d Tensor.
Definition tensor.h:1176
Tensor< T > reshape(long dim0)
Returns new view/tensor rehapings to conforming 1-d tensor with given dimension.
Definition tensor.h:1422
SliceTensor< T > operator()(const Slice &s0, long j)
Return a 1d SliceTensor that views the specified range of the 2d Tensor.
Definition tensor.h:1136
Tensor< T > fusedim(long i)
Returns new view/tensor fusing contiguous dimensions i and i+1.
Definition tensor.h:1588
const Tensor< T > operator()(long i, long j, const Slice &s2) const
Return a 1d constant Tensor that views the specified range of the 3d Tensor.
Definition tensor.h:1266
const Tensor< T > operator()(const Slice &s0, const Slice &s1, const Slice &s2) const
Return a 3d constant Tensor that views the specified range of the 3d Tensor.
Definition tensor.h:1186
TENSOR_RESULT_TYPE(T, Q) trace_conj(const Tensor< Q > &t) const
Return the trace of two tensors with complex conjugate of the leftmost (i.e., this)
Definition tensor.h:1786
const Tensor< T > operator()(const Slice &s0, const Slice &s1, long k) const
Return a 2d constant Tensor that views the specified range of the 3d Tensor.
Definition tensor.h:1246
const T & operator()(const std::vector< long > ind) const
General indexing operation with bounds checking.
Definition tensor.h:1047
T & operator()(const long ind[])
Politically incorrect general indexing operation without bounds checking.
Definition tensor.h:1001
Tensor< T > flat()
Returns new view/tensor rehshaping to flat (1-d) tensor.
Definition tensor.h:1556
const Tensor< T > reshape(long dim0, long dim1) const
Returns new view/tensor rehaping to conforming 2-d tensor with given dimensions.
Definition tensor.h:1450
Tensor(long d0, long d1, long d2, long d3, long d4)
Create and zero new 5-d tensor.
Definition tensor.h:515
Tensor()
Default constructor does not allocate any data and sets ndim=-1, size=0, _p=0, and id.
Definition tensor.h:416
const Tensor< T > operator()(long i, const Slice &s1, long k) const
Return a 1d constant Tensor that views the specified range of the 3d Tensor.
Definition tensor.h:1286
TensorIterator< T, Q, R > ternary_iterator(const Tensor< Q > &q, const Tensor< R > &r, long iterlevel=0, bool optimize=true, bool fusedim=true, long jdim=default_jdim) const
Return iterator over three tensors.
Definition tensor.h:1882
const Tensor< T > operator()(long i, const Slice &s1) const
Return a 1d SliceTensor that views the specified range of the 2d Tensor.
Definition tensor.h:1126
static bool bounds_checking()
Return true if bounds checking was enabled at compile time.
Definition tensor.h:769
const T & operator()(long i) const
1-d indexing operation without bounds checking.
Definition tensor.h:814
void clear()
Frees all memory and resests to state of default constructor.
Definition tensor.h:1901
TENSOR_SHARED_PTR< T > _shptr
Definition tensor.h:323
Tensor< T > & fillrandom()
Inplace fill with random values ( [0,1] for floats, [0,MAXSIZE] for integers)
Definition tensor.h:725
Tensor(long nd, const long d[], bool dozero=true)
Politically incorrect general constructor.
Definition tensor.h:546
const Tensor< T > operator()(const Slice &s0, long j, const Slice &s2) const
Return a 2d constant Tensor that views the specified range of the 3d Tensor.
Definition tensor.h:1226
IsSupported< TensorTypeData< Q >, Tensor< TENSOR_RESULT_TYPE(T, Q)> >::type operator-(const Q &x) const
Subtract a scalar of the same type from all elements producing a new tensor.
Definition tensor.h:657
const Tensor< T > operator()(const Slice &s0, const Slice &s1) const
Return a 2d constant Tensor that views the specified range of the 2d Tensor.
Definition tensor.h:1166
Tensor< T > & fillindex()
Inplace fill with the index of each element.
Definition tensor.h:749
SliceTensor< T > operator()(long i, long j, const Slice &s2)
Return a 1d SliceTensor that views the specified range of the 3d Tensor.
Definition tensor.h:1256
const Tensor< T > reshape(long dim0, long dim1, long dim2, long dim3, long dim4) const
Returns new view/tensor rehaping to conforming 5-d tensor with given dimensions.
Definition tensor.h:1522
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type operator+=(const Q &x)
Inplace increment by scalar of supported type.
Definition tensor.h:697
Tensor< T > & conj()
Inplace complex conjugate.
Definition tensor.h:717
SliceTensor< T > operator()(const Slice &s0, long j, const Slice &s2)
Return a 2d SliceTensor that views the specified range of the 3d Tensor.
Definition tensor.h:1216
SliceTensor< T > operator()(const std::vector< Slice > &s)
General slicing operation.
Definition tensor.h:1061
Definition thread_specific.h:82
static const double R
Definition csqrt.cc:46
char * p(char *buf, const char *name, int k, int initial_level, double thresh, int order)
Definition derivatives.cc:72
archive_array< T > wrap(const T *, unsigned int)
Factory function to wrap a dynamically allocated pointer as a typed archive_array.
Definition archive.h:914
Tensor< T > conj_transpose(const Tensor< T > &t)
Returns a new deep copy of the complex conjugate transpose of the input tensor.
Definition tensor.h:2044
Tensor< typename Tensor< T >::scalar_type > arg(const Tensor< T > &t)
Return a new tensor holding the argument of each element of t (complex types only)
Definition tensor.h:2757
Tensor< TENSOR_RESULT_TYPE(T, Q) > & fast_transform(const Tensor< T > &t, const Tensor< Q > &c, Tensor< TENSOR_RESULT_TYPE(T, Q) > &result, Tensor< TENSOR_RESULT_TYPE(T, Q) > &workspace)
Restricted but heavily optimized form of transform()
Definition tensor.h:2460
void inner_result(const Tensor< T > &left, const Tensor< Q > &right, long k0, long k1, Tensor< TENSOR_RESULT_TYPE(T, Q) > &result)
Accumulate inner product into user provided, contiguous, correctly sized result tensor.
Definition tensor.h:2312
Tensor< T > transpose(const Tensor< T > &t)
Returns a new deep copy of the transpose of the input tensor.
Definition tensor.h:2035
const double beta
Definition gygi_soltion.cc:62
Tensor< double > op(const Tensor< double > &x)
Definition kain.cc:508
#define MADNESS_RESTRICT
Definition mTxmq.h:37
Macros and tools pertaining to the configuration of MADNESS.
#define MADNESS_PRAGMA_GCC(x)
Definition madness_config.h:205
#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
Definition potentialmanager.cc:41
void eval_scratch_clear()
Definition tensor.h:2737
std::pair< Tensor< R > &, Tensor< R > & > eval_scratch(long need)
Definition tensor.h:2723
thread_specific< EvalScratch< R > > & eval_scratch_pool()
Definition tensor.h:2707
T mynorm(T t)
Definition tensor.h:261
Namespace for all elements and tools of MADNESS.
Definition DFConvergence.h:9
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition lowrankfunction.h:401
double abs(double x)
Definition complexfun.h:48
void mTxmT(long dimi, long dimj, long dimk, T *MADNESS_RESTRICT c, const T *a, const T *b)
Matrix += Matrix transpose * matrix transpose ... MKL interface version.
Definition mxm.h:204
void outer_result(const Tensor< T > &left, const Tensor< T > &right, Tensor< T > &result)
Outer product ... result(i,j,...,p,q,...) = left(i,k,...)*right(p,q,...)
Definition tensor.h:2239
Q conditional_conj(const Q &coeff)
For real types return value, for complex return conjugate.
Definition tensor.h:256
GenTensor< TENSOR_RESULT_TYPE(R, Q)> general_transform(const GenTensor< R > &t, const Tensor< Q > c[])
Definition gentensor.h:274
Function< Q, NDIM > convert(const Function< T, NDIM > &f, bool fence=true)
Type conversion implies a deep copy. No communication except for optional fence.
Definition mra.h:2280
void mxm(long dimi, long dimj, long dimk, T *MADNESS_RESTRICT c, const T *a, const T *b)
Matrix += Matrix * matrix ... BLAS/MKL interface version.
Definition mxm.h:165
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:758
Function< T, NDIM > conj(const Function< T, NDIM > &f, bool fence=true)
Return the complex conjugate of the input function with the same distribution and optional fence.
Definition mra.h:2294
void mTxm(long dimi, long dimj, long dimk, T *MADNESS_RESTRICT c, const T *a, const T *b)
Matrix += Matrix transpose * matrix ... MKL interface version.
Definition mxm.h:178
Tensor< TENSOR_RESULT_TYPE(T, Q)> & general_fast_transform(const Tensor< T > &t, const Tensor< Q > *c, Tensor< TENSOR_RESULT_TYPE(T, Q)> &result, Tensor< TENSOR_RESULT_TYPE(T, Q)> &workspace)
Definition tensor.h:2564
std::vector< CCPairFunction< T, NDIM > > operator*(const double fac, const std::vector< CCPairFunction< T, NDIM > > &arg)
Definition ccpairfunction.h:1089
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
std::vector< CCPairFunction< T, NDIM > > operator-(const std::vector< CCPairFunction< T, NDIM > > c1, const std::vector< CCPairFunction< T, NDIM > > &c2)
Definition ccpairfunction.h:1060
static double pop(std::vector< double > &v)
Definition SCF.cc:117
static void aligned_zero(long n, T *a)
Definition aligned.h:55
double imag(double x)
Definition complexfun.h:56
GenTensor< TENSOR_RESULT_TYPE(R, Q)> transform_dir(const GenTensor< R > &t, const Tensor< Q > &c, const int axis)
Definition lowranktensor.h:1106
std::string type(const PairType &n)
Definition PNOParameters.h:18
static const long default_jdim
Definition tensoriter.h:57
std::vector< CCPairFunction< T, NDIM > > operator+(const std::vector< CCPairFunction< T, NDIM > > c1, const std::vector< CCPairFunction< T, NDIM > > &c2)
Definition ccpairfunction.h:1052
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:993
double real(double x)
Definition complexfun.h:52
void mxmT(long dimi, long dimj, long dimk, T *MADNESS_RESTRICT c, const T *a, const T *b)
Matrix += Matrix * matrix transpose ... MKL interface version.
Definition mxm.h:191
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:2233
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 long abs(long a)
Definition tensor.h:219
static const double d
Definition nonlinschro.cc:121
static const double a
Definition nonlinschro.cc:118
Implement dummy posix_memalign if it is missing on the system.
int posix_memalign(void **memptr, std::size_t alignment, std::size_t size)
Definition posixmem.h:44
std::complex< float > float_complex
Definition ran.h:40
double Q(double a)
Definition relops.cc:20
static const double c
Definition relops.cc:10
static const double m
Definition relops.cc:9
static const long k
Definition rk.cc:44
Definition test_ar.cc:204
Definition test_ccpairfunction.cc:22
Definition type_data.h:146
static void load(const Archive &s, Tensor< T > &t)
Definition tensor.h:1930
Default load of an object via serialize(ar, t).
Definition archive.h:667
static void store(const Archive &s, const Tensor< T > &t)
Definition tensor.h:1915
Default store of an object via serialize(ar, t).
Definition archive.h:612
static Q op(const Q &coeff)
Definition tensor.h:249
For real types return value, for complex return conjugate.
Definition tensor.h:240
static Q op(const Q &coeff)
Definition tensor.h:241
Per-thread grow-on-demand buffer pair for general_fast_transform.
Definition tensor.h:2700
Tensor< R > b
Definition tensor.h:2700
Tensor< R > a
Definition tensor.h:2700
static const double s0
Definition tdse4.cc:83
#define UNARY_UNOPTIMIZED_ITERATOR(X, x, exp)
Definition tensor_macros.h:678
#define BINARY_OPTIMIZED_ITERATOR(X, x, Y, y, exp)
Definition tensor_macros.h:701
#define UNARY_OPTIMIZED_ITERATOR(X, x, exp)
Definition tensor_macros.h:658
#define TERNARY_OPTIMIZED_ITERATOR(X, x, Y, y, Z, z, exp)
Definition tensor_macros.h:719
#define TENSOR_MAXDIM
Definition tensor_macros.h:194
Declares and implements TensorException.
#define TENSOR_ASSERT(condition, msg, value, t)
Definition tensorexcept.h:130
#define TENSOR_EXCEPTION(msg, value, t)
Definition tensorexcept.h:126
AtomicInt sum
Definition test_atomicint.cc:46
static const double alpha
Definition testcosine.cc:10
const double offset
Definition testfuns.cc:143
std::size_t axis
Definition testpdiff.cc:59
double k0
Definition testperiodic.cc:66
double k1
Definition testperiodic.cc:67
Reclaimable thread-specific storage (a thread_local you can free).
#define TENSOR_RESULT_TYPE(L, R)
This macro simplifies access to TensorResultType.
Definition type_data.h:205