Boost logo

Ublas :

Subject: [ublas] ATLAS binding: error when multiplying a complex matrix by a real matrix
From: Florent Teichteil (florent.teichteil_at_[hidden])
Date: 2012-09-28 11:22:50


Hi all,

I am trying to multiply a complex matrix by a real one using gemm:

atlas::gemm(m1, m2, r);

where m2 is defined as: ublas::matrix<double, ublas::column_major>
and m1: ublas::matrix<std::complex<double>, ublas::column_major>

However, I get a compilation error saying that there is no known
conversion from type
ublas::matrix<double, ublas::column_major>::pointer {aka const double*}
to type const complex_d* {aka const std::complex<double>*}

Looking at the file cblas3_overloads.hpp, it appears that the
corresponding overload (real matrix by complex matrix) is actually not
defined, which is an API error in my mind, since the C interface of
ATLAS allows for it trough the void* types for matrix pointers.

The workaround would consist in copying the real matrix into a complex
one before calling gemm. But:
1. This operation is expensive for big matrices;
2. It is not easy to manage when matrices m1 and m2 are actually
template matrices for which we do not know the type.

NOTE: the standard boost ublas function axpy_prod allows for multiplying
real matrices by complex ones (and vice versa).

All the best,
Florent