diff --git a/CHANGELOG.md b/CHANGELOG.md
index 544bd77ad..13c7e9c13 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,93 @@
> Package changelog.
+
+
+## Unreleased (2024-08-18)
+
+
+
+### Packages
+
+
+
+#### [@stdlib/blas/base/dspr](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/dspr)
+
+
+
+
+
+##### Features
+
+- [`da12183`](https://github.com/stdlib-js/stdlib/commit/da121832eca80c36e1e32929e994fef44ca8a4cc) - add `blas/base/dspr` [(#2794)](https://github.com/stdlib-js/stdlib/pull/2794)
+
+
+
+
+
+
+
+
+
+
+
+
+
+#### [@stdlib/blas/base/sspr](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/sspr)
+
+
+
+
+
+##### Features
+
+- [`da12183`](https://github.com/stdlib-js/stdlib/commit/da121832eca80c36e1e32929e994fef44ca8a4cc) - add `blas/base/dspr` [(#2794)](https://github.com/stdlib-js/stdlib/pull/2794)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Contributors
+
+A total of 2 people contributed to this release. Thank you to the following contributors:
+
+- Aman Bhansali
+- Athan Reines
+
+
+
+
+
+
+
+### Commits
+
+
+
+- [`da12183`](https://github.com/stdlib-js/stdlib/commit/da121832eca80c36e1e32929e994fef44ca8a4cc) - **feat:** add `blas/base/dspr` [(#2794)](https://github.com/stdlib-js/stdlib/pull/2794) _(by Aman Bhansali, Athan Reines)_
+
+
+
+
+
+
+
+
+
+
+
## 0.3.1 (2024-08-18)
diff --git a/README.md b/README.md
index 63509a6c0..e453b6622 100644
--- a/README.md
+++ b/README.md
@@ -161,8 +161,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
[npm-image]: http://img.shields.io/npm/v/@stdlib/blas.svg
[npm-url]: https://npmjs.org/package/@stdlib/blas
-[test-image]: https://github.com/stdlib-js/blas/actions/workflows/test.yml/badge.svg?branch=v0.3.1
-[test-url]: https://github.com/stdlib-js/blas/actions/workflows/test.yml?query=branch:v0.3.1
+[test-image]: https://github.com/stdlib-js/blas/actions/workflows/test.yml/badge.svg?branch=main
+[test-url]: https://github.com/stdlib-js/blas/actions/workflows/test.yml?query=branch:main
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/blas/main.svg
[coverage-url]: https://codecov.io/github/stdlib-js/blas?branch=main
diff --git a/base/dspr/README.md b/base/dspr/README.md
new file mode 100644
index 000000000..9c5443124
--- /dev/null
+++ b/base/dspr/README.md
@@ -0,0 +1,255 @@
+
+
+# dspr
+
+> Perform the symmetric rank 1 operation `A = α*x*x^T + A`.
+
+
+
+## Usage
+
+```javascript
+var dspr = require( '@stdlib/blas/base/dspr' );
+```
+
+#### dspr( order, uplo, N, α, x, sx, AP )
+
+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.
+
+```javascript
+var Float64Array = require( '@stdlib/array/float64' );
+
+var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] );
+var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
+
+dspr( 'row-major', 'upper', 3, 1.0, x, 1, AP );
+// AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+```
+
+The function has the following parameters:
+
+- **order**: storage layout.
+- **uplo**: specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied.
+- **N**: number of elements along each dimension of `A`.
+- **α**: scalar constant.
+- **x**: input [`Float64Array`][mdn-float64array].
+- **sx**: index increment for `x`.
+- **AP**: packed form of a symmetric matrix `A` stored as a [`Float64Array`][mdn-float64array].
+
+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,
+
+```javascript
+var Float64Array = require( '@stdlib/array/float64' );
+
+var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] );
+var x = new Float64Array( [ 3.0, 2.0, 1.0 ] );
+
+dspr( 'row-major', 'upper', 3, 1.0, x, -1, AP );
+// AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+```
+
+Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
+
+
+
+```javascript
+var Float64Array = require( '@stdlib/array/float64' );
+
+// Initial arrays...
+var x0 = new Float64Array( [ 0.0, 3.0, 2.0, 1.0 ] );
+var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] );
+
+// Create offset views...
+var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
+
+dspr( 'row-major', 'upper', 3, 1.0, x1, -1, AP );
+// AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+```
+
+#### dspr.ndarray( uplo, N, α, x, sx, ox, AP, sap, oap )
+
+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.
+
+```javascript
+var Float64Array = require( '@stdlib/array/float64' );
+
+var AP = new Float64Array( [ 1.0, 1.0, 2.0, 1.0, 2.0, 3.0 ] );
+var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
+
+dspr.ndarray( 'row-major', 'lower', 3, 1.0, x, 1, 0, AP, 1, 0 );
+// AP => [ 2.0, 3.0, 6.0, 4.0, 8.0, 12.0 ]
+```
+
+The function has the following additional parameters:
+
+- **ox**: starting index for `x`.
+- **sap**: `AP` stride length.
+- **oap**: starting index for `AP`.
+
+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,
+
+```javascript
+var Float64Array = require( '@stdlib/array/float64' );
+
+var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] );
+var x = new Float64Array( [ 3.0, 2.0, 1.0 ] );
+
+dspr.ndarray( 'row-major', 'upper', 3, 1.0, x, -1, 2, AP, 1, 0 );
+// AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+```
+
+
+
+
+
+
+
+## Notes
+
+- `dspr()` corresponds to the [BLAS][blas] level 2 function [`dspr`][blas-dspr].
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
+var dspr = require( '@stdlib/blas/base/dspr' );
+
+var opts = {
+ 'dtype': 'float64'
+};
+
+var N = 5;
+
+var AP = discreteUniform( N * ( N + 1 ) / 2, -10.0, 10.0, opts );
+var x = discreteUniform( N, -10.0, 10.0, opts );
+
+dspr( 'column-major', 'upper', N, 1.0, x, 1, AP );
+console.log( AP );
+
+dspr.ndarray( 'column-major', 'upper', N, 1.0, x, 1, 0, AP, 1, 0 );
+console.log( AP );
+```
+
+
+
+
+
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+TODO
+```
+
+#### TODO
+
+TODO.
+
+```c
+TODO
+```
+
+TODO
+
+```c
+TODO
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Examples
+
+```c
+TODO
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[blas]: http://www.netlib.org/blas
+
+[blas-dspr]: https://www.netlib.org/lapack/explore-html/d5/df9/group__hpr_gaa5d4297738fb1391709c645a7c2bee5e.html#gaa5d4297738fb1391709c645a7c2bee5e
+
+[mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array
+
+[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
+
+
+
+
diff --git a/base/dspr/benchmark/benchmark.js b/base/dspr/benchmark/benchmark.js
new file mode 100644
index 000000000..b58be056c
--- /dev/null
+++ b/base/dspr/benchmark/benchmark.js
@@ -0,0 +1,104 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var uniform = require( '@stdlib/random/array/uniform' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var floor = require( '@stdlib/math/base/special/floor' );
+var pkg = require( './../package.json' ).name;
+var dspr = require( './../lib/dspr.js' );
+
+
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {PositiveInteger} N - number of elements along each dimension
+* @returns {Function} benchmark function
+*/
+function createBenchmark( N ) {
+ var AP = uniform( N * ( N + 1 ) / 2, -10.0, 10.0, options );
+ var x = uniform( N, -10.0, 10.0, options );
+ return benchmark;
+
+ /**
+ * Benchmark function.
+ *
+ * @private
+ * @param {Benchmark} b - benchmark instance
+ */
+ function benchmark( b ) {
+ var z;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ z = dspr( 'row-major', 'upper', N, 1.0, x, 1, AP );
+ if ( isnan( z[ i%z.length ] ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ }
+ b.toc();
+ if ( isnan( z[ i%z.length ] ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+ }
+}
+
+
+// MAIN //
+
+/**
+* Main execution sequence.
+*
+* @private
+*/
+function main() {
+ var len;
+ var min;
+ var max;
+ var f;
+ var i;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( i = min; i <= max; i++ ) {
+ len = floor( pow( pow( 10, i ), 1.0/2.0 ) );
+ f = createBenchmark( len );
+ bench( pkg+':size='+( len * ( len + 1 ) / 2 ), f );
+ }
+}
+
+main();
diff --git a/base/dspr/benchmark/benchmark.ndarray.js b/base/dspr/benchmark/benchmark.ndarray.js
new file mode 100644
index 000000000..e551208ab
--- /dev/null
+++ b/base/dspr/benchmark/benchmark.ndarray.js
@@ -0,0 +1,104 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var uniform = require( '@stdlib/random/array/uniform' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var floor = require( '@stdlib/math/base/special/floor' );
+var pkg = require( './../package.json' ).name;
+var dspr = require( './../lib/ndarray.js' );
+
+
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {PositiveInteger} N - number of elements along each dimension
+* @returns {Function} benchmark function
+*/
+function createBenchmark( N ) {
+ var AP = uniform( N * ( N + 1 ) / 2, -10.0, 10.0, options );
+ var x = uniform( N, -10.0, 10.0, options );
+ return benchmark;
+
+ /**
+ * Benchmark function.
+ *
+ * @private
+ * @param {Benchmark} b - benchmark instance
+ */
+ function benchmark( b ) {
+ var z;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ z = dspr( 'row-major', 'upper', N, 1.0, x, 1, 0, AP, 1, 0 );
+ if ( isnan( z[ i%z.length ] ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ }
+ b.toc();
+ if ( isnan( z[ i%z.length ] ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+ }
+}
+
+
+// MAIN //
+
+/**
+* Main execution sequence.
+*
+* @private
+*/
+function main() {
+ var len;
+ var min;
+ var max;
+ var f;
+ var i;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( i = min; i <= max; i++ ) {
+ len = floor( pow( pow( 10, i ), 1.0/2.0 ) );
+ f = createBenchmark( len );
+ bench( pkg+':ndarray:size='+( len * ( len + 1 ) / 2 ), f );
+ }
+}
+
+main();
diff --git a/base/dspr/docs/repl.txt b/base/dspr/docs/repl.txt
new file mode 100644
index 000000000..7bb0921b6
--- /dev/null
+++ b/base/dspr/docs/repl.txt
@@ -0,0 +1,109 @@
+
+{{alias}}( ord, uplo, N, α, x, sx, AP )
+ 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.
+
+ Indexing is relative to the first index. To introduce an offset, use typed
+ array views.
+
+ If `N` is equal to `0` or `α` is equal to `0`, the function returns `AP`
+ unchanged.
+
+ Parameters
+ ----------
+ ord: string
+ Row-major (C-style) or column-major (Fortran-style) order. Must be
+ either 'row-major' or 'column-major'.
+
+ uplo: string
+ Specifies whether the upper or lower triangular matrix of `A` is
+ supplied. Must be either 'upper' or 'lower'.
+
+ N: integer
+ Number of elements along each dimension of `A`.
+
+ α: number
+ Scalar constant.
+
+ x: Float64Array
+ Input vector `x`.
+
+ sx: integer
+ Index increment for `x`.
+
+ AP: Float64Array
+ Matrix in packed form.
+
+ Returns
+ -------
+ AP: Float64Array
+ Matrix in packed form.
+
+ Examples
+ --------
+ > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
+ > var AP = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0 ] );
+ > {{alias}}( 'row-major', 'upper', 2, 1.0, x, 1, AP )
+ [ 2.0, 3.0, 4.0 ]
+
+
+{{alias}}.ndarray( ord, uplo, N, α, x, sx, ox, AP, sap, oap )
+ 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.
+
+ While typed array views mandate a view offset based on the underlying
+ buffer, the offset parameters support indexing semantics based on starting
+ indices.
+
+ Parameters
+ ----------
+ ord: string
+ Row-major (C-style) or column-major (Fortran-style) order. Must be
+ either 'row-major' or 'column-major'.
+
+ uplo: string
+ Specifies whether the upper or lower triangular matrix of `A` is
+ supplied. Must be either 'upper' or 'lower'.
+
+ N: integer
+ Number of elements along each dimension of `A`.
+
+ α: number
+ Scalar.
+
+ x: Float64Array
+ Input vector `x`.
+
+ sx: integer
+ Index increment for `x`.
+
+ ox: integer
+ Starting index for `x`.
+
+ AP: Float64Array
+ Matrix in packed form.
+
+ sap: integer
+ Index increment for `ap`.
+
+ oap: integer
+ Starting index for `ap`.
+
+ Returns
+ -------
+ AP: Float64Array
+ Matrix in packed form.
+
+ Examples
+ --------
+ > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] );
+ > var AP = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0 ] );
+ > var ord = 'row-major';
+ > var uplo = 'upper';
+ > {{alias}}.ndarray( ord, uplo, 2, 1.0, x, 1, 0, AP, 1, 0 )
+ [ 2.0, 3.0, 4.0 ]
+
+ See Also
+ --------
diff --git a/base/dspr/docs/types/index.d.ts b/base/dspr/docs/types/index.d.ts
new file mode 100644
index 000000000..aec58a4c9
--- /dev/null
+++ b/base/dspr/docs/types/index.d.ts
@@ -0,0 +1,114 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// TypeScript Version: 4.1
+
+///
+
+import { Layout, MatrixTriangle } from '@stdlib/types/blas';
+
+/**
+* Interface describing `dspr`.
+*/
+interface Routine {
+ /**
+ * 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.
+ *
+ * @param order - storage layout
+ * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is being supplied
+ * @param N - number of elements along each dimension of `A`
+ * @param alpha - scalar constant
+ * @param x - input vector
+ * @param strideX - `x` stride length
+ * @param AP - packed form of a symmetric matrix `A`
+ * @returns `AP`
+ *
+ * @example
+ * var Float64Array = require( '@stdlib/array/float64' );
+ *
+ * var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); // => [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ]
+ * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
+ *
+ * dspr( 'row-major', 'upper', 3, 1.0, x, 1, AP );
+ * // A => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+ */
+ ( order: Layout, uplo: MatrixTriangle, N: number, alpha: number, x: Float64Array, strideX: number, AP: Float64Array ): Float64Array;
+
+ /**
+ * 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.
+ *
+ * @param order - storage layout
+ * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is being supplied
+ * @param N - number of elements along each dimension of `A`
+ * @param alpha - scalar constant
+ * @param x - input vector
+ * @param strideX - `x` stride length
+ * @param offsetX - starting index for `x`
+ * @param AP - packed form of a symmetric matrix `A`
+ * @param strideAP - `AP` stride length
+ * @param offsetAP - starting index for `AP`
+ * @returns `AP`
+ *
+ * @example
+ * var Float64Array = require( '@stdlib/array/float64' );
+ *
+ * var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); // => [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ]
+ * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
+ *
+ * dspr.ndarray( 'row-major', 'upper', 3, 1.0, x, 1, 0, AP, 1, 0 );
+ * // A => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+ */
+ ndarray( order: Layout, uplo: MatrixTriangle, N: number, alpha: number, x: Float64Array, strideX: number, offsetX: number, AP: Float64Array, strideAP: number, offsetAP: number ): Float64Array;
+}
+
+/**
+* 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.
+*
+* @param order - storage layout
+* @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is being supplied
+* @param N - number of elements along each dimension of `A`
+* @param alpha - scalar constant
+* @param x - input vector
+* @param strideX - `x` stride length
+* @param AP - packed form of a symmetric matrix `A`
+* @returns `AP`
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var AP = new Float64Array( [ 1.0, 1.0, 2.0, 1.0, 2.0, 3.0 ] );
+* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
+*
+* dspr( 'row-major', 'lower', 3, 1.0, x, 1, AP );
+* // AP => [ 2.0, 3.0, 6.0, 4.0, 8.0, 12.0 ]
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var AP = new Float64Array( [ 1.0, 1.0, 2.0, 1.0, 2.0, 3.0 ] );
+* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
+*
+* dspr.ndarray( 'row-major', 'lower', 3, 1.0, x, 1, 0, AP, 1, 0 );
+* // AP => [ 2.0, 3.0, 6.0, 4.0, 8.0, 12.0 ]
+*/
+declare var dspr: Routine;
+
+
+// EXPORTS //
+
+export = dspr;
diff --git a/base/dspr/docs/types/test.ts b/base/dspr/docs/types/test.ts
new file mode 100644
index 000000000..9807d6c88
--- /dev/null
+++ b/base/dspr/docs/types/test.ts
@@ -0,0 +1,326 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import dspr = require( './index' );
+
+
+// TESTS //
+
+// The function returns a Float64Array...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1, A ); // $ExpectType Float64Array
+}
+
+// The compiler throws an error if the function is provided a first argument which is not a string...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr( 10, 'upper', 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( true, 'upper', 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( false, 'upper', 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( null, 'upper', 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( void 0, 'upper', 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( [], 'upper', 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( {}, 'upper', 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( ( x: number ): number => x, 'upper', 10, 1.0, x, 1, A ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a second argument which is not a string...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr( 'row-major', 10, 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', true, 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', false, 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', null, 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', void 0, 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', [ '1' ], 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', {}, 10, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', ( x: number ): number => x, 10, 1.0, x, 1, A ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a third argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr( 'row-major', 'upper', '10', 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', true, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', false, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', null, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', void 0, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', [], 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', {}, 1.0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', ( x: number ): number => x, 1.0, x, 1, A ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a fourth argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr( 'row-major', 'upper', 10, '10', x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, true, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, false, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, null, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, void 0, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, [], x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, {}, x, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, ( x: number ): number => x, x, 1, A ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array...
+{
+ const A = new Float64Array( 55 );
+
+ dspr( 'row-major', 'upper', 10, 1.0, 10, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, '10', 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, true, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, false, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, null, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, void 0, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, [ '1' ], 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, {}, 1, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, ( x: number ): number => x, 1, A ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a sixth argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr( 'row-major', 'upper', 10, 1.0, x, '10', A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, true, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, false, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, null, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, void 0, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, [], A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, {}, A ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, ( x: number ): number => x, A ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array...
+{
+ const x = new Float64Array( 10 );
+
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1, 10 ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1, '10' ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1, true ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1, false ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1, null ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1, void 0 ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1, [ '1' ] ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1, {} ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr(); // $ExpectError
+ dspr( 'row-major' ); // $ExpectError
+ dspr( 'row-major', 'upper' ); // $ExpectError
+ dspr( 'row-major', 'upper', 10 ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0 ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1 ); // $ExpectError
+ dspr( 'row-major', 'upper', 10, 1.0, x, 1, A, 10 ); // $ExpectError
+}
+
+// Attached to main export is an `ndarray` method which returns a Float64Array...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectType Float64Array
+}
+
+// The compiler throws an error if the function is provided a first argument which is not a string...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr.ndarray( 10, 'upper', 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( true, 'upper', 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( false, 'upper', 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( null, 'upper', 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( void 0, 'upper', 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( [], 'upper', 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( {}, 'upper', 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( ( x: number ): number => x, 'upper', 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a second argument which is not a string...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr.ndarray( 'row-major', 10, 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', true, 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', false, 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', null, 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', void 0, 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', [ '1' ], 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', {}, 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', ( x: number ): number => x, 10, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a third argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr.ndarray( 'row-major', 'upper', '10', 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', true, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', false, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', null, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', void 0, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', [], 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', {}, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', ( x: number ): number => x, 1.0, x, 1, 0, A, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a fourth argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr.ndarray( 'row-major', 'upper', 10, '10', x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, true, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, false, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, null, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, void 0, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, [], x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, {}, x, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, ( x: number ): number => x, x, 1, 0, A, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array...
+{
+ const A = new Float64Array( 55 );
+
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, 10, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, '10', 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, true, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, false, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, null, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, void 0, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, [ '1' ], 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, {}, 1, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, ( x: number ): number => x, 1, 0, A, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a sixth argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, '10', 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, true, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, false, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, null, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, void 0, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, [], 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, {}, 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, ( x: number ): number => x, 0, A, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a seventh argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, '10', A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, true, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, false, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, null, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, void 0, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, [], A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, {}, A, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, ( x: number ): number => x, A, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an eighth argument which is not a Float64Array...
+{
+ const x = new Float64Array( 10 );
+
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, 10, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, '10', 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, true, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, false, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, null, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, void 0, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, [ '1' ], 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, {}, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a ninth argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, '10', 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, true, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, false, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, null, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, void 0, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, [], 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, {}, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, ( x: number ): number => x, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a tenth argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, 1, '10' ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, 1, true ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, 1, false ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, 1, null ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, 1, void 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, 1, [] ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, 1, {} ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, 1, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
+{
+ const x = new Float64Array( 10 );
+ const A = new Float64Array( 55 );
+
+ dspr.ndarray(); // $ExpectError
+ dspr.ndarray( 'row-major' ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper' ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, 1 ); // $ExpectError
+ dspr.ndarray( 'row-major', 'upper', 10, 1.0, x, 1, 0, A, 1, 0, 10 ); // $ExpectError
+}
diff --git a/base/dspr/examples/index.js b/base/dspr/examples/index.js
new file mode 100644
index 000000000..4b0e21de0
--- /dev/null
+++ b/base/dspr/examples/index.js
@@ -0,0 +1,37 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
+var dspr = require( './../lib' );
+
+var opts = {
+ 'dtype': 'float64'
+};
+
+var N = 5;
+
+var AP = discreteUniform( N * ( N + 1 ) / 2, -10.0, 10.0, opts );
+var x = discreteUniform( N, -10.0, 10.0, opts );
+
+dspr( 'column-major', 'upper', N, 1.0, x, 1, AP );
+console.log( AP );
+
+dspr.ndarray( 'column-major', 'upper', N, 1.0, x, 1, 0, AP, 1, 0 );
+console.log( AP );
diff --git a/base/dspr/lib/base.js b/base/dspr/lib/base.js
new file mode 100644
index 000000000..1f9ad4875
--- /dev/null
+++ b/base/dspr/lib/base.js
@@ -0,0 +1,103 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MAIN //
+
+/**
+* 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.
+*
+* @private
+* @param {string} order - storage layout
+* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
+* @param {NonNegativeInteger} N - number of elements along each dimension of `A`
+* @param {number} alpha - scalar
+* @param {Float64Array} x - input vector
+* @param {integer} strideX - `x` stride length
+* @param {NonNegativeInteger} offsetX - starting index for `x`
+* @param {Float64Array} AP - packed form of a symmetric matrix `A`
+* @param {integer} strideAP - `AP` stride length
+* @param {NonNegativeInteger} offsetAP - starting index for `AP`
+* @returns {Float64Array} `A`
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); // => [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ]
+* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
+*
+* dspr( 'row-major', 'upper', 3, 1.0, x, 1, 0, AP, 1, 0 );
+* // AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+*/
+function dspr( order, uplo, N, alpha, x, strideX, offsetX, AP, strideAP, offsetAP ) { // eslint-disable-line max-len
+ var tmp;
+ var ix0;
+ var ix1;
+ var iap;
+ var i0;
+ var i1;
+ var kk;
+ var ox;
+
+ ox = offsetX;
+ kk = offsetAP;
+ if (
+ ( order === 'column-major' && uplo === 'upper' ) ||
+ ( order === 'row-major' && uplo === 'lower' )
+ ) {
+ ix1 = ox;
+ for ( i1 = 0; i1 < N; i1++ ) {
+ if ( x[ ix1 ] !== 0.0 ) {
+ tmp = alpha * x[ ix1 ];
+ ix0 = ox;
+ iap = kk;
+ for ( i0 = 0; i0 <= i1; i0++ ) {
+ AP[ iap ] += x[ ix0 ] * tmp;
+ ix0 += strideX;
+ iap += strideAP;
+ }
+ }
+ ix1 += strideX;
+ kk += ( i1 + 1 ) * strideAP;
+ }
+ return AP;
+ }
+ // ( order === 'column-major' && uplo === 'lower' ) || ( order === 'row-major' && uplo === 'upper' )
+ ix1 = ox;
+ for ( i1 = 0; i1 < N; i1++ ) {
+ if ( x[ ix1 ] !== 0.0 ) {
+ tmp = alpha * x[ ix1 ];
+ ix0 = ix1;
+ iap = kk;
+ for ( i0 = 0; i0 < N - i1; i0++ ) {
+ AP[ iap ] += x[ ix0 ] * tmp;
+ ix0 += strideX;
+ iap += strideAP;
+ }
+ }
+ ix1 += strideX;
+ kk += ( N - i1 ) * strideAP;
+ }
+ return AP;
+}
+
+
+// EXPORTS //
+
+module.exports = dspr;
diff --git a/base/dspr/lib/dspr.js b/base/dspr/lib/dspr.js
new file mode 100644
index 000000000..a32fc0070
--- /dev/null
+++ b/base/dspr/lib/dspr.js
@@ -0,0 +1,82 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var isLayout = require( './../../../base/assert/is-layout' );
+var isMatrixTriangle = require( './../../../base/assert/is-matrix-triangle' );
+var stride2offset = require( '@stdlib/strided/base/stride2offset' );
+var format = require( '@stdlib/string/format' );
+var base = require( './base.js' );
+
+
+// MAIN //
+
+/**
+* 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.
+*
+* @param {string} order - storage layout
+* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
+* @param {NonNegativeInteger} N - number of elements along each dimension of `A`
+* @param {number} alpha - scalar
+* @param {Float64Array} x - input vector
+* @param {integer} strideX - `x` stride length
+* @param {Float64Array} AP - packed form of a symmetric matrix `A`
+* @throws {TypeError} first argument must be a valid order
+* @throws {TypeError} second argument must specify whether the lower or upper triangular matrix is supplied
+* @throws {RangeError} third argument must be a nonnegative integer
+* @throws {RangeError} sixth argument must be non-zero
+* @returns {Float64Array} `A`
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); // => [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ]
+* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
+*
+* dspr( 'row-major', 'upper', 3, 1.0, x, 1, AP );
+* // AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+*/
+function dspr( order, uplo, N, alpha, x, strideX, AP ) {
+ var ox;
+
+ if ( !isLayout( order ) ) {
+ throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
+ }
+ if ( !isMatrixTriangle( uplo ) ) {
+ throw new TypeError( format( 'invalid argument. Second argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) );
+ }
+ if ( N < 0 ) {
+ throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) );
+ }
+ if ( strideX === 0 ) {
+ throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideX ) );
+ }
+ if ( N === 0 || alpha === 0.0 ) {
+ return AP;
+ }
+ ox = stride2offset( N, strideX );
+ return base( order, uplo, N, alpha, x, strideX, ox, AP, 1, 0 );
+}
+
+
+// EXPORTS //
+
+module.exports = dspr;
diff --git a/base/dspr/lib/index.js b/base/dspr/lib/index.js
new file mode 100644
index 000000000..90212fe92
--- /dev/null
+++ b/base/dspr/lib/index.js
@@ -0,0 +1,70 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* BLAS level 2 routine to perform 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.
+*
+* @module @stdlib/blas/base/dspr
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var dspr = require( '@stdlib/blas/base/dspr' );
+*
+* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); // => [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ]
+* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
+*
+* dspr( 'row-major', 'upper', 3, 1.0, x, 1, AP );
+* // AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var dspr = require( '@stdlib/blas/base/dspr' );
+*
+* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); // => [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ]
+* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
+*
+* dspr.ndarray( 'row-major', 'upper', 3, 1.0, x, 1, 0, AP, 1, 0 );
+* // AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+*/
+
+// MODULES //
+
+var join = require( 'path' ).join;
+var tryRequire = require( '@stdlib/utils/try-require' );
+var isError = require( '@stdlib/assert/is-error' );
+var main = require( './main.js' );
+
+
+// MAIN //
+
+var dspr;
+var tmp = tryRequire( join( __dirname, './native.js' ) );
+if ( isError( tmp ) ) {
+ dspr = main;
+} else {
+ dspr = tmp;
+}
+
+
+// EXPORTS //
+
+module.exports = dspr;
+
+// exports: { "ndarray": "dspr.ndarray" }
diff --git a/base/dspr/lib/main.js b/base/dspr/lib/main.js
new file mode 100644
index 000000000..a49c014fa
--- /dev/null
+++ b/base/dspr/lib/main.js
@@ -0,0 +1,35 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var dspr = require( './dspr.js' );
+var ndarray = require( './ndarray.js' );
+
+
+// MAIN //
+
+setReadOnly( dspr, 'ndarray', ndarray );
+
+
+// EXPORTS //
+
+module.exports = dspr;
diff --git a/base/dspr/lib/ndarray.js b/base/dspr/lib/ndarray.js
new file mode 100644
index 000000000..68c5ffab8
--- /dev/null
+++ b/base/dspr/lib/ndarray.js
@@ -0,0 +1,85 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var isLayout = require( './../../../base/assert/is-layout' );
+var isMatrixTriangle = require( './../../../base/assert/is-matrix-triangle' );
+var format = require( '@stdlib/string/format' );
+var base = require( './base.js' );
+
+
+// MAIN //
+
+/**
+* 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.
+*
+* @param {string} order - storage layout
+* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied
+* @param {NonNegativeInteger} N - number of elements along each dimension of `A`
+* @param {number} alpha - scalar
+* @param {Float64Array} x - input vector
+* @param {integer} strideX - `x` stride length
+* @param {NonNegativeInteger} offsetX - starting index for `x`
+* @param {Float64Array} AP - packed form of a symmetric matrix `A`
+* @param {integer} strideAP - `AP` stride length
+* @param {NonNegativeInteger} offsetAP - starting index for `AP`
+* @throws {TypeError} first argument must be a valid order
+* @throws {TypeError} second argument must specify whether the lower or upper triangular matrix is supplied
+* @throws {RangeError} third argument must be a nonnegative integer
+* @throws {RangeError} sixth argument must be non-zero
+* @throws {RangeError} ninth argument must be non-zero
+* @returns {Float64Array} `A`
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+*
+* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); // => [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ]
+* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
+*
+* dspr( 'row-major', 'upper', 3, 1.0, x, 1, 0, AP, 1, 0 );
+* // AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+*/
+function dspr( order, uplo, N, alpha, x, strideX, offsetX, AP, strideAP, offsetAP ) { // eslint-disable-line max-len
+ if ( !isLayout( order ) ) {
+ throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
+ }
+ if ( !isMatrixTriangle( uplo ) ) {
+ throw new TypeError( format( 'invalid argument. Second argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) );
+ }
+ if ( N < 0 ) {
+ throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) );
+ }
+ if ( strideX === 0 ) {
+ throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideX ) );
+ }
+ if ( strideAP === 0 ) {
+ throw new RangeError( format( 'invalid argument. Ninth argument must be non-zero. Value: `%d`.', strideAP ) );
+ }
+ if ( N === 0 || alpha === 0.0 ) {
+ return AP;
+ }
+ return base( order, uplo, N, alpha, x, strideX, offsetX, AP, strideAP, offsetAP ); // eslint-disable-line max-len
+}
+
+
+// EXPORTS //
+
+module.exports = dspr;
diff --git a/base/dspr/package.json b/base/dspr/package.json
new file mode 100644
index 000000000..e753e0dab
--- /dev/null
+++ b/base/dspr/package.json
@@ -0,0 +1,68 @@
+{
+ "name": "@stdlib/blas/base/dspr",
+ "version": "0.0.0",
+ "description": "Perform the symmetric rank 1 operation `A = α*x*x^T + A`.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "types": "./docs/types",
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "stdmath",
+ "mathematics",
+ "math",
+ "blas",
+ "level 2",
+ "dspr",
+ "linear",
+ "algebra",
+ "subroutines",
+ "array",
+ "ndarray",
+ "float64",
+ "double",
+ "float64array"
+ ]
+}
diff --git a/base/dspr/test/fixtures/column_major_complex_access_pattern.json b/base/dspr/test/fixtures/column_major_complex_access_pattern.json
new file mode 100644
index 000000000..569d0efa0
--- /dev/null
+++ b/base/dspr/test/fixtures/column_major_complex_access_pattern.json
@@ -0,0 +1,13 @@
+{
+ "order": "column-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 3.0, 2.0, 1.0 ],
+ "strideX": -1,
+ "offsetX": 2,
+ "AP": [ 0.0, 3.0, 0.0, 2.0, 0.0, 2.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ],
+ "strideAP": -2,
+ "offsetAP": 11,
+ "AP_out": [ 0.0, 12.0, 0.0, 8.0, 0.0, 6.0, 0.0, 4.0, 0.0, 3.0, 0.0, 2.0, 0.0 ]
+}
diff --git a/base/dspr/test/fixtures/column_major_l.json b/base/dspr/test/fixtures/column_major_l.json
new file mode 100644
index 000000000..4a46b8781
--- /dev/null
+++ b/base/dspr/test/fixtures/column_major_l.json
@@ -0,0 +1,13 @@
+{
+ "order": "column-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 0,
+ "AP": [ 1.0, 1.0, 1.0, 2.0, 2.0, 3.0 ],
+ "strideAP": 1,
+ "offsetAP": 0,
+ "AP_out": [ 2.0, 3.0, 4.0, 6.0, 8.0, 12.0 ]
+}
diff --git a/base/dspr/test/fixtures/column_major_oap.json b/base/dspr/test/fixtures/column_major_oap.json
new file mode 100644
index 000000000..ad4d762d0
--- /dev/null
+++ b/base/dspr/test/fixtures/column_major_oap.json
@@ -0,0 +1,13 @@
+{
+ "order": "column-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 0,
+ "AP": [ 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 3.0 ],
+ "strideAP": 1,
+ "offsetAP": 1,
+ "AP_out": [ 0.0, 2.0, 3.0, 4.0, 6.0, 8.0, 12.0 ]
+}
diff --git a/base/dspr/test/fixtures/column_major_ox.json b/base/dspr/test/fixtures/column_major_ox.json
new file mode 100644
index 000000000..37578600f
--- /dev/null
+++ b/base/dspr/test/fixtures/column_major_ox.json
@@ -0,0 +1,13 @@
+{
+ "order": "column-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 0.0, 0.0, 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 2,
+ "AP": [ 1.0, 1.0, 1.0, 2.0, 2.0, 3.0 ],
+ "strideAP": 1,
+ "offsetAP": 0,
+ "AP_out": [ 2.0, 3.0, 4.0, 6.0, 8.0, 12.0 ]
+}
diff --git a/base/dspr/test/fixtures/column_major_sap.json b/base/dspr/test/fixtures/column_major_sap.json
new file mode 100644
index 000000000..0c6baacf0
--- /dev/null
+++ b/base/dspr/test/fixtures/column_major_sap.json
@@ -0,0 +1,13 @@
+{
+ "order": "column-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 0,
+ "AP": [ 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 2.0, 0.0, 2.0, 0.0, 3.0, 0.0 ],
+ "strideAP": 2,
+ "offsetAP": 1,
+ "AP_out": [ 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0, 6.0, 0.0, 8.0, 0.0, 12.0, 0.0 ]
+}
diff --git a/base/dspr/test/fixtures/column_major_sapn.json b/base/dspr/test/fixtures/column_major_sapn.json
new file mode 100644
index 000000000..c23bc0685
--- /dev/null
+++ b/base/dspr/test/fixtures/column_major_sapn.json
@@ -0,0 +1,13 @@
+{
+ "order": "column-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 0,
+ "AP": [ 0.0, 3.0, 0.0, 2.0, 0.0, 2.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ],
+ "strideAP": -2,
+ "offsetAP": 11,
+ "AP_out": [ 0.0, 12.0, 0.0, 8.0, 0.0, 6.0, 0.0, 4.0, 0.0, 3.0, 0.0, 2.0, 0.0 ]
+}
diff --git a/base/dspr/test/fixtures/column_major_u.json b/base/dspr/test/fixtures/column_major_u.json
new file mode 100644
index 000000000..738969690
--- /dev/null
+++ b/base/dspr/test/fixtures/column_major_u.json
@@ -0,0 +1,13 @@
+{
+ "order": "column-major",
+ "uplo": "upper",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 0,
+ "AP": [ 1.0, 2.0, 1.0, 3.0, 2.0, 1.0 ],
+ "strideAP": 1,
+ "offsetAP": 0,
+ "AP_out": [ 2.0, 4.0, 5.0, 6.0, 8.0, 10.0 ]
+}
diff --git a/base/dspr/test/fixtures/column_major_xn.json b/base/dspr/test/fixtures/column_major_xn.json
new file mode 100644
index 000000000..d3ef596ca
--- /dev/null
+++ b/base/dspr/test/fixtures/column_major_xn.json
@@ -0,0 +1,13 @@
+{
+ "order": "column-major",
+ "uplo": "upper",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 3.0, 2.0, 1.0 ],
+ "strideX": -1,
+ "offsetX": 2,
+ "AP": [ 1.0, 2.0, 1.0, 3.0, 2.0, 1.0 ],
+ "strideAP": 1,
+ "offsetAP": 0,
+ "AP_out": [ 2.0, 4.0, 5.0, 6.0, 8.0, 10.0 ]
+}
diff --git a/base/dspr/test/fixtures/column_major_xp.json b/base/dspr/test/fixtures/column_major_xp.json
new file mode 100644
index 000000000..6d6f60b1b
--- /dev/null
+++ b/base/dspr/test/fixtures/column_major_xp.json
@@ -0,0 +1,13 @@
+{
+ "order": "column-major",
+ "uplo": "upper",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 0.0, 2.0, 0.0, 3.0 ],
+ "strideX": 2,
+ "offsetX": 0,
+ "AP": [ 1.0, 2.0, 1.0, 3.0, 2.0, 1.0 ],
+ "strideAP": 1,
+ "offsetAP": 0,
+ "AP_out": [ 2.0, 4.0, 5.0, 6.0, 8.0, 10.0 ]
+}
diff --git a/base/dspr/test/fixtures/row_major_complex_access_pattern.json b/base/dspr/test/fixtures/row_major_complex_access_pattern.json
new file mode 100644
index 000000000..0a2ad8b4c
--- /dev/null
+++ b/base/dspr/test/fixtures/row_major_complex_access_pattern.json
@@ -0,0 +1,13 @@
+{
+ "order": "row-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 3.0, 2.0, 1.0 ],
+ "strideX": -1,
+ "offsetX": 2,
+ "AP": [ 3.0, 0.0, 2.0, 0.0, 1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 1.0 ],
+ "strideAP": -2,
+ "offsetAP": 10,
+ "AP_out": [ 12.0, 0.0, 8.0, 0.0, 4.0, 0.0, 6.0, 0.0, 3.0, 0.0, 2.0 ]
+}
diff --git a/base/dspr/test/fixtures/row_major_l.json b/base/dspr/test/fixtures/row_major_l.json
new file mode 100644
index 000000000..d2ef326a7
--- /dev/null
+++ b/base/dspr/test/fixtures/row_major_l.json
@@ -0,0 +1,13 @@
+{
+ "order": "row-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 0,
+ "AP": [ 1.0, 1.0, 2.0, 1.0, 2.0, 3.0 ],
+ "strideAP": 1,
+ "offsetAP": 0,
+ "AP_out": [ 2.0, 3.0, 6.0, 4.0, 8.0, 12.0 ]
+}
diff --git a/base/dspr/test/fixtures/row_major_oap.json b/base/dspr/test/fixtures/row_major_oap.json
new file mode 100644
index 000000000..252589c28
--- /dev/null
+++ b/base/dspr/test/fixtures/row_major_oap.json
@@ -0,0 +1,13 @@
+{
+ "order": "row-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 0,
+ "AP": [ 0.0, 1.0, 0.0, 1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 2.0, 0.0, 3.0 ],
+ "strideAP": 2,
+ "offsetAP": 1,
+ "AP_out": [ 0.0, 2.0, 0.0, 3.0, 0.0, 6.0, 0.0, 4.0, 0.0, 8.0, 0.0, 12.0 ]
+}
diff --git a/base/dspr/test/fixtures/row_major_ox.json b/base/dspr/test/fixtures/row_major_ox.json
new file mode 100644
index 000000000..10560f4c2
--- /dev/null
+++ b/base/dspr/test/fixtures/row_major_ox.json
@@ -0,0 +1,13 @@
+{
+ "order": "row-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 0.0, 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 1,
+ "AP": [ 1.0, 1.0, 2.0, 1.0, 2.0, 3.0 ],
+ "strideAP": 1,
+ "offsetAP": 0,
+ "AP_out": [ 2.0, 3.0, 6.0, 4.0, 8.0, 12.0 ]
+}
diff --git a/base/dspr/test/fixtures/row_major_sap.json b/base/dspr/test/fixtures/row_major_sap.json
new file mode 100644
index 000000000..f4aaa2775
--- /dev/null
+++ b/base/dspr/test/fixtures/row_major_sap.json
@@ -0,0 +1,13 @@
+{
+ "order": "row-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 0,
+ "AP": [ 1.0, 0.0, 1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 2.0, 0.0, 3.0 ],
+ "strideAP": 2,
+ "offsetAP": 0,
+ "AP_out": [ 2.0, 0.0, 3.0, 0.0, 6.0, 0.0, 4.0, 0.0, 8.0, 0.0, 12.0 ]
+}
diff --git a/base/dspr/test/fixtures/row_major_sapn.json b/base/dspr/test/fixtures/row_major_sapn.json
new file mode 100644
index 000000000..982895e46
--- /dev/null
+++ b/base/dspr/test/fixtures/row_major_sapn.json
@@ -0,0 +1,13 @@
+{
+ "order": "row-major",
+ "uplo": "lower",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 0,
+ "AP": [ 3.0, 0.0, 2.0, 0.0, 1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 1.0 ],
+ "strideAP": -2,
+ "offsetAP": 10,
+ "AP_out": [ 12.0, 0.0, 8.0, 0.0, 4.0, 0.0, 6.0, 0.0, 3.0, 0.0, 2.0 ]
+}
diff --git a/base/dspr/test/fixtures/row_major_u.json b/base/dspr/test/fixtures/row_major_u.json
new file mode 100644
index 000000000..fa7dc425b
--- /dev/null
+++ b/base/dspr/test/fixtures/row_major_u.json
@@ -0,0 +1,13 @@
+{
+ "order": "row-major",
+ "uplo": "upper",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 2.0, 3.0 ],
+ "strideX": 1,
+ "offsetX": 0,
+ "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ],
+ "strideAP": 1,
+ "offsetAP": 0,
+ "AP_out": [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+}
diff --git a/base/dspr/test/fixtures/row_major_xn.json b/base/dspr/test/fixtures/row_major_xn.json
new file mode 100644
index 000000000..19dc2ca8d
--- /dev/null
+++ b/base/dspr/test/fixtures/row_major_xn.json
@@ -0,0 +1,13 @@
+{
+ "order": "row-major",
+ "uplo": "upper",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 3.0, 2.0, 1.0 ],
+ "strideX": -1,
+ "offsetX": 2,
+ "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ],
+ "strideAP": 1,
+ "offsetAP": 0,
+ "AP_out": [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+}
diff --git a/base/dspr/test/fixtures/row_major_xp.json b/base/dspr/test/fixtures/row_major_xp.json
new file mode 100644
index 000000000..ed86f58d9
--- /dev/null
+++ b/base/dspr/test/fixtures/row_major_xp.json
@@ -0,0 +1,13 @@
+{
+ "order": "row-major",
+ "uplo": "upper",
+ "N": 3,
+ "alpha": 1.0,
+ "x": [ 1.0, 0.0, 2.0, 0.0, 3.0 ],
+ "strideX": 2,
+ "offsetX": 0,
+ "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ],
+ "strideAP": 1,
+ "offsetAP": 0,
+ "AP_out": [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ]
+}
diff --git a/base/dspr/test/test.dspr.js b/base/dspr/test/test.dspr.js
new file mode 100644
index 000000000..0308b43f7
--- /dev/null
+++ b/base/dspr/test/test.dspr.js
@@ -0,0 +1,389 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/* eslint-disable max-len */
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var Float64Array = require( '@stdlib/array/float64' );
+var dspr = require( './../lib/dspr.js' );
+
+
+// FIXTURES //
+
+var rl = require( './fixtures/row_major_l.json' );
+var ru = require( './fixtures/row_major_u.json' );
+var rxp = require( './fixtures/row_major_xp.json' );
+var rxn = require( './fixtures/row_major_xn.json' );
+
+var cl = require( './fixtures/column_major_l.json' );
+var cu = require( './fixtures/column_major_u.json' );
+var cxp = require( './fixtures/column_major_xp.json' );
+var cxn = require( './fixtures/column_major_xn.json' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof dspr, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function has an arity of 7', function test( t ) {
+ t.strictEqual( dspr.length, 7, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided an invalid first argument', function test( t ) {
+ var values;
+ var data;
+ var i;
+
+ data = rl;
+
+ values = [
+ 'foo',
+ 'bar',
+ 'beep',
+ 'boop'
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ dspr( value, data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.AP );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an invalid second argument', function test( t ) {
+ var values;
+ var data;
+ var i;
+
+ data = rl;
+
+ values = [
+ 'foo',
+ 'bar',
+ 'beep',
+ 'boop'
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ dspr( data.order, value, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.AP );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an invalid third argument', function test( t ) {
+ var values;
+ var data;
+ var i;
+
+ data = rl;
+
+ values = [
+ -1,
+ -2,
+ -3
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ dspr( data.order, data.uplo, value, data.alpha, new Float64Array( data.x ), data.strideX, data.AP );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an invalid sixth argument', function test( t ) {
+ var values;
+ var data;
+ var i;
+
+ data = rl;
+
+ values = [
+ 0
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ dspr( data.order, data.uplo, data.N, data.alpha, new Float64Array( data.x ), value, data.AP );
+ };
+ }
+});
+
+tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, lower)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rl;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, lower)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = cl;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, upper)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = ru;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, upper)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = cu;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a reference to the packed form of a symmetric matrix `A`', function test( t ) {
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rl;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'if `N` is zero or `α` is zero, respectively, the function returns `AP` unchanged (row-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = ru;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP );
+
+ out = dspr( data.order, data.uplo, 0, data.alpha, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( ap, expected, 'returns expected value' );
+
+ out = dspr( data.order, data.uplo, data.N, 0.0, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( ap, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'if `N` is zero or `α` is zero, respectively, the function returns `AP` unchanged (column-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = cu;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP );
+
+ out = dspr( data.order, data.uplo, 0, data.alpha, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( ap, expected, 'returns expected value' );
+
+ out = dspr( data.order, data.uplo, data.N, 0.0, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( ap, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying an `x` stride (row-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rxp;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying an `x` stride (column-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = cxp;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying a negative `x` stride (row-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rxn;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying a negative `x` stride (column-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = cxn;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
diff --git a/base/dspr/test/test.js b/base/dspr/test/test.js
new file mode 100644
index 000000000..d48fb3107
--- /dev/null
+++ b/base/dspr/test/test.js
@@ -0,0 +1,82 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var proxyquire = require( 'proxyquire' );
+var IS_BROWSER = require( '@stdlib/assert/is-browser' );
+var dspr = require( './../lib' );
+
+
+// VARIABLES //
+
+var opts = {
+ 'skip': IS_BROWSER
+};
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof dspr, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) {
+ t.strictEqual( typeof dspr.ndarray, 'function', 'method is a function' );
+ t.end();
+});
+
+tape( 'if a native implementation is available, the main export is the native implementation', opts, function test( t ) {
+ var dspr = proxyquire( './../lib', {
+ '@stdlib/utils/try-require': tryRequire
+ });
+
+ t.strictEqual( dspr, mock, 'returns expected value' );
+ t.end();
+
+ function tryRequire() {
+ return mock;
+ }
+
+ function mock() {
+ // Mock...
+ }
+});
+
+tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) {
+ var dspr;
+ var main;
+
+ main = require( './../lib/dspr.js' );
+
+ dspr = proxyquire( './../lib', {
+ '@stdlib/utils/try-require': tryRequire
+ });
+
+ t.strictEqual( dspr, main, 'returns expected value' );
+ t.end();
+
+ function tryRequire() {
+ return new Error( 'Cannot find module' );
+ }
+});
diff --git a/base/dspr/test/test.ndarray.js b/base/dspr/test/test.ndarray.js
new file mode 100644
index 000000000..081ba1083
--- /dev/null
+++ b/base/dspr/test/test.ndarray.js
@@ -0,0 +1,632 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/* eslint-disable max-len */
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var Float64Array = require( '@stdlib/array/float64' );
+var dspr = require( './../lib/ndarray.js' );
+
+
+// FIXTURES //
+
+var rl = require( './fixtures/row_major_l.json' );
+var ru = require( './fixtures/row_major_u.json' );
+var rxp = require( './fixtures/row_major_xp.json' );
+var rxn = require( './fixtures/row_major_xn.json' );
+var rox = require( './fixtures/row_major_ox.json' );
+var rsap = require( './fixtures/row_major_sap.json' );
+var rsapn = require( './fixtures/row_major_sapn.json' );
+var roap = require( './fixtures/row_major_oap.json' );
+var rcap = require( './fixtures/row_major_complex_access_pattern.json' );
+
+var cl = require( './fixtures/column_major_l.json' );
+var cu = require( './fixtures/column_major_u.json' );
+var cxp = require( './fixtures/column_major_xp.json' );
+var cxn = require( './fixtures/column_major_xn.json' );
+var cox = require( './fixtures/column_major_ox.json' );
+var csap = require( './fixtures/column_major_sap.json' );
+var csapn = require( './fixtures/column_major_sapn.json' );
+var coap = require( './fixtures/column_major_oap.json' );
+var ccap = require( './fixtures/column_major_complex_access_pattern.json' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof dspr, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function has an arity of 10', function test( t ) {
+ t.strictEqual( dspr.length, 10, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided an invalid first argument', function test( t ) {
+ var values;
+ var data;
+ var i;
+
+ data = rl;
+
+ values = [
+ 'foo',
+ 'bar',
+ 'beep',
+ 'boop'
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ dspr( value, data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, data.AP, data.strideAP, data.offsetAP );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an invalid second argument', function test( t ) {
+ var values;
+ var data;
+ var i;
+
+ data = rl;
+
+ values = [
+ 'foo',
+ 'bar',
+ 'beep',
+ 'boop'
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ dspr( data.order, value, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, data.AP, data.strideAP, data.offsetAP );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an invalid third argument', function test( t ) {
+ var values;
+ var data;
+ var i;
+
+ data = rl;
+
+ values = [
+ -1,
+ -2,
+ -3
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ dspr( data.order, data.uplo, value, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, data.AP, data.strideAP, data.offsetAP );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an invalid sixth argument', function test( t ) {
+ var values;
+ var data;
+ var i;
+
+ data = rl;
+
+ values = [
+ 0
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ dspr( data.order, data.uplo, data.N, data.alpha, new Float64Array( data.x ), value, data.offsetx, data.AP, data.strideAP, data.offsetAP );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an invalid ninth argument', function test( t ) {
+ var values;
+ var data;
+ var i;
+
+ data = rl;
+
+ values = [
+ 0
+ ];
+
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ dspr( data.order, data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetx, data.AP, value, data.offsetAP );
+ };
+ }
+});
+
+tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, lower)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rl;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, lower)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = cl;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, upper)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = ru;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, upper)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = cu;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a reference to the packed form of a symmetric matrix `A`', function test( t ) {
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rl;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'if `N` is zero or `α` is zero, respectively, the function returns `AP` unchanged (row-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = ru;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP );
+
+ out = dspr( data.order, data.uplo, 0, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( ap, expected, 'returns expected value' );
+
+ out = dspr( data.order, data.uplo, data.N, 0.0, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( ap, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'if `N` is zero or `α` is zero, respectively, the function returns `AP` unchanged (column-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = cu;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP );
+
+ out = dspr( data.order, data.uplo, 0, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( ap, expected, 'returns expected value' );
+
+ out = dspr( data.order, data.uplo, data.N, 0.0, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( ap, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying an `x` stride (row-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rxp;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying an `x` stride (column-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = cxp;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying a negative `x` stride (row-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rxn;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying a negative `x` stride (column-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = cxn;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying an `x` offset (row-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rox;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying an `x` offset (column-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = cox;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying a stride for `AP` (row-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rsap;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying a stride for `AP` (column-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = csap;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying a negative stride for `AP` (row-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rsapn;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying a negative stride for `AP` (column-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = csapn;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying an offset for `AP` (row-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = roap;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying an offset for `AP` (column-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = coap;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports complex access patterns (row-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = rcap;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports complex access patterns (column-major)', function test( t ) {
+ var expected;
+ var data;
+ var out;
+ var ap;
+ var x;
+
+ data = ccap;
+
+ ap = new Float64Array( data.AP );
+ x = new Float64Array( data.x );
+
+ expected = new Float64Array( data.AP_out );
+
+ out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
+ t.strictEqual( out, ap, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
diff --git a/base/sspr/docs/repl.txt b/base/sspr/docs/repl.txt
index d90115f2b..aca833de6 100644
--- a/base/sspr/docs/repl.txt
+++ b/base/sspr/docs/repl.txt
@@ -7,7 +7,7 @@
Indexing is relative to the first index. To introduce an offset, use typed
array views.
- If `N` is equal to `0` or `α` is equal to `0`, the function returns `x`
+ If `N` is equal to `0` or `α` is equal to `0`, the function returns `AP`
unchanged.
Parameters
diff --git a/base/sspr/lib/sspr.js b/base/sspr/lib/sspr.js
index 6979d7270..9db04187c 100644
--- a/base/sspr/lib/sspr.js
+++ b/base/sspr/lib/sspr.js
@@ -40,7 +40,7 @@ var base = require( './base.js' );
* @param {integer} strideX - `x` stride length
* @param {Float32Array} AP - packed form of a symmetric matrix `A`
* @throws {TypeError} first argument must be a valid order
-* @throws {TypeError} second argument must specify whether to reference the lower or upper triangular matrix
+* @throws {TypeError} second argument must specify whether the lower or upper triangular matrix is supplied
* @throws {RangeError} third argument must be a nonnegative integer
* @throws {RangeError} sixth argument must be non-zero
* @returns {Float32Array} `A`
diff --git a/base/sspr/test/test.ndarray.js b/base/sspr/test/test.ndarray.js
index cfcabc96e..2768e60a2 100644
--- a/base/sspr/test/test.ndarray.js
+++ b/base/sspr/test/test.ndarray.js
@@ -24,8 +24,6 @@
var tape = require( 'tape' );
var Float32Array = require( '@stdlib/array/float32' );
-var EPS = require( '@stdlib/constants/float32/eps' );
-var abs = require( '@stdlib/math/base/special/abs' );
var sspr = require( './../lib/ndarray.js' );
@@ -52,35 +50,6 @@ var coap = require( './fixtures/column_major_oap.json' );
var ccap = require( './fixtures/column_major_complex_access_pattern.json' );
-// FUNCTIONS //
-
-/**
-* Tests for element-wise approximate equality.
-*
-* @private
-* @param {Object} t - test object
-* @param {Collection} actual - actual values
-* @param {Collection} expected - expected values
-* @param {number} rtol - relative tolerance
-*/
-function isApprox( t, actual, expected, rtol ) {
- var delta;
- var tol;
- var i;
-
- t.strictEqual( actual.length, expected.length, 'returns expected value' );
- for ( i = 0; i < expected.length; i++ ) {
- if ( actual[ i ] === expected[ i ] ) {
- t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' );
- } else {
- delta = abs( actual[ i ] - expected[ i ] );
- tol = rtol * EPS * abs( expected[ i ] );
- t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' );
- }
- }
-}
-
-
// TESTS //
tape( 'main export is a function', function test( t ) {
@@ -233,7 +202,7 @@ tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, lower)',
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -254,7 +223,7 @@ tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, lower)
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -275,7 +244,7 @@ tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, upper)',
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -296,7 +265,7 @@ tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, upper)
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -384,7 +353,7 @@ tape( 'the function supports specifying an `x` stride (row-major)', function tes
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -405,7 +374,7 @@ tape( 'the function supports specifying an `x` stride (column-major)', function
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -426,7 +395,7 @@ tape( 'the function supports specifying a negative `x` stride (row-major)', func
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -447,7 +416,7 @@ tape( 'the function supports specifying a negative `x` stride (column-major)', f
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -468,7 +437,7 @@ tape( 'the function supports specifying an `x` offset (row-major)', function tes
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -489,12 +458,12 @@ tape( 'the function supports specifying an `x` offset (column-major)', function
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
-tape( 'the function supports specifying stride for `AP` (row-major)', function test( t ) {
+tape( 'the function supports specifying a stride for `AP` (row-major)', function test( t ) {
var expected;
var data;
var out;
@@ -510,12 +479,12 @@ tape( 'the function supports specifying stride for `AP` (row-major)', function t
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
-tape( 'the function supports specifying stride for `AP` (column-major)', function test( t ) {
+tape( 'the function supports specifying a stride for `AP` (column-major)', function test( t ) {
var expected;
var data;
var out;
@@ -531,7 +500,7 @@ tape( 'the function supports specifying stride for `AP` (column-major)', functio
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -552,7 +521,7 @@ tape( 'the function supports specifying a negative stride for `AP` (row-major)',
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -573,7 +542,7 @@ tape( 'the function supports specifying a negative stride for `AP` (column-major
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -594,7 +563,7 @@ tape( 'the function supports specifying an offset for `AP` (row-major)', functio
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -615,7 +584,7 @@ tape( 'the function supports specifying an offset for `AP` (column-major)', func
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -636,7 +605,7 @@ tape( 'the function supports complex access patterns (row-major)', function test
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -657,7 +626,7 @@ tape( 'the function supports complex access patterns (column-major)', function t
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
diff --git a/base/sspr/test/test.sspr.js b/base/sspr/test/test.sspr.js
index 15e454322..7ed0a42aa 100644
--- a/base/sspr/test/test.sspr.js
+++ b/base/sspr/test/test.sspr.js
@@ -24,8 +24,6 @@
var tape = require( 'tape' );
var Float32Array = require( '@stdlib/array/float32' );
-var EPS = require( '@stdlib/constants/float32/eps' );
-var abs = require( '@stdlib/math/base/special/abs' );
var sspr = require( './../lib/sspr.js' );
@@ -42,35 +40,6 @@ var cxp = require( './fixtures/column_major_xp.json' );
var cxn = require( './fixtures/column_major_xn.json' );
-// FUNCTIONS //
-
-/**
-* Tests for element-wise approximate equality.
-*
-* @private
-* @param {Object} t - test object
-* @param {Collection} actual - actual values
-* @param {Collection} expected - expected values
-* @param {number} rtol - relative tolerance
-*/
-function isApprox( t, actual, expected, rtol ) {
- var delta;
- var tol;
- var i;
-
- t.strictEqual( actual.length, expected.length, 'returns expected value' );
- for ( i = 0; i < expected.length; i++ ) {
- if ( actual[ i ] === expected[ i ] ) {
- t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' );
- } else {
- delta = abs( actual[ i ] - expected[ i ] );
- tol = rtol * EPS * abs( expected[ i ] );
- t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' );
- }
- }
-}
-
-
// TESTS //
tape( 'main export is a function', function test( t ) {
@@ -200,7 +169,7 @@ tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, lower)',
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -221,7 +190,7 @@ tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, lower)
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -242,7 +211,7 @@ tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, upper)',
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -263,7 +232,7 @@ tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, upper)
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -351,7 +320,7 @@ tape( 'the function supports specifying an `x` stride (row-major)', function tes
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -372,7 +341,7 @@ tape( 'the function supports specifying an `x` stride (column-major)', function
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -393,7 +362,7 @@ tape( 'the function supports specifying a negative `x` stride (row-major)', func
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});
@@ -414,7 +383,7 @@ tape( 'the function supports specifying a negative `x` stride (column-major)', f
out = sspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap );
t.strictEqual( out, ap, 'returns expected value' );
- isApprox( t, ap, expected, 2.0 );
+ t.deepEqual( out, expected, 'returns expected value' );
t.end();
});