- prepared to use armadillo matrix lib

git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@897 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2022-05-30 10:23:47 +00:00
parent da9b8f2c90
commit a8b9744f54
+48 -11
View File
@@ -8,31 +8,68 @@
#ifndef _RADIO_VECTOR_HPP_
#define _RADIO_VECTOR_HPP_
#include <Eigen/Dense>
using namespace Eigen;
#define VECTOR_USE_EIGEN
//#define VECTOR_USE_ARMADILLO
#include <complex>
using namespace std;
#include <radio/radio_types.h>
using Eigen::Dense;
#ifndef radio_float_t
#define radio_float_t float
#endif
#ifdef VECTOR_USE_EIGEN
#include <Eigen/Dense>
#endif
#ifdef VECTOR_USE_ARMADILLO
#include <armadillo>
#endif
namespace Radio
{
typedef radio_float_t RealScalar;
typedef complex<radio_float_t> ComplexScalar;
typedef std::complex<radio_float_t> ComplexScalar;
typedef Matrix<RealScalar, Dynamic, 1> RVec;
typedef Matrix<ComplexScalar, Dynamic, 1> CVec;
#ifdef VECTOR_USE_EIGEN
typedef Matrix<RealScalar, Dynamic, Dynamic> RMat;
typedef Matrix<ComplexScalar, Dynamic, Dynamic> CMat;
typedef Eigen::Matrix<RealScalar, Eigen::Dynamic, 1> RVec;
typedef Eigen::Matrix<ComplexScalar, Eigen::Dynamic, 1> CVec;
typedef Eigen::Matrix<RealScalar, Eigen::Dynamic, Eigen::Dynamic> RMat;
typedef Eigen::Matrix<ComplexScalar, Eigen::Dynamic, Eigen::Dynamic> CMat;
typedef Eigen::Map<RVec> RMap;
#endif
#ifdef VECTOR_USE_ARMADILLO
#if 1
template <typename T>
class Vec : public arma::Col<T>
{
public:
void setZero()
{
}
};
class RVec : public Vec<RealScalar>
{
};
class CVec : public Vec<ComplexScalar>
{
};
#endif
//typedef arma::col<RealScalar> RVec;
//typedef arma::col<ComplexScalar> CVec;
typedef arma::Mat<RealScalar> RMat;
typedef arma::Mat<ComplexScalar> CMat;
typedef arma::Map<RVec> RMap;
#endif
static ComplexScalar toComplexScalar(cpx_t v)
{