You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

lapacke_config.h 5.5 kB

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