1 /***************************************************************************** 2 Copyright (c) 2010, Intel Corp. 3 All rights reserved. 4 5 Redistribution and use in source and binary forms, with or without 6 modification, are permitted provided that the following conditions are met: 7 8 * Redistributions of source code must retain the above copyright notice, 9 this list of conditions and the following disclaimer. 10 * Redistributions in binary form must reproduce the above copyright 11 notice, this list of conditions and the following disclaimer in the 12 documentation and/or other materials provided with the distribution. 13 * Neither the name of Intel Corporation nor the names of its contributors 14 may be used to endorse or promote products derived from this software 15 without specific prior written permission. 16 17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 THE POSSIBILITY OF SUCH DAMAGE. 28 ****************************************************************************** 29 * Contents: Native C interface to LAPACK 30 * Author: Intel Corporation 31 *****************************************************************************/ 32 33 #ifndef _LAPACKE_CONFIG_H_ 34 #define _LAPACKE_CONFIG_H_ 35 36 #ifdef __cplusplus 37 #if defined(LAPACK_COMPLEX_CPP) 38 #include <complex> 39 #endif 40 extern "C" { 41 #endif /* __cplusplus */ 42 43 #include <stdlib.h> 44 45 #ifndef lapack_int 46 #if defined(LAPACK_ILP64) 47 #define lapack_int long 48 #else 49 #define lapack_int int 50 #endif 51 #endif 52 53 #ifndef lapack_logical 54 #define lapack_logical lapack_int 55 #endif 56 57 #ifndef LAPACK_COMPLEX_CUSTOM 58 59 #if defined(LAPACK_COMPLEX_STRUCTURE) 60 61 typedef struct { float real, imag; } _lapack_complex_float; 62 typedef struct { double real, imag; } _lapack_complex_double; 63 #define lapack_complex_float _lapack_complex_float 64 #define lapack_complex_double _lapack_complex_double 65 #define lapack_complex_float_real(z) ((z).real) 66 #define lapack_complex_float_imag(z) ((z).imag) 67 #define lapack_complex_double_real(z) ((z).real) 68 #define lapack_complex_double_imag(z) ((z).imag) 69 70 #elif defined(LAPACK_COMPLEX_C99) 71 72 #include <complex.h> 73 #define lapack_complex_float float _Complex 74 #define lapack_complex_double double _Complex 75 #define lapack_complex_float_real(z) (creal(z)) 76 #define lapack_complex_float_imag(z) (cimag(z)) 77 #define lapack_complex_double_real(z) (creal(z)) 78 #define lapack_complex_double_imag(z) (cimag(z)) 79 80 #elif defined(LAPACK_COMPLEX_CPP) 81 82 #define lapack_complex_float std::complex<float> 83 #define lapack_complex_double std::complex<double> 84 #define lapack_complex_float_real(z) ((z).real()) 85 #define lapack_complex_float_imag(z) ((z).imag()) 86 #define lapack_complex_double_real(z) ((z).real()) 87 #define lapack_complex_double_imag(z) ((z).imag()) 88 89 #else 90 91 #include <complex.h> 92 #define lapack_complex_float float _Complex 93 #define lapack_complex_double double _Complex 94 #define lapack_complex_float_real(z) (creal(z)) 95 #define lapack_complex_float_imag(z) (cimag(z)) 96 #define lapack_complex_double_real(z) (creal(z)) 97 #define lapack_complex_double_imag(z) (cimag(z)) 98 99 #endif 100 101 lapack_complex_float lapack_make_complex_float( float re, float im ); 102 lapack_complex_double lapack_make_complex_double( double re, double im ); 103 104 #endif 105 106 #ifndef LAPACK_malloc 107 #define LAPACK_malloc( size ) malloc( size ) 108 #endif 109 110 #ifndef LAPACK_free 111 #define LAPACK_free( p ) free( p ) 112 #endif 113 114 #ifdef __cplusplus 115 } 116 #endif /* __cplusplus */ 117 118 #endif /* _LAPACKE_CONFIG_H_ */ 119