Skip to content

Commit 291cee5

Browse files
committed
chore: clean-up
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: na - task: lint_c_benchmarks status: missing_dependencies - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent aef4a1d commit 291cee5

File tree

10 files changed

+34
-53
lines changed

10 files changed

+34
-53
lines changed

lib/node_modules/@stdlib/blas/base/dsyr/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ console.log( A );
188188

189189
#### c_dsyr( order, uplo, N, alpha, \*X, strideX, \*A, LDA )
190190

191-
Performs the symmetric rank 1 operation `A = α*x*x^T + A`.
191+
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.
192192

193193
```c
194194
#include "stdlib/blas/base/shared.h"
@@ -216,7 +216,7 @@ void c_dsyr( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N,
216216

217217
#### c_dsyr_ndarray( uplo, N, alpha, \*X, strideX, offsetX, \*A, sa1, sa2, oa )
218218

219-
Performs the symmetric rank 1 operation `A = α*x*x^T + A` using alternative indexing semantics.
219+
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.
220220

221221
```c
222222
#include "stdlib/blas/base/shared.h"

lib/node_modules/@stdlib/blas/base/dsyr/benchmark/c/benchmark.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,18 @@ static double benchmark1( int iterations, int N ) {
9393
double t;
9494
int i;
9595

96-
stdlib_strided_dfill( N, 0.5, x, 1 );
96+
stdlib_strided_dfill( N, 1.0, x, 1 );
9797
stdlib_strided_dfill( N*N, 1.0, A, 1 );
9898
t = tic();
9999
for ( i = 0; i < iterations; i++ ) {
100100
c_dsyr( CblasRowMajor, CblasUpper, N, 1.0, x, 1, A, N );
101-
if ( A[ 0 ] != A[ 0 ] ) {
101+
if ( A[ i%(N*2) ] != A[ i%(N*2) ] ) {
102102
printf( "should not return NaN\n" );
103103
break;
104104
}
105105
}
106106
elapsed = tic() - t;
107-
if ( A[ 0 ] != A[ 0 ] ) {
107+
if ( A[ i%(N*2) ] != A[ i%(N*2) ] ) {
108108
printf( "should not return NaN\n" );
109109
}
110110
return elapsed;
@@ -124,18 +124,18 @@ static double benchmark2( int iterations, int N ) {
124124
double t;
125125
int i;
126126

127-
stdlib_strided_dfill( N, 0.5, x, 1 );
127+
stdlib_strided_dfill( N, 1.0, x, 1 );
128128
stdlib_strided_dfill( N*N, 1.0, A, 1 );
129129
t = tic();
130130
for ( i = 0; i < iterations; i++ ) {
131131
c_dsyr_ndarray( CblasUpper, N, 1.0, x, 1, 0, A, N, 1, 0 );
132-
if ( A[ 0 ] != A[ 0 ] ) {
132+
if ( A[ i%(N*2) ] != A[ i%(N*2) ] ) {
133133
printf( "should not return NaN\n" );
134134
break;
135135
}
136136
}
137137
elapsed = tic() - t;
138-
if ( A[ 0 ] != A[ 0 ] ) {
138+
if ( A[ i%(N*2) ] != A[ i%(N*2) ] ) {
139139
printf( "should not return NaN\n" );
140140
}
141141
return elapsed;

lib/node_modules/@stdlib/blas/base/dsyr/include/stdlib/blas/base/dsyr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ extern "C" {
3232
#endif
3333

3434
/**
35-
* Performs the symmetric rank 1 operation `A = α*x*x^T + A`.
35+
* 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.
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 );
3838

3939
/**
40-
* Performs the symmetric rank 1 operation `A = α*x*x^T + A` using alternative indexing semantics.
40+
* 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.
4141
*/
4242
void API_SUFFIX(c_dsyr_ndarray)( const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA );
4343

lib/node_modules/@stdlib/blas/base/dsyr/include/stdlib/blas/base/dsyr_cblas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extern "C" {
3232
#endif
3333

3434
/**
35-
* Performs the symmetric rank 1 operation `A = α*x*x^T + A`.
35+
* 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.
3636
*/
3737
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 );
3838

lib/node_modules/@stdlib/blas/base/dsyr/lib/dsyr.native.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ var addon = require( './../src/addon.node' );
2828
// MAIN //
2929

3030
/**
31-
* Performs the symmetric rank 1 operation `A = α*x*x^T + A`.
31+
* 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.
3232
*
3333
* @param {string} order - storage layout
34-
* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced
34+
* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
3535
* @param {NonNegativeInteger} N - number of elements along each dimension of `A`
3636
* @param {number} alpha - scalar
3737
* @param {Float64Array} x - input vector

lib/node_modules/@stdlib/blas/base/dsyr/lib/ndarray.native.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ var addon = require( './../src/addon.node' );
2727
// MAIN //
2828

2929
/**
30-
* Performs the symmetric rank 1 operation `A = α*x*x^T + A`.
30+
* 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.
3131
*
32-
* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced
32+
* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
3333
* @param {NonNegativeInteger} N - number of elements along each dimension of `A`
3434
* @param {number} alpha - scalar
3535
* @param {Float64Array} x - input vector

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
* @return Node-API value
3636
*/
3737
static napi_value addon( napi_env env, napi_callback_info info ) {
38+
CBLAS_INT sa1;
39+
CBLAS_INT sa2;
40+
3841
STDLIB_NAPI_ARGV( env, info, argv, argc, 8 );
3942

4043
STDLIB_NAPI_ARGV_INT32( env, order, argv, 0 );
@@ -46,8 +49,16 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
4649

4750
STDLIB_NAPI_ARGV_DOUBLE( env, alpha, argv, 3 );
4851

52+
if ( order == CblasColMajor ) {
53+
sa1 = 1;
54+
sa2 = LDA;
55+
} else { // order === 'row-major'
56+
sa1 = LDA;
57+
sa2 = 1;
58+
}
59+
4960
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 4 );
50-
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, A, ((N-1)*LDA) + N, 1, argv, 6 );
61+
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY2D( env, A, N, N, sa1, sa2, argv, 6 );
5162

5263
API_SUFFIX(c_dsyr)( order, uplo, N, alpha, X, strideX, A, LDA );
5364

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#include "stdlib/strided/base/stride2offset.h"
2222

2323
/**
24-
* Performs the symmetric rank 1 operation `A = α*x*x^T + A`.
24+
* 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.
2525
*
2626
* @param order storage layout
27-
* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced
27+
* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
2828
* @param N number of elements along each dimension of `A`
2929
* @param alpha scalar
3030
* @param X input vector

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

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
#include "stdlib/ndarray/base/min_view_buffer_index.h"
2424

2525
/**
26-
* Performs the symmetric rank 1 operation `A = α*x*x^T + A`.
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.
2727
*
2828
* @param order storage layout
29-
* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced
29+
* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
3030
* @param N number of elements along each dimension of `A`
3131
* @param alpha scalar
3232
* @param x input vector
@@ -35,35 +35,5 @@
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-
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.
47-
*
48-
* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced
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 `A`
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-
const int64_t shape[] = { N, N };
63-
const int64_t 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 );
38+
API_SUFFIX(cblas_dsyr)( order, uplo, N, alpha, X, strideX, A, LDA );
6939
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#include "stdlib/ndarray/base/assert/is_row_major.h"
2222

2323
/**
24-
* Performs the symmetric rank 1 operation `A = α*x*x^T + A` using alternative indexing semantics.
24+
* 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.
2525
*
26-
* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced
26+
* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
2727
* @param N number of elements along each dimension of `A`
2828
* @param alpha scalar
2929
* @param X input vector

0 commit comments

Comments
 (0)