- changed status to open
Provide a real() function for vectors and matrices
Issue #17
resolved
Description
The standard library provides the real
function to access the real part of complex numbers. In order to extend the support for complex numbers Blaze should provide a real
operation for vectors and matrices in order to compute the real part of all elements. Conceptually, the real
operation should work like this:
using blaze::StaticVector;
typedef std::complex<double> cplx;
// Creating the vector
// ( (1,0) (-2,-1) )
StaticVector<cplx,2UL> a( cplx(1.0,0.0), cplx(-2.0,-1.0) );
// Compute the real part of all vector elements
// ( 1 -2 )
StaticVector<double,2UL> b;
b = real( a );
using blaze::StaticMatrix;
typedef std::complex<double> cplx;
// Creating the matrix
// ( (1,0) (-2,-1) )
// ( (1,1) ( 0, 1) )
StaticMatrix<cplx,2UL,2UL> A( cplx(1.0,0.0), cplx(-2.0,-1.0),
cplx(1.0,1.0), cplx( 0.0, 1.0) );
// Compute the real part of all matrix elements
// ( 1 -2 )
// ( 1 0 )
StaticMatrix<double,2UL,2UL> B;
B = real( A );
Tasks
- provide the
real
operation for scalars, including complex numbers - provide the
real
operation for dense and sparse vectors - provide the
real
operation for dense and sparse matrices - provide a full documentation of the operation
- ensure compatibility to all existing vector and matrix classes
- ensure compatibility to all existing vector and matrix expressions
- guarantee maximum performance for the operation
- extend existing test cases to also cover the
real
operation
Comments (3)
-
reporter -
reporter -
assigned issue to
-
assigned issue to
-
reporter - changed status to resolved
The feature has been implemented, tested, optimized (including parallelization) and documented as required. The feature is immediately available via cloning the Blaze repository. It will be officially released in Blaze 2.5.
- Log in to comment