- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the complex form of multiplying a matrix by a vector, namely the functions: cblas_cgemv and cblas_zgemv , what is the type of the parameters alpha and beta? The API for those functions requires a void*, so it is not clear what should be the type. Is it float/double for cblas_cgemv and cblas_zgemv respectively. Or maybe std::complex<float/double>? Mathematically a scalar can be defined as both a real or a complex number. So the description in the documentation of alpha and beta as scalars is not sufficient. I'm guessing this ambiguity can be found also in other functions throughout the MKL
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good question.
alpha and beta apparently need to be compatible with Fortran. I'd question whether the supplied headers are fully correct if they say void* rather than C99 complex data type pointers. In cblas_cgemv it's a pointer to an array of 2 floats. I guess this was done before there was much thought about consistent styles for C complex. It's a reasonable assumption that a Fortran complex scalar reference is interoperable with a pointer to an array of 2 floats. "It might be nice" if the cblas_gemv were updated to reconcile with Fortran 2003 where iso_c_binding specifies data types
Fortran C
complex(c_float_complex) float _Complex
complex(c_double_complex) double _Complex
which in usual implementations would be effectively the same as the legacy cblas_?gemv scheme given that pointers are used consistently. Also, in usual implementations c_float_complex==REAL32, c_double_complex==REAL64, but the std Fortran module would save you from making that assumption.
As no one wants to mess with legacy C++ extern "C" in this respect, maybe we are stuck with the status quo. Anyway, updates would require dealing with the maintainers of cblas. Without such reconciliation, the cblas wrapper falls short in my view of the goal of rationalizing this interface, and we must look up the source to answer your question (and rely on the fact that MKL uses public source for this).
![](/skins/images/D2683F18326913BBA0436CB7114DD569/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page