Files
cpp/radio/Vector.hpp
T
jens 2c544f0576 - added some helpers
git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@107 b431acfa-c32f-4a4a-93f1-934dc6c82436
2014-12-22 17:37:43 +00:00

68 lines
1.2 KiB
C++

/*
* File: Vector.hpp
* Author: jens
*
* Created on 19. Dezember 2014, 18:24
*/
#ifndef VECTOR_HPP
#define VECTOR_HPP
#include <Eigen/Dense>
using namespace Eigen;
#include <complex>
using namespace std;
#include "../radio/radio_types.h"
using Eigen::Dense;
#ifndef radio_float_t
#define radio_float_t float
#endif
namespace Radio
{
typedef radio_float_t RealScalar;
typedef complex<radio_float_t> ComplexScalar;
typedef Matrix<RealScalar, Dynamic, 1> RVec;
typedef Matrix<ComplexScalar, Dynamic, 1> CVec;
typedef Matrix<RealScalar, Dynamic, Dynamic> RMat;
typedef Matrix<ComplexScalar, Dynamic, Dynamic> CMat;
static ComplexScalar toComplexScalar(cpx_t v)
{
return ComplexScalar(v.real, v.imag);
}
static cpx_t toCpx(ComplexScalar v)
{
return Cpx(v.real(), v.imag());
}
static void toComplexVector(CVec &dst, cpx_t const *pSrc, uint32_t len)
{
for (uint32_t i=0; i < len; i++)
{
dst[i] = ComplexScalar(pSrc[i].real, pSrc[i].imag);
}
}
static void toCpxVector(cpx_t *pDst, CVec const &src, uint32_t len)
{
for (uint32_t i=0; i < len; i++)
{
pDst[i].real = src[i].real();
pDst[i].imag = src[i].imag();
}
}
} // ::Radio
#endif /* VECTOR_HPP */