- refactored

- use blaze matrix library instead of Eigen

git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@943 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2022-06-11 08:56:42 +00:00
parent 368f11d9ba
commit f66d39c11c
8 changed files with 82 additions and 47 deletions
+36 -1
View File
@@ -8,7 +8,7 @@
#ifndef _RADIO_VECTOR_HPP_
#define _RADIO_VECTOR_HPP_
#define VECTOR_USE_EIGEN
#define VECTOR_USE_BLAZE
#include <complex>
#include <radio/cpx.h>
@@ -22,6 +22,10 @@
#include <Eigen/Dense>
#endif
#ifdef VECTOR_USE_BLAZE
#include <blaze/Blaze.h>
#endif
#ifdef VECTOR_USE_ARMADILLO
#include <armadillo>
#endif
@@ -42,6 +46,37 @@ typedef Eigen::Matrix<ComplexScalar, Eigen::Dynamic, Eigen::Dynamic> CMat;
#endif
#ifdef VECTOR_USE_BLAZE
typedef blaze::DynamicVector<RealScalar> RVec;
typedef blaze::DynamicVector<ComplexScalar> CVec;
typedef blaze::DynamicMatrix<RealScalar> RMat;
typedef blaze::DynamicMatrix<ComplexScalar> CMat;
inline void ror(auto &vec)
{
vec = elements(vec, [size=vec.size()](size_t i){ return (i-1) % size; }, vec.size());
}
inline void rol(auto &vec)
{
vec = elements(vec, [size=vec.size()](size_t i){ return (i+1) % size; }, vec.size());
}
inline void insert_left(auto &vec, auto const &x)
{
ror(vec);
vec[0] = x;
}
inline void insert_right(auto &vec, auto const &x)
{
rol(vec);
vec[vec.size()-1] = x;
}
#endif
#ifdef VECTOR_USE_ARMADILLO
#error "Vector: Implement armadillo support!"
#endif