Skip to content

feat: add lapack/base/dlantr - #15808

Open
benatsf wants to merge 1 commit into
stdlib-js:developfrom
benatsf:feat/lapack-dlantr
Open

benatsf wants to merge 1 commit into
stdlib-js:developfrom
benatsf:feat/lapack-dlantr

Conversation

@benatsf

@benatsf benatsf commented Oct 2, 2026

Copy link
Copy Markdown

Refs #14631.

Description

The accepted LAPACK implementation RFC lists dlantr, which is currently missing. This PR adds JavaScript and C implementations of all four norms of double-precision triangular and trapezoidal matrices, including row-major/column-major storage, arbitrary ndarray strides and offsets, and an optional Node-API addon.

Unit diagonal entries are never read; the unused triangle and padding are also ignored. Scaled Frobenius accumulation avoids unnecessary overflow and underflow, referenced NaNs propagate even alongside infinities, and infinity-norm workspace retains its explicit size/stride requirements. The JavaScript interface uses four package-local canonical norm names and the adopted BLAS layout/triangle/diagonal options; the C API supports LAPACK character aliases. The numerical routine is self-contained and does not depend on an open DLASSQ refactor.

The package includes declarations, documentation, public headers, build manifests, examples, benchmarks and regression coverage. LAPACK adaptation provenance and its BSD redistribution terms are retained in NOTICE; the SciPy fixture runner makes the independent oracle results reproducible.

Related Issues

Validation

  • Built and loaded the real addon on Linux x86_64 with Node 24.19.0 and GCC 14.2.0. Direct public, JavaScript and native suites pass 5,703 assertions, with zero skipped native tests. Other platforms were not tested.
  • Independent SciPy 1.17.0 fixtures cover upper/lower rectangular and square matrices, all four norms, unit/non-unit diagonal, huge/tiny/subnormal values, NaN/infinity combinations, negative strides, padded leading dimensions, typed-array byte offsets, unchanged inputs and workspace guards. The checked-in runner exactly regenerates all 144 expected norm values. A separate Codex agent independently checked 1,740 SciPy comparisons, 90 API probes per backend, and 16 C checks each in LP64 and ILP64 builds.
  • A fresh process with the binary absent selects the JavaScript implementation; the optional native suite loads and deliberately skips when unavailable. The built validation runs every native assertion.
  • Applicable JavaScript/C/Markdown/TypeScript/Python/package/REPL/license lint and both upstream EditorConfig configurations pass. The installed lint dependencies emit a deprecation warning; the Python linter emits a warning about the existing upstream configuration. No source lint errors remain. TypeScript 4.9.5 verifies 10 expected errors and four numeric return results, including numeric enum calls.
  • JavaScript and compiled C examples execute; all 16 bounded JS/native and 12 C benchmark runs complete. No performance improvement is claimed.

Questions

No.

Other

This implements one routine from the accepted RFC and does not close the whole tracking issue. No shared helper or dependency source is modified.

Checklist

AI Assistance

  • Yes

  • No

  • Code generation

  • Test/benchmark generation

  • Documentation (including examples)

  • Research and understanding

Disclosure

This contribution was authored primarily with OpenAI Codex. Codex generated the implementations, Node-API bridge, build metadata, tests, benchmarks and documentation; reviewed the LAPACK reference algorithm and license; generated and regenerated independent SciPy fixtures; and ran the recorded validation. A second Codex agent independently reviewed and exercised the numerical/native implementation. The contributing-guidelines acknowledgment records Codex's review and application of the guidelines under benatsf's explicit authorization to contribute. It does not claim that benatsf personally read the guide or manually reviewed the code. No manual applicant review is claimed.


@stdlib-js/reviewers

Implement triangular and trapezoidal matrix norms with JavaScript and native C interfaces, scaled Frobenius accumulation, independent LAPACK fixtures, indexed storage coverage and package documentation.

Assisted-by: OpenAI Codex
@benatsf
benatsf requested a review from a team October 2, 2026 12:18
@stdlib-bot stdlib-bot added LAPACK Issue or pull request related to the Linear Algebra Package (LAPACK). Needs Review A pull request which needs code review. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. labels Oct 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor A pull request from a contributor who has never previously committed to the project repository. LAPACK Issue or pull request related to the Linear Algebra Package (LAPACK). Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants