-
-
Notifications
You must be signed in to change notification settings - Fork 805
feat: add lapack/base/dptts2
#2625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Signed-off-by: Pranav <[email protected]>
Signed-off-by: Pranav <[email protected]>
Signed-off-by: Pranav <[email protected]>
Signed-off-by: Pranav <[email protected]>
I think this PR can now have a final review. |
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
B = uniform( len * len, -10.0, 10.0, options ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not allocate new arrays in benchmarks. Results will be tainted with non-relevant operations.
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
B = uniform( len * len, -10.0, 10.0, options ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment.
B[ ob + ( ( N - 1 ) * strideB1 ) ] /= D[ offsetD + ( ( N - 1 ) * strideD ) ]; | ||
se = N - 2; | ||
for ( i = N - 2; i >= 0; i-- ) { | ||
B[ ob + ( i * strideB1 ) ] = ( B[ ob + ( i * strideB1 ) ] / D[ offsetD + ( i * strideD ) ] ) - ( E[ offsetE + se ] * B[ ob + ( ( i + 1) * strideB1 ) ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have repeated computation of index offsets. Refactor and simplify.
expected = new Float64Array( [ 11.0, 38.0, -5.0, -18.0, 2.0, 6.0 ] ); | ||
out = dptts2( 'row-major', 3, 2, D, E, B, 2 ); | ||
t.strictEqual( out, B, 'returns expected value' ); | ||
isApprox( t, B, expected, 1.0e-7 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 1.0e-7
? This tolerance does not make sense to me. That effectively makes the tol
value 0
in isApprox
.
t.end(); | ||
}); | ||
|
||
tape( 'the function solves a tridiagonal system of the form `A * X = B` using `L * D * L^T` factorization of `A` (row-major, offsetD=3, offsetE=4, offsetB=6)', function test( t ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameterizing with explicit values does not mean much to the casual reader. What is this test (and the ones which follow) indicated to show?
t.end(); | ||
}); | ||
|
||
tape( 'the function solves a tridiagonal system of the form `A * X = B` using `L * D * L^T` factorization of `A` (row-major, offsetD=3, strideD=2, offsetE=4, offsetB=6)', function test( t ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, you are testing that the function supports a D
stride. Update the description accordingly.
t.end(); | ||
}); | ||
|
||
tape( 'the function solves a tridiagonal system of the form `A * X = B` using `L * D * L^T` factorization of `A` (row-major, strideB1=-2, strideB2=-1)', function test( t ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, you are showing that the function supports negative strides for B
. Update the description accordingly. Etc.
t.end(); | ||
}); | ||
|
||
tape( 'the function solves a tridiagonal system of the form `A * X = B` using `L * D * L^T` factorization of `A` (row-major, strideB1=-3, strideB2=-2)', function test( t ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All your tests are row-major. You need to also systematically test behavior for column-major.
Towards #2464
Description
This pull request adds initial implementation for
lapack/base/dptts2
.Related Issues
No.
Questions
No.
Other
No.
Checklist
TODO:
strideB1
,strideB2
.@stdlib-js/reviewers