diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/README.md b/lib/node_modules/@stdlib/blas/ext/base/gtriu/README.md
new file mode 100644
index 000000000000..547a6c2adaa0
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/README.md
@@ -0,0 +1,187 @@
+
+
+# gtriu
+
+> Copy the upper triangular part of a matrix `A` to another matrix `B`.
+
+
+
+## Usage
+
+```javascript
+var gtriu = require( '@stdlib/blas/ext/base/gtriu' );
+```
+
+#### gtriu( order, M, N, k, A, LDA, B, LDB )
+
+Copies the upper triangular part of a matrix `A` to another matrix `B`.
+
+```javascript
+var A = [ 1.0, 2.0, 3.0, 4.0 ];
+var B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+gtriu( 'row-major', 2, 2, 0, A, 2, B, 2 );
+// B => [ 1.0, 2.0, 0.0, 4.0 ]
+```
+
+The function has the following parameters:
+
+- **order**: storage layout.
+- **M**: number of rows in `A`.
+- **N**: number of columns in `A`.
+- **k**: diagonal below which to ignore. A value of `k = 0` refers to the main diagonal, `k < 0` refers to a diagonal below the main diagonal, and `k > 0` refers to a diagonal above the main diagonal. Accordingly, when `k < 0`, the function copies the upper triangle **and** one or more sub-diagonals (i.e., part of the lower triangle), and, when `k > 0`, the function copies only part of the upper triangle.
+- **A**: input matrix.
+- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
+- **B**: output matrix.
+- **LDB**: stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`).
+
+Setting the `k` parameter to a value other than `0` allows including and excluding sub- and super-diagonals, respectively. For example, to copy the upper triangle and the first sub-diagonal,
+
+```javascript
+var A = [ 1.0, 2.0, 3.0, 4.0 ];
+var B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+gtriu( 'row-major', 2, 2, -1, A, 2, B, 2 );
+// B => [ 1.0, 2.0, 3.0, 4.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 A0 = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
+var B0 = new Float64Array( 5 );
+
+// Create offset views...
+var A1 = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
+var B1 = new Float64Array( B0.buffer, B0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
+
+gtriu( 'row-major', 2, 2, 0, A1, 2, B1, 2 );
+// B0 => [ 0.0, 2.0, 3.0, 0.0, 5.0 ]
+```
+
+#### gtriu.ndarray( M, N, k, A, sa1, sa2, oa, B, sb1, sb2, ob )
+
+Copies the upper triangular part of a matrix `A` to another matrix `B` using alternative indexing semantics.
+
+```javascript
+var A = [ 1.0, 2.0, 3.0, 4.0 ];
+var B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 0 );
+// B => [ 1.0, 2.0, 0.0, 4.0 ]
+```
+
+The function has the following parameters:
+
+- **M**: number of rows in `A`.
+- **N**: number of columns in `A`.
+- **k**: diagonal below which to ignore.
+- **A**: input matrix.
+- **sa1**: stride of the first dimension of `A`.
+- **sa2**: stride of the second dimension of `A`.
+- **oa**: starting index for `A`.
+- **B**: output matrix.
+- **sb1**: stride of the first dimension of `B`.
+- **sb2**: stride of the second dimension of `B`.
+- **ob**: starting index for `B`.
+
+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 A = [ 1.0, 2.0, 3.0, 4.0 ];
+var B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 2 );
+// B => [ 0.0, 0.0, 1.0, 2.0, 0.0, 4.0 ]
+```
+
+
+
+
+
+
+
+## Notes
+
+- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]).
+- Elements outside of the copied region are left unchanged.
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
+var uniform = require( '@stdlib/random/array/discrete-uniform' );
+var numel = require( '@stdlib/ndarray/base/numel' );
+var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
+var gtriu = require( '@stdlib/blas/ext/base/gtriu' );
+
+var shape = [ 5, 8 ];
+var order = 'row-major';
+var strides = shape2strides( shape, order );
+
+var N = numel( shape );
+
+var A = uniform( N, -10, 10, {
+ 'dtype': 'generic'
+});
+console.log( ndarray2array( A, shape, strides, 0, order ) );
+
+var B = uniform( N, -10, 10, {
+ 'dtype': 'generic'
+});
+console.log( ndarray2array( B, shape, strides, 0, order ) );
+
+gtriu( order, shape[ 0 ], shape[ 1 ], 0, A, strides[ 0 ], B, strides[ 0 ] );
+console.log( ndarray2array( B, shape, strides, 0, order ) );
+```
+
+
+
+
+
+
+
+
+
+
+
+[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
+
+[@stdlib/array/base/accessor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/accessor
+
+
+
+
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/gtriu/benchmark/benchmark.js
new file mode 100644
index 000000000000..5feac5d4e5ce
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/benchmark/benchmark.js
@@ -0,0 +1,112 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 isnan = require( '@stdlib/math/base/assert/is-nan' );
+var zeros = require( '@stdlib/array/zeros' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var floor = require( '@stdlib/math/base/special/floor' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var gtriu = require( './../lib' );
+
+
+// VARIABLES //
+
+var LAYOUTS = [
+ 'row-major',
+ 'column-major'
+];
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {string} order - storage layout
+* @param {PositiveInteger} N - number of elements along each dimension
+* @returns {Function} benchmark function
+*/
+function createBenchmark( order, N ) {
+ var A = zeros( N*N, 'generic' );
+ var B = zeros( N*N, 'generic' );
+ 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 = gtriu( order, N, N, 0, A, N, B, N );
+ 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 min;
+ var max;
+ var ord;
+ var N;
+ var f;
+ var i;
+ var k;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( k = 0; k < LAYOUTS.length; k++ ) {
+ ord = LAYOUTS[ k ];
+ for ( i = min; i <= max; i++ ) {
+ N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
+ f = createBenchmark( ord, N );
+ bench( format( '%s::square_matrix:order=%s,size=%d', pkg, ord, N*N ), f );
+ }
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gtriu/benchmark/benchmark.ndarray.js
new file mode 100644
index 000000000000..8341fe0716b4
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/benchmark/benchmark.ndarray.js
@@ -0,0 +1,126 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 isnan = require( '@stdlib/math/base/assert/is-nan' );
+var zeros = require( '@stdlib/array/zeros' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var floor = require( '@stdlib/math/base/special/floor' );
+var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
+var format = require( '@stdlib/string/format' );
+var pkg = require( './../package.json' ).name;
+var gtriu = require( './../lib' ).ndarray;
+
+
+// VARIABLES //
+
+var LAYOUTS = [
+ 'row-major',
+ 'column-major'
+];
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {string} order - storage layout
+* @param {PositiveInteger} N - number of elements along each dimension
+* @returns {Function} benchmark function
+*/
+function createBenchmark( order, N ) {
+ var sa1;
+ var sa2;
+ var A;
+ var B;
+
+ A = zeros( N*N, 'generic' );
+ B = zeros( N*N, 'generic' );
+
+ if ( isColumnMajor( order ) ) {
+ sa1 = 1;
+ sa2 = N;
+ } else { // order === 'row-major'
+ sa1 = N;
+ sa2 = 1;
+ }
+ 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 = gtriu( N, N, 0, A, sa1, sa2, 0, B, sa1, sa2, 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 min;
+ var max;
+ var ord;
+ var N;
+ var f;
+ var i;
+ var k;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( k = 0; k < LAYOUTS.length; k++ ) {
+ ord = LAYOUTS[ k ];
+ for ( i = min; i <= max; i++ ) {
+ N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
+ f = createBenchmark( ord, N );
+ bench( format( '%s::square_matrix:ndarray:order=%s,size=%d', pkg, ord, N*N ), f );
+ }
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gtriu/docs/repl.txt
new file mode 100644
index 000000000000..6542e5e7e6a9
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/docs/repl.txt
@@ -0,0 +1,111 @@
+
+{{alias}}( order, M, N, k, A, LDA, B, LDB )
+ Copies the upper triangular part of a matrix `A` to another matrix `B`.
+
+ Indexing is relative to the first index. To introduce an offset, use typed
+ array views.
+
+ The diagonal parameter `k` specifies the diagonal below which to ignore. A
+ value of `k = 0` refers to the main diagonal, `k < 0` refers to a diagonal
+ below the main diagonal, and `k > 0` refers to a diagonal above the main
+ diagonal.
+
+ Parameters
+ ----------
+ order: string
+ Row-major (C-style) or column-major (Fortran-style) order. Must be
+ either 'row-major' or 'column-major'.
+
+ M: integer
+ Number of rows in `A`.
+
+ N: integer
+ Number of columns in `A`.
+
+ k: integer
+ Diagonal below which to ignore.
+
+ A: Array|TypedArray
+ Input matrix `A`.
+
+ LDA: integer
+ Stride of the first dimension of `A` (a.k.a., leading dimension of the
+ matrix `A`).
+
+ B: Array|TypedArray
+ Output matrix `B`.
+
+ LDB: integer
+ Stride of the first dimension of `B` (a.k.a., leading dimension of the
+ matrix `B`).
+
+ Returns
+ -------
+ B: Array|TypedArray
+ Output matrix.
+
+ Examples
+ --------
+ > var A = [ 1.0, 2.0, 3.0, 4.0 ];
+ > var B = [ 0.0, 0.0, 0.0, 0.0 ];
+ > {{alias}}( 'row-major', 2, 2, 0, A, 2, B, 2 )
+ [ 1.0, 2.0, 0.0, 4.0 ]
+
+
+{{alias}}.ndarray( M, N, k, A, sa1, sa2, oa, B, sb1, sb2, ob )
+ Copies the upper triangular part of a matrix `A` to another matrix `B` using
+ alternative indexing semantics.
+
+ While typed array views mandate a view offset based on the underlying
+ buffer, the offset parameters support indexing semantics based on starting
+ indices.
+
+ Parameters
+ ----------
+ M: integer
+ Number of rows in `A`.
+
+ N: integer
+ Number of columns in `A`.
+
+ k: integer
+ Diagonal below which to ignore.
+
+ A: Array|TypedArray
+ Input matrix `A`.
+
+ sa1: integer
+ Stride of the first dimension of `A`.
+
+ sa2: integer
+ Stride of the second dimension of `A`.
+
+ oa: integer
+ Starting index for `A`.
+
+ B: Array|TypedArray
+ Output matrix `B`.
+
+ sb1: integer
+ Stride of the first dimension of `B`.
+
+ sb2: integer
+ Stride of the second dimension of `B`.
+
+ ob: integer
+ Starting index for `B`.
+
+ Returns
+ -------
+ B: Array|TypedArray
+ Output matrix.
+
+ Examples
+ --------
+ > var A = [ 1.0, 2.0, 3.0, 4.0 ];
+ > var B = [ 0.0, 0.0, 0.0, 0.0 ];
+ > {{alias}}.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 0 )
+ [ 1.0, 2.0, 0.0, 4.0 ]
+
+ See Also
+ --------
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/gtriu/docs/types/index.d.ts
new file mode 100644
index 000000000000..032a11fb3a20
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/docs/types/index.d.ts
@@ -0,0 +1,120 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 { Collection, AccessorArrayLike } from '@stdlib/types/array';
+import { Layout } from '@stdlib/types/blas';
+
+/**
+* Input array.
+*/
+type InputArray = Collection | AccessorArrayLike;
+
+/**
+* Output array.
+*/
+type OutputArray = Collection | AccessorArrayLike;
+
+/**
+* Interface describing `gtriu`.
+*/
+interface Routine {
+ /**
+ * Copies the upper triangular part of a matrix `A` to another matrix `B`.
+ *
+ * @param order - storage layout of `A` and `B`
+ * @param M - number of rows in matrix `A`
+ * @param N - number of columns in matrix `A`
+ * @param k - diagonal below which to ignore
+ * @param A - input matrix
+ * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
+ * @param B - output matrix
+ * @param LDB - stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`)
+ * @returns `B`
+ *
+ * @example
+ * var A = [ 1.0, 2.0, 3.0, 4.0 ];
+ * var B = [ 0.0, 0.0, 0.0, 0.0 ];
+ *
+ * gtriu( 'row-major', 2, 2, 0, A, 2, B, 2 );
+ * // B => [ 1.0, 2.0, 0.0, 4.0 ]
+ */
+ = OutputArray>( order: Layout, M: number, N: number, k: number, A: InputArray, LDA: number, B: U, LDB: number ): U;
+
+ /**
+ * Copies the upper triangular part of a matrix `A` to another matrix `B` using alternative indexing semantics.
+ *
+ * @param M - number of rows in matrix `A`
+ * @param N - number of columns in matrix `A`
+ * @param k - diagonal below which to ignore
+ * @param A - input matrix
+ * @param strideA1 - stride of the first dimension of `A`
+ * @param strideA2 - stride of the second dimension of `A`
+ * @param offsetA - starting index for `A`
+ * @param B - output matrix
+ * @param strideB1 - stride of the first dimension of `B`
+ * @param strideB2 - stride of the second dimension of `B`
+ * @param offsetB - starting index for `B`
+ * @returns `B`
+ *
+ * @example
+ * var A = [ 1.0, 2.0, 3.0, 4.0 ];
+ * var B = [ 0.0, 0.0, 0.0, 0.0 ];
+ *
+ * gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 0 );
+ * // B => [ 1.0, 2.0, 0.0, 4.0 ]
+ */
+ ndarray = OutputArray>( M: number, N: number, k: number, A: InputArray, strideA1: number, strideA2: number, offsetA: number, B: U, strideB1: number, strideB2: number, offsetB: number ): U;
+}
+
+/**
+* Copies the upper triangular part of a matrix `A` to another matrix `B`.
+*
+* @param order - storage layout of `A` and `B`
+* @param M - number of rows in matrix `A`
+* @param N - number of columns in matrix `A`
+* @param k - diagonal below which to ignore
+* @param A - input matrix
+* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
+* @param B - output matrix
+* @param LDB - stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`)
+* @returns `B`
+*
+* @example
+* var A = [ 1.0, 2.0, 3.0, 4.0 ];
+* var B = [ 0.0, 0.0, 0.0, 0.0 ];
+*
+* gtriu( 'row-major', 2, 2, 0, A, 2, B, 2 );
+* // B => [ 1.0, 2.0, 0.0, 4.0 ]
+*
+* @example
+* var A = [ 1.0, 2.0, 3.0, 4.0 ];
+* var B = [ 0.0, 0.0, 0.0, 0.0 ];
+*
+* gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 0 );
+* // B => [ 1.0, 2.0, 0.0, 4.0 ]
+*/
+declare var gtriu: Routine;
+
+
+// EXPORTS //
+
+export = gtriu;
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/gtriu/docs/types/test.ts
new file mode 100644
index 000000000000..6311fb5afba4
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/docs/types/test.ts
@@ -0,0 +1,350 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 gtriu = require( './index' );
+
+
+// TESTS //
+
+// The function returns a collection...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'row-major', 2, 2, 0, A, 2, B, 2 ); // $ExpectType number[]
+}
+
+// The compiler throws an error if the function is provided a first argument which is not a valid order...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 5, 2, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( true, 2, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( false, 2, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( null, 2, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( void 0, 2, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( [], 2, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( {}, 2, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( ( x: number ): number => x, 2, 2, 0, A, 2, B, 2 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a second argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'row-major', '5', 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', true, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', false, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', null, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', void 0, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', [], 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', {}, 2, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', ( x: number ): number => x, 2, 0, A, 2, B, 2 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a third argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'row-major', 2, '5', 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, true, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, false, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, null, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, void 0, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, [], 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, {}, 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, ( x: number ): number => x, 0, A, 2, B, 2 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a fourth argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'row-major', 2, 2, '5', A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, true, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, false, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, null, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, void 0, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, [], A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, {}, A, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, ( x: number ): number => x, A, 2, B, 2 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a fifth argument which is not a collection...
+{
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'row-major', 2, 2, 0, 5, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, true, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, false, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, null, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, void 0, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, {}, 2, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, ( x: number ): number => x, 2, B, 2 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a sixth argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'row-major', 2, 2, 0, A, '5', B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, true, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, false, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, null, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, void 0, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, [], B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, {}, B, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, ( x: number ): number => x, B, 2 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a seventh argument which is not a collection...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+
+ gtriu( 'row-major', 2, 2, 0, A, 2, 5, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, true, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, false, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, null, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, void 0, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, {}, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, ( x: number ): number => x, 2 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an eighth argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'row-major', 2, 2, 0, A, 2, B, '5' ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, B, true ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, B, false ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, B, null ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, B, void 0 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, B, [] ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, B, {} ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, B, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu(); // $ExpectError
+ gtriu( 'row-major' ); // $ExpectError
+ gtriu( 'row-major', 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2 ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, B ); // $ExpectError
+ gtriu( 'row-major', 2, 2, 0, A, 2, B, 2, 10 ); // $ExpectError
+}
+
+// Attached to main export is an `ndarray` method which returns a collection...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectType number[]
+}
+
+// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray( '5', 2, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( true, 2, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( false, 2, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( null, 2, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( void 0, 2, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( [], 2, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( {}, 2, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( ( x: number ): number => x, 2, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a second argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray( 2, '5', 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, true, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, false, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, null, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, void 0, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, [], 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, {}, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, ( x: number ): number => x, 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray( 2, 2, '5', A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, true, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, false, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, null, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, void 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, [], A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, {}, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, ( x: number ): number => x, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a collection...
+{
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray( 2, 2, 0, 5, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, true, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, false, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, null, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, void 0, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, {}, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, ( x: number ): number => x, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray( 2, 2, 0, A, '5', 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, true, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, false, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, null, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, void 0, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, [], 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, {}, 1, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, ( x: number ): number => x, 1, 0, B, 2, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray( 2, 2, 0, A, 2, '5', 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, true, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, false, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, null, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, void 0, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, [], 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, {}, 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, ( x: number ): number => x, 0, B, 2, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, '5', B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, true, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, false, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, null, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, void 0, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, [], B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, {}, B, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, ( x: number ): number => x, B, 2, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a collection...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, 5, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, true, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, false, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, null, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, void 0, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, {}, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, ( x: number ): number => x, 2, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a ninth argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, '5', 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, true, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, false, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, null, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, void 0, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, [], 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, {}, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, ( x: number ): number => x, 1, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a tenth argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, '5', 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, true, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, false, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, null, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, void 0, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, [], 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, {}, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, ( x: number ): number => x, 0 ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided an eleventh argument which is not a number...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, '5' ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, true ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, false ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, null ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, void 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, [] ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, {} ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
+{
+ const A = [ 1.0, 2.0, 3.0, 4.0 ];
+ const B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu.ndarray(); // $ExpectError
+ gtriu.ndarray( 2 ); // $ExpectError
+ gtriu.ndarray( 2, 2 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1 ); // $ExpectError
+ gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 0, 0 ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/gtriu/examples/index.js
new file mode 100644
index 000000000000..079176648365
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/examples/index.js
@@ -0,0 +1,44 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 ndarray2array = require( '@stdlib/ndarray/base/to-array' );
+var uniform = require( '@stdlib/random/array/discrete-uniform' );
+var numel = require( '@stdlib/ndarray/base/numel' );
+var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
+var gtriu = require( './../lib' );
+
+var shape = [ 5, 8 ];
+var order = 'row-major';
+var strides = shape2strides( shape, order );
+
+var N = numel( shape );
+
+var A = uniform( N, -10, 10, {
+ 'dtype': 'generic'
+});
+console.log( ndarray2array( A, shape, strides, 0, order ) );
+
+var B = uniform( N, -10, 10, {
+ 'dtype': 'generic'
+});
+console.log( ndarray2array( B, shape, strides, 0, order ) );
+
+gtriu( order, shape[ 0 ], shape[ 1 ], 0, A, strides[ 0 ], B, strides[ 0 ] );
+console.log( ndarray2array( B, shape, strides, 0, order ) );
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/accessors.js b/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/accessors.js
new file mode 100644
index 000000000000..a46f02108886
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/accessors.js
@@ -0,0 +1,108 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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, max-params */
+
+'use strict';
+
+// MODULES //
+
+var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' );
+var max = require( '@stdlib/math/base/special/fast/max' );
+var min = require( '@stdlib/math/base/special/fast/min' );
+
+
+// MAIN //
+
+/**
+* Copies the upper triangular part of a matrix `A` to another matrix `B`.
+*
+* @private
+* @param {NonNegativeInteger} M - number of rows in matrix `A`
+* @param {NonNegativeInteger} N - number of columns in matrix `A`
+* @param {integer} k - diagonal below which to ignore
+* @param {Object} A - input matrix object
+* @param {Collection} A.data - input matrix data
+* @param {Array} A.accessors - matrix element accessors
+* @param {integer} strideA1 - stride of the first dimension of `A`
+* @param {integer} strideA2 - stride of the second dimension of `A`
+* @param {NonNegativeInteger} offsetA - starting index for `A`
+* @param {Object} B - output matrix object
+* @param {Collection} B.data - output matrix data
+* @param {Array} B.accessors - matrix element accessors
+* @param {integer} strideB1 - stride of the first dimension of `B`
+* @param {integer} strideB2 - stride of the second dimension of `B`
+* @param {NonNegativeInteger} offsetB - starting index for `B`
+* @returns {Object} `B`
+*
+* @example
+* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
+* var arraylike2object = require( '@stdlib/array/base/arraylike2object' );
+*
+* var A = arraylike2object( toAccessorArray( [ 1.0, 2.0, 3.0, 4.0 ] ) );
+* var B = arraylike2object( toAccessorArray( [ 0.0, 0.0, 0.0, 0.0 ] ) );
+*
+* gtriu( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 0 );
+* // B.data => [ 1.0, 2.0, 0.0, 4.0 ]
+*/
+function gtriu( M, N, k, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ) {
+ var abuf;
+ var bbuf;
+ var aget;
+ var bset;
+ var ia;
+ var ib;
+ var i0;
+ var i1;
+
+ // Cache references to array data:
+ abuf = A.data;
+ bbuf = B.data;
+
+ // Cache references to the element accessors:
+ aget = A.accessors[ 0 ];
+ bset = B.accessors[ 1 ];
+
+ ia = offsetA;
+ ib = offsetB;
+ if ( isRowMajor( [ strideA1, strideA2 ] ) ) {
+ // Copy row-by-row in order to ensure cache-optimal traversal...
+ for ( i1 = 0; i1 < M; i1++ ) {
+ for ( i0 = max( 0, i1+k ); i0 < N; i0++ ) {
+ bset( bbuf, ib+(i0*strideB2), aget( abuf, ia+(i0*strideA2) ) );
+ }
+ ia += strideA1;
+ ib += strideB1;
+ }
+ return B;
+ }
+ // Copy column-by-column in order to ensure cache-optimal traversal...
+ for ( i1 = 0; i1 < N; i1++ ) {
+ for ( i0 = 0; i0 <= min( i1-k, M-1 ); i0++ ) {
+ bset( bbuf, ib+(i0*strideB1), aget( abuf, ia+(i0*strideA1) ) );
+ }
+ ia += strideA2;
+ ib += strideB2;
+ }
+ return B;
+}
+
+
+// EXPORTS //
+
+module.exports = gtriu;
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/base.js b/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/base.js
new file mode 100644
index 000000000000..2bbd15e7058f
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/base.js
@@ -0,0 +1,104 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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, max-params */
+
+'use strict';
+
+// MODULES //
+
+var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' );
+var arraylike2object = require( '@stdlib/array/base/arraylike2object' );
+var max = require( '@stdlib/math/base/special/fast/max' );
+var min = require( '@stdlib/math/base/special/fast/min' );
+var accessors = require( './accessors.js' );
+
+
+// MAIN //
+
+/**
+* Copies the upper triangular part of a matrix `A` to another matrix `B`.
+*
+* @private
+* @param {NonNegativeInteger} M - number of rows in matrix `A`
+* @param {NonNegativeInteger} N - number of columns in matrix `A`
+* @param {integer} k - diagonal below which to ignore
+* @param {Collection} A - input matrix
+* @param {integer} strideA1 - stride of the first dimension of `A`
+* @param {integer} strideA2 - stride of the second dimension of `A`
+* @param {NonNegativeInteger} offsetA - starting index for `A`
+* @param {Collection} B - output matrix
+* @param {integer} strideB1 - stride of the first dimension of `B`
+* @param {integer} strideB2 - stride of the second dimension of `B`
+* @param {NonNegativeInteger} offsetB - starting index for `B`
+* @returns {Collection} `B`
+*
+* @example
+* var A = [ 1.0, 2.0, 3.0, 4.0 ];
+* var B = [ 0.0, 0.0, 0.0, 0.0 ];
+*
+* gtriu( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 0 );
+* // B => [ 1.0, 2.0, 0.0, 4.0 ]
+*
+* @example
+* var A = [ 1.0, 2.0, 3.0, 4.0 ];
+* var B = [ 0.0, 0.0, 0.0, 0.0 ];
+*
+* gtriu( 2, 2, -1, A, 2, 1, 0, B, 2, 1, 0 );
+* // B => [ 1.0, 2.0, 3.0, 4.0 ]
+*/
+function gtriu( M, N, k, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ) {
+ var oa;
+ var ob;
+ var ia;
+ var ib;
+ var i0;
+ var i1;
+
+ oa = arraylike2object( A );
+ ob = arraylike2object( B );
+ if ( oa.accessorProtocol || ob.accessorProtocol ) {
+ accessors( M, N, k, oa, strideA1, strideA2, offsetA, ob, strideB1, strideB2, offsetB );
+ return B;
+ }
+ ia = offsetA;
+ ib = offsetB;
+ if ( isRowMajor( [ strideA1, strideA2 ] ) ) {
+ for ( i1 = 0; i1 < M; i1++ ) {
+ for ( i0 = max( 0, i1+k ); i0 < N; i0++ ) {
+ B[ ib+(i0*strideB2) ] = A[ ia+(i0*strideA2) ];
+ }
+ ia += strideA1;
+ ib += strideB1;
+ }
+ return B;
+ }
+ for ( i1 = 0; i1 < N; i1++ ) {
+ for ( i0 = 0; i0 <= min( i1-k, M-1 ); i0++ ) {
+ B[ ib+(i0*strideB1) ] = A[ ia+(i0*strideA1) ];
+ }
+ ia += strideA2;
+ ib += strideB2;
+ }
+ return B;
+}
+
+
+// EXPORTS //
+
+module.exports = gtriu;
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/index.js
new file mode 100644
index 000000000000..54f5c9b615b2
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/index.js
@@ -0,0 +1,61 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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';
+
+/**
+* Copy the upper triangular part of a matrix `A` to another matrix `B`.
+*
+* @module @stdlib/blas/ext/base/gtriu
+*
+* @example
+* var gtriu = require( '@stdlib/blas/ext/base/gtriu' );
+*
+* var A = [ 1.0, 2.0, 3.0, 4.0 ];
+* var B = [ 0.0, 0.0, 0.0, 0.0 ];
+*
+* gtriu( 'row-major', 2, 2, 0, A, 2, B, 2 );
+* // B => [ 1.0, 2.0, 0.0, 4.0 ]
+*
+* @example
+* var gtriu = require( '@stdlib/blas/ext/base/gtriu' );
+*
+* var A = [ 1.0, 2.0, 3.0, 4.0 ];
+* var B = [ 0.0, 0.0, 0.0, 0.0 ];
+*
+* gtriu.ndarray( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 0 );
+* // B => [ 1.0, 2.0, 0.0, 4.0 ]
+*/
+
+// MODULES //
+
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var main = require( './main.js' );
+var ndarray = require( './ndarray.js' );
+
+
+// MAIN //
+
+setReadOnly( main, 'ndarray', ndarray );
+
+
+// EXPORTS //
+
+module.exports = main;
+
+// exports: { "ndarray": "main.ndarray" }
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/main.js
new file mode 100644
index 000000000000..7f2bfa21156d
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/main.js
@@ -0,0 +1,101 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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( '@stdlib/blas/base/assert/is-layout' );
+var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
+var max = require( '@stdlib/math/base/special/fast/max' );
+var format = require( '@stdlib/string/format' );
+var base = require( './base.js' );
+
+
+// MAIN //
+
+/**
+* Copies the upper triangular part of a matrix `A` to another matrix `B`.
+*
+* @param {string} order - storage layout of `A` and `B`
+* @param {NonNegativeInteger} M - number of rows in matrix `A`
+* @param {NonNegativeInteger} N - number of columns in matrix `A`
+* @param {integer} k - diagonal below which to ignore
+* @param {Collection} A - input matrix
+* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
+* @param {Collection} B - output matrix
+* @param {PositiveInteger} LDB - stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`)
+* @throws {TypeError} first argument must be a valid order
+* @throws {RangeError} sixth argument must be a valid stride
+* @throws {RangeError} eighth argument must be a valid stride
+* @returns {Collection} `B`
+*
+* @example
+* var A = [ 1.0, 2.0, 3.0, 4.0 ];
+* var B = [ 0.0, 0.0, 0.0, 0.0 ];
+*
+* gtriu( 'row-major', 2, 2, 0, A, 2, B, 2 );
+* // B => [ 1.0, 2.0, 0.0, 4.0 ]
+*
+* @example
+* var A = [ 1.0, 2.0, 3.0, 4.0 ];
+* var B = [ 0.0, 0.0, 0.0, 0.0 ];
+*
+* gtriu( 'row-major', 2, 2, 1, A, 2, B, 2 );
+* // B => [ 0.0, 2.0, 0.0, 0.0 ]
+*/
+function gtriu( order, M, N, k, A, LDA, B, LDB ) {
+ var isrm;
+ var sa1;
+ var sa2;
+ var sb1;
+ var sb2;
+ var s;
+ if ( !isLayout( order ) ) {
+ throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
+ }
+ isrm = isRowMajor( order );
+ if ( isrm ) {
+ s = N;
+ } else {
+ s = M;
+ }
+ if ( LDA < max( 1, s ) ) {
+ throw new RangeError( format( 'invalid argument. Sixth argument must be greater than or equal to max(1,%d). Value: `%d`.', s, LDA ) );
+ }
+ if ( LDB < max( 1, s ) ) {
+ throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d). Value: `%d`.', s, LDB ) );
+ }
+ if ( isrm ) {
+ sa1 = LDA;
+ sa2 = 1;
+ sb1 = LDB;
+ sb2 = 1;
+ } else { // order === 'column-major'
+ sa1 = 1;
+ sa2 = LDA;
+ sb1 = 1;
+ sb2 = LDB;
+ }
+ return base( M, N, k, A, sa1, sa2, 0, B, sb1, sb2, 0 );
+}
+
+
+// EXPORTS //
+
+module.exports = gtriu;
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/ndarray.js
new file mode 100644
index 000000000000..e0821e7666c2
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/lib/ndarray.js
@@ -0,0 +1,65 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 base = require( './base.js' );
+
+
+// MAIN //
+
+/**
+* Copies the upper triangular part of a matrix `A` to another matrix `B` using alternative indexing semantics.
+*
+* @param {NonNegativeInteger} M - number of rows in matrix `A`
+* @param {NonNegativeInteger} N - number of columns in matrix `A`
+* @param {integer} k - diagonal below which to ignore
+* @param {Collection} A - input matrix
+* @param {integer} strideA1 - stride of the first dimension of `A`
+* @param {integer} strideA2 - stride of the second dimension of `A`
+* @param {NonNegativeInteger} offsetA - starting index for `A`
+* @param {Collection} B - output matrix
+* @param {integer} strideB1 - stride of the first dimension of `B`
+* @param {integer} strideB2 - stride of the second dimension of `B`
+* @param {NonNegativeInteger} offsetB - starting index for `B`
+* @returns {Collection} `B`
+*
+* @example
+* var A = [ 1.0, 2.0, 3.0, 4.0 ];
+* var B = [ 0.0, 0.0, 0.0, 0.0 ];
+*
+* gtriu( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 0 );
+* // B => [ 1.0, 2.0, 0.0, 4.0 ]
+*
+* @example
+* var A = [ 1.0, 2.0, 3.0, 4.0 ];
+* var B = [ 0.0, 0.0, 0.0, 0.0 ];
+*
+* gtriu( 2, 2, -1, A, 2, 1, 0, B, 2, 1, 0 );
+* // B => [ 1.0, 2.0, 3.0, 4.0 ]
+*/
+function gtriu( M, N, k, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ) { // eslint-disable-line max-len, max-params
+ return base( M, N, k, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ); // eslint-disable-line max-len
+}
+
+
+// EXPORTS //
+
+module.exports = gtriu;
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/package.json b/lib/node_modules/@stdlib/blas/ext/base/gtriu/package.json
new file mode 100644
index 000000000000..08dc388c196c
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "@stdlib/blas/ext/base/gtriu",
+ "version": "0.0.0",
+ "description": "Copy the upper triangular part of a matrix A to another matrix B.",
+ "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",
+ "blas",
+ "extended",
+ "ext",
+ "linear",
+ "algebra",
+ "matrix",
+ "triangular",
+ "triangle",
+ "upper",
+ "triu",
+ "copy",
+ "array",
+ "ndarray"
+ ]
+}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/gtriu/test/test.js
new file mode 100644
index 000000000000..ae04bc88b101
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/test/test.js
@@ -0,0 +1,38 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 gtriu = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof gtriu, '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 gtriu.ndarray, 'function', 'method is a function' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/gtriu/test/test.main.js
new file mode 100644
index 000000000000..da7008f040cd
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/test/test.main.js
@@ -0,0 +1,549 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
+var gtriu = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof gtriu, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function has an arity of 8', function test( t ) {
+ t.strictEqual( gtriu.length, 8, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided an invalid first argument', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ 'foo',
+ 'bar',
+ 'beep',
+ 'boop',
+ -5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ 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() {
+ var A = [ 1.0, 2.0, 3.0, 4.0 ];
+ var B = [ 0.0, 0.0, 0.0, 0.0 ];
+ gtriu( value, 2, 2, 0, A, 2, B, 2 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a sixth argument which is not a valid LDA value (row-major)', function test( t ) {
+ var values;
+ var i;
+
+ values = [ 0, 1 ];
+ 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() {
+ var A = [ 1.0, 2.0, 3.0, 4.0 ];
+ var B = [ 0.0, 0.0, 0.0, 0.0 ];
+ gtriu( 'row-major', 2, 2, 0, A, value, B, 2 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an eighth argument which is not a valid LDB value (row-major)', function test( t ) {
+ var values;
+ var i;
+
+ values = [ 0, 1 ];
+ 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() {
+ var A = [ 1.0, 2.0, 3.0, 4.0 ];
+ var B = [ 0.0, 0.0, 0.0, 0.0 ];
+ gtriu( 'row-major', 2, 2, 0, A, 2, B, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a sixth argument which is not a valid LDA value (column-major)', function test( t ) {
+ var values;
+ var i;
+
+ values = [ 0, 1 ];
+ 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() {
+ var A = [ 1.0, 2.0, 3.0, 4.0 ];
+ var B = [ 0.0, 0.0, 0.0, 0.0 ];
+ gtriu( 'column-major', 2, 2, 0, A, value, B, 2 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an eighth argument which is not a valid LDB value (column-major)', function test( t ) {
+ var values;
+ var i;
+
+ values = [ 0, 1 ];
+ 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() {
+ var A = [ 1.0, 2.0, 3.0, 4.0 ];
+ var B = [ 0.0, 0.0, 0.0, 0.0 ];
+ gtriu( 'column-major', 2, 2, 0, A, 2, B, value );
+ };
+ }
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k=0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 'row-major', 3, 3, 0, A, 3, B, 3 );
+
+ expected = [ 1.0, 2.0, 3.0, 0.0, 5.0, 6.0, 0.0, 0.0, 9.0 ];
+ t.strictEqual( out, B, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k=0, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'row-major', 3, 3, 0, toAccessorArray( A ), 3, toAccessorArray( B ), 3 );
+
+ expected = [ 1.0, 2.0, 3.0, 0.0, 5.0, 6.0, 0.0, 0.0, 9.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k>0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 'row-major', 3, 3, 1, A, 3, B, 3 );
+
+ expected = [ 0.0, 2.0, 3.0, 0.0, 0.0, 6.0, 0.0, 0.0, 0.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k>0, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'row-major', 3, 3, 1, toAccessorArray( A ), 3, toAccessorArray( B ), 3 );
+
+ expected = [ 0.0, 2.0, 3.0, 0.0, 0.0, 6.0, 0.0, 0.0, 0.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k<0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 'row-major', 3, 3, -1, A, 3, B, 3 );
+
+ expected = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 0.0, 8.0, 9.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k<0, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'row-major', 3, 3, -1, toAccessorArray( A ), 3, toAccessorArray( B ), 3 );
+
+ expected = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 0.0, 8.0, 9.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k=0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 'column-major', 3, 3, 0, A, 3, B, 3 );
+
+ expected = [ 1.0, 0.0, 0.0, 2.0, 5.0, 0.0, 3.0, 6.0, 9.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k=0, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'column-major', 3, 3, 0, toAccessorArray( A ), 3, toAccessorArray( B ), 3 );
+
+ expected = [ 1.0, 0.0, 0.0, 2.0, 5.0, 0.0, 3.0, 6.0, 9.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k<0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 'column-major', 3, 3, -1, A, 3, B, 3 );
+
+ expected = [ 1.0, 4.0, 0.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k<0, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'column-major', 3, 3, -1, toAccessorArray( A ), 3, toAccessorArray( B ), 3 );
+
+ expected = [ 1.0, 4.0, 0.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k>0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 'column-major', 3, 3, 1, A, 3, B, 3 );
+
+ expected = [ 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 3.0, 6.0, 0.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k>0, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'column-major', 3, 3, 1, toAccessorArray( A ), 3, toAccessorArray( B ), 3 );
+
+ expected = [ 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 3.0, 6.0, 0.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports non-square matrices (row-major)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ out = gtriu( 'row-major', 2, 3, 0, A, 3, B, 3 );
+ expected = [ 1.0, 2.0, 3.0, 0.0, 5.0, 6.0 ];
+ t.deepEqual( out, expected, 'returns expected value (2x3)' );
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ out = gtriu( 'row-major', 3, 2, 0, A, 2, B, 2 );
+ expected = [ 1.0, 2.0, 0.0, 4.0, 0.0, 0.0 ];
+ t.deepEqual( out, expected, 'returns expected value (3x2)' );
+
+ t.end();
+});
+
+tape( 'the function supports non-square matrices (row-major, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ gtriu( 'row-major', 2, 3, 0, toAccessorArray( A ), 3, toAccessorArray( B ), 3 );
+ expected = [ 1.0, 2.0, 3.0, 0.0, 5.0, 6.0 ];
+ t.deepEqual( B, expected, 'returns expected value (2x3)' );
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ gtriu( 'row-major', 3, 2, 0, toAccessorArray( A ), 2, toAccessorArray( B ), 2 );
+ expected = [ 1.0, 2.0, 0.0, 4.0, 0.0, 0.0 ];
+ t.deepEqual( B, expected, 'returns expected value (3x2)' );
+
+ t.end();
+});
+
+tape( 'the function supports non-square matrices (column-major)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ out = gtriu( 'column-major', 2, 3, 0, A, 2, B, 2 );
+ expected = [ 1.0, 0.0, 2.0, 5.0, 3.0, 6.0 ];
+ t.deepEqual( out, expected, 'returns expected value (2x3)' );
+
+ A = [ 1.0, 3.0, 5.0, 2.0, 4.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ out = gtriu( 'column-major', 3, 2, 0, A, 3, B, 3 );
+ expected = [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0 ];
+ t.deepEqual( out, expected, 'returns expected value (3x2)' );
+
+ t.end();
+});
+
+tape( 'the function supports non-square matrices (column-major, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ gtriu( 'column-major', 2, 3, 0, toAccessorArray( A ), 2, toAccessorArray( B ), 2 );
+ expected = [ 1.0, 0.0, 2.0, 5.0, 3.0, 6.0 ];
+ t.deepEqual( B, expected, 'returns expected value (2x3)' );
+
+ A = [ 1.0, 3.0, 5.0, 2.0, 4.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ gtriu( 'column-major', 3, 2, 0, toAccessorArray( A ), 3, toAccessorArray( B ), 3 );
+ expected = [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0 ];
+ t.deepEqual( B, expected, 'returns expected value (3x2)' );
+
+ t.end();
+});
+
+tape( 'the function leaves elements outside of the copied region unchanged', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0 ];
+
+ out = gtriu( 'row-major', 3, 3, 0, A, 3, B, 3 );
+
+ expected = [ 1.0, 2.0, 3.0, -1.0, 5.0, 6.0, -1.0, -1.0, 9.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function leaves elements outside of the copied region unchanged (accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0 ];
+
+ gtriu( 'row-major', 3, 3, 0, toAccessorArray( A ), 3, toAccessorArray( B ), 3 );
+
+ expected = [ 1.0, 2.0, 3.0, -1.0, 5.0, 6.0, -1.0, -1.0, 9.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'when `k` is greater than or equal to `N`, the function copies nothing', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+
+ out = gtriu( 'row-major', 2, 2, 2, A, 2, B, 2 );
+
+ expected = [ 9.0, 9.0, 9.0, 9.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'when `k` is greater than or equal to `N`, the function copies nothing (accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+
+ gtriu( 'row-major', 2, 2, 2, toAccessorArray( A ), 2, toAccessorArray( B ), 2 );
+
+ expected = [ 9.0, 9.0, 9.0, 9.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'when `k` is sufficiently negative, the function copies the entire matrix', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 'row-major', 2, 2, -2, A, 2, B, 2 );
+
+ expected = [ 1.0, 2.0, 3.0, 4.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'when `k` is sufficiently negative, the function copies the entire matrix (accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 'row-major', 2, 2, -2, toAccessorArray( A ), 2, toAccessorArray( B ), 2 );
+
+ expected = [ 1.0, 2.0, 3.0, 4.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function leaves `B` unchanged when `M` or `N` is equal to zero', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ expected = [ 9.0, 9.0, 9.0, 9.0 ];
+
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+ out = gtriu( 'row-major', 0, 2, 0, A, 2, B, 2 );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+ out = gtriu( 'row-major', 2, 0, 0, A, 2, B, 2 );
+ t.deepEqual( out, expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function leaves `B` unchanged when `M` or `N` is equal to zero (accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ expected = [ 9.0, 9.0, 9.0, 9.0 ];
+
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+ gtriu( 'row-major', 0, 2, 0, toAccessorArray( A ), 2, toAccessorArray( B ), 2 );
+ t.deepEqual( B, expected, 'returns expected value' );
+
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+ gtriu( 'row-major', 2, 0, 0, toAccessorArray( A ), 2, toAccessorArray( B ), 2 );
+ t.deepEqual( B, expected, 'returns expected value' );
+
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gtriu/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gtriu/test/test.ndarray.js
new file mode 100644
index 000000000000..19128e962fc3
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gtriu/test/test.ndarray.js
@@ -0,0 +1,509 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2026 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 toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
+var gtriu = require( './../lib' ).ndarray;
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof gtriu, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function has an arity of 11', function test( t ) {
+ t.strictEqual( gtriu.length, 11, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k=0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 3, 3, 0, A, 3, 1, 0, B, 3, 1, 0 );
+
+ expected = [ 1.0, 2.0, 3.0, 0.0, 5.0, 6.0, 0.0, 0.0, 9.0 ];
+ t.strictEqual( out, B, 'returns expected value' );
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k=0, accessors)', function test( t ) {
+ var expected;
+ var out;
+ var buf;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ buf = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ B = toAccessorArray( buf );
+ out = gtriu( 3, 3, 0, toAccessorArray( A ), 3, 1, 0, B, 3, 1, 0 );
+
+ expected = [ 1.0, 2.0, 3.0, 0.0, 5.0, 6.0, 0.0, 0.0, 9.0 ];
+ t.strictEqual( out, B, 'returns expected value' );
+ t.deepEqual( buf, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k>0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 3, 3, 1, A, 3, 1, 0, B, 3, 1, 0 );
+
+ expected = [ 0.0, 2.0, 3.0, 0.0, 0.0, 6.0, 0.0, 0.0, 0.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k>0, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 3, 3, 1, toAccessorArray( A ), 3, 1, 0, toAccessorArray( B ), 3, 1, 0 );
+
+ expected = [ 0.0, 2.0, 3.0, 0.0, 0.0, 6.0, 0.0, 0.0, 0.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k<0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 3, 3, -1, A, 3, 1, 0, B, 3, 1, 0 );
+
+ expected = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 0.0, 8.0, 9.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (row-major, k<0, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 3, 3, -1, toAccessorArray( A ), 3, 1, 0, toAccessorArray( B ), 3, 1, 0 );
+
+ expected = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 0.0, 8.0, 9.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k=0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 3, 3, 0, A, 1, 3, 0, B, 1, 3, 0 );
+
+ expected = [ 1.0, 0.0, 0.0, 2.0, 5.0, 0.0, 3.0, 6.0, 9.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k=0, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 3, 3, 0, toAccessorArray( A ), 1, 3, 0, toAccessorArray( B ), 1, 3, 0 );
+
+ expected = [ 1.0, 0.0, 0.0, 2.0, 5.0, 0.0, 3.0, 6.0, 9.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k<0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 3, 3, -1, A, 1, 3, 0, B, 1, 3, 0 );
+
+ expected = [ 1.0, 4.0, 0.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k<0, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 3, 3, -1, toAccessorArray( A ), 1, 3, 0, toAccessorArray( B ), 1, 3, 0 );
+
+ expected = [ 1.0, 4.0, 0.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k>0)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 3, 3, 1, A, 1, 3, 0, B, 1, 3, 0 );
+
+ expected = [ 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 3.0, 6.0, 0.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function copies the upper triangular part of `A` to `B` (column-major, k>0, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 3, 3, 1, toAccessorArray( A ), 1, 3, 0, toAccessorArray( B ), 1, 3, 0 );
+
+ expected = [ 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 3.0, 6.0, 0.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports non-square matrices (row-major)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ out = gtriu( 2, 3, 0, A, 3, 1, 0, B, 3, 1, 0 );
+ expected = [ 1.0, 2.0, 3.0, 0.0, 5.0, 6.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports non-square matrices (row-major, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ gtriu( 2, 3, 0, toAccessorArray( A ), 3, 1, 0, toAccessorArray( B ), 3, 1, 0 );
+ expected = [ 1.0, 2.0, 3.0, 0.0, 5.0, 6.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports non-square matrices (column-major)', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 3.0, 5.0, 2.0, 4.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ out = gtriu( 3, 2, 0, A, 1, 3, 0, B, 1, 3, 0 );
+ expected = [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports non-square matrices (column-major, accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 3.0, 5.0, 2.0, 4.0, 6.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+ gtriu( 3, 2, 0, toAccessorArray( A ), 1, 3, 0, toAccessorArray( B ), 1, 3, 0 );
+ expected = [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports an `A` offset', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 2, 2, 0, A, 2, 1, 1, B, 2, 1, 0 );
+
+ expected = [ 2.0, 3.0, 0.0, 5.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports an `A` offset (accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 2, 2, 0, toAccessorArray( A ), 2, 1, 1, toAccessorArray( B ), 2, 1, 0 );
+
+ expected = [ 2.0, 3.0, 0.0, 5.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports a `B` offset', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 2, 2, 0, A, 2, 1, 0, B, 2, 1, 2 );
+
+ expected = [ 0.0, 0.0, 1.0, 2.0, 0.0, 4.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports a `B` offset (accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 2, 2, 0, toAccessorArray( A ), 2, 1, 0, toAccessorArray( B ), 2, 1, 2 );
+
+ expected = [ 0.0, 0.0, 1.0, 2.0, 0.0, 4.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports negative strides', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 2.0, 1.0, 4.0, 3.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 2, 2, 0, A, 2, -1, 1, B, 2, 1, 0 );
+
+ expected = [ 1.0, 2.0, 0.0, 4.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports negative strides (accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 2.0, 1.0, 4.0, 3.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 2, 2, 0, toAccessorArray( A ), 2, -1, 1, toAccessorArray( B ), 2, 1, 0 );
+
+ expected = [ 1.0, 2.0, 0.0, 4.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function leaves elements outside of the copied region unchanged', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0 ];
+
+ out = gtriu( 3, 3, 0, A, 3, 1, 0, B, 3, 1, 0 );
+
+ expected = [ 1.0, 2.0, 3.0, -1.0, 5.0, 6.0, -1.0, -1.0, 9.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function leaves elements outside of the copied region unchanged (accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ];
+ B = [ -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0 ];
+
+ gtriu( 3, 3, 0, toAccessorArray( A ), 3, 1, 0, toAccessorArray( B ), 3, 1, 0 );
+
+ expected = [ 1.0, 2.0, 3.0, -1.0, 5.0, 6.0, -1.0, -1.0, 9.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'when `k` is greater than or equal to `N`, the function copies nothing', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+
+ out = gtriu( 2, 2, 2, A, 2, 1, 0, B, 2, 1, 0 );
+
+ expected = [ 9.0, 9.0, 9.0, 9.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'when `k` is greater than or equal to `N`, the function copies nothing (accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+
+ gtriu( 2, 2, 2, toAccessorArray( A ), 2, 1, 0, toAccessorArray( B ), 2, 1, 0 );
+
+ expected = [ 9.0, 9.0, 9.0, 9.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'when `k` is sufficiently negative, the function copies the entire matrix', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ out = gtriu( 2, 2, -2, A, 2, 1, 0, B, 2, 1, 0 );
+
+ expected = [ 1.0, 2.0, 3.0, 4.0 ];
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'when `k` is sufficiently negative, the function copies the entire matrix (accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ B = [ 0.0, 0.0, 0.0, 0.0 ];
+
+ gtriu( 2, 2, -2, toAccessorArray( A ), 2, 1, 0, toAccessorArray( B ), 2, 1, 0 );
+
+ expected = [ 1.0, 2.0, 3.0, 4.0 ];
+ t.deepEqual( B, expected, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function leaves `B` unchanged when `M` or `N` is equal to zero', function test( t ) {
+ var expected;
+ var out;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ expected = [ 9.0, 9.0, 9.0, 9.0 ];
+
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+ out = gtriu( 0, 2, 0, A, 2, 1, 0, B, 2, 1, 0 );
+ t.deepEqual( out, expected, 'returns expected value (M=0)' );
+
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+ out = gtriu( 2, 0, 0, A, 2, 1, 0, B, 2, 1, 0 );
+ t.deepEqual( out, expected, 'returns expected value (N=0)' );
+
+ t.end();
+});
+
+tape( 'the function leaves `B` unchanged when `M` or `N` is equal to zero (accessors)', function test( t ) {
+ var expected;
+ var A;
+ var B;
+
+ A = [ 1.0, 2.0, 3.0, 4.0 ];
+ expected = [ 9.0, 9.0, 9.0, 9.0 ];
+
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+ gtriu( 0, 2, 0, toAccessorArray( A ), 2, 1, 0, toAccessorArray( B ), 2, 1, 0 );
+ t.deepEqual( B, expected, 'returns expected value (M=0)' );
+
+ B = [ 9.0, 9.0, 9.0, 9.0 ];
+ gtriu( 2, 0, 0, toAccessorArray( A ), 2, 1, 0, toAccessorArray( B ), 2, 1, 0 );
+ t.deepEqual( B, expected, 'returns expected value (N=0)' );
+
+ t.end();
+});