Skip to content

Commit c632a9a

Browse files
committed
chore: update implementation
1 parent d049962 commit c632a9a

20 files changed

+374
-117
lines changed

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

Lines changed: 12 additions & 11 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
- **AP**: packed form of a symmetric matrix `A` stored as a [`Float64Array`][mdn-float64array].
5656

5757
The stride parameters determine how elements in the input arrays are accessed at runtime. For example, to iterate over the elements of `x` in reverse order,
@@ -101,7 +101,7 @@ dspr.ndarray( 'row-major', 'lower', 3, 1.0, x, 1, 0, AP, 1, 0 );
101101
The function has the following additional parameters:
102102

103103
- **ox**: starting index for `x`.
104-
- **sap**: `AP` stride length.
104+
- **sap**: stride length for `AP`.
105105
- **oap**: starting index for `AP`.
106106

107107
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example,
@@ -186,7 +186,7 @@ console.log( AP );
186186
#include "stdlib/blas/base/dspr.h"
187187
```
188188

189-
#### c_dspr( order, uplo, N, alpha, \*X, strideX, \*AP )
189+
#### c_dspr( layout, uplo, N, alpha, \*X, sx, \*AP )
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 supplied in packed form.
192192

@@ -201,19 +201,19 @@ c_dspr( CblasRowMajor, CblasUpper, 3, 1.0, x, 1, AP );
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`.
207207
- **alpha**: `[in] double` scalar.
208208
- **X**: `[in] double*` input vector.
209-
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
209+
- **sx**: `[in] CBLAS_INT` stride length for `X`.
210210
- **AP**: `[inout] double*` packed form of a symmetric matrix `A`.
211211
212212
```c
213-
void c_dspr( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP )
213+
void c_dspr( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *x, const CBLAS_INT strideX, double *ap )
214214
```
215215

216-
#### c_dspr_ndarray( order, uplo, N, alpha, \*X, strideX, \*AP, strideAP, offsetAP )
216+
#### c_dspr_ndarray( layout, uplo, N, alpha, \*X, sx, \*AP, sap, offsetAP )
217217

218218
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 supplied in packed form.
219219

@@ -228,18 +228,19 @@ c_dspr_ndarray( CblasRowMajor, CblasUpper, 3, 1.0, x, 1, AP, 1, 0 );
228228
229229
The function accepts the following arguments:
230230
231-
- **order**: `[in] CBLAS_LAYOUT` storage layout.
231+
- **layout**: `[in] CBLAS_LAYOUT` storage layout.
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`.
234234
- **alpha**: `[in] double` scalar.
235235
- **X**: `[in] double*` input vector.
236-
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
236+
- **sx**: `[in] CBLAS_INT` stride length for `X`.
237+
- **ox**: `[in] CBLAS_INT` starting index for `x`.
237238
- **AP**: `[inout] double*` packed form of a symmetric matrix `A`.
238-
- **strideAP**: `[in] CBLAS_INT` stride length for `AP`.
239+
- **sap**: `[in] CBLAS_INT` stride length for `AP`.
239240
- **offsetAP**: `[in] CBLAS_INT` starting index for `AP`.
240241
241242
```c
242-
void c_dspr_ndarray( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP )
243+
void c_dspr_ndarray( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *ap, const CBLAS_INT strideAP, const CBLAS_INT offsetAP )
243244
```
244245

245246
</section>

lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function createBenchmark( N ) {
8585
* @private
8686
*/
8787
function main() {
88-
var len;
88+
var N;
8989
var min;
9090
var max;
9191
var f;
@@ -95,9 +95,9 @@ function main() {
9595
max = 6; // 10^max
9696

9797
for ( i = min; i <= max; i++ ) {
98-
len = floor( pow( pow( 10, i ), 1.0/2.0 ) );
99-
f = createBenchmark( len );
100-
bench( pkg+':size='+( len * ( len + 1 ) / 2 ), f );
98+
N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
99+
f = createBenchmark( N );
100+
bench( pkg+':size='+( N * ( N + 1 ) / 2 ), f );
101101
}
102102
}
103103

lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function createBenchmark( N ) {
9090
* @private
9191
*/
9292
function main() {
93-
var len;
93+
var N;
9494
var min;
9595
var max;
9696
var f;
@@ -100,9 +100,9 @@ function main() {
100100
max = 6; // 10^max
101101

102102
for ( i = min; i <= max; i++ ) {
103-
len = floor( pow( pow( 10, i ), 1.0/2.0 ) );
104-
f = createBenchmark( len );
105-
bench( pkg+'::native:size='+( len * ( len + 1 ) / 2 ), opts, f );
103+
N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
104+
f = createBenchmark( N );
105+
bench( pkg+'::native:size='+( N * ( N + 1 ) / 2 ), opts, f );
106106
}
107107
}
108108

lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function createBenchmark( N ) {
8585
* @private
8686
*/
8787
function main() {
88-
var len;
88+
var N;
8989
var min;
9090
var max;
9191
var f;
@@ -95,9 +95,9 @@ function main() {
9595
max = 6; // 10^max
9696

9797
for ( i = min; i <= max; i++ ) {
98-
len = floor( pow( pow( 10, i ), 1.0/2.0 ) );
99-
f = createBenchmark( len );
100-
bench( pkg+':ndarray:size='+( len * ( len + 1 ) / 2 ), f );
98+
N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
99+
f = createBenchmark( N );
100+
bench( pkg+':ndarray:size='+( N * ( N + 1 ) / 2 ), f );
101101
}
102102
}
103103

lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function createBenchmark( N ) {
9090
* @private
9191
*/
9292
function main() {
93-
var len;
93+
var N;
9494
var min;
9595
var max;
9696
var f;
@@ -100,9 +100,9 @@ function main() {
100100
max = 6; // 10^max
101101

102102
for ( i = min; i <= max; i++ ) {
103-
len = floor( pow( pow( 10, i ), 1.0/2.0 ) );
104-
f = createBenchmark( len );
105-
bench( pkg+'::native:ndarray:size='+( len * ( len + 1 ) / 2 ), opts, f );
103+
N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
104+
f = createBenchmark( N );
105+
bench( pkg+'::native:ndarray:size='+( N * ( N + 1 ) / 2 ), opts, f );
106106
}
107107
}
108108

lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -83,28 +83,28 @@ static double tic( void ) {
8383
* Runs a benchmark.
8484
*
8585
* @param iterations number of iterations
86-
* @param len array length
86+
* @param N array dimension size
8787
* @return elapsed time in seconds
8888
*/
89-
static double benchmark1( int iterations, int len ) {
89+
static double benchmark1( int iterations, int N ) {
9090
double elapsed;
91-
double AP[ len*(len+1)/2 ];
92-
double x[ len ];
91+
double AP[ N*(N+1)/2 ];
92+
double x[ N ];
9393
double t;
9494
int i;
9595

96-
stdlib_strided_dfill( len, 1.0, x, 1 );
97-
stdlib_strided_dfill( len*(len+1)/2, 1.0, AP, 1 );
96+
stdlib_strided_dfill( N, 1.0, x, 1 );
97+
stdlib_strided_dfill( N*(N+1)/2, 1.0, AP, 1 );
9898
t = tic();
9999
for ( i = 0; i < iterations; i++ ) {
100-
c_dspr( CblasRowMajor, CblasUpper, len, 1.0, x, 1, AP );
101-
if ( AP[ i%len ] != AP[ i%len ] ) {
100+
c_dspr( CblasRowMajor, CblasUpper, N, 1.0, x, 1, AP );
101+
if ( AP[ i%N ] != AP[ i%N ] ) {
102102
printf( "should not return NaN\n" );
103103
break;
104104
}
105105
}
106106
elapsed = tic() - t;
107-
if ( AP[ i%len ] != AP[ i%len ] ) {
107+
if ( AP[ i%N ] != AP[ i%N ] ) {
108108
printf( "should not return NaN\n" );
109109
}
110110
return elapsed;
@@ -114,28 +114,28 @@ static double benchmark1( int iterations, int len ) {
114114
* Runs a benchmark.
115115
*
116116
* @param iterations number of iterations
117-
* @param len array length
117+
* @param N array dimension size
118118
* @return elapsed time in seconds
119119
*/
120-
static double benchmark2( int iterations, int len ) {
120+
static double benchmark2( int iterations, int N ) {
121121
double elapsed;
122-
double AP[ len*(len+1)/2 ];
123-
double x[ len ];
122+
double AP[ N*(N+1)/2 ];
123+
double x[ N ];
124124
double t;
125125
int i;
126126

127-
stdlib_strided_dfill( len, 1.0, x, 1 );
128-
stdlib_strided_dfill( len*(len+1)/2, 1.0, AP, 1 );
127+
stdlib_strided_dfill( N, 1.0, x, 1 );
128+
stdlib_strided_dfill( N*(N+1)/2, 1.0, AP, 1 );
129129
t = tic();
130130
for ( i = 0; i < iterations; i++ ) {
131-
c_dspr_ndarray( CblasRowMajor, CblasUpper, len, 1.0, x, 1, 0, AP, 1, 0 );
132-
if ( AP[ i%len ] != AP[ i%len ] ) {
131+
c_dspr_ndarray( CblasRowMajor, CblasUpper, N, 1.0, x, 1, 0, AP, 1, 0 );
132+
if ( AP[ i%N ] != AP[ i%N ] ) {
133133
printf( "should not return NaN\n" );
134134
break;
135135
}
136136
}
137137
elapsed = tic() - t;
138-
if ( AP[ i%len ] != AP[ i%len ] ) {
138+
if ( AP[ i%N ] != AP[ i%N ] ) {
139139
printf( "should not return NaN\n" );
140140
}
141141
return elapsed;
@@ -148,7 +148,7 @@ int main( void ) {
148148
double elapsed;
149149
int count;
150150
int iter;
151-
int len;
151+
int N;
152152
int i;
153153
int j;
154154

@@ -158,19 +158,19 @@ int main( void ) {
158158
print_version();
159159
count = 0;
160160
for ( i = MIN; i <= MAX; i++ ) {
161-
len = floor( pow( pow( 10, i ), 1.0/2.0 ) );
161+
N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
162162
iter = ITERATIONS / pow( 10, i-1 );
163163
for ( j = 0; j < REPEATS; j++ ) {
164164
count += 1;
165-
printf( "# c::%s:len=%d\n", NAME, len );
166-
elapsed = benchmark1( iter, len );
165+
printf( "# c::%s:N=%d\n", NAME, N );
166+
elapsed = benchmark1( iter, N );
167167
print_results( iter, elapsed );
168168
printf( "ok %d benchmark finished\n", count );
169169
}
170170
for ( j = 0; j < REPEATS; j++ ) {
171171
count += 1;
172-
printf( "# c::%s:ndarray:len=%d\n", NAME, len );
173-
elapsed = benchmark2( iter, len );
172+
printf( "# c::%s:ndarray:N=%d\n", NAME, N );
173+
elapsed = benchmark2( iter, N );
174174
print_results( iter, elapsed );
175175
printf( "ok %d benchmark finished\n", count );
176176
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
{{alias}}( ord, uplo, N, α, x, sx, AP )
2+
{{alias}}( order, uplo, N, α, x, sx, AP )
33
Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a
44
scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric
55
matrix supplied in packed form.
@@ -12,7 +12,7 @@
1212

1313
Parameters
1414
----------
15-
ord: string
15+
order: string
1616
Row-major (C-style) or column-major (Fortran-style) order. Must be
1717
either 'row-major' or 'column-major'.
1818

@@ -48,7 +48,7 @@
4848
<Float64Array>[ 2.0, 3.0, 4.0 ]
4949

5050

51-
{{alias}}.ndarray( ord, uplo, N, α, x, sx, ox, AP, sap, oap )
51+
{{alias}}.ndarray( order, uplo, N, α, x, sx, ox, AP, sap, oap )
5252
Performs the symmetric rank 1 operation `A = α*x*x^T + A` using alternative
5353
indexing semantics and where `α` is a scalar, `x` is an `N` element vector,
5454
and `A` is an `N` by `N` symmetric matrix supplied in packed form.
@@ -59,7 +59,7 @@
5959

6060
Parameters
6161
----------
62-
ord: string
62+
order: string
6363
Row-major (C-style) or column-major (Fortran-style) order. Must be
6464
either 'row-major' or 'column-major'.
6565

@@ -100,9 +100,9 @@
100100
--------
101101
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
102102
> var AP = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0 ] );
103-
> var ord = 'row-major';
103+
> var order = 'row-major';
104104
> var uplo = 'upper';
105-
> {{alias}}.ndarray( ord, uplo, 2, 1.0, x, 1, 0, AP, 1, 0 )
105+
> {{alias}}.ndarray( order, uplo, 2, 1.0, x, 1, 0, AP, 1, 0 )
106106
<Float64Array>[ 2.0, 3.0, 4.0 ]
107107

108108
See Also

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ 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 supplied in packed form.
3636
*/
37-
void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP );
37+
void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP );
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 supplied in packed form.
4141
*/
42-
void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP );
42+
void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP );
4343

4444
#ifdef __cplusplus
4545
}

lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr_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 supplied in packed form.
3636
*/
37-
void API_SUFFIX(cblas_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP );
37+
void API_SUFFIX(cblas_dspr)( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP );
3838

3939
#ifdef __cplusplus
4040
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ function dspr( order, uplo, N, alpha, x, strideX, AP ) {
6969
if ( strideX === 0 ) {
7070
throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideX ) );
7171
}
72+
// Check if we can early return...
7273
if ( N === 0 || alpha === 0.0 ) {
7374
return AP;
7475
}

0 commit comments

Comments
 (0)