TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
lapacke_config.h
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#define LAPACK_COMPLEX_CPP // PhD
39
40#if defined(LAPACK_COMPLEX_CPP)
41#include <complex>
42#endif
43extern "C" {
44#endif /* __cplusplus */
45
46#include <stdlib.h>
47
48#ifndef lapack_int
49#if defined(LAPACK_ILP64)
50#define lapack_int long
51#else
52#define lapack_int int
53#endif
54#endif
55
56#ifndef lapack_logical
57#define lapack_logical lapack_int
58#endif
59
60#ifndef LAPACK_COMPLEX_CUSTOM
61
62#if defined(LAPACK_COMPLEX_STRUCTURE)
63
64typedef struct {
65 float real, imag;
66} _lapack_complex_float;
67typedef struct {
68 double real, imag;
69} _lapack_complex_double;
70#define lapack_complex_float _lapack_complex_float
71#define lapack_complex_double _lapack_complex_double
72#define lapack_complex_float_real(z) ((z).real)
73#define lapack_complex_float_imag(z) ((z).imag)
74#define lapack_complex_double_real(z) ((z).real)
75#define lapack_complex_double_imag(z) ((z).imag)
76
77#elif defined(LAPACK_COMPLEX_C99)
78
79#include <complex.h>
80#define lapack_complex_float float _Complex
81#define lapack_complex_double double _Complex
82#define lapack_complex_float_real(z) (creal(z))
83#define lapack_complex_float_imag(z) (cimag(z))
84#define lapack_complex_double_real(z) (creal(z))
85#define lapack_complex_double_imag(z) (cimag(z))
86
87#elif defined(LAPACK_COMPLEX_CPP)
88
89#define lapack_complex_float std::complex<float>
90#define lapack_complex_double std::complex<double>
91#define lapack_complex_float_real(z) ((z).real())
92#define lapack_complex_float_imag(z) ((z).imag())
93#define lapack_complex_double_real(z) ((z).real())
94#define lapack_complex_double_imag(z) ((z).imag())
95
96#else
97
98#include <complex.h>
99#define lapack_complex_float float _Complex
100#define lapack_complex_double double _Complex
101#define lapack_complex_float_real(z) (creal(z))
102#define lapack_complex_float_imag(z) (cimag(z))
103#define lapack_complex_double_real(z) (creal(z))
104#define lapack_complex_double_imag(z) (cimag(z))
105
106#endif
107
108#ifdef __clang__
109#pragma clang diagnostic push
110#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
111#endif
112
113lapack_complex_float lapack_make_complex_float(float re, float im);
114lapack_complex_double lapack_make_complex_double(double re, double im);
115
116#ifdef __clang__
117#pragma clang diagnostic pop
118#endif
119
120#endif
121
122#ifndef LAPACK_malloc
123#define LAPACK_malloc(size) malloc(size)
124#endif
125
126#ifndef LAPACK_free
127#define LAPACK_free(p) free(p)
128#endif
129
130#ifdef __cplusplus
131}
132#endif /* __cplusplus */
133
134#endif /* _LAPACKE_CONFIG_H_ */
auto imag(A &&a)
Function imag for nda::ArrayOrScalar types (lazy and coefficient-wise for nda::Array types).