You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have questions about stdlib? Need help fixing a bug, figuring out what to do next, or just looking for feedback? Join our weekly office hours to connect with project maintainers, stay updated on the latest project news, and chat with other community members. This is a great opportunity to ask questions, share ideas, and engage directly with the stdlib team.
I was looking at custom array methods, and I was wondering why not provide a default ordering and only use a custom compareFcn when the user supplies one?
I have a doubt regarding tests, we use ULP difference to see whether tests are passing or not. But, near-zero values like 2.4e-17 and -4.6e-19 are both essentially zero and they differ by ~9e18 ULPs due to opposite signs. This is causing my tests to fail. Is there any other way to write tests?
For the dorgqr routine, I have tried to implement the mathematical verification test. Does this look fine?
tape('the function generates an `M-by-N` real matrix `Q` with orthonormal columns (multiple blocks, mathematical verification)',functiontest(t){varWORK;varinfo;varTAU;varLDA;varQT;varA;varC;varM;varN;varK;vari;varI;varQ;M=162;N=162;K=161;LDA=M;A=newFloat64Array(M*N);TAU=newFloat64Array(K);WORK=newFloat64Array(2*N);for(i=0;i<N;i++){A[i+(i*LDA)]=1.0;}for(i=0;i<K;i++){TAU[i]=2.0;}info=dorgqr('column-major',M,N,K,A,LDA,TAU,WORK,2*N);Q=ctor('float64',A,[M,N],[1,LDA],0,'column-major');// Create ndarray view of QQT=transpose(Q);// Compute Q^TC=newFloat64Array(N*N);// Compute C = Q^T * Qdgemm('no-transpose','no-transpose',N,N,M,1.0,QT.data,QT.strides[0],QT.strides[1],QT.offset,Q.data,Q.strides[0],Q.strides[1],Q.offset,0.0,C,1,N,0);// Compute C = Q^T * QI=newFloat64Array(N*N);// Create identity matrixfor(i=0;i<N;i++){I[i+(i*N)]=1.0;}t.strictEqual(info,0,'returns expected value');t.strictEqual(isAlmostEqual(C,I,1),true,'Q^T * Q equals identity matrix');t.end();});
These notes are likely imperfect, especially when it comes to spelling/function/package names
Meeting Purpose
Resolve technical questions and align on best practices for development.
Key Takeaways
array-uint64 Sorting: Implement a default sort by comparing high then low words. Wrap user-provided comparators to ensure they receive uint64 instances, not raw buffer values.
Test Failures Near Zero: For values near zero with sign differences, use an absolute tolerance (abs(value) < eps) instead of ULP comparisons, which fail due to the large ULP distance across zero.
Test Fixture Optimization: To reduce large fixture sizes, Prajjwal will test a strategy of storing only column-major data and dynamically converting it to row-major for testing.
README Best Practices: Prioritize user clarity by hiding non-essential info (e.g., ESLint comments) in README examples. Use existing high-level APIs (e.g., random for real numbers) to simplify code.
Topics
array-uint64 Custom Sort
Problem: The array-uint64 sort implementation lacks a default comparator.
Rationale: Unlike complex numbers, uint64 values have a total order, making a default sort necessary for consistency with other array types (e.g., array-bool).
Solution:
Default Comparator: Define a function to sort by comparing high words, then low words.
User Comparator: Wrap user-provided functions to ensure they receive uint64 instances, not raw buffer values.
Scope: The default comparator can be defined in the parent scope; the user wrapper must be defined within the sort method.
Test Failures Near Zero
Problem: ULP comparisons fail for values near zero with opposite signs (e.g., +1e-308 vs. -1e-308), which have a large ULP distance but are mathematically equivalent.
Solution:
Absolute Tolerance: For values expected to be near zero, use an absolute tolerance check: abs(value) < eps. This handles sign differences correctly.
ULP Comparison: Continue using ULP comparisons for all other values where signs are expected to match.
Optimizing Mathematical Verification Tests
Context: Prajjwal is writing mathematical verification tests (e.g., Q * Q^T = I) to supplement Fortran reference tests.
Optimizations:
Transpose: Use DGETrans instead of manual buffer manipulation.
Identity Matrix: Use DLAset with alpha=0, beta=1 to create an identity matrix.
Fixture Optimization Idea:
Proposal: Store only column-major data in JSON fixtures.
Method: Dynamically convert column-major data to row-major for testing using DGETrans.
Goal: Reduce large fixture sizes and simplify maintenance.
README & Example Best Practices
Problem: recent PRs used complex number random-generation logic for real-valued arrays and included ESLint comments in README examples.
Rationale for Corrections:
API Usage: Use existing high-level APIs (e.g., random for real numbers) to simplify code. The complex number logic is a temporary workaround for a missing API and should not be generalized.
README Clarity: Hide non-essential info (e.g., ESLint comments) from users. Use HTML comments (<!-- eslint-disable -->) to hide linter directives in markdown, ensuring examples are clean and focused.
Activity
DivitJain26 commentedon Jul 14, 2026
array/uint64stdlib#12562 is ready for review.compareFcnwhen the user supplies one?prajjwalbajpai commentedon Jul 14, 2026
0PrashantYadav0 commentedon Jul 14, 2026
Discussion on this issues: stdlib-js/stdlib#13468
batpigandme commentedon Jul 14, 2026
AI-Generated Summary
Caution
These notes are likely imperfect, especially when it comes to spelling/function/package names
Meeting Purpose
Resolve technical questions and align on best practices for development.
Key Takeaways
array-uint64Sorting: Implement a default sort by comparing high then low words. Wrap user-provided comparators to ensure they receiveuint64instances, not raw buffer values.abs(value) < eps) instead of ULP comparisons, which fail due to the large ULP distance across zero.randomfor real numbers) to simplify code.Topics
array-uint64Custom Sortarray-uint64sort implementation lacks a default comparator.uint64values have a total order, making a default sort necessary for consistency with other array types (e.g.,array-bool).uint64instances, not raw buffer values.Test Failures Near Zero
+1e-308vs.-1e-308), which have a large ULP distance but are mathematically equivalent.abs(value) < eps. This handles sign differences correctly.Optimizing Mathematical Verification Tests
Q * Q^T = I) to supplement Fortran reference tests.DGETransinstead of manual buffer manipulation.DLAsetwithalpha=0, beta=1to create an identity matrix.DGETrans.README & Example Best Practices
randomfor real numbers) to simplify code. The complex number logic is a temporary workaround for a missing API and should not be generalized.<!-- eslint-disable -->) to hide linter directives in markdown, ensuring examples are clean and focused.Full transcript
Full office hours transcript