MADNESS 0.10.1
Functions
bind_tensor.cpp File Reference
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
#include <pybind11/stl.h>
#include <algorithm>
#include <madness/tensor/tensor.h>
Include dependency graph for bind_tensor.cpp:

Functions

void bind_tensor (py::module_ &m)
 
static Tensor< double > numpy_to_tensor (py::array_t< double, py::array::c_style > arr)
 Convert a numpy array to a MADNESS Tensor<double> (copies data).
 
static py::array_t< double > tensor_to_numpy (const Tensor< double > &t)
 Convert a MADNESS Tensor<double> to a numpy array (copies data).
 

Function Documentation

◆ bind_tensor()

void bind_tensor ( py::module_ &  m)

◆ numpy_to_tensor()

static Tensor< double > numpy_to_tensor ( py::array_t< double, py::array::c_style >  arr)
static

Convert a numpy array to a MADNESS Tensor<double> (copies data).

References madness::Tensor< T >::ptr(), and madness::BaseTensor::size().

Referenced by bind_tensor().

◆ tensor_to_numpy()

static py::array_t< double > tensor_to_numpy ( const Tensor< double > &  t)
static