32#ifndef MADNESS_TENSOR_TENSOR_H__INCLUDED
33#define MADNESS_TENSOR_TENSOR_H__INCLUDED
211#ifndef HAVE_STD_ABS_LONG
215 return a>=0 ?
a : -
a;
220 static long abs(
long a) {
229#define IS_ODD(n) ((n)&0x1)
230#define IS_UNALIGNED(p) (((unsigned long)(p))&0x7)
234 template <
typename Q,
bool iscomplex>
242 template <
typename Q>
250 template <
typename Q>
259 template <
typename T=
int>
double mynorm(
int t) {
260 return double(t)*double(t);
263 template <
typename T> T
mynorm(std::complex<T> t) {
268 template <
class T>
class SliceTensor;
273#ifdef TENSOR_USE_SHARED_ALIGNED_ARRAY
274#define TENSOR_SHARED_PTR detail::SharedAlignedArray
283 template <
typename T>
class SharedAlignedArray {
286 void dec() {
if (
p && ((*cnt)-- == 1)) {free(
p);
p = 0;}}
287 void inc() {
if (
p) (*cnt)++;}
289 SharedAlignedArray() :
p(0), cnt(0) {}
290 T* allocate(std::size_t size,
unsigned int alignment) {
291 std::size_t
offset = (size*
sizeof(T)-1)/
sizeof(AtomicInt) + 1;
292 std::size_t nbyte = (
offset+1)*
sizeof(AtomicInt);
294 cnt = (AtomicInt*)(
p) +
offset;
298 SharedAlignedArray<T>& operator=(
const SharedAlignedArray<T>& other) {
299 if (
this != &other) {dec();
p = other.p; cnt = other.cnt; inc();}
302 void reset() {dec();
p = 0;}
303 ~SharedAlignedArray() {dec();}
307#define TENSOR_SHARED_PTR std::shared_ptr
332 for (
int i=0; i<nd; ++i) {
333 TENSOR_ASSERT(
d[i]>=0 &&
d[i]<268435456,
"invalid dimension size in new tensor",
d[i],0);
340#define TENSOR_ALIGNMENT 16
342#define TENSOR_ALIGNMENT 32
343#elif MADNESS_HAVE_AVX2
346#define TENSOR_ALIGNMENT 32
347#elif MADNESS_HAVE_AVX512
349#define TENSOR_ALIGNMENT 64
352#define TENSOR_ALIGNMENT 64
355#ifdef TENSOR_USE_SHARED_ALIGNED_ARRAY
357#elif defined WORLD_GATHER_MEM_STATS
369 std::printf(
"new failed nd=%ld type=%ld size=%ld\n", nd,
id(),
_size);
370 std::printf(
" %ld %ld %ld %ld %ld %ld\n",
371 d[0],
d[1],
d[2],
d[3],
d[4],
d[5]);
380 memset((
void *)
_p, 0,
_size*
sizeof(T));
457 explicit operator bool() const noexcept {
458 return this->
size() > 0;
463 return !
static_cast<bool>(*this);
496 explicit Tensor(
long d0,
long d1,
long d2) :
_p(0) {
507 explicit Tensor(
long d0,
long d1,
long d2,
long d3) :
_p(0) {
519 explicit Tensor(
long d0,
long d1,
long d2,
long d3,
long d4) :
_p(0) {
532 explicit Tensor(
long d0,
long d1,
long d2,
long d3,
long d4,
long d5) {
541 explicit Tensor(
const std::vector<long>&
d,
bool dozero=
true) :
_p(0) {
542 allocate(
d.size(),
d.size() ? &(
d[0]) : 0, dozero);
550 explicit Tensor(
long nd,
const long d[],
bool dozero=
true) :
_p(0) {
576 template <
typename Q>
586 template <
typename Q>
596 template <
typename Q>
608 template <
typename Q>
620 template <
typename Q>
633 template <
typename Q>
646 template <
typename Q>
659 template <
typename Q>
662 return (*
this) + (-x);
678 template <
typename Q>
689 template <
typename Q>
699 template <
typename Q>
710 template <
typename Q>
774#ifdef TENSOR_BOUNDS_CHECKING
786#ifdef TENSOR_BOUNDS_CHECKING
797#ifdef TENSOR_BOUNDS_CHECKING
808#ifdef TENSOR_BOUNDS_CHECKING
819#ifdef TENSOR_BOUNDS_CHECKING
831#ifdef TENSOR_BOUNDS_CHECKING
844#ifdef TENSOR_BOUNDS_CHECKING
858#ifdef TENSOR_BOUNDS_CHECKING
873#ifdef TENSOR_BOUNDS_CHECKING
889#ifdef TENSOR_BOUNDS_CHECKING
907#ifdef TENSOR_BOUNDS_CHECKING
926#ifdef TENSOR_BOUNDS_CHECKING
946#ifdef TENSOR_BOUNDS_CHECKING
967#ifdef TENSOR_BOUNDS_CHECKING
988 const T&
operator()(
long i,
long j,
long k,
long l,
long m,
long n)
const {
989#ifdef TENSOR_BOUNDS_CHECKING
1009#ifdef TENSOR_BOUNDS_CHECKING
1010 TENSOR_ASSERT(i>=0 && i<
_dim[0],
"non-PC general indexing bounds check failed dim=",
d,
this);
1025#ifdef TENSOR_BOUNDS_CHECKING
1026 TENSOR_ASSERT(i>=0 && i<
_dim[0],
"non-PC general indexing bounds check failed dim=",
d,
this);
1038 TENSOR_ASSERT(ind.size()>=(
unsigned int)
_ndim,
"invalid number of dimensions",ind.size(),
this);
1052 TENSOR_ASSERT(ind.size()>=(
unsigned int)
_ndim,
"invalid number of dimensions",ind.size(),
this);
1066 TENSOR_ASSERT(s.size()>=(
unsigned)(this->ndim()),
"invalid number of dimensions",
1076 TENSOR_ASSERT(s.size()>=(
unsigned)(this->ndim()),
"invalid number of dimensions",
1332 const Slice& s3)
const {
1346 Slice s[5] = {
s0,s1,s2,s3,s4};
1357 Slice s[5] = {
s0,s1,s2,s3,s4};
1368 Slice s[6] = {
s0,s1,s2,s3,s4,s5};
1380 Slice s[6] = {
s0,s1,s2,s3,s4,s5};
1411 return reshape(
d.size(),
d.size() ? &
d[0] : 0);
1419 return reshape(
d.size(),
d.size() ? &
d[0] : 0);
1445 long d[2] = {dim0,dim1};
1455 long d[2] = {dim0,dim1};
1466 long d[3] = {dim0,dim1,dim2};
1477 long d[3] = {dim0,dim1,dim2};
1489 long d[4] = {dim0,dim1,dim2,dim3};
1501 long d[4] = {dim0,dim1,dim2,dim3};
1514 long d[5] = {dim0,dim1,dim2,dim3,dim4};
1527 long d[5] = {dim0,dim1,dim2,dim3,dim4};
1541 long d[6] = {dim0,dim1,dim2,dim3,dim4,dim5};
1554 const Tensor<T> reshape(
long dim0,
long dim1,
long dim2,
long dim3,
long dim4,
long dim5)
const {
1555 long d[6] = {dim0,dim1,dim2,dim3,dim4,dim5};
1689 T result = *(this->_p);
1691 for (
long i=0; i<
_ndim; ++i) ind[i]=0;
1694 if (result > *_p0) {
1696 for (
long i=0; i<nd; ++i) ind[i]=iter.ind[i];
1709 T result = *(this->_p);
1711 for (
long i=0; i<
_ndim; ++i) ind[i]=0;
1714 if (result < *_p0) {
1716 for (
long i=0; i<nd; ++i) ind[i]=iter.ind[i];
1741 for (
long i=0; i<
_ndim; ++i) ind[i]=0;
1745 if (result > absval) {
1747 for (
long i=0; i<nd; ++i) ind[i]=iter.ind[i];
1762 for (
long i=0; i<
_ndim; ++i) ind[i]=0;
1766 if (result < absval) {
1768 for (
long i=0; i<nd; ++i) ind[i]=iter.ind[i];
1797 template <
typename opT>
1811 if (
alpha == T(1)) {
1815 else if (
beta == T(0)) {
1822 else if (
alpha == T(0)) {
1826 else if (
beta == T(0)) {
1835 }
else if (
beta == T(0)) {
1870 iterlevel, optimize,
fusedim, jdim);
1881 iterlevel, optimize,
fusedim, jdim);
1885 template <
class Q,
class R>
1893 iterlevel, optimize,
fusedim, jdim);
1917 template <
class Archive,
typename T>
1932 template <
class Archive,
typename T>
1935 long sz = 0l,
id = 0l;
1937 if (
id != t.
id())
throw "type mismatch deserializing a tensor";
1942 if (sz != t.
size())
throw "size mismatch deserializing a tensor";
1956 template <
typename T,
typename Q>
1965 template <
typename T,
typename Q>
1974 template <
typename T,
typename Q>
1999 template <
class Q,
class T>
2022 template <
class T,
class Q>
2079 long nd = 0,
size=1;
2080 for (
long i=0; i<t.
_ndim; ++i) {
2081 long start=s[i].start,
end=s[i].end, step=s[i].step;
2084 if (start < 0) start += this->
_dim[i];
2086 long len =
end-start+1;
2087 if (step) len /= step;
2091 end = start + (len-1)*step;
2096 TENSOR_ASSERT(start>=0 && start<this->
_dim[i],
"slice start invalid",start,
this);
2098 TENSOR_ASSERT(len>0,
"slice length must be non-zero",len,
this);
2104 this->
_dim[nd] = len;
2164 if (t.
size() == 0) {
2165 s <<
"[empty tensor]\n";
2170 long index_width = 0;
2171 for (
int i = 0; i<(t.
ndim()-1); ++i) {
2172 if (maxdim < t.
dim(i)) maxdim = t.
dim(i);
2176 else if (maxdim < 100)
2178 else if (maxdim < 1000)
2180 else if (maxdim < 10000)
2185 std::ios::fmtflags oldflags = s.setf(std::ios::scientific);
2186 long oldprec = s.precision();
2187 long oldwidth = s.width();
2191 const T*
p = iter._p0;
2192 long inc = iter._s0;
2193 long dimj = iter.dimj;
2194 s.unsetf(std::ios::scientific);
2196 for (
long i=0; i<iter.ndim; ++i) {
2197 s.width(index_width);
2204 s.setf(std::ios::fixed);
2205 for (
long j=0; j<dimj; ++j,
p+=inc) {
2212 s.unsetf(std::ios::scientific);
2215 s.setf(oldflags,std::ios::floatfield);
2216 s.precision(oldprec);
2228 long nd = left.
ndim() + right.
ndim();
2232 for (
long i = 0; i < left.
ndim(); ++i)
d[i] = left.
dim(i);
2233 for (
long i = 0; i < right.
ndim(); ++i)
d[i + left.
ndim()] = right.
dim(i);
2246 T *ptr = result.
ptr();
2251 for (iter.
reset(); iter.
_p0; ++iter) {
2252 long dimj = iter.
dimj;
2254 long Tstride = iter.
_s0;
2255 for (
long _j=0; _j<dimj; ++_j, _p0+=Tstride) {
2256 *ptr++ = val1 * (*_p0);
2271 template <
class T,
class Q>
2273 long k0=-1,
long k1=0) {
2276 long nd = left.
ndim() + right.
ndim() - 2;
2277 TENSOR_ASSERT(nd!=0,
"result is a scalar but cannot return one ... use dot",
2282 right.
dim(
k1), &left);
2285 "invalid number of dimensions in the result", nd,0);
2290 for (
long i=0; i<
k0; ++i)
d[i] = left.
dim(i);
2291 for (
long i=
k0+1; i<left.
ndim(); ++i)
d[i-1] = left.
dim(i);
2292 base = left.
ndim()-1;
2293 for (
long i=0; i<
k1; ++i)
d[i+base] = right.
dim(i);
2295 for (
long i=
k1+1; i<right.
ndim(); ++i)
d[i+base] = right.
dim(i);
2315 template <
class T,
class Q>
2323 resultT* ptr = result.
ptr();
2329 if (
k0==0 &&
k1==0) {
2331 long dimk = left.
dim(
k0);
2332 long dimj = right.
stride(0);
2333 long dimi = left.
stride(0);
2334 mTxm(dimi,dimj,dimk,ptr,left.
ptr(),right.
ptr());
2337 else if (
k0==(left.
ndim()-1) &&
k1==(right.
ndim()-1)) {
2339 long dimk = left.
dim(
k0);
2340 long dimi = left.
size()/dimk;
2341 long dimj = right.
size()/dimk;
2342 mxmT(dimi,dimj,dimk,ptr,left.
ptr(),right.
ptr());
2345 else if (
k0==0 &&
k1==(right.
ndim()-1)) {
2347 long dimk = left.
dim(
k0);
2348 long dimi = left.
stride(0);
2349 long dimj = right.
size()/dimk;
2353 else if (
k0==(left.
ndim()-1) &&
k1==0) {
2355 long dimk = left.
dim(
k0);
2356 long dimi = left.
size()/dimk;
2357 long dimj = right.
stride(0);
2358 mxm(dimi,dimj,dimk,ptr,left.
ptr(),right.
ptr());
2363 long dimj = left.
dim(
k0);
2367 iter0._p0; ++iter0) {
2369 long s0 = iter0._s0;
2370 for (iter1.
reset(); iter1.
_p0; ++iter1) {
2373 long s1 = iter1.
_s0;
2375 for (
long j=0; j<dimj; ++j,p0+=
s0,p1+=s1) {
2376 sum += (*p0) * (*p1);
2397 template <
class T,
class Q>
2400 TENSOR_ASSERT(
c.ndim() == 2,
"second argument must be a matrix",
c.ndim(),&
c);
2408 for (
long i=0; i<t.
ndim(); ++i) {
2409 result =
inner(result,
c,0,0);
2425 template <
class T,
class Q>
2429 for (
long i=0; i<t.
ndim(); ++i) {
2430 result =
inner(result,
c[i],0,0);
2463 template <
class T,
class Q>
2467 const Q *pc=
c.ptr();
2468 resultT *t0=workspace.ptr(), *t1=result.ptr();
2471 t1 = workspace.ptr();
2474 long dimj =
c.dim(1);
2476 for (
int n=1; n<t.
ndim(); ++n) dimi *= dimj;
2478 mTxmq(dimi, dimj, dimj, t0, t.
ptr(), pc);
2479 for (
int n=1; n<t.
ndim(); ++n) {
2480 mTxmq(dimi, dimj, dimj, t1, t0, pc);
2499 Tensor<std::complex<R>>& result,
2500 Tensor<std::complex<R>>& workspace) {
2505 const R* pc =
c.ptr();
2506 const long ndim = t.
ndim();
2507 const long sz = t.
size();
2508 MADNESS_CHECK(result.size() >= sz && workspace.size() >= sz);
2510 long dimj =
c.dim(1);
2512 for (
int n = 1; n < ndim; ++n) dimi *= dimj;
2514 R* res_raw =
reinterpret_cast<R*
>(result.ptr());
2515 R* wrk_raw =
reinterpret_cast<R*
>(workspace.ptr());
2516 R* bufA = (ndim & 1) ? res_raw : wrk_raw;
2517 R* bufB = (ndim & 1) ? wrk_raw : res_raw;
2520 R* in_im = bufA + sz;
2522 R* out_im = bufB + sz;
2525 const R* t_raw =
reinterpret_cast<const R*
>(t.
ptr());
2526 for (
long i = 0; i < sz; ++i) {
2527 in_re[i] = t_raw[2 * i];
2528 in_im[i] = t_raw[2 * i + 1];
2531 for (
int n = 0; n < ndim; ++n) {
2532 mTxmq(dimi, dimj, dimj, out_re, in_re, pc);
2533 mTxmq(dimi, dimj, dimj, out_im, in_im, pc);
2534 std::swap(in_re, out_re);
2535 std::swap(in_im, out_im);
2539 for (
long i = 0; i < sz; ++i) {
2540 res_raw[2 * i] = in_re[i];
2541 res_raw[2 * i + 1] = in_im[i];
2566 template <
class T,
class Q>
2575 "general_fast_transform requires the matrix type not to "
2576 "promote the result past the tensor type");
2584 const long D = t.
ndim();
2590 long running = t.
size();
2591 long max_running = running;
2592 for (
long d = 0;
d <
D; ++
d) {
2595 running = (running /
c[
d].dim(0)) *
c[
d].dim(1);
2596 if (running > max_running) max_running = running;
2599 workspace.size() >= max_running);
2602 R* buf0 = workspace.ptr();
2603 R* buf1 = result.ptr();
2604 if (
D & 1) std::swap(buf0, buf1);
2610 for (
long d = 0;
d <
D; ++
d) {
2611 const long dimk =
c[
d].dim(0);
2612 const long dimj =
c[
d].dim(1);
2613 const long dimi = n / dimk;
2615 mTxmq(dimi, dimj, dimk, out, t.
ptr(),
c[
d].ptr());
2617 mTxmq(dimi, dimj, dimk, out, in_r,
c[
d].ptr());
2621 out = (out == buf0) ? buf1 : buf0;
2631 Tensor<std::complex<R>>& result,
2632 Tensor<std::complex<R>>& workspace) {
2637 const long D = t.
ndim();
2639 long running = t.
size();
2640 long max_running = running;
2641 for (
long d = 0;
d <
D; ++
d) {
2644 running = (running /
c[
d].dim(0)) *
c[
d].dim(1);
2645 if (running > max_running) max_running = running;
2648 workspace.size() >= max_running);
2654 R* res_raw =
reinterpret_cast<R*
>(result.ptr());
2655 R* wrk_raw =
reinterpret_cast<R*
>(workspace.ptr());
2656 R* bufA = (
D & 1) ? res_raw : wrk_raw;
2657 R* bufB = (
D & 1) ? wrk_raw : res_raw;
2660 R* bufA_im = bufA + max_running;
2662 R* bufB_im = bufB + max_running;
2665 const long sz0 = t.
size();
2666 const R* t_raw =
reinterpret_cast<const R*
>(t.
ptr());
2667 for (
long i = 0; i < sz0; ++i) {
2668 bufA_re[i] = t_raw[2 * i];
2669 bufA_im[i] = t_raw[2 * i + 1];
2674 R* out_re = bufB_re;
2675 R* out_im = bufB_im;
2678 for (
long d = 0;
d <
D; ++
d) {
2679 const long dimk =
c[
d].dim(0);
2680 const long dimj =
c[
d].dim(1);
2681 const long dimi = n / dimk;
2683 mTxmq(dimi, dimj, dimk, out_re, in_re,
c[
d].ptr());
2684 mTxmq(dimi, dimj, dimk, out_im, in_im,
c[
d].ptr());
2687 std::swap(in_re, out_re);
2688 std::swap(in_im, out_im);
2692 const long final_sz = n;
2693 for (
long i = 0; i < final_sz; ++i) {
2694 res_raw[2 * i] = in_re[i];
2695 res_raw[2 * i + 1] = in_im[i];
2703 template <
typename R>
2710 template <
typename R>
2726 template <
typename R>
2729 if (s.a.size() < need) {
2740 template <
typename R>
2806 for (
long i=0; i<n; ++i) result(i,i) = T(1);
2812#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
A tensor is a multidimensional array.
Definition tensor.h:313
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
BaseTensor()
Definition basetensor.h:116
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
virtual ~SliceTensor()
Definition tensor.h:2147
SliceTensor(const Tensor< T > &t, const Slice s[])
Definition tensor.h:2073
SliceTensor< T > & operator=(const SliceTensor< Q > &t)
Definition tensor.h:2126
SliceTensor< T > & operator=(const Tensor< Q > &t)
Definition tensor.h:2137
SliceTensor< T > & operator=(const SliceTensor< T > &t)
Definition tensor.h:2120
SliceTensor(const Tensor< T > &t, const std::array< Slice, TENSOR_MAXDIM > s)
Definition tensor.h:2069
SliceTensor< T > & operator=(const Tensor< T > &t)
Definition tensor.h:2131
SliceTensor< T > & operator=(const T &t)
Definition tensor.h:2142
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:313
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:1759
void deallocate()
Definition tensor.h:393
double *MADNESS_RESTRICT _p
Definition tensor.h:317
Tensor< T > & operator=(T x)
Inplace fill tensor with scalar.
Definition tensor.h:558
const Tensor< T > swapdim(long idim, long jdim) const
Returns new view/tensor swaping dimensions i and j.
Definition tensor.h:1619
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:541
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:1342
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:1331
float_scalar_type normf() const
Returns the Frobenius norm of the tensor.
Definition tensor.h:1731
Tensor< T > & gaxpy(T alpha, const Tensor< T > &other, T beta)
Inplace generalized saxpy ... this = this*alpha + other*beta.
Definition tensor.h:1810
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:1875
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:1280
Tensor(long d0, long d1)
Create and zero new 2-d tensor.
Definition tensor.h:486
const T * ptr() const
Returns a pointer to the internal data.
Definition tensor.h:1850
bool operator!() const noexcept
convenience for testing if tensor is empty (i.e., has no data)
Definition tensor.h:462
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:1738
Tensor< T > & unaryop(opT &op)
Inplace apply a unary function to each element of the tensor.
Definition tensor.h:1798
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:648
Tensor< T > & fill(T x)
Inplace fill with a scalar (legacy name).
Definition tensor.h:567
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:1210
Tensor< T > & operator+=(const Tensor< Q > &t)
Inplace addition of two tensors.
Definition tensor.h:577
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:1513
Tensor< T > swapdim(long idim, long jdim)
Returns new view/tensor swaping dimensions i and j.
Definition tensor.h:1610
const Tensor< T > flat() const
Returns new view/tensor rehshaping to flat (1-d) tensor.
Definition tensor.h:1566
T sum() const
Returns the sum of all elements of the tensor.
Definition tensor.h:1667
Tensor< T > reshape(int ndimnew, const long *d)
Returns new view/tensor reshaping size/number of dimensions to conforming tensor.
Definition tensor.h:1389
const T & operator[](long i) const
1-d indexing operation using [] without bounds checking.
Definition tensor.h:796
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:1865
Tensor< T > reshape(long dim0, long dim1)
Returns new view/tensor rehaping to conforming 2-d tensor with given dimensions.
Definition tensor.h:1444
TensorTypeData< double >::scalar_type scalar_type
Definition tensor.h:405
Tensor(long d0, long d1, long d2, long d3, long d4, long d5)
Create and zero new 6-d tensor.
Definition tensor.h:532
double type
Definition tensor.h:402
Tensor< TENSOR_RESULT_TYPE(T, Q) > operator+(const Tensor< Q > &t) const
Addition of two tensors to produce a new tensor.
Definition tensor.h:597
T & operator()(long i)
1-d indexing operation without bounds checking.
Definition tensor.h:807
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:1320
T & operator()(long i, long j, long k, long l, long m)
5-d indexing operation without bounds checking.
Definition tensor.h:925
T * ptr()
Returns a pointer to the internal data.
Definition tensor.h:1845
bool conforms(const Tensor< Q > &t) const
Test if *this and t conform.
Definition tensor.h:1662
const Tensor< T > mapdim(const std::vector< long > &map) const
Returns new view/tensor permuting the dimensions.
Definition tensor.h:1638
T & operator()(long i, long j)
2-d indexing operation without bounds checking.
Definition tensor.h:830
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:1418
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:1646
const Tensor< T > operator()(const std::vector< Slice > &s) const
General slicing operation (const).
Definition tensor.h:1075
Tensor< T > & operator-=(const Tensor< Q > &t)
Inplace subtraction of two tensors.
Definition tensor.h:587
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:1476
const T & operator()(long i, long j, long k) const
3-d indexing operation without bounds checking.
Definition tensor.h:872
SliceTensor< T > operator()(long i, const Slice &s1)
Return a 1d SliceTensor that views the specified range of the 2d Tensor.
Definition tensor.h:1120
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:1376
Tensor< T > mapdim(const std::vector< long > &map)
Returns new view/tensor permuting the dimensions.
Definition tensor.h:1629
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:622
const Tensor< T > operator()(const std::array< Slice, TENSOR_MAXDIM > &s) const
General slicing operation (const).
Definition tensor.h:1093
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:1240
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:1400
const Tensor< T > fusedim(long i) const
Returns new view/tensor fusing contiguous dimensions i and i+1.
Definition tensor.h:1601
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type scale(Q x)
Inplace multiplication by scalar of supported type (legacy name).
Definition tensor.h:691
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type operator-=(const Q &x)
Inplace decrement by scalar of supported type.
Definition tensor.h:712
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:635
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:1160
TensorTypeData< double >::float_scalar_type float_scalar_type
Definition tensor.h:408
Tensor(const Tensor< T > &t)
Copy constructor is shallow (same as assignment).
Definition tensor.h:424
T & operator()(long i, long j, long k)
3-d indexing operation without bounds checking.
Definition tensor.h:857
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:1353
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:1500
Tensor< T > operator-() const
Unary negation producing a new tensor.
Definition tensor.h:668
const T & operator()(long i, long j) const
2-d indexing operation without bounds checking.
Definition tensor.h:843
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:1310
T & operator()(long i, long j, long k, long l, long m, long n)
6-d indexing operation without bounds checking.
Definition tensor.h:966
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:1364
SliceTensor< T > operator()(const Slice &s0)
Return a 1d SliceTensor that views the specified range of the 1d Tensor.
Definition tensor.h:1100
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:1300
const T & operator()(const long ind[]) const
Politically incorrect general indexing operation without bounds checking.
Definition tensor.h:1021
Tensor< T > & emul(const Tensor< T > &t)
Inplace multiply by corresponding elements of argument Tensor.
Definition tensor.h:1804
Tensor< T > & operator=(const Tensor< T > &t)
Assignment is shallow (same as copy constructor).
Definition tensor.h:439
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:1200
T & operator()(long i, long j, long k, long l)
4-d indexing operation without bounds checking.
Definition tensor.h:888
TENSOR_RESULT_TYPE(T, Q) trace(const Tensor< Q > &t) const
Return the trace of two tensors (no complex conjugate invoked).
Definition tensor.h:1782
SliceTensor< T > operator()(const std::array< Slice, TENSOR_MAXDIM > &s)
General slicing operation.
Definition tensor.h:1085
T max(long *ind=0) const
Return the maximum value (and if ind is non-null, its index) in the Tensor.
Definition tensor.h:1708
Tensor(long d0)
Create and zero new 1-d tensor.
Definition tensor.h:477
const T & operator()(long i, long j, long k, long l) const
4-d indexing operation without bounds checking.
Definition tensor.h:906
T product() const
Return the product of all elements of the tensor.
Definition tensor.h:1681
const T & operator()(long i, long j, long k, long l, long m) const
5-d indexing operation without bounds checking.
Definition tensor.h:945
T min(long *ind=0) const
Return the minimum value (and if ind is non-null, its index) in the Tensor.
Definition tensor.h:1688
Tensor< TENSOR_RESULT_TYPE(T, Q) > operator-(const Tensor< Q > &t) const
Subtraction of two tensors to produce a new tensor.
Definition tensor.h:609
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:988
T & operator()(const std::vector< long > ind)
General indexing operation with bounds checking.
Definition tensor.h:1037
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:1574
virtual ~Tensor()
Definition tensor.h:1902
const Tensor< T > operator()(const Slice &s0) const
Return a 1d SliceTensor that views the specified range of the 1d Tensor.
Definition tensor.h:1110
void allocate(long nd, const long d[], bool dozero)
Definition tensor.h:320
const BaseTensor * base() const
Returns a pointer to the base class.
Definition tensor.h:1860
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:1540
T sumsq() const
Returns the sum of the squares of the elements.
Definition tensor.h:1674
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type operator*=(const Q &x)
Inplace multiplication by scalar of supported type.
Definition tensor.h:680
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:1150
T & operator[](long i)
1-d indexing operation using [] without bounds checking.
Definition tensor.h:785
Tensor< T > & screen(double x)
Inplace set elements of *this less than x in absolute magnitude to zero.
Definition tensor.h:763
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:1654
friend class SliceTensor
Definition tensor.h:314
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:1583
Tensor(long d0, long d1, long d2, long d3)
Create and zero new 4-d tensor.
Definition tensor.h:507
Tensor(long d0, long d1, long d2)
Create and zero new 3-d tensor.
Definition tensor.h:496
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:1554
const Tensor< T > reshape(long dim0) const
Returns new view/tensor rehapings to conforming 1-d tensor with given dimension.
Definition tensor.h:1434
bool has_data() const
Definition tensor.h:1907
Tensor< T > reshape(const std::vector< long > &d)
Returns new view/tensor reshaping size/number of dimensions to conforming tensor.
Definition tensor.h:1410
BaseTensor * base()
Returns a pointer to the base class.
Definition tensor.h:1855
const TensorIterator< double > & end() const
Definition tensor.h:1897
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:1465
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:1488
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:1180
Tensor< T > reshape(long dim0)
Returns new view/tensor rehapings to conforming 1-d tensor with given dimension.
Definition tensor.h:1426
SliceTensor< T > operator()(const Slice &s0, long j)
Return a 1d SliceTensor that views the specified range of the 2d Tensor.
Definition tensor.h:1140
Tensor< T > fusedim(long i)
Returns new view/tensor fusing contiguous dimensions i and i+1.
Definition tensor.h:1592
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:1270
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:1190
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:1790
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:1250
const T & operator()(const std::vector< long > ind) const
General indexing operation with bounds checking.
Definition tensor.h:1051
T & operator()(const long ind[])
Politically incorrect general indexing operation without bounds checking.
Definition tensor.h:1005
Tensor< T > flat()
Returns new view/tensor rehshaping to flat (1-d) tensor.
Definition tensor.h:1560
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:1454
Tensor(long d0, long d1, long d2, long d3, long d4)
Create and zero new 5-d tensor.
Definition tensor.h:519
Tensor()
Default constructor does not allocate any data and sets ndim=-1, size=0, _p=0, and id.
Definition tensor.h:411
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:1290
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:1886
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:1130
static bool bounds_checking()
Return true if bounds checking was enabled at compile time.
Definition tensor.h:773
const T & operator()(long i) const
1-d indexing operation without bounds checking.
Definition tensor.h:818
void clear()
Frees all memory and resests to state of default constructor.
Definition tensor.h:1905
TENSOR_SHARED_PTR< double > _shptr
Definition tensor.h:318
Tensor< T > & fillrandom()
Inplace fill with random values ( [0,1] for floats, [0,MAXSIZE] for integers).
Definition tensor.h:729
Tensor(long nd, const long d[], bool dozero=true)
Politically incorrect general constructor.
Definition tensor.h:550
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:1230
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:661
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:1170
Tensor< T > & fillindex()
Inplace fill with the index of each element.
Definition tensor.h:753
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:1260
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:1526
IsSupported< TensorTypeData< Q >, Tensor< T > & >::type operator+=(const Q &x)
Inplace increment by scalar of supported type.
Definition tensor.h:701
Tensor< T > & conj()
Inplace complex conjugate.
Definition tensor.h:721
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:1220
SliceTensor< T > operator()(const std::vector< Slice > &s)
General slicing operation.
Definition tensor.h:1065
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 > identity_matrix(long n)
Returns the identity matrix of the specified size.
Definition tensor.h:2804
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:2048
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:2761
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:2464
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:2316
Tensor< T > transpose(const Tensor< T > &t)
Returns a new deep copy of the transpose of the input tensor.
Definition tensor.h:2039
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:2741
std::pair< Tensor< R > &, Tensor< R > & > eval_scratch(long need)
Definition tensor.h:2727
thread_specific< EvalScratch< R > > & eval_scratch_pool()
Definition tensor.h:2711
T mynorm(T t)
Definition tensor.h:256
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:452
void RandomVector(int n, T *t)
Definition ran.h:153
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:2243
Q conditional_conj(const Q &coeff)
For real types return value, for complex return conjugate.
Definition tensor.h:251
GenTensor< TENSOR_RESULT_TYPE(R, Q)> general_transform(const GenTensor< R > &t, const Tensor< Q > c[])
Definition gentensor.h:274
int FunctionDefaults< NDIM >::k
Definition mraimpl.h:3878
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:2286
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:807
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:2300
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:2568
std::vector< CCPairFunction< T, NDIM > > operator*(const double fac, const std::vector< CCPairFunction< T, NDIM > > &arg)
Definition ccpairfunction.h:1111
std::vector< CCPairFunction< T, NDIM > > operator+(const CCPairFunction< T, NDIM > c1, const CCPairFunction< T, NDIM > &c2)
Definition ccpairfunction.h:1066
Function< T, NDIM > sum(World &world, const std::vector< Function< T, NDIM > > &f, bool fence=true)
Returns new function — q = sum_i f[i].
Definition vmra.h:1774
ConcurrentHashMap< hashT, std::shared_ptr< GaussianConvolution1D< double > > > GaussianConvolution1DCache< double >::map
Definition convolution1d.h:1073
std::enable_if< std::is_base_of< ProjectorBase, projT >::value, OuterProjector< projT, projQ > >::type outer(const projT &p0, const projQ &p1)
Definition projector.h:476
std::vector< CCPairFunction< T, NDIM > > operator-(const std::vector< CCPairFunction< T, NDIM > > c1, const std::vector< CCPairFunction< T, NDIM > > &c2)
Definition ccpairfunction.h:1082
static double pop(std::vector< double > &v)
Definition SCF.cc:118
static void aligned_zero(long n, T *a)
Definition aligned.h:55
const Future< void > Future< void >::value
Definition future.cc:44
T RandomValue()
Random value that wraps the default Fibonacci generator.
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:1108
std::string type(const PairType &n)
Definition PNOParameters.h:18
static const long default_jdim
Definition tensoriter.h:57
Function< T, CCPairFunction< T, NDIM >::LDIM > inner(const CCPairFunction< T, NDIM > &c, const Function< T, CCPairFunction< T, NDIM >::LDIM > &f, const std::tuple< int, int, int > v1, const std::tuple< int, int, int > v2)
Definition ccpairfunction.h:1007
double real(double x)
Definition complexfun.h:52
const FunctionCommonData< T, NDIM > * FunctionCommonData< T, NDIM >::data[MAXK]
Definition mraimpl.h:3875
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:2239
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:214
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
Definition test_ar.cc:204
Definition type_data.h:146
static void load(const Archive &s, Tensor< T > &t)
Definition tensor.h:1934
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:1919
Default store of an object via serialize(ar, t).
Definition archive.h:612
static Q op(const Q &coeff)
Definition tensor.h:244
For real types return value, for complex return conjugate.
Definition tensor.h:235
static Q op(const Q &coeff)
Definition tensor.h:236
Per-thread grow-on-demand buffer pair for general_fast_transform.
Definition tensor.h:2704
Tensor< R > b
Definition tensor.h:2704
Tensor< R > a
Definition tensor.h:2704
static const double s0
Definition tdse4.cc:83
#define TENSOR_SHARED_PTR
Definition tensor.h:307
#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
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