Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
Pranavchiku wants to merge 19 commits into stdlib-js:develop
base: develop
Choose a base branch
Loading
from Pranavchiku:dptts2

Conversation

Copy link
Member

@Pranavchiku Pranavchiku commented Jul 18, 2024
edited by kgryte
Loading

Towards #2464

Description

What is the purpose of this pull request?

This pull request adds initial implementation for lapack/base/dptts2.

Related Issues

Does this pull request have any related issues?

No.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

TODO:

  • Add tests for strideB1, strideB2.
  • Refactor implementation ( loop interchange ) -- can't be done

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@Pranavchiku Pranavchiku added Feature Issue or pull request for adding a new feature. Base Issue or pull requests related to "low-level" functionality oriented toward library consumers. JavaScript Issue involves or relates to JavaScript. LAPACK Issue or pull request related to the Linear Algebra Package (LAPACK). labels Jul 18, 2024
Signed-off-by: Pranav <85227306+Pranavchiku@users.noreply.github.com>
Signed-off-by: Pranav <85227306+Pranavchiku@users.noreply.github.com>
@Pranavchiku Pranavchiku marked this pull request as ready for review July 22, 2024 13:43
Signed-off-by: Pranav <85227306+Pranavchiku@users.noreply.github.com>
@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Aug 1, 2024
Signed-off-by: Pranav <85227306+Pranavchiku@users.noreply.github.com>
@Pranavchiku Pranavchiku added Needs Review A pull request which needs code review. and removed Needs Changes Pull request which needs changes before being merged. labels Aug 3, 2024
Copy link
Member Author

I think this PR can now have a final review.

kgryte reacted with thumbs up emoji


b.tic();
for ( i = 0; i < b.iterations; i++ ) {
B = uniform( len * len, -10.0, 10.0, options );
Copy link
Member

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 );
Copy link
Member

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 ) ] );
Copy link
Member

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 );
Copy link
Member

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 ) {
Copy link
Member

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 ) {
Copy link
Member

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 ) {
Copy link
Member

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 ) {
Copy link
Member

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.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@kgryte kgryte kgryte left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
Base Issue or pull requests related to "low-level" functionality oriented toward library consumers. Feature Issue or pull request for adding a new feature. JavaScript Issue involves or relates to JavaScript. LAPACK Issue or pull request related to the Linear Algebra Package (LAPACK). Needs Changes Pull request which needs changes before being merged.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /