elpa_generic.h 6.98 KB
Newer Older
1 2
#pragma once

3
/*! \brief generic C method for elpa_set
4
 *
5
 *  \details
6 7 8 9 10
 *  \param  handle  handle of the ELPA object for which a key/value pair should be set
 *  \param  name    the name of the key
 *  \param  value   integer/double value to be set for the key
 *  \param  error   on return the error code, which can be queried with elpa_strerr()
 *  \result void
11 12 13 14 15 16 17 18 19
 */
#define elpa_set(e, name, value, error) _Generic((value), \
                int: \
                  elpa_set_integer, \
                \
                double: \
                  elpa_set_double \
        )(e, name, value, error)

20

21
/*! \brief generic C method for elpa_get
22
 *
23
 *  \details
24 25 26 27 28
 *  \param  handle  handle of the ELPA object for which a key/value pair should be queried
 *  \param  name    the name of the key
 *  \param  value   integer/double value to be queried
 *  \param  error   on return the error code, which can be queried with elpa_strerr()
 *  \result void
29 30 31 32 33 34 35 36 37 38
 */
#define elpa_get(e, name, value, error) _Generic((value), \
                int*: \
                  elpa_get_integer, \
                \
                double*: \
                  elpa_get_double \
        )(e, name, value, error)


39
/*! \brief generic C method for elpa_eigenvectors
40
 *
41
 *  \details
42 43 44 45 46 47
 *  \param  handle  handle of the ELPA object, which defines the problem
 *  \param  a       float/double float complex/double complex pointer to matrix a
 *  \param  ev      on return: float/double pointer to eigenvalues
 *  \param  q       on return: float/double float complex/double complex pointer to eigenvectors
 *  \param  error   on return the error code, which can be queried with elpa_strerr()
 *  \result void
48
 */
49
#define elpa_eigenvectors(handle, a, ev, q, error) _Generic((a), \
50
                double*: \
51
                  elpa_eigenvectors_d, \
52 53
                \
                float*: \
54
                  elpa_eigenvectors_f, \
55 56
                \
                double complex*: \
57
                  elpa_eigenvectors_dc, \
58 59
                \
                float complex*: \
60
                  elpa_eigenvectors_fc \
61
        )(handle, a, ev, q, error)
62

Andreas Marek's avatar
Andreas Marek committed
63

64 65 66 67 68 69 70 71 72 73 74 75
/*! \brief generic C method for elpa_generalized_eigenvectors
 *
 *  \details
 *  \param  handle  handle of the ELPA object, which defines the problem
 *  \param  a       float/double float complex/double complex pointer to matrix a
 *  \param  b       float/double float complex/double complex pointer to matrix b
 *  \param  ev      on return: float/double pointer to eigenvalues
 *  \param  q       on return: float/double float complex/double complex pointer to eigenvectors
 *  \param  is_already_decomposed   set to 1, if b already decomposed by previous call to elpa_generalized
 *  \param  error   on return the error code, which can be queried with elpa_strerr()
 *  \result void
 */
76
#define elpa_generalized_eigenvectors(handle, a, b, ev, q, is_already_decomposed, error) _Generic((a), \
77 78 79 80 81 82 83 84 85 86 87
                double*: \
                  elpa_generalized_eigenvectors_d, \
                \
                float*: \
                  elpa_generalized_eigenvectors_f, \
                \
                double complex*: \
                  elpa_generalized_eigenvectors_dc, \
                \
                float complex*: \
                  elpa_generalized_eigenvectors_fc \
88
        )(handle, a, b, ev, q, is_already_decomposed, error)
89 90


Andreas Marek's avatar
Andreas Marek committed
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
/*! \brief generic C method for elpa_eigenvalues
 *
 *  \details
 *  \param  handle  handle of the ELPA object, which defines the problem
 *  \param  a       float/double float complex/double complex pointer to matrix a
 *  \param  ev      on return: float/double pointer to eigenvalues
 *  \param  error   on return the error code, which can be queried with elpa_strerr()
 *  \result void
 */
#define elpa_eigenvalues(handle, a, ev, error) _Generic((a), \
                double*: \
                  elpa_eigenvalues_d, \
                \
                float*: \
                  elpa_eigenvalues_f, \
                \
                double complex*: \
                  elpa_eigenvalues_dc, \
                \
                float complex*: \
                  elpa_eigenvalues_fc \
        )(handle, a, ev, error)

114 115
/*  \brief generic C method for elpa_cholesky
 *
116
 *  \details
117 118 119 120 121
 *  \param  handle  handle of the ELPA object, which defines the problem
 *  \param  a       float/double float complex/double complex pointer to matrix a, for which
 *                  the cholesky factorizaion will be computed
 *  \param  error   on return the error code, which can be queried with elpa_strerr()
 *  \result void
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
 */
#define elpa_cholesky(handle, a, error) _Generic((a), \
                double*: \
                  elpa_cholesky_d, \
                \
                float*: \
                  elpa_cholesky_f, \
                \
                double complex*: \
                  elpa_cholesky_dc, \
                \
                float complex*: \
                  elpa_cholesky_fc \
        )(handle, a, error)


138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
/*! \brief generic C method for elpa_hermitian_multiply
 *
 *  \details
 *  \param  handle  handle of the ELPA object, which defines the problem
 *  \param  uplo_a  descriptor for matrix a
 *  \param  uplo_c  descriptor for matrix c
 *  \param  ncb     int
 *  \param  a       float/double float complex/double complex pointer to matrix a
 *  \param  b       float/double float complex/double complex pointer to matrix b
 *  \param  nrows_b number of rows for matrix b
 *  \param  ncols_b number of cols for matrix b
 *  \param  c       float/double float complex/double complex pointer to matrix c
 *  \param  nrows_c number of rows for matrix c
 *  \param  ncols_c number of cols for matrix c
 *  \param  error   on return the error code, which can be queried with elpa_strerr()
 *  \result void
 */
#define elpa_hermitian_multiply(handle, uplo_a, uplo_c, ncb, a, b, nrows_b, ncols_b, c, nrows_c, ncols_c, error) _Generic((a), \
                double*: \
                  elpa_hermitian_multiply_d, \
                \
                float*: \
                  elpa_hermitian_multiply_f, \
                \
                double complex*: \
                  elpa_hermitian_multiply_dc, \
                \
                float complex*: \
                  elpa_hermitian_multiply_fc \
        )(handle, a, error)


170
/*! \brief generic C method for elpa_invert_triangular
171
 *
172
 *  \details
173 174 175 176 177
 *  \param  handle  handle of the ELPA object, which defines the problem
 *  \param  a       float/double float complex/double complex pointer to matrix a, which
 *                  should be inverted
 *  \param  error   on return the error code, which can be queried with elpa_strerr()
 *  \result void
178 179 180 181 182 183 184 185 186 187 188 189 190 191
 */
#define elpa_invert_triangular(handle, a, error) _Generic((a), \
                double*: \
                  elpa_invert_trm_d, \
                \
                float*: \
                  elpa_invert_trm_f, \
                \
                double complex*: \
                  elpa_invert_trm_dc, \
                \
                float complex*: \
                  elpa_invert_trm_fc \
        )(handle, a, error)