MADNESS  version 0.9
Namespaces | Functions

Defines operations on vectors of FunctionsThis file defines a number of operations on vectors of functions. Assume v is a vector of NDIM-D functions of a certain type. More...

#include <madness/mra/mra.h>
#include <madness/mra/derivative.h>
#include <cstdio>
Include dependency graph for vmra.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 madness
 Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
 

Functions

template<typename T , std::size_t NDIM>
void madness::compress (World &world, const std::vector< Function< T, NDIM > > &v, bool fence=true)
 Compress a vector of functions. More...
 
template<typename T , std::size_t NDIM>
void madness::reconstruct (World &world, const std::vector< Function< T, NDIM > > &v, bool fence=true)
 Reconstruct a vector of functions. More...
 
template<typename T , std::size_t NDIM>
void madness::nonstandard (World &world, std::vector< Function< T, NDIM > > &v, bool fence=true)
 Generates non-standard form of a vector of functions. More...
 
template<typename T , std::size_t NDIM>
void madness::standard (World &world, std::vector< Function< T, NDIM > > &v, bool fence=true)
 Generates standard form of a vector of functions. More...
 
template<typename T , std::size_t NDIM>
void madness::truncate (World &world, std::vector< Function< T, NDIM > > &v, double tol=0.0, bool fence=true)
 Truncates a vector of functions. More...
 
template<typename T , std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::apply (World &world, const Derivative< T, NDIM > &D, const std::vector< Function< T, NDIM > > &v, bool fence=true)
 Applies a derivative operator to a vector of functions. More...
 
template<typename T , std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::zero_functions (World &world, int n)
 Generates a vector of zero functions. More...
 
template<typename T , typename R , std::size_t NDIM>
std::vector< Function
< TENSOR_RESULT_TYPE(T, R),
NDIM > > 
madness::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]. More...
 
template<typename L , typename R , std::size_t NDIM>
std::vector< Function
< TENSOR_RESULT_TYPE(L, R),
NDIM > > 
madness::transform (World &world, const std::vector< Function< L, NDIM > > &v, const Tensor< R > &c, double tol, bool fence)
 
template<typename T , typename Q , std::size_t NDIM>
void madness::scale (World &world, std::vector< Function< T, NDIM > > &v, const std::vector< Q > &factors, bool fence=true)
 Scales inplace a vector of functions by distinct values. More...
 
template<typename T , typename Q , std::size_t NDIM>
void madness::scale (World &world, std::vector< Function< T, NDIM > > &v, const Q factor, bool fence=true)
 Scales inplace a vector of functions by the same. More...
 
template<typename T , std::size_t NDIM>
std::vector< double > madness::norm2s (World &world, const std::vector< Function< T, NDIM > > &v)
 Computes the 2-norms of a vector of functions. More...
 
template<typename T , std::size_t NDIM>
double madness::norm2 (World &world, const std::vector< Function< T, NDIM > > &v)
 Computes the 2-norm of a vector of functions. More...
 
double madness::conj (double x)
 
double madness::conj (float x)
 
template<typename T , typename R , std::size_t NDIM>
Tensor< TENSOR_RESULT_TYPE(T, R) > madness::matrix_inner (World &world, const std::vector< Function< T, NDIM > > &f, const std::vector< Function< R, NDIM > > &g, bool sym=false)
 Computes the matrix inner product of two function vectors - q(i,j) = inner(f[i],g[j]) More...
 
template<typename T , typename R , std::size_t NDIM>
Tensor< TENSOR_RESULT_TYPE(T, R) > madness::inner (World &world, const std::vector< Function< T, NDIM > > &f, const std::vector< Function< R, NDIM > > &g)
 Computes the element-wise inner product of two function vectors - q(i) = inner(f[i],g[i]) More...
 
template<typename T , typename R , std::size_t NDIM>
Tensor< TENSOR_RESULT_TYPE(T, R) > madness::inner (World &world, const Function< T, NDIM > &f, const std::vector< Function< R, NDIM > > &g)
 Computes the inner product of a function with a function vector - q(i) = inner(f,g[i]) More...
 
template<typename T , typename R , std::size_t NDIM>
std::vector< Function
< TENSOR_RESULT_TYPE(T, R),
NDIM > > 
madness::mul (World &world, const Function< T, NDIM > &a, const std::vector< Function< R, NDIM > > &v, bool fence=true)
 Multiplies a function against a vector of functions — q[i] = a * v[i]. More...
 
template<typename T , typename R , std::size_t NDIM>
std::vector< Function
< TENSOR_RESULT_TYPE(T, R),
NDIM > > 
madness::mul_sparse (World &world, const Function< T, NDIM > &a, const std::vector< Function< R, NDIM > > &v, double tol, bool fence=true)
 Multiplies a function against a vector of functions using sparsity of a and v[i] — q[i] = a * v[i]. More...
 
template<typename T , std::size_t NDIM>
void madness::norm_tree (World &world, const std::vector< Function< T, NDIM > > &v, bool fence=true)
 Makes the norm tree for all functions in a vector. More...
 
template<typename T , typename R , std::size_t NDIM>
std::vector< Function
< TENSOR_RESULT_TYPE(T, R),
NDIM > > 
madness::mul (World &world, const std::vector< Function< T, NDIM > > &a, const std::vector< Function< R, NDIM > > &b, bool fence=true)
 Multiplies two vectors of functions q[i] = a[i] * b[i]. More...
 
template<typename T , std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::square (World &world, const std::vector< Function< T, NDIM > > &v, bool fence=true)
 Computes the square of a vector of functions — q[i] = v[i]**2. More...
 
template<typename T , std::size_t NDIM>
void madness::set_thresh (World &world, std::vector< Function< T, NDIM > > &v, double thresh, bool fence=true)
 Sets the threshold in a vector of functions. More...
 
template<typename T , std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::conj (World &world, const std::vector< Function< T, NDIM > > &v, bool fence=true)
 Returns the complex conjugate of the vector of functions. More...
 
template<typename T , std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::copy (World &world, const std::vector< Function< T, NDIM > > &v, bool fence=true)
 Returns a deep copy of a vector of functions. More...
 
template<typename T , std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::copy (World &world, const Function< T, NDIM > &v, const unsigned int n, bool fence=true)
 Returns a vector of deep copies of of a function. More...
 
template<typename T , typename R , std::size_t NDIM>
std::vector< Function
< TENSOR_RESULT_TYPE(T, R),
NDIM > > 
madness::add (World &world, const std::vector< Function< T, NDIM > > &a, const std::vector< Function< R, NDIM > > &b, bool fence=true)
 Returns new vector of functions — q[i] = a[i] + b[i]. More...
 
template<typename T , typename R , std::size_t NDIM>
std::vector< Function
< TENSOR_RESULT_TYPE(T, R),
NDIM > > 
madness::add (World &world, const Function< T, NDIM > &a, const std::vector< Function< R, NDIM > > &b, bool fence=true)
 Returns new vector of functions — q[i] = a + b[i]. More...
 
template<typename T , typename R , std::size_t NDIM>
std::vector< Function
< TENSOR_RESULT_TYPE(T, R),
NDIM > > 
madness::add (World &world, const std::vector< Function< R, NDIM > > &b, const Function< T, NDIM > &a, bool fence=true)
 
template<typename T , typename R , std::size_t NDIM>
std::vector< Function
< TENSOR_RESULT_TYPE(T, R),
NDIM > > 
madness::sub (World &world, const std::vector< Function< T, NDIM > > &a, const std::vector< Function< R, NDIM > > &b, bool fence=true)
 Returns new vector of functions — q[i] = a[i] - b[i]. More...
 
template<typename T , typename Q , typename R , std::size_t NDIM>
void madness::gaxpy (World &world, Q alpha, std::vector< Function< T, NDIM > > &a, Q beta, const std::vector< Function< R, NDIM > > &b, bool fence=true)
 Generalized A*X+Y for vectors of functions -— a[i] = alpha*a[i] + beta*b[i]. More...
 
template<typename opT , typename R , std::size_t NDIM>
std::vector< Function
< TENSOR_RESULT_TYPE(typename
opT::opT, R), NDIM > > 
madness::apply (World &world, const std::vector< std::shared_ptr< opT > > &op, const std::vector< Function< R, NDIM > > f)
 Applies a vector of operators to a vector of functions — q[i] = apply(op[i],f[i]) More...
 
template<typename T , typename R , std::size_t NDIM>
std::vector< Function
< TENSOR_RESULT_TYPE(T, R),
NDIM > > 
madness::apply (World &world, const SeparatedConvolution< T, NDIM > &op, const std::vector< Function< R, NDIM > > f)
 Applies an operator to a vector of functions — q[i] = apply(op,f[i]) More...
 
template<typename T , std::size_t NDIM>
void madness::normalize (World &world, std::vector< Function< T, NDIM > > &v, bool fence=true)
 Normalizes a vector of functions — v[i] = v[i].scale(1.0/v[i].norm2()) More...
 
template<typename T , std::size_t NDIM>
double madness::get_size (World &world, const std::vector< Function< T, NDIM > > &v)
 

Detailed Description

Defines operations on vectors of Functions

This file defines a number of operations on vectors of functions. Assume v is a vector of NDIM-D functions of a certain type.

Operations on array of functions

) copying: deep copying of vectors of functions to vector of functions

vector2 = copy(world, vector1,fence);

) compress: convert multiwavelet representation to legendre representation

compress(world, vector, fence);

) reconstruct: convert representation to multiwavelets

reconstruct(world, vector, fence);

) nonstandard: convert to non-standard form

nonstandard(world, v, fence);

) standard: convert to standard form

standard(world, v, fence);

) truncate: truncating vectors of functions to desired precision

truncate(world, v, tolerance, fence);

) zero function: create a vector of zero functions of length n

v=zero(world, n);

) transform: transform a representation from one basis to another

transform(world, vector, tensor, tolerance, fence )

Setting thresh-hold for precision

) set_thresh: setting a finite thresh-hold for a vector of functions

void set_thresh(World& world, std::vector< Function<T,NDIM> >& v, double thresh, bool fence=true);

Arithmetic Operations on arrays of functions

) conjugation: conjugate a vector of complex functions

) add ) sub ) mul

Norms, inner-products, blas-1 like operations on vectors of functions

) inner ) matrix_inner ) norm_tree ) normalize ) norm2