Skip to content

Commit

Permalink
chore: apply review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-095 committed Aug 1, 2024
1 parent 1228f69 commit e6d62f4
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 85 deletions.
13 changes: 8 additions & 5 deletions lib/node_modules/@stdlib/blas/base/dtrmv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.

# dtrmv

> Perform one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.
> Perform one of the matrix-vector operations `x = A*x` or `x = A^T*x`.
<section class = "usage">

Expand Down Expand Up @@ -127,7 +127,7 @@ dtrmv.ndarray( 'upper', 'no-transpose', 'unit', 3, A, 3, 1, 0, x, -1, 2 );

## Notes

- `dtrmv()` corresponds to the [BLAS][blas] level 2 function [`dtrmv`][dtrmv].
- `dtrmv()` corresponds to the [BLAS][blas] level 2 function [`dtrmv`][blas-dtrmv].

</section>

Expand All @@ -147,12 +147,15 @@ var opts = {
'dtype': 'float64'
};

var N = 3;
var N = 5;

var A = discreteUniform( N*N, -10.0, 10.0, opts );
var x = discreteUniform( N, -10.0, 10.0, opts );

dtrmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, 1 );
dtrmv( 'column-major', 'upper', 'no-transpose', 'unit', N, A, N, x, 1 );
console.log( x );

dtrmv.ndarray( 'upper', 'no-transpose', 'unit', N, A, 1, N, 0, x, 1, 0 );
console.log( x );
```

Expand Down Expand Up @@ -244,7 +247,7 @@ TODO

[blas]: http://www.netlib.org/blas

[dtrmv]: https://www.netlib.org/lapack/explore-html/d6/d1c/group__trmv_ga7b90369d2b2b19f78f168e10dd9eb8ad.html#ga7b90369d2b2b19f78f168e10dd9eb8ad
[blas-dtrmv]: https://www.netlib.org/lapack/explore-html/d6/d1c/group__trmv_ga7b90369d2b2b19f78f168e10dd9eb8ad.html#ga7b90369d2b2b19f78f168e10dd9eb8ad

[mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array

Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/blas/base/dtrmv/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
Returns
-------
x: Float64Array
Output vector.
Input vector.

Examples
--------
Expand Down Expand Up @@ -103,7 +103,7 @@
Returns
-------
x: Float64Array
Output array.
Input vector.

Examples
--------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ interface Routine {
* dtrmv.ndarray( 'upper', 'no-transpose', 'non-unit', 3, A, 3, 1, 0, x, 1, 0 );
* // x => <Float64Array>[ 14.0, 8.0, 3.0 ]
*/
ndarray( uplo: MatrixTriangle, trans: TransposeOperation, diag: DiagonalType, N: number, A: Float64Array, LDA: number, x: Float64Array, strideX: number, offsetX: number ): Float64Array;
ndarray( uplo: MatrixTriangle, trans: TransposeOperation, diag: DiagonalType, N: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, x: Float64Array, strideX: number, offsetX: number ): Float64Array;
}

/**
Expand Down
7 changes: 5 additions & 2 deletions lib/node_modules/@stdlib/blas/base/dtrmv/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ var opts = {
'dtype': 'float64'
};

var N = 3;
var N = 5;

var A = discreteUniform( N*N, -10.0, 10.0, opts );
var x = discreteUniform( N, -10.0, 10.0, opts );

dtrmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, 1 );
dtrmv( 'column-major', 'upper', 'no-transpose', 'unit', N, A, N, x, 1 );
console.log( x );

dtrmv.ndarray( 'upper', 'no-transpose', 'unit', N, A, 1, N, 0, x, 1, 0 );
console.log( x );
37 changes: 17 additions & 20 deletions lib/node_modules/@stdlib/blas/base/dtrmv/lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' );
/**
* Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.
*
* @private
* @param {string} uplo - specifies whether `A` is an upper or lower triangular matrix
* @param {string} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
* @param {string} diag - specifies whether `A` has a unit diagonal
Expand Down Expand Up @@ -77,8 +78,8 @@ function dtrmv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX
sa0 = strideA1; // stride for innermost loop
sa1 = strideA2; // stride for outermost loop
}

ox = offsetX;

if (
( !isrm && trans === 'no-transpose' && uplo === 'upper' ) ||
( isrm && trans !== 'no-transpose' && uplo === 'lower' )
Expand Down Expand Up @@ -145,27 +146,23 @@ function dtrmv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX
}
return x;
}
if (
( !isrm && trans !== 'no-transpose' && uplo === 'lower' ) ||
( isrm && trans === 'no-transpose' && uplo === 'upper' )
) {
ix1 = ox;
for ( i1 = 0; i1 < N; i1++ ) {
tmp = x[ ix1 ];
oa = offsetA + (sa1*i1);
ix0 = ix1;
if ( nonunit ) {
tmp *= A[ oa+(sa0*i1) ];
}
for ( i0 = i1+1; i0 < N; i0++ ) {
ix0 += strideX;
tmp += ( x[ ix0 ] * A[ oa+(sa0*i0) ] );
}
x[ ix1 ] = tmp;
ix1 += strideX;
// ( !isrm && trans !== 'no-transpose' && uplo === 'lower' ) || ( isrm && trans === 'no-transpose' && uplo === 'upper' )

Check warning on line 149 in lib/node_modules/@stdlib/blas/base/dtrmv/lib/base.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "isrm"

Check warning on line 149 in lib/node_modules/@stdlib/blas/base/dtrmv/lib/base.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "uplo"

Check warning on line 149 in lib/node_modules/@stdlib/blas/base/dtrmv/lib/base.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "isrm"

Check warning on line 149 in lib/node_modules/@stdlib/blas/base/dtrmv/lib/base.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "uplo"
ix1 = ox;
for ( i1 = 0; i1 < N; i1++ ) {
tmp = x[ ix1 ];
oa = offsetA + (sa1*i1);
ix0 = ix1;
if ( nonunit ) {
tmp *= A[ oa+(sa0*i1) ];
}
return x;
for ( i0 = i1+1; i0 < N; i0++ ) {
ix0 += strideX;
tmp += ( x[ ix0 ] * A[ oa+(sa0*i0) ] );
}
x[ ix1 ] = tmp;
ix1 += strideX;
}
return x;
}


Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/blas/base/dtrmv/lib/dtrmv.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

// MODULES //

var max = require( '@stdlib/math/base/special/max' );
var max = require( '@stdlib/math/base/special/fast/max' );
var isLayout = require( '@stdlib/blas/base/assert/is-layout' );
var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' );
var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' );
Expand All @@ -45,7 +45,7 @@ var base = require( './base.js' );
* @param {Float64Array} x - input vector
* @param {integer} strideX - `x` stride length
* @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 {TypeError} second argument must specify whether a lower or upper triangular matrix is supplied
* @throws {TypeError} third argument must be a valid transpose operation
* @throws {TypeError} fourth argument must be a valid diagonal type
* @throws {RangeError} fifth argument must be a nonnegative integer
Expand Down
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/blas/base/dtrmv/lib/ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var base = require( './base.js' );
* @param {Float64Array} x - input vector
* @param {integer} strideX - `x` stride length
* @param {NonNegativeInteger} offsetX - starting index for `x`
* @throws {TypeError} first argument must specify whether the lower or upper triangular matrix is supplied
* @throws {TypeError} first argument must specify whether a lower or upper triangular matrix is supplied
* @throws {TypeError} second argument must be a valid transpose operation
* @throws {TypeError} third argument must be a valid diagonal type
* @throws {RangeError} fourth argument must be a nonnegative integer
Expand Down
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/blas/base/dtrmv/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@stdlib/blas/base/dtrmv",
"version": "0.0.0",
"description": "Perform one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.",
"description": "Perform one of the matrix-vector operations `x = A*x` or `x = A^T*x`.",
"license": "Apache-2.0",
"author": {
"name": "The Stdlib Authors",
Expand Down
42 changes: 21 additions & 21 deletions lib/node_modules/@stdlib/blas/base/dtrmv/test/test.dtrmv.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ tape( 'the function throws an error if provided an invalid ninth argument', func
}
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (row-major, lower, none, non-unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (row-major, lower, none, non-unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -297,7 +297,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (column-major, lower, none, non-unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (column-major, lower, none, non-unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -318,7 +318,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (row-major, lower, transpose, non-unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (row-major, lower, transpose, non-unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -339,7 +339,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (column-major, lower, transpose, non-unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (column-major, lower, transpose, non-unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -360,7 +360,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (row-major, lower, none, unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (row-major, lower, none, unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -381,7 +381,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (column-major, lower, none, unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (column-major, lower, none, unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -402,7 +402,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (row-major, lower, transpose, unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (row-major, lower, transpose, unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -423,7 +423,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (column-major, lower, transpose, unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (column-major, lower, transpose, unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -444,7 +444,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (row-major, upper, none, non-unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (row-major, upper, none, non-unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -465,7 +465,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (column-major, upper, none, non-unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (column-major, upper, none, non-unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -486,7 +486,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (row-major, upper, none, unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (row-major, upper, none, unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -507,7 +507,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (column-major, upper, none, unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (column-major, upper, none, unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -528,7 +528,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (row-major, upper, transpose, non-unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (row-major, upper, transpose, non-unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -549,7 +549,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (column-major, upper, transpose, non-unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (column-major, upper, transpose, non-unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -570,7 +570,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (row-major, upper, transpose, unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (row-major, upper, transpose, unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -591,7 +591,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (column-major, upper, transpose, unit)', function test( t ) {
tape( 'the function performs one of the matrix-vector operations `x = A*x`, or `x = A^T*x` (column-major, upper, transpose, unit)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -612,7 +612,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (row-major, sx=2)', function test( t ) {
tape( 'the function supports speciying an `x` stride (row-major)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -633,7 +633,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x = A**T*x`, `x` and `y` are `N` element vectors, and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix (column-major, sx=2)', function test( t ) {
tape( 'the function supports speciying an `x` stride (column-major)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -654,7 +654,7 @@ tape( 'the function performs one of the matrix-vector operation `x = A*x`, or `x
t.end();
});

tape( 'the function returns a reference to the second input vector', function test( t ) {
tape( 'the function returns a reference to the input vector', function test( t ) {
var data;
var out;
var a;
Expand All @@ -671,7 +671,7 @@ tape( 'the function returns a reference to the second input vector', function te
t.end();
});

tape( 'if `N` is zero, the function returns the second input vector unchanged (row-major)', function test( t ) {
tape( 'if `N` is zero, the function returns the input vector unchanged (row-major)', function test( t ) {
var expected;
var data;
var out;
Expand All @@ -692,7 +692,7 @@ tape( 'if `N` is zero, the function returns the second input vector unchanged (r
t.end();
});

tape( 'if `N` is zero, the function returns the second input vector unchanged (column-major)', function test( t ) {
tape( 'if `N` is zero, the function returns the input vector unchanged (column-major)', function test( t ) {
var expected;
var data;
var out;
Expand Down
Loading

0 comments on commit e6d62f4

Please sign in to comment.