Developer Guide

Contents

Using Complex Types in C/C++

As described in the documentation for the Intel® Fortran Compiler, C/C++ does not directly implement the Fortran types
COMPLEX(4)
and
COMPLEX(8)
. However, you can write equivalent structures. The type
COMPLEX(4)
consists of two 4-byte floating-point numbers. The first of them is the real-number component, and the second one is the imaginary-number component. The type
COMPLEX(8)
is similar to
COMPLEX(4)
except that it contains two 8-byte floating-point numbers.
Intel® MKL
provides complex types
MKL_Complex8
and
MKL_Complex16
, which are structures equivalent to the Fortran complex types
COMPLEX(4)
and
COMPLEX(8)
, respectively. The
MKL_Complex8
and
MKL_Complex16
types are defined in the
mkl_types.h
header file. You can use these types to define complex data. You can also redefine the types with your own types before including the
mkl_types.h
header file. The only requirement is that the types must be compatible with the Fortran complex layout, that is, the complex type must be a pair of real numbers for the values of real and imaginary parts.
For example, you can use the following definitions in your C++ code:
#define MKL_Complex8 std::complex<float>
and
#define MKL_Complex16 std::complex<double>
See Example "Calling a Complex BLAS Level 1 Function from C++" for details. You can also define these types in the command line:
-DMKL_Complex8="std::complex<float>" -DMKL_Complex16="std::complex<double>"

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804