github.com/gonum/lapack@v0.0.0-20181123203213-e4cdc5a0bff9/cgo/lapacke/lapacke_config.h (about)

     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  * Generated May, 2011
    32  *****************************************************************************/
    33  
    34  #ifndef _LAPACKE_CONFIG_H_
    35  #define _LAPACKE_CONFIG_H_
    36  
    37  #ifdef __cplusplus
    38  #if defined(LAPACK_COMPLEX_CPP)
    39  #include <complex>
    40  #endif
    41  extern "C" {
    42  #endif /* __cplusplus */
    43  
    44  #include <stdlib.h>
    45  
    46  #ifndef lapack_int
    47  #if defined(LAPACK_ILP64)
    48  #define lapack_int              long
    49  #else
    50  #define lapack_int              int
    51  #endif
    52  #endif
    53  
    54  #ifndef lapack_logical
    55  #define lapack_logical          lapack_int
    56  #endif
    57  
    58  #ifndef LAPACK_COMPLEX_CUSTOM
    59  
    60  #if defined(LAPACK_COMPLEX_STRUCTURE)
    61  
    62  typedef struct { float real, imag; } _lapack_complex_float;
    63  typedef struct { double real, imag; } _lapack_complex_double;
    64  #define lapack_complex_float  _lapack_complex_float
    65  #define lapack_complex_double _lapack_complex_double
    66  #define lapack_complex_float_real(z)  ((z).real)
    67  #define lapack_complex_float_imag(z)  ((z).imag)
    68  #define lapack_complex_double_real(z)  ((z).real)
    69  #define lapack_complex_double_imag(z)  ((z).imag)
    70  
    71  #elif defined(LAPACK_COMPLEX_C99)
    72  
    73  #include <complex.h>
    74  #define lapack_complex_float    float _Complex
    75  #define lapack_complex_double   double _Complex
    76  #define lapack_complex_float_real(z)       (creal(z))
    77  #define lapack_complex_float_imag(z)       (cimag(z))
    78  #define lapack_complex_double_real(z)       (creal(z))
    79  #define lapack_complex_double_imag(z)       (cimag(z))
    80  
    81  #elif defined(LAPACK_COMPLEX_CPP)
    82  
    83  #define lapack_complex_float std::complex<float>
    84  #define lapack_complex_double std::complex<double>
    85  #define lapack_complex_float_real(z)       ((z).real())
    86  #define lapack_complex_float_imag(z)       ((z).imag())
    87  #define lapack_complex_double_real(z)       ((z).real())
    88  #define lapack_complex_double_imag(z)       ((z).imag())
    89  
    90  #else
    91  
    92  #include <complex.h>
    93  #define lapack_complex_float    float _Complex
    94  #define lapack_complex_double   double _Complex
    95  #define lapack_complex_float_real(z)       (creal(z))
    96  #define lapack_complex_float_imag(z)       (cimag(z))
    97  #define lapack_complex_double_real(z)       (creal(z))
    98  #define lapack_complex_double_imag(z)       (cimag(z))
    99  
   100  #endif
   101  
   102  lapack_complex_float lapack_make_complex_float( float re, float im );
   103  lapack_complex_double lapack_make_complex_double( double re, double im );
   104  
   105  #endif
   106  
   107  #ifndef LAPACK_malloc
   108  #define LAPACK_malloc( size )   malloc( size )
   109  #endif
   110  
   111  #ifndef LAPACK_free
   112  #define LAPACK_free( p )        free( p )
   113  #endif
   114  
   115  #ifdef __cplusplus
   116  }
   117  #endif /* __cplusplus */
   118  
   119  #endif /* _LAPACKE_CONFIG_H_ */