Skip to content

Commit 3c6f996

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: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - 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 8d5d2e7 commit 3c6f996

File tree

17 files changed

+359
-98
lines changed

17 files changed

+359
-98
lines changed

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

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The function has the following parameters:
5151
- **N**: number of elements along each dimension of `A`.
5252
- **α**: scalar constant.
5353
- **x**: input [`Float64Array`][mdn-float64array].
54-
- **sx**: index increment for `x`.
54+
- **sx**: stride length for `x`.
5555
- **A**: input matrix stored in linear memory as a [`Float64Array`][mdn-float64array].
5656
- **lda**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
5757

@@ -186,7 +186,7 @@ console.log( A );
186186
#include "stdlib/blas/base/dsyr.h"
187187
```
188188

189-
#### c_dsyr( order, uplo, N, alpha, \*X, strideX, \*A, LDA )
189+
#### c_dsyr( layout, uplo, N, alpha, \*X, sx, \*A, LDA )
190190

191191
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

@@ -201,20 +201,20 @@ c_dsyr( CblasColMajor, CblasUpper, 3, 1.0, x, 1, A, 3 );
201201
202202
The function accepts the following arguments:
203203
204-
- **order**: `[in] CBLAS_LAYOUT` storage layout.
204+
- **layout**: `[in] CBLAS_LAYOUT` storage layout.
205205
- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied.
206206
- **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`.
207-
- **alpha**: `[in] double` scalar.
207+
- **alpha**: `[in] double` scalar constant.
208208
- **X**: `[in] double*` input array.
209-
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
209+
- **sx**: `[in] CBLAS_INT` stride length for `X`.
210210
- **A**: `[inout] double*` input matrix.
211211
- **LDA**: `[in] CBLAS_INT` stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
212212
213213
```c
214-
void 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 )
214+
void c_dsyr( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *x, const CBLAS_INT strideX, double *A, const CBLAS_INT LDA )
215215
```
216216

217-
#### c_dsyr_ndarray( uplo, N, alpha, \*X, strideX, offsetX, \*A, sa1, sa2, oa )
217+
#### c_dsyr_ndarray( uplo, N, alpha, \*X, sx, ox, \*A, sa1, sa2, oa )
218218

219219
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

@@ -231,17 +231,17 @@ The function accepts the following arguments:
231231
232232
- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied.
233233
- **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`.
234-
- **alpha**: `[in] double` scalar.
234+
- **alpha**: `[in] double` scalar constant.
235235
- **X**: `[in] double*` input array.
236-
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
237-
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
236+
- **sx**: `[in] CBLAS_INT` stride length for `X`.
237+
- **ox**: `[in] CBLAS_INT` starting index for `X`.
238238
- **A**: `[inout] double*` input matrix.
239239
- **sa1**: `[in] CBLAS_INT` stride of the first dimension of `A`.
240240
- **sa2**: `[in] CBLAS_INT` stride of the second dimension of `A`.
241241
- **oa**: `[in] CBLAS_INT` starting index for `A`.
242242
243243
```c
244-
void 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 sa1, const CBLAS_INT sa2, const CBLAS_INT oa )
244+
void 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 )
245245
```
246246

247247
</section>
@@ -268,9 +268,15 @@ void c_dsyr_ndarray( const CBLAS_UPLO uplo, const CBLAS_INT N, const double alph
268268
#include <stdio.h>
269269

270270
int main( void ) {
271-
// Create strided arrays:
272-
double A[] = { 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 };
273-
const double x[] = { 1.0, 2.0, 3.0 };
271+
// Define a 3x3 symmetric matrix stored in row-major layout:
272+
double A[ 3*3 ] = {
273+
1.0, 0.0, 0.0,
274+
2.0, 1.0, 0.0,
275+
3.0, 2.0, 1.0
276+
};
277+
278+
// Define `x` vector:
279+
const double x[ 3 ] = { 1.0, 2.0, 3.0 };
274280

275281
// Specify the number of elements along each dimension of `A`:
276282
const int N = 3;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ 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 N array dimension size
8787
* @return elapsed time in seconds
8888
*/
8989
static double benchmark1( int iterations, int N ) {
@@ -114,7 +114,7 @@ static double benchmark1( int iterations, int N ) {
114114
* Runs a benchmark.
115115
*
116116
* @param iterations number of iterations
117-
* @param N number of elements along each dimension
117+
* @param N array dimension size
118118
* @return elapsed time in seconds
119119
*/
120120
static double benchmark2( int iterations, int N ) {

lib/node_modules/@stdlib/blas/base/dsyr/docs/repl.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,25 @@
4646

4747
Examples
4848
--------
49+
// Standard usage:
4950
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
5051
> var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 0.0, 2.0 ] );
5152
> {{alias}}( 'row-major', 'upper', 2, 1.0, x, 1, A, 2 )
5253
<Float64Array>[ 2.0, 3.0, 0.0, 3.0 ]
5354

55+
// Advanced indexing:
56+
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
57+
> var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 0.0, 2.0 ] );
58+
> {{alias}}( 'row-major', 'upper', 2, 1.0, x, -1, A, 2 )
59+
<Float64Array>[ 2.0, 3.0, 0.0, 3.0 ]
60+
61+
// Using typed array views:
62+
> var x0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 1.0 ] );
63+
> A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 0.0, 2.0 ] );
64+
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
65+
> {{alias}}( 'row-major', 'upper', 2, 1.0, x, 1, A, 2 )
66+
<Float64Array>[ 2.0, 3.0, 0.0, 3.0 ]
67+
5468

5569
{{alias}}.ndarray( uplo, N, α, x, sx, ox, A, sa1, sa2, oa )
5670
Performs the symmetric rank 1 operation `A = α*x*x^T + A`, using alternative

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

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

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

2834
// Specify the number of elements along each dimension of `A`:
2935
const int N = 3;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extern "C" {
3434
/**
3535
* 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
*/
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 );
37+
void API_SUFFIX(c_dsyr)( const CBLAS_LAYOUT layout, 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
/**
4040
* 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.

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
@@ -34,7 +34,7 @@ extern "C" {
3434
/**
3535
* 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
*/
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 );
37+
void API_SUFFIX(cblas_dsyr)( const CBLAS_LAYOUT layout, 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
#ifdef __cplusplus
4040
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
// MODULES //
2222

23-
var max = require( '@stdlib/math/base/special/fast/max' );
23+
var stride2offset = require( '@stdlib/strided/base/stride2offset' );
2424
var isLayout = require( '@stdlib/blas/base/assert/is-layout' );
2525
var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' );
26-
var stride2offset = require( '@stdlib/strided/base/stride2offset' );
26+
var max = require( '@stdlib/math/base/special/fast/max' );
2727
var format = require( '@stdlib/string/format' );
2828
var base = require( './base.js' );
2929

@@ -45,7 +45,7 @@ var base = require( './base.js' );
4545
* @throws {TypeError} second argument must specify whether to reference the lower or upper triangular matrix
4646
* @throws {RangeError} third argument must be a nonnegative integer
4747
* @throws {RangeError} sixth argument must be non-zero
48-
* @throws {RangeError} eighth argument must be greater than or equal to max(1,N)
48+
* @throws {RangeError} eighth argument must be a valid stride
4949
* @returns {Float64Array} `A`
5050
*
5151
* @example
@@ -77,6 +77,7 @@ function dsyr( order, uplo, N, alpha, x, strideX, A, LDA ) {
7777
if ( LDA < max( 1, N ) ) {
7878
throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) );
7979
}
80+
// Check if we can early return...
8081
if ( N === 0 || alpha === 0.0 ) {
8182
return A;
8283
}

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@
2020

2121
// MODULES //
2222

23+
var isLayout = require( '@stdlib/blas/base/assert/is-layout' );
24+
var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' );
25+
var max = require( '@stdlib/math/base/special/fast/max' );
2326
var resolveOrder = require( '@stdlib/blas/base/layout-resolve-enum' );
2427
var resolveUplo = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' );
28+
var format = require( '@stdlib/string/format' );
2529
var addon = require( './../src/addon.node' );
2630

2731

@@ -38,6 +42,11 @@ var addon = require( './../src/addon.node' );
3842
* @param {integer} strideX - `x` stride length
3943
* @param {Float64Array} A - input matrix
4044
* @param {integer} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
45+
* @throws {TypeError} first argument must be a valid order
46+
* @throws {TypeError} second argument must specify whether to reference the lower or upper triangular matrix
47+
* @throws {RangeError} third argument must be a nonnegative integer
48+
* @throws {RangeError} sixth argument must be non-zero
49+
* @throws {RangeError} eighth argument must be a valid stride
4150
* @returns {Float64Array} `A`
4251
*
4352
* @example
@@ -50,6 +59,25 @@ var addon = require( './../src/addon.node' );
5059
* // A => <Float64Array>[ 2.0, 4.0, 6.0, 0.0, 5.0, 8.0, 0.0, 0.0, 10.0 ]
5160
*/
5261
function dsyr( order, uplo, N, alpha, x, strideX, A, LDA ) {
62+
if ( !isLayout( order ) ) {
63+
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
64+
}
65+
if ( !isMatrixTriangle( uplo ) ) {
66+
throw new TypeError( format( 'invalid argument. Second argument must specify whether to reference the lower or upper triangular matrix. Value: `%s`.', uplo ) );
67+
}
68+
if ( N < 0 ) {
69+
throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) );
70+
}
71+
if ( strideX === 0 ) {
72+
throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideX ) );
73+
}
74+
if ( LDA < max( 1, N ) ) {
75+
throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) );
76+
}
77+
// Check if we can early return...
78+
if ( N === 0 || alpha === 0.0 ) {
79+
return A;
80+
}
5381
addon( resolveOrder( order ), resolveUplo( uplo ), N, alpha, x, strideX, A, LDA ); // eslint-disable-line max-len
5482
return A;
5583
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function dsyr( uplo, N, alpha, x, strideX, offsetX, A, strideA1, strideA2, offse
6464
if ( strideX === 0 ) {
6565
throw new RangeError( format( 'invalid argument. Fifth argument must be non-zero. Value: `%d`.', strideX ) );
6666
}
67+
// Check if we can early return...
6768
if ( N === 0 || alpha === 0.0 ) {
6869
return A;
6970
}

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121
// MODULES //
2222

23+
var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' );
2324
var resolveUplo = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' );
25+
var format = require( '@stdlib/string/format' );
2426
var addon = require( './../src/addon.node' );
2527

2628

@@ -39,6 +41,9 @@ var addon = require( './../src/addon.node' );
3941
* @param {integer} strideA1 - stride of the first dimension of `A`
4042
* @param {integer} strideA2 - stride of the second dimension of `A`
4143
* @param {NonNegativeInteger} offsetA - starting index for `A`
44+
* @throws {TypeError} first argument must specify whether to reference the lower or upper triangular matrix
45+
* @throws {RangeError} second argument must be a nonnegative integer
46+
* @throws {RangeError} fifth argument must be non-zero
4247
* @returns {Float64Array} `A`
4348
*
4449
* @example
@@ -51,6 +56,19 @@ var addon = require( './../src/addon.node' );
5156
* // A => <Float64Array>[ 2.0, 4.0, 6.0, 0.0, 5.0, 8.0, 0.0, 0.0, 10.0 ]
5257
*/
5358
function dsyr( uplo, N, alpha, x, strideX, offsetX, A, strideA1, strideA2, offsetA ) { // eslint-disable-line max-len
59+
if ( !isMatrixTriangle( uplo ) ) {
60+
throw new TypeError( format( 'invalid argument. First argument must specify whether to reference the lower or upper triangular matrix. Value: `%s`.', uplo ) );
61+
}
62+
if ( N < 0 ) {
63+
throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', N ) );
64+
}
65+
if ( strideX === 0 ) {
66+
throw new RangeError( format( 'invalid argument. Fifth argument must be non-zero. Value: `%d`.', strideX ) );
67+
}
68+
// Check if we can early return...
69+
if ( N === 0 || alpha === 0.0 ) {
70+
return A;
71+
}
5472
addon.ndarray( resolveUplo( uplo ), N, alpha, x, strideX, offsetX, A, strideA1, strideA2, offsetA ); // eslint-disable-line max-len
5573
return A;
5674
}

0 commit comments

Comments
 (0)