Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2252453
feat: add blas/base/dtrsm/lib
Pranavchiku Jul 6, 2024
12708a5
chore: apply suggestions from code review
Pranavchiku Jul 6, 2024
4b951ba
enh: support offsetA and offsetB
Pranavchiku Jul 6, 2024
5d0646d
fix: incorrect base implementation
Pranavchiku Jul 8, 2024
4fe27b2
chore: add examples
Pranavchiku Jul 8, 2024
510cc17
chore: add readme
Pranavchiku Jul 8, 2024
6569dc8
chore: add package.json
Pranavchiku Jul 8, 2024
bc4f4c2
fix: incorrect readme example
Pranavchiku Jul 8, 2024
d121f15
chore: add repl.txt
Pranavchiku Jul 8, 2024
6b3562f
chore: add docs/types
Pranavchiku Jul 8, 2024
2f00ec3
chore: add benchmark
Pranavchiku Jul 8, 2024
78d49ac
test: add and register
Pranavchiku Jul 8, 2024
9ad1e43
enh: files in lib/
Pranavchiku Jul 8, 2024
851ed80
fix: incorrect description of ndarray api in readme
Pranavchiku Jul 8, 2024
93204fd
refactor: base implementation
Pranavchiku Jul 9, 2024
86d36ca
fix: lint warnings in base.js
Pranavchiku Jul 9, 2024
df96605
chore: apply code review
Pranavchiku Jul 9, 2024
8b7a997
fix: lint error in repl.txt part 1
Pranavchiku Jul 9, 2024
4ff0296
Merge branch 'dtrsm' of https://github.com/Pranavchiku/stdlib into dtrsm
Pranavchiku Jul 9, 2024
6ceef42
refactor: base implementation and consequent changes
Pranavchiku Jul 24, 2024
acc78cc
refactor: repl.txt
Pranavchiku Jul 24, 2024
35db166
chore: apply suggestion from code review
Pranavchiku Jul 24, 2024
48b8231
refactor: base implementation to compute offsets before loop
Pranavchiku Jul 24, 2024
2eea9ee
chore: work in progress
Pranavchiku Jul 25, 2024
53e44c9
Merge branch 'develop' into dtrsm
Pranavchiku Jul 25, 2024
355a56e
refactor: remove fixtures
Pranavchiku Jul 25, 2024
17b2671
refactor: remove fixtures from ndarray tests
Pranavchiku Jul 25, 2024
9deb187
refactor: docs/repl.txt
Pranavchiku Jul 25, 2024
5f3be19
chore: update description of tests
Pranavchiku Jul 25, 2024
2bae813
chore: update description of ndarray tests
Pranavchiku Jul 25, 2024
b50078f
test: add tests for complex access patterns
Pranavchiku Jul 25, 2024
7e295de
fix: incorrect spelling of contiguous
Pranavchiku Jul 25, 2024
6585a6a
chore: apply suggestions from code review
Pranavchiku Jul 25, 2024
f710cd3
Merge branch 'develop' into dtrsm
Pranavchiku Aug 8, 2024
03532e0
refactor: base implementation and consequent changes
Pranavchiku Aug 8, 2024
d0183d3
test: add more values
Pranavchiku Aug 8, 2024
449f2d5
Merge branch 'dtrsm' of https://github.com/Pranavchiku/stdlib into dtrsm
Pranavchiku Aug 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: base implementation and consequent changes
  • Loading branch information
Pranavchiku committed Jul 24, 2024
commit 6ceef427eea8a7973a164749aa13ca389fdf0e5a
14 changes: 9 additions & 5 deletions lib/node_modules/@stdlib/blas/base/dtrsm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ var A0 = new Float64Array( [ 0.0, 1.0, 3.0, 0.0, 4.0 ] );
var B0 = new Float64Array( [ 0.0, 5.0, 7.0, 0.0, 8.0 ] );

// Create offset views...
var A1 = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 1st element
var B1 = new Float64Array( B0.buffer, B0.BYTES_PER_ELEMENT*1 ); // start at 1st element
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

dtrsm( 'row-major', 'left', 'upper', 'none', 'non-unit', 2, 2, 6.0, A1, 2, B1, 2 );
// B0 => <Float64Array>[ 0.0, 30.0, 6.0, 0.0, 12.0 ]
```

#### dtrsm.ndarray( ord, side, ul, ta, diag, m, n, α, A, LDA, oa, B, LDB, ob )
#### dtrsm.ndarray( o, s, ul, t, d, m, n, α, A, sa1, sa2, oa, B, sb1, sb2, ob )

Solves matrix equation `op(A) * X = alpha * B` or `X * op(A) = alpha * B` using alternative indexing semantics where `alpha` is a scalar, `X` and `B` are m by n matrices, `A` is a unit, or non-unit, upper or lower triangular matrix and `op( A )` is one of `op( A ) = A` or `op( A ) = A**T`. The matrix `X` is overwritten on `B`.

Expand All @@ -98,13 +98,17 @@ var Float64Array = require( '@stdlib/array/float64' );
A = new Float64Array( [ 0.0, 0.0, 1.0, 3.0, 0.0, 4.0 ] );
B = new Float64Array( [ 0.0, 5.0, 7.0, 0.0, 8.0 ] );

dtrsm.ndarray( 'row-major', 'left', 'upper', 'none', 'non-unit', 2, 2, 6.0, A, 2, 2, B, 2, 1 );
dtrsm.ndarray( 'row-major', 'left', 'upper', 'none', 'non-unit', 2, 2, 6.0, A, 2, 1, 2, B, 2, 1, 1 );
// B => <Float64Array>[ 0.0, 30.0, 6.0, 0.0, 12.0 ]
```

The function has the following additional parameters:

- **sa1**: stride of the first dimension of `A`.
- **sa2**: stride of the second dimension of `A`.
- **oa**: starting index for `A`.
- **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,
Expand All @@ -115,7 +119,7 @@ var Float64Array = require( '@stdlib/array/float64' );
A = new Float64Array( [ 0.0, 0.0, 1.0, 3.0, 0.0, 4.0 ] );
B = new Float64Array( [ 0.0, 5.0, 7.0, 0.0, 8.0 ] );

dtrsm.ndarray( 'row-major', 'left', 'upper', 'none', 'non-unit', 2, 2, 6.0, A, 2, 2, B, 2, 1 );
dtrsm.ndarray( 'row-major', 'left', 'upper', 'none', 'non-unit', 2, 2, 6.0, A, 2, 1, 2, B, 2, 1, 1 );
// B => <Float64Array>[ 0.0, 30.0, 6.0, 0.0, 12.0 ]
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function createBenchmark( N ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
z = dtrsm( 'column-major', 'left', 'upper', 'none', 'non-unit', N, N, 1.0, A, N, 0, B, N, 0 );
z = dtrsm( 'column-major', 'left', 'upper', 'none', 'non-unit', N, N, 1.0, A, 1, N, 0, B, 1, N, 0 );
if ( isnan( z[ i%z.length ] ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
28 changes: 15 additions & 13 deletions lib/node_modules/@stdlib/blas/base/dtrsm/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,25 @@ interface Routine {
* @param n - number of columns in `B`
* @param alpha - scalar constant
* @param A - input matrix `A`
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
* @param offsetA - starting `A` index
* @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 - input matrix `B`
* @param LDB - stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`)
* @param offsetB - starting `B` index
* @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 Float64Array = require( '@stdlib/array/float64' );
*
* var A = new Float64Array( [ 1.0, 3.0, 0.0, 4.0 ] );
* var B = new Float64Array( [ 5.0, 7.0, 0.0, 8.0 ] );
* var A = new Float64Array( [ 0.0, 0.0, 1.0, 3.0, 0.0, 4.0 ] );
* var B = new Float64Array( [ 0.0, 5.0, 7.0, 0.0, 8.0 ] );
*
* dtrsm( 'row-major', 'left', 'upper', 'none', 'non-unit', 2, 2, 6.0, A, 2, 0, B, 2, 0 );
* // B => <Float64Array>[ 30.0, 6.0, 0.0, 12.0 ]
* dtrsm.ndarray( 'row-major', 'left', 'upper', 'none', 'non-unit', 2, 2, 6.0, A, 2, 1, 2, B, 2, 1, 1 );
* // B => <Float64Array>[ 0.0, 30.0, 6.0, 0.0, 12.0 ]
*/
ndarray( order: Layout, side: OperationSide, uplo: MatrixTriangle, transa: TransposeOperation, diag: DiagonalType, m: number, n: number, alpha: number, A: Float64Array, LDA: number, offsetA: number, B: Float64Array, LDB: number, offsetB: number ): Float64Array;
ndarray( order: Layout, side: OperationSide, uplo: MatrixTriangle, transa: TransposeOperation, diag: DiagonalType, m: number, n: number, alpha: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, B: Float64Array, strideB1: number, strideB2: number, offsetB: number ): Float64Array;
}

/**
Expand Down Expand Up @@ -114,11 +116,11 @@ interface Routine {
* @example
* var Float64Array = require( '@stdlib/array/float64' );
*
* var A = new Float64Array( [ 1.0, 3.0, 0.0, 4.0 ] );
* var B = new Float64Array( [ 5.0, 7.0, 0.0, 8.0 ] );
* var A = new Float64Array( [ 0.0, 0.0, 1.0, 3.0, 0.0, 4.0 ] );
* var B = new Float64Array( [ 0.0, 5.0, 7.0, 0.0, 8.0 ] );
*
* dtrsm( 'row-major', 'left', 'upper', 'none', 'non-unit', 2, 2, 6.0, A, 2, 0, B, 2, 0 );
* // B => <Float64Array>[ 30.0, 6.0, 0.0, 12.0 ]
* dtrsm.ndarray( 'row-major', 'left', 'upper', 'none', 'non-unit', 2, 2, 6.0, A, 2, 1, 2, B, 2, 1, 1 );
* // B => <Float64Array>[ 0.0, 30.0, 6.0, 0.0, 12.0 ]
*/
declare var dtrsm: Routine;

Expand Down
Loading