Provide support for conjugate transpose (adjoint) matrices

Issue #8 resolved
Klaus Iglberger created an issue

Description

Blaze provides support for complex numbers and transpose matrices, but is missing the feature to compute the conjugate transpose of a complex matrix (also called adjoint matrix, Hermetian conjugate matrix, or transjugate). Conceptually, the ctrans operation should work like this:

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) );

// Computing the conjugate transpose matrix
//    ( ( 1,0)  (1,-1) )
//    ( (-2,1)  (0,-1) )
StaticMatrix<cplx,2UL,2UL> B;
B = ctrans( A );

Tasks

  • provide the ctrans operation for scalars, including complex numbers
  • provide the ctrans operation for dense and sparse vectors
  • provide the ctrans 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 ctrans operation

Comments (4)

  1. Klaus Iglberger reporter
    • edited description

    Instead of calling the function to compute the conjugate transpose of a matrix adjoint, the function name ctrans should be used. There are two reasons for this:

    • From a terminology point of view, there is only an adjoint matrix, but no adjoint vector, although it is also possible to compute the conjugate transpose of a vector. Thus adjoint would (from a terminology point of view) limit the operation to matrices.
    • In mathematics the term adjoint matrix is also used for adjugate matrices. Therefore an adjoint function could cause misunderstandings.

    The choice of ctrans is inspired by MATLAB. MATLAB provides a function called transpose to compute the non-conjugate transpose of a matrix and a ctranspose function to compute the conjugate transpose of a matrix. Since Blaze provides the function trans for computing the non-conjugate transpose of a matrix, the function to compute the conjugate transpose of a matrix should be called ctrans.

  2. Klaus Iglberger reporter

    The feature has been implemented, tested, optimized (including vectorization and parallelization) and documented as required. The following examples give an impression of the final feature:

    using blaze::StaticVector;
    
    typedef std::complex<double>  cplx;
    
    // Creating the vector
    //    ( (-2,-1) ( 1, 1) )
    StaticVector<cplx,2UL,rowVector> a( cplx(-2.0,-1.0), cplx(1.0,1.0) );
    
    // Computing the conjugate transpose of the vector
    //    ( (-2, 1) )
    //    ( ( 1,-1) )
    StaticVector<cplx,2UL,columnVector> b;
    b = ctrans( 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) );
    
    // Computing the conjugate transpose of the matrix
    //    ( ( 1,0)  (1,-1) )
    //    ( (-2,1)  (0,-1) )
    StaticMatrix<cplx,2UL,2UL> B;
    B = ctrans( A );
    

    The feature is immediately available via cloning the Blaze repository. It will be officially released in Blaze 2.5.

  3. Log in to comment