LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
arma_npy.h File Reference
#include "lasp_mathtypes.h"
#include <cstring>
#include <pybind11/numpy.h>
#include <type_traits>
Include dependency graph for arma_npy.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

template<typename T >
using pyarray = py::array_t< T, py::array::f_style|py::array::forcecast >
 
using dpyarray = pyarray< d >
 
using cpyarray = pyarray< c >
 

Functions

template<typename T >
py::array_t< T > ColToNpy (const arma::Col< T > &data)
 Convert Armadillo column vector to Numpy 1D array.
 
template<typename T >
py::array_t< T > MatToNpy (const arma::Mat< T > &data)
 Convert Armadillo 2D array Numpy 2D array.
 
template<typename T >
py::array_t< T > CubeToNpy (const arma::Cube< T > &data)
 Convert Armadillo Cube to Numpy 3D array.
 
template<typename T , bool copy = true>
arma::Mat< T > NpyToMat (pyarray< T > data)
 BACK converters.
 
template<typename T , bool copy = true>
arma::Mat< T > NpyToCol (pyarray< T > data)
 Wrap Numpy array to 1D Armadillo column vector.
 

Typedef Documentation

◆ cpyarray

using cpyarray = pyarray<c>

Definition at line 12 of file arma_npy.h.

◆ dpyarray

using dpyarray = pyarray<d>

Definition at line 11 of file arma_npy.h.

◆ pyarray

template<typename T >
using pyarray = py::array_t<T, py::array::f_style | py::array::forcecast>

Definition at line 10 of file arma_npy.h.

Function Documentation

◆ ColToNpy()

template<typename T >
py::array_t< T > ColToNpy ( const arma::Col< T > &  data)

Convert Armadillo column vector to Numpy 1D array.

Template Parameters
TType (double, d, c, etc)
Parameters
dataInput Armadillo array
Returns
Numpy array with copied data

Definition at line 23 of file arma_npy.h.

◆ CubeToNpy()

template<typename T >
py::array_t< T > CubeToNpy ( const arma::Cube< T > &  data)

Convert Armadillo Cube to Numpy 3D array.

Template Parameters
TType (double, d, c, etc)
Parameters
dataInput Armadillo Array
Returns
Numpy array with copied data

Definition at line 76 of file arma_npy.h.

◆ MatToNpy()

template<typename T >
py::array_t< T > MatToNpy ( const arma::Mat< T > &  data)

Convert Armadillo 2D array Numpy 2D array.

Template Parameters
TType (double, d, c, etc)
Parameters
dataInput Armadillo array
Returns
Numpy array with copied data

Definition at line 49 of file arma_npy.h.

◆ NpyToCol()

template<typename T , bool copy = true>
arma::Mat< T > NpyToCol ( pyarray< T >  data)

Wrap Numpy array to 1D Armadillo column vector.

Template Parameters
TType
copyWhether to copy the data. If true, creates a copy
Parameters
dataThe Numpy array to convert
Returns
Armadillo column instance

Definition at line 127 of file arma_npy.h.

◆ NpyToMat()

template<typename T , bool copy = true>
arma::Mat< T > NpyToMat ( pyarray< T >  data)

BACK converters.

Wrap Numpy array to 2D Armadillo Mat

Template Parameters
TType
copyWhether to copy the data. If true, creates a copy
Parameters
dataThe Numpy array to convert
Returns
Mat instance

Definition at line 110 of file arma_npy.h.