|
|
|
@ -4,7 +4,7 @@ |
|
|
|
|
#include "Core.h" |
|
|
|
|
#include "Macros.h" |
|
|
|
|
#include "Types.h" |
|
|
|
|
#include <Eigen/Dense> |
|
|
|
|
|
|
|
|
|
#include <cmath> |
|
|
|
|
#include <complex> |
|
|
|
|
#include <cstdlib> |
|
|
|
@ -12,6 +12,10 @@ |
|
|
|
|
#include <random> |
|
|
|
|
#include <type_traits> |
|
|
|
|
|
|
|
|
|
#ifdef CUDATOOLS_USE_EIGEN |
|
|
|
|
#include <Eigen/Dense> |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef DEVICE |
|
|
|
|
#define POINTER pDevice |
|
|
|
|
#else |
|
|
|
@ -22,6 +26,7 @@ using namespace CudaTools::Types; |
|
|
|
|
|
|
|
|
|
namespace CudaTools { |
|
|
|
|
|
|
|
|
|
#ifdef CUDATOOLS_USE_EIGEN |
|
|
|
|
template <typename T> |
|
|
|
|
using EigenMat = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor>; |
|
|
|
|
template <typename T> using EigenMapMat = Eigen::Map<EigenMat<T>>; |
|
|
|
@ -30,6 +35,7 @@ template <typename T> using ConstEigenMapMat = Eigen::Map<const EigenMat<T>>; |
|
|
|
|
template <typename T> struct EigenAdaptConst_S { typedef EigenMapMat<T> type; }; |
|
|
|
|
template <typename T> struct EigenAdaptConst_S<const T> { typedef ConstEigenMapMat<T> type; }; |
|
|
|
|
template <typename T> using EigenAdaptConst = typename EigenAdaptConst_S<T>::type; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
template <typename T> class Array; |
|
|
|
|
|
|
|
|
@ -496,6 +502,7 @@ template <typename T> class Array { |
|
|
|
|
*/ |
|
|
|
|
HD void flatten() { reshape({mShape.mItems}); }; |
|
|
|
|
|
|
|
|
|
#ifdef CUDATOOLS_USE_EIGEN |
|
|
|
|
/**
|
|
|
|
|
* Returns the Eigen::Map of this Array. |
|
|
|
|
*/ |
|
|
|
@ -507,6 +514,7 @@ template <typename T> class Array { |
|
|
|
|
return EigenAdaptConst<ComplexConversion<T>>((ComplexConversion<T>*)POINTER, mShape.rows(), |
|
|
|
|
mShape.cols()); |
|
|
|
|
}; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the Shape of the Array. |
|
|
|
|