Skip to content

Commit 81acffa

Browse files
authored
chore: minor clean-up
Signed-off-by: Shabareesh Shetty <[email protected]>
1 parent 6c831d5 commit 81acffa

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

lib/node_modules/@stdlib/blas/base/dsyr/src/dsyr_cblas.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,35 @@
3535
* @param LDA stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
3636
*/
3737
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-
API_SUFFIX(cblas_dsyr)( order, uplo, N, alpha, X, strideX, A, 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, A, LDA );
43+
}
44+
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)( order, uplo, N, alpha, X, sx, A, LDA );
3969
}

0 commit comments

Comments
 (0)