|
16 | 16 | * limitations under the License. |
17 | 17 | */ |
18 | 18 |
|
19 | | -/** |
20 | | -* Header file containing function declarations for the C interface to the CBLAS Level 2 routine `cblas_dsyr`. |
21 | | -*/ |
22 | | -#ifndef DSYR_CBLAS_H |
23 | | -#define DSYR_CBLAS_H |
24 | | - |
| 19 | +#include "stdlib/blas/base/dsyr.h" |
| 20 | +#include "stdlib/blas/base/dsyr_cblas.h" |
25 | 21 | #include "stdlib/blas/base/shared.h" |
26 | | - |
27 | | -/* |
28 | | -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. |
29 | | -*/ |
30 | | -#ifdef __cplusplus |
31 | | -extern "C" { |
32 | | -#endif |
| 22 | +#include "stdlib/strided/base/min_view_buffer_index.h" |
| 23 | +#include "stdlib/ndarray/base/min_view_buffer_index.h" |
33 | 24 |
|
34 | 25 | /** |
35 | 26 | * Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix. |
| 27 | +* |
| 28 | +* @param order storage layout |
| 29 | +* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied |
| 30 | +* @param N number of elements along each dimension of `A` |
| 31 | +* @param alpha scalar |
| 32 | +* @param x input vector |
| 33 | +* @param strideX `X` stride length |
| 34 | +* @param A input matrix |
| 35 | +* @param LDA stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) |
36 | 36 | */ |
37 | | -void API_SUFFIX(cblas_dsyr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *A, const CBLAS_INT LDA ); |
38 | | - |
39 | | -#ifdef __cplusplus |
| 37 | +void API_SUFFIX(c_dsyr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *A, const CBLAS_INT LDA ) { |
| 38 | + CBLAS_INT sx = strideX; |
| 39 | + if ( sx < 0 ) { |
| 40 | + sx = -sx; |
| 41 | + } |
| 42 | + API_SUFFIX(cblas_dsyr)( order, uplo, N, alpha, X, sx, AP ); |
40 | 43 | } |
41 | | -#endif |
42 | 44 |
|
43 | | -#endif // !DSYR_CBLAS_H |
| 45 | +/** |
| 46 | +* Performs the symmetric rank 1 operation `A = α*x*x^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix. |
| 47 | +* |
| 48 | +* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied |
| 49 | +* @param N number of elements along each dimension of `A` |
| 50 | +* @param alpha scalar |
| 51 | +* @param X input vector |
| 52 | +* @param strideX `x` stride length |
| 53 | +* @param offsetX starting index for `x` |
| 54 | +* @param A input matrix |
| 55 | +* @param strideA1 stride of the first dimension of `A` |
| 56 | +* @param strideA2 stride of the second dimension of `A` |
| 57 | +* @param offsetA starting index for `AP` |
| 58 | +*/ |
| 59 | +void API_SUFFIX(c_dsyr_ndarray)( const CBLAS_UPLO uplo, const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, float *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA ) { |
| 60 | + CBLAS_INT sx = strideX; |
| 61 | + X += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); // adjust array pointer |
| 62 | + CBLAS_INT shape[] = { N, N }; |
| 63 | + CBLAS_INT strides[] = { strideA1, strideA2 }; |
| 64 | + A += stdlib_ndarray_min_view_buffer_index( 2, shape, strides, offsetA); // adjust array pointer |
| 65 | + if ( sx < 0 ) { |
| 66 | + sx = -sx; |
| 67 | + } |
| 68 | + API_SUFFIX(cblas_dsyr)( uplo, N, alpha, X, sx, offsetX, A, strideA1, strideA2, offsetA ); |
| 69 | +} |
0 commit comments