-
-
Notifications
You must be signed in to change notification settings - Fork 564
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
feat: add lapack/base/dlas2
#2833
base: develop
Are you sure you want to change the base?
Conversation
var out = new Float64Array( 2 ); | ||
dlas2( 1.0, 2.0, 3.0, out ); | ||
console.log( out ); |
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.
@Pranavchiku You need to go beyond just copy-pasting a prior example. This applies to all your PRs.
A = ( randu() * 100.0 ) - 50.0; | ||
B = ( randu() * 100.0 ) - 50.0; | ||
C = ( randu() * 100.0 ) - 50.0; | ||
out = new Float64Array( 2 ); |
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 are you doing this within the b.tic()
? This benchmark needs to be refactored. It is also not clear why were are reusing out
values in subsequent iterations.
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
out = dlas2( A, B, C, out, 1, 0 ); | ||
A = out[ i%out.length ]; |
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.
if ( fhmx === 0.0 ) { | ||
ssmax = ga; | ||
} else { | ||
ssmax = max( fhmx, ga ) * sqrt( 1.0 + pow( min( fhmx, ga ) / max( fhmx, ga ), 2 ) ); |
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.
For squaring numbers, use abs2
. It is a much lighter weight dependency and will be faster in general.
} else { | ||
as = 1.0 + ( fhmn / fhmx ); | ||
at = ( fhmx - fhmn ) / fhmx; | ||
c = 1.0 / ( sqrt( 1.0 + pow( as * au, 2 ) ) + sqrt( 1.0 + pow( at * au, 2 ) ) ); |
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.
|
||
out = new Float64Array( 2 ); | ||
out = dlas2( 2.0, 3.0, 4.0, out ); | ||
expected = new Float64Array( [ 1.5513263285176897, 5.1568776039816795 ] ); |
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.
@Pranavchiku How did you compute these expected values? R, Mathematica, something else? It would be good to include a comment here (as we do in other parts of the codebase) specifying how expected values were computed.
t.end(); | ||
}); | ||
|
||
tape( 'the function computes the eigenvalues of a 2x2 symmetric matrix', 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.
I believe you are computing singular values, not eigenvalues values. Applies here and elsewhere.
t.end(); | ||
}); | ||
|
||
tape( 'the function supports complex access pattern to store computed values', 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.
@Pranavchiku You need to include the tests from test.dlas2.js
here. Don't take shortcuts. It is not a given that the underlying implementation is the same for the main and ndarray exports. Always test to the interface, NOT the implementation.
t.end(); | ||
}); | ||
|
||
tape( 'the function supports accessing elements in reverse order to store computed values', 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.
tape( 'the function supports accessing elements in reverse order to store computed values', function test( t ) { | |
tape( 'the function supports a negative `out` stride', function test( t ) { |
Follow the conventions found elsewhere for test descriptions.
t.end(); | ||
}); | ||
|
||
tape( 'the function supports complex access pattern to store computed values', 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.
Having such a test is fine ("complex access patterns"), but you also should have tests for specific behavior. E.g., "the function supports an out
stride", "the function supports supports an out
offset", etc, where you hold everything constant except for the behavior you want to test. Tests should build on one another.
Towards #2464.
Description
This pull request adds JS implementation for
lapack/base/dlas2
.Related Issues
NA
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers