Skip to content

Commit 468b2dc

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: missing_dependencies - 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 f6fa175 commit 468b2dc

File tree

11 files changed

+79
-56
lines changed

11 files changed

+79
-56
lines changed

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dsyr2( 'row-major', 'upper', 3, 1.0, x, 1, y, 1, A, 3 );
4848
The function has the following parameters:
4949

5050
- **order**: storage layout.
51-
- **uplo**: specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced.
51+
- **uplo**: specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied.
5252
- **N**: number of elements along each dimension of `A`.
5353
- **α**: scalar constant.
5454
- **x**: first input [`Float64Array`][mdn-float64array].
@@ -198,7 +198,7 @@ console.log( A );
198198

199199
#### c_dsyr2( order, uplo, N, alpha, \*X, strideX, \*Y, strideY, \*A, LDA )
200200

201-
Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A`.
201+
Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` where `α` is a scalar, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
202202

203203
```c
204204
#include "stdlib/blas/base/shared.h"
@@ -213,7 +213,7 @@ c_dsyr2( CblasColMajor, CblasUpper, 3, 1.0, x, 1, y, 1, A, 3 );
213213
The function accepts the following arguments:
214214
215215
- **order**: `[in] CBLAS_LAYOUT` storage layout.
216-
- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced.
216+
- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied.
217217
- **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`.
218218
- **alpha**: `[in] double` scalar.
219219
- **X**: `[in] double*` first input array.
@@ -231,7 +231,7 @@ void c_dsyr2( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N
231231

232232
#### c_dsyr2_ndarray( uplo, N, alpha, \*X, strideX, offsetX, \*Y, strideY, offsetY, \*A, sa1, sa2, oa )
233233

234-
Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` using alternative indexing semantics.
234+
Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
235235

236236
```c
237237
#include "stdlib/blas/base/shared.h"
@@ -245,7 +245,7 @@ c_dsyr2_ndarray( CblasUpper, 3, 1.0, x, 1, 0, y, 1, 0, A, 3, 1, 0 );
245245
246246
The function accepts the following arguments:
247247
248-
- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced.
248+
- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied.
249249
- **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`.
250250
- **alpha**: `[in] double` scalar.
251251
- **X**: `[in] double*` first input array.
@@ -287,23 +287,29 @@ void c_dsyr2_ndarray( const CBLAS_UPLO uplo, const CBLAS_INT N, const double alp
287287
#include <stdio.h>
288288

289289
int main( void ) {
290+
// Define a 3x3 symmetric matrix stored in row-major order:
291+
double A[] = {
292+
1.0, 0.0, 0.0,
293+
2.0, 1.0, 0.0,
294+
3.0, 2.0, 1.0
295+
};
296+
290297
// Create strided arrays:
291-
double A[] = { 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 };
292298
const double x[] = { 1.0, 2.0, 3.0 };
293299
const double y[] = { 1.0, 2.0, 3.0 };
294300

295301
// Specify the number of elements along each dimension of `A`:
296302
const int N = 3;
297303

298-
// Perform the symmetric rank 1 operation `A = α*x*x^T + A`:
299-
c_dsyr2( CblasColMajor, CblasUpper, N, 1.0, x, 1, y, 1 A, N );
304+
// Perform the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A`:
305+
c_dsyr2( CblasColMajor, CblasUpper, N, 1.0, x, 1, y, 1, A, N );
300306

301307
// Print the result:
302308
for ( int i = 0; i < N*N; i++ ) {
303309
printf( "A[ %i ] = %f\n", i, A[ i ] );
304310
}
305311

306-
// Perform the symmetric rank 1 operation `A = α*x*x^T + A`:
312+
// Perform the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` using alternative semantics indexing:
307313
c_dsyr2_ndarray( CblasUpper, N, 1.0, x, 1, 0, y, 1, 0, A, N, 1, 0 );
308314

309315
// Print the result:

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

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -83,30 +83,30 @@ static double tic( void ) {
8383
* Runs a benchmark.
8484
*
8585
* @param iterations number of iterations
86-
* @param N number of elements along each dimension
86+
* @param len number of elements along each dimension
8787
* @return elapsed time in seconds
8888
*/
89-
static double benchmark1( int iterations, int N ) {
89+
static double benchmark1( int iterations, int len ) {
9090
double elapsed;
91-
double A[ N*N ];
92-
double x[ N ];
93-
double y[ N ];
91+
double A[ len*len ];
92+
double x[ len ];
93+
double y[ len ];
9494
double t;
9595
int i;
9696

97-
stdlib_strided_dfill( N, 0.5, x, 1 );
98-
stdlib_strided_dfill( N, 0.5, y, 1 );
99-
stdlib_strided_dfill( N*N, 1.0, A, 1 );
97+
stdlib_strided_dfill( len, 1.0, x, 1 );
98+
stdlib_strided_dfill( len, 1.0, y, 1 );
99+
stdlib_strided_dfill( len*len, 1.0, A, 1 );
100100
t = tic();
101101
for ( i = 0; i < iterations; i++ ) {
102-
c_dsyr2( CblasRowMajor, CblasUpper, N, 1.0, x, 1, y, 1, A, N );
103-
if ( A[ 0 ] != A[ 0 ] ) {
102+
c_dsyr2( CblasRowMajor, CblasUpper, len, 1.0, x, 1, y, 1, A, len );
103+
if ( A[ i%len ] != A[ i%len ] ) {
104104
printf( "should not return NaN\n" );
105105
break;
106106
}
107107
}
108108
elapsed = tic() - t;
109-
if ( A[ 0 ] != A[ 0 ] ) {
109+
if ( A[ i%len ] != A[ i%len ] ) {
110110
printf( "should not return NaN\n" );
111111
}
112112
return elapsed;
@@ -116,30 +116,30 @@ static double benchmark1( int iterations, int N ) {
116116
* Runs a benchmark.
117117
*
118118
* @param iterations number of iterations
119-
* @param N number of elements along each dimension
119+
* @param len number of elements along each dimension
120120
* @return elapsed time in seconds
121121
*/
122-
static double benchmark2( int iterations, int N ) {
122+
static double benchmark2( int iterations, int len ) {
123123
double elapsed;
124-
double A[ N*N ];
125-
double x[ N ];
126-
double y[ N ];
124+
double A[ len*len ];
125+
double x[ len ];
126+
double y[ len ];
127127
double t;
128128
int i;
129129

130-
stdlib_strided_dfill( N, 0.5, x, 1 );
131-
stdlib_strided_dfill( N, 0.5, y, 1 );
132-
stdlib_strided_dfill( N*N, 1.0, A, 1 );
130+
stdlib_strided_dfill( len, 1.0, x, 1 );
131+
stdlib_strided_dfill( len, 1.0, y, 1 );
132+
stdlib_strided_dfill( len*len, 1.0, A, 1 );
133133
t = tic();
134134
for ( i = 0; i < iterations; i++ ) {
135-
c_dsyr2_ndarray( CblasUpper, N, 1.0, x, 1, 0, y, 1, 0, A, N, 1, 0 );
136-
if ( A[ 0 ] != A[ 0 ] ) {
135+
c_dsyr2_ndarray( CblasUpper, len, 1.0, x, 1, 0, y, 1, 0, A, len, 1, 0 );
136+
if ( A[ i%len ] != A[ i%len ] ) {
137137
printf( "should not return NaN\n" );
138138
break;
139139
}
140140
}
141141
elapsed = tic() - t;
142-
if ( A[ 0 ] != A[ 0 ] ) {
142+
if ( A[ i%len ] != A[ i%len ] ) {
143143
printf( "should not return NaN\n" );
144144
}
145145
return elapsed;
@@ -154,27 +154,27 @@ int main( void ) {
154154
int iter;
155155
int i;
156156
int j;
157-
int N;
157+
int len;
158158

159159
// Use the current time to seed the random number generator:
160160
srand( time( NULL ) );
161161

162162
print_version();
163163
count = 0;
164164
for ( i = MIN; i <= MAX; i++ ) {
165-
N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
165+
len = floor( pow( pow( 10, i ), 1.0/2.0 ) );
166166
iter = ITERATIONS / pow( 10, i-1 );
167167
for ( j = 0; j < REPEATS; j++ ) {
168168
count += 1;
169-
printf( "# c::%s:size=%d\n", NAME, N*N );
170-
elapsed = benchmark1( iter, N );
169+
printf( "# c::%s:size=%d\n", NAME, len*len );
170+
elapsed = benchmark1( iter, len );
171171
print_results( iter, elapsed );
172172
printf( "ok %d benchmark finished\n", count );
173173
}
174174
for ( j = 0; j < REPEATS; j++ ) {
175175
count += 1;
176-
printf( "# c::%s:ndarray:size=%d\n", NAME, N*N );
177-
elapsed = benchmark2( iter, N );
176+
printf( "# c::%s:ndarray:size=%d\n", NAME, len*len );
177+
elapsed = benchmark2( iter, len );
178178
print_results( iter, elapsed );
179179
printf( "ok %d benchmark finished\n", count );
180180
}

lib/node_modules/@stdlib/blas/base/dsyr2/examples/c/example.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@
2121
#include <stdio.h>
2222

2323
int main( void ) {
24+
// Define a 3x3 symmetric matrix stored in row-major order:
25+
double A[] = {
26+
1.0, 0.0, 0.0,
27+
2.0, 1.0, 0.0,
28+
3.0, 2.0, 1.0
29+
};
30+
2431
// Create strided arrays:
25-
double A[] = { 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 };
2632
const double x[] = { 1.0, 2.0, 3.0 };
2733
const double y[] = { 1.0, 2.0, 3.0 };
2834

@@ -37,7 +43,7 @@ int main( void ) {
3743
printf( "A[ %i ] = %f\n", i, A[ i ] );
3844
}
3945

40-
// Perform the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A`:
46+
// Perform the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` using alternative semantics indexing:
4147
c_dsyr2_ndarray( CblasUpper, N, 1.0, x, 1, 0, y, 1, 0, A, N, 1, 0 );
4248

4349
// Print the result:

lib/node_modules/@stdlib/blas/base/dsyr2/include/stdlib/blas/base/dsyr2.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 2 operation `A = α*x*y^T + α*y*x^T + A`.
35+
* Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` where `α` is a scalar, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
3636
*/
3737
void API_SUFFIX(c_dsyr2)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const double *Y, const CBLAS_INT strideY, double *A, const CBLAS_INT LDA );
3838

3939
/**
40-
* Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` using alternative indexing semantics.
40+
* Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
4141
*/
4242
void API_SUFFIX(c_dsyr2_ndarray)( const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const double *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY, double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA );
4343

lib/node_modules/@stdlib/blas/base/dsyr2/include/stdlib/blas/base/dsyr2_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 2 operation `A = α*x*y^T + α*y*x^T + A`.
35+
* Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` where `α` is a scalar, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
3636
*/
3737
void API_SUFFIX(cblas_dsyr2)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const double *Y, const CBLAS_INT strideY, double *A, const CBLAS_INT LDA );
3838

lib/node_modules/@stdlib/blas/base/dsyr2/lib/dsyr2.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 2 operation `A = α*x*y^T + α*y*x^T + A`.
31+
* Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` where `α` is a scalar, `x` and `y` are `N` element vectors, 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 - first input vector

lib/node_modules/@stdlib/blas/base/dsyr2/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 2 operation `A = α*x*y^T + α*y*x^T + A`.
30+
* Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` where `α` is a scalar, `x` and `y` are `N` element vectors, 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 - first input vector

lib/node_modules/@stdlib/blas/base/dsyr2/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, 10 );
3942

4043
STDLIB_NAPI_ARGV_INT32( env, order, argv, 0 );
@@ -47,9 +50,17 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
4750

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

53+
if ( order == CblasColMajor ) {
54+
sa1 = 1;
55+
sa2 = LDA;
56+
} else { // order === CblasRowMajor
57+
sa1 = LDA;
58+
sa2 = 1;
59+
}
60+
5061
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 4 );
5162
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Y, N, strideY, argv, 6 );
52-
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, A, ((N-1)*LDA) + N, 1, argv, 8 );
63+
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY2D( env, A, M, N, sa1, sa2, argv, 8 );
5364

5465
API_SUFFIX(c_dsyr2)( order, uplo, N, alpha, X, strideX, Y, strideY, A, LDA );
5566

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

Lines changed: 3 additions & 3 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 2 operation `A = α*x*y^T + α*y*x^T + A`.
24+
* Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` where `α` is a scalar, `x` and `y` are `N` element vectors, 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 first input vector
@@ -46,7 +46,7 @@ void API_SUFFIX(c_dsyr2)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const
4646
if ( order == CblasColMajor ) {
4747
sa1 = 1;
4848
sa2 = LDA;
49-
} else { // order === 'row-major'
49+
} else { // order === CblasRowMajor
5050
sa1 = LDA;
5151
sa2 = 1;
5252
}

lib/node_modules/@stdlib/blas/base/dsyr2/src/dsyr2_cblas.c

Lines changed: 4 additions & 4 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 2 operation `A = α*x*y^T + α*y*x^T + A`.
26+
* Performs the symmetric rank 2 operation `A = α*x*y^T + α*y*x^T + A` where `α` is a scalar, `x` and `y` are `N` element vectors, 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 first input vector
@@ -45,9 +45,9 @@ void API_SUFFIX(c_dsyr2)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const
4545
}
4646

4747
/**
48-
* Performs the symmetric rank 2 operation `A = α*x*x^T + A` using alternative indexing semantics.
48+
* Performs the symmetric rank 2 operation `A = α*x*x^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` symmetric matrix.
4949
*
50-
* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced
50+
* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
5151
* @param N number of elements along each dimension of `A`
5252
* @param alpha scalar
5353
* @param X input vector

0 commit comments

Comments
 (0)