Skip to content

feat: add lapack/base/dlasyf - #15824

Open
benatsf wants to merge 2 commits into
stdlib-js:developfrom
benatsf:feat/lapack-dlasyf
Open

benatsf wants to merge 2 commits into
stdlib-js:developfrom
benatsf:feat/lapack-dlasyf

Conversation

@benatsf

@benatsf benatsf commented Oct 2, 2026 •

Copy link
Copy Markdown

Description

Add lapack/base/dlasyf to compute a partial symmetric indefinite Bunch–Kaufman factorization panel. The routine updates the stored triangle and workspace, returns numeric INFO, writes the produced column count to KB, and writes only the produced prefix or suffix of signed, one-based ordinary Bunch–Kaufman pivots. Adjacent negative pivot values remain equal; this is the ordinary pivot format rather than the distinct-pair rook format.

This is one complete package with JavaScript and C implementations, a Node-API binding, explicit JavaScript fallback, contiguous and independently strided APIs, declarations, examples and bounded benchmarks. Pivot search and panel updates follow the pinned reference order. Package-local allocation-free first-maximum and ordered GEMV/triangular helpers preserve the required semantics; the existing copy/scale/swap dependencies remain unchanged. A bounded, rebased copy adapter keeps the implementation correct across the existing portable and Fortran dependency configurations.

Related Issues

Questions

The package proposes a ten-argument main API and sixteen-argument ndarray API. Both return numeric INFO and use mutable Int32Array outputs for KB and IPIV. Please review the proposed signatures and retained signed, one-based pivot convention.

The documented N=0 behavior is a package-local safe quick return: scalar arguments and the active KB slot are validated, that slot becomes zero, and inactive A/IPIV/W arguments are not accessed. This is explicitly new behavior; the pinned unchanged reference did not successfully return for the tested empty calls.

Other

Reference implementation: DLASYF at Reference-LAPACK commit 2e5d9c1. The derived triangular-update helper retains the DGEMMTR/Martin Koehler attribution. Full BSD attribution and license are retained in NOTICE and the documentation.

Active public buffers must be intrinsic ordinary ArrayBuffer-backed Float64Array/Int32Array views with disjoint indexed-byte envelopes. Shared backing stores are rejected before writes. Foreign addons must not supply externally aliased ordinary buffers to the pure JavaScript path; the private bridge and C core independently check physical envelopes. Used geometry, configured LAPACK/BLAS integer arithmetic and helper loop endpoints are checked before writes or allocations. Native dispatch uses a conservative signed32 domain and explicitly falls back for valid wider JavaScript metadata. Incoming pivot values are not read, and unfactored pivot slots remain unchanged. Positive singular INFO still finishes the panel and writes KB.

Executed validation on Linux x64 with Node 24.19.0, GCC and GNU Fortran 14.2:

  • Direct public/JavaScript suite: 11,171 assertions; API suite: 54 assertions; compiled-native suite: 5,613 assertions. All exit zero with no skips in the built-native runs. Seventy-two unchanged-reference fixtures cover partial and full panels, singular statuses, pivot thresholds/ties, signed layouts, scratch cells, byte offsets, ignored triangles, padding and guard storage. Additional mathematical diagonal cases at sizes 14 and 21 cross portable copy-loop block boundaries.
  • Independent automated review runs 5,832 fresh-reference routine calls with 3,024 measured real-addon calls and 34,992 exact whole-buffer assertions, plus metadata and all six physical-alias pair checks. Its fresh reference corpus has independent partial/full reconstructions and separate SciPy checks.
  • Standalone C checks execute 4,200 numerical calls across five real portable/Fortran width configurations. ASan/UBSan finite tests execute 1,008 calls across four widths; boundary tests exercise exact integer limits and injectivity across five configurations. The addon compiles the actual Fortran copy/scale/swap dependency closure.
  • Physically removing the addon separately verifies the public JavaScript fallback, examples, bounded benchmarks and portable loading of native-dependent tests; absent-native skips are excluded from compiled-native evidence. The exact binary is restored afterward.
  • Scoped JavaScript/C/README/declaration/type/REPL/metadata/license/EditorConfig checks, actual compiled C examples and bounded C/native JavaScript benchmarks pass. JavaScript lint reports 50 warnings and zero errors. Benchmarks establish execution and make no comparative performance claim.

Finite supplied symmetric matrices are compared with the unchanged reference and reconstruction checks. This does not claim universal nonfinite or JavaScript NaN-payload parity, numerical stability for arbitrary extreme inputs, execution on other platforms, or upstream CI execution.

Checklist

AI Assistance

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

This PR was authored primarily by OpenAI Codex under benatsf’s explicit authorization. The checked contributing acknowledgment describes the delegated agents’ workflow; no personal applicant reading is claimed. The implementation agent generated the JavaScript paths, native staging, build configuration and checked-in tests. A delegated Codex agent generated the C core and bounded standalone validation; another generated documentation, declarations, examples and benchmarks. A separate Codex agent performed independent reference-backed source and runtime review. All agents used the existing upstream rules and the explicitly proposed package API. No applicant manual authorship, personal understanding or human review is claimed. Generated code and validation require the same upstream scrutiny as other contributions.


@stdlib-js/reviewers

Runtime metadata correction

A follow-up commit changes only package.json's engines.node from the copied >=0.10.0 value to a conservative proposed >=8.0.0 floor. Mandatory validation imports rely on intrinsic typed-array and ArrayBuffer getters plus Symbol; optional addon requirements alone were not used to raise other packages' JavaScript floors. Actual isolated metadata/format checks and independent import/empty-input checks passed on Node 24 with the addon physically absent. This does not establish an exact historical minimum or claim tested Node 8/native compatibility. The algorithm, tests and original frozen validation evidence remain unchanged. This correction and its independent review were performed by Codex; no applicant manual review is claimed.

Implement the partial Bunch–Kaufman panel with JavaScript and C paths, checked output staging, reference-order helpers and regression coverage.

AI-assisted implementation, tests, documentation and independent automated review by OpenAI Codex under benatsf’s authorization. The public API is proposed under RFC stdlib-js#2464.

Assisted-by: OpenAI Codex
@benatsf
benatsf requested a review from a team October 2, 2026 21:08
@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. and removed Needs Review A pull request which needs code review. 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