diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/NOTICE b/lib/node_modules/@stdlib/lapack/base/dpstf2/NOTICE new file mode 100644 index 000000000000..4b7f630c6bab --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/NOTICE @@ -0,0 +1,50 @@ +This package derives the DPSTF2 complete-pivoting Cholesky algorithm and narrow private ordered DGEMV loops from Reference-LAPACK commit 2e5d9c1273435fbd953adb294ed603e4789afaba. The private maximum compares candidate diagonal values and retains first ties. Positive one-based permutations and reference finite operation order are retained. The safe empty rank-only branch is new proposed package behavior, not unchanged reference parity. See the source comments and accompanying documentation for the proposed API and ordinary backing-store limitations. + +Copyright (c) 1992-2025 The University of Tennessee and The University + of Tennessee Research Foundation. All rights + reserved. +Copyright (c) 2000-2025 The University of California Berkeley. All + rights reserved. +Copyright (c) 2006-2025 The University of Colorado Denver. All rights + reserved. + +$COPYRIGHT$ + +Additional copyrights may follow + +$HEADER$ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + +- Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +The copyright holders provide no reassurances that the source code +provided does not infringe any patent, copyright, or any other +intellectual property rights of third parties. The copyright holders +disclaim any liability to any recipient for claims brought against +recipient by any third party for infringement of that parties +intellectual property rights. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/README.md b/lib/node_modules/@stdlib/lapack/base/dpstf2/README.md new file mode 100644 index 000000000000..46527b519dff --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/README.md @@ -0,0 +1,357 @@ + + +# dpstf2 + +> Compute an unblocked Cholesky factorization with complete pivoting. + +
+ +Computes the pivoted Cholesky factorization of a real symmetric positive semidefinite matrix, using the selected upper or lower triangle. The factorization is in place and returns its numeric status separately from the numerical rank and full permutation. A user-specified tolerance may stop the factorization early. + +
+ + + +
+ +## Usage + +```javascript +var dpstf2 = require( '@stdlib/lapack/base/dpstf2' ); +``` + +#### dpstf2( order, uplo, N, A, LDA, PIV, RANK, TOL, WORK ) + +Factors the selected triangle in place, returns numeric `INFO`, and writes the numerical rank to `RANK[0]`. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); + +var A = new Float64Array( [ 4.0, 0.0, 999.0, 1.0 ] ); +var PIV = new Int32Array( 2 ); +var RANK = new Int32Array( 1 ); +var WORK = new Float64Array( 4 ); + +var info = dpstf2( 'row-major', 'upper', 2, A, 2, PIV, RANK, -1.0, WORK ); +// returns 0 +// RANK => [ 2 ] +// PIV => [ 1, 2 ] +// A => [ 2.0, 0.0, 999.0, 1.0 ] +``` + +The function has the following parameters: + +- **order**: `'row-major'` (`101`) or `'column-major'` (`102`). +- **uplo**: `'upper'` (`121`) or `'lower'` (`122`). +- **N**: nonnegative safe integer matrix order, at most `2147483647`. +- **A**: input/output `Float64Array` containing a full `N`-by-`N` matrix view. +- **LDA**: matrix leading dimension, at least `max(1,N)`. +- **PIV**: output `Int32Array` with `N` indexed entries; a complete positive 1-based permutation. +- **RANK**: output `Int32Array` containing at least one active scalar. +- **TOL**: required primitive finite number; pass `-1` to request the reference default cutoff. +- **WORK**: output scratch `Float64Array` with `2*N` indexed entries. + +Row-major indexing is `A(i,j)=A[i*LDA+j]`; column-major indexing is `A(i,j)=A[i+j*LDA]`. Indexing is relative to each actual typed-array view, including its byte offset. + + + +#### dpstf2.ndarray( uplo, N, A, strideA1, strideA2, offsetA, PIV, stridePIV, offsetPIV, RANK, offsetRANK, TOL, WORK, strideWORK, offsetWORK ) + +Factors using explicit element strides and offsets. The function returns numeric `INFO`, and `RANK[offsetRANK]` receives the rank. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); + +var A = new Float64Array( [ 9.0, 1.0, 0.0, 999.0, 4.0, 9.0 ] ); +var PIV = new Int32Array( [ 8, -99, -99, 8 ] ); +var RANK = new Int32Array( [ 7, -9, 7 ] ); +var WORK = new Float64Array( 6 ); + +var info = dpstf2.ndarray( 'lower', 2, A, -2, -1, 4, PIV, -1, 2, RANK, 1, -1.0, WORK, -1, 4 ); +// returns 0 +// RANK => [ 7, 2, 7 ] +// PIV => [ 8, 2, 1, 8 ] +// A => [ 9.0, 1.0, 0.0, 999.0, 2.0, 9.0 ] +``` + +The matrix is indexed as `A[offsetA+i*strideA1+j*strideA2]`, permutation as `PIV[offsetPIV+i*stridePIV]`, and scratch as `WORK[offsetWORK+i*strideWORK]`. All strides and offsets are element indices relative to the actual typed-array views. Matrix row/column strides and vector strides may be positive or negative. + +
+ + + +
+ +## Notes + +- `INFO=0` indicates a complete factorization. `INFO=1` indicates termination at a deficient or nonpositive remaining pivot, including a user-selected cutoff; `RANK` contains the number of completed steps. The routine does not certify positive semidefiniteness. For example, a zero-diagonal indefinite matrix can return rank zero without inspecting off-diagonal entries. +- `PIV` is a complete **positive 1-based** permutation of `1..N`, including early termination. Its entries are not signed block pivots or zero-based indices. If `P(PIV(k)-1,k)=1`, the permuted matrix is factored as `P^T A P=U^T U` or `P^T A P=L L^T`. Incoming `PIV` and `RANK` contents are not input. +- The first positive maximum diagonal is accepted before testing `TOL`. Subsequent candidates stop when `candidate<=cutoff`. A negative `TOL` requests `N*2^-53*max(initial diagonal)`; a nonnegative `TOL` is used directly. Thus a positive 1-by-1 matrix completes even when its diagonal is below the supplied tolerance. +- Only the selected triangle of `A` is read or modified. Ignored triangle, padding, and guards remain unchanged. `WORK` is output scratch, not a factorization result. If the initial maximum is nonpositive, scratch is unchanged; otherwise the first half is initialized to zero and the second half receives candidate diagonals. Prior scratch contents do not affect defined results. +- Finite stored-triangle inputs with finite intermediate arithmetic define the reference-comparison domain. Ignored storage and incoming scratch may contain NaNs. Active NaN/Infinity inputs and intermediate overflow have no universal factorization or bit-parity guarantee. +- For `N>0`, full `N`-by-`N` matrix, `N`-element permutation, one-element rank, and `2*N`-element scratch views must fit their buffers. All active metadata and indexing must use exact safe integers. The matrix must be injective; mutable vector strides cannot be zero when the extent exceeds one. Positive and negative strides are supported. +- Every active typed-array backing store must be an intrinsic ordinary `ArrayBuffer`. `SharedArrayBuffer` views, including shared storage returned by `structuredClone`, throw `TypeError` before routine-owned writes. Shadowed buffer/length properties do not change the intrinsic requirements. TypeScript declarations cannot encode this runtime precondition. +- All four active views must have pairwise disjoint conservative **indexed-byte envelopes**, even if interleaved active slots differ. Disjoint subviews of one ordinary `ArrayBuffer` are allowed. The caller must exclude exotic ordinary buffers whose physical memory is externally aliased by foreign addons; the native bridge also checks actual pointer-byte envelopes. +- Scalar validation checks layout/triangle and `N`, then required primitive finite `TOL`, then main-interface `LDA`, then active `RANK`. For `N=0`, only `RANK[0]` (or `RANK[offsetRANK]`) is written to zero, and the function returns `0` without inspecting `A`, `PIV`, `WORK`, or unused ndarray metadata. Inactive storage aliased to `RANK` may observe that scalar write. This empty convention is package-defined, not unchanged Reference-LAPACK rank parity. +- Invalid selectors, active types/backing stores, or nonprimitive `TOL` throw `TypeError`. Invalid dimensions, nonfinite `TOL`, active metadata, bounds, collisions, and envelope overlap throw `RangeError` before routine-owned writes. This excludes caller-defined getter side effects and unsupported concurrent external mutation. +- An unavailable addon or valid public metadata outside its conservative configured native helper domain uses the validated JavaScript implementation. Native integer widths are not silently narrowed; native staging allocation failure throws before routine-owned writes. + +
+ + + +
+ +## Examples + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var dpstf2 = require( '@stdlib/lapack/base/dpstf2' ); + +var A = new Float64Array( [ 1.0, 0.0, 0.0, 999.0, 0.0, 0.0, 999.0, 999.0, 4.0 ] ); +var WORK = new Float64Array( 6 ); +var PIV = new Int32Array( [ -99, -99, -99 ] ); +var RANK = new Int32Array( 1 ); +var info; + +// A rank-deficient diagonal matrix still produces a complete permutation: +info = dpstf2( 'row-major', 'upper', 3, A, 3, PIV, RANK, -1.0, WORK ); +if ( + info !== 1 || + RANK[ 0 ] !== 2 || + PIV[ 0 ] !== 3 || + PIV[ 1 ] !== 1 || + PIV[ 2 ] !== 2 || + A[ 0 ] !== 2.0 || + A[ 4 ] !== 1.0 || + A[ 8 ] !== 0.0 || + A[ 3 ] !== 999.0 || + A[ 6 ] !== 999.0 || + A[ 7 ] !== 999.0 +) { + throw new Error( 'Unexpected rank-deficient factorization.' ); +} +console.log( 'INFO: %d; RANK: %d', info, RANK[ 0 ] ); +console.log( 'Pivots: %s', PIV.join( ', ' ) ); + +// A lower diagonal matrix using negative strides and guarded output views: +A = new Float64Array( [ 9.0, 1.0, 0.0, 999.0, 4.0, 9.0 ] ); +WORK = new Float64Array( 6 ); +PIV = new Int32Array( [ 8, -99, -99, 8 ] ); +RANK = new Int32Array( [ 7, -9, 7 ] ); +info = dpstf2.ndarray( 'lower', 2, A, -2, -1, 4, PIV, -1, 2, RANK, 1, -1.0, WORK, -1, 4 ); +if ( + info !== 0 || + RANK[ 0 ] !== 7 || + RANK[ 1 ] !== 2 || + RANK[ 2 ] !== 7 || + PIV[ 0 ] !== 8 || + PIV[ 1 ] !== 2 || + PIV[ 2 ] !== 1 || + PIV[ 3 ] !== 8 || + A[ 0 ] !== 9.0 || + A[ 1 ] !== 1.0 || + A[ 3 ] !== 999.0 || + A[ 4 ] !== 2.0 || + A[ 5 ] !== 9.0 +) { + throw new Error( 'Unexpected strided factorization.' ); +} +console.log( 'Strided INFO: %d; RANK: %d', info, RANK[ 1 ] ); +console.log( 'Guarded pivots: %s', PIV.join( ', ' ) ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + +
+ +C metadata and outputs use configured `LAPACK_INT` and functions use `API_SUFFIX`. Pivots remain complete positive 1-based outputs, `RANK` points to a separate scalar, and the return value is numeric `INFO`. Sufficient allocated storage and stable exclusive backing are caller preconditions. + +
+ + + +
+ +### Usage + +```c +#include "stdlib/lapack/base/dpstf2.h" +``` + +#### c_dpstf2( layout, uplo, N, A, LDA, PIV, RANK, TOL, WORK ) + +`layout` is `LAPACK_ROW_MAJOR` or `LAPACK_COL_MAJOR`; `uplo` is `LAPACK_UPPER_TRIANGLE` or `LAPACK_LOWER_TRIANGLE`. Buffer, tolerance, and output meanings match the JavaScript interface. + +```c +LAPACK_INT API_SUFFIX(c_dpstf2)( const LAPACK_LAYOUT layout, const LAPACK_UPLO uplo, const LAPACK_INT N, double *A, const LAPACK_INT LDA, LAPACK_INT *PIV, LAPACK_INT *RANK, const double TOL, double *WORK ); +``` + +The return is `INFO=0` or `1`, or a negative rejected argument position: layout `-1`, uplo `-2`, N/count guards `-3`, A `-4`, LDA/helper-stride guards `-5`, PIV `-6`, RANK `-7`, nonfinite TOL `-8`, WORK `-9`. + + + +#### c_dpstf2_ndarray( uplo, N, A, strideA1, strideA2, offsetA, PIV, stridePIV, offsetPIV, RANK, offsetRANK, TOL, WORK, strideWORK, offsetWORK ) + +Uses explicit element strides and offsets. + +```c +LAPACK_INT API_SUFFIX(c_dpstf2_ndarray)( const LAPACK_UPLO uplo, const LAPACK_INT N, double *A, const LAPACK_INT strideA1, const LAPACK_INT strideA2, const LAPACK_INT offsetA, LAPACK_INT *PIV, const LAPACK_INT stridePIV, const LAPACK_INT offsetPIV, LAPACK_INT *RANK, const LAPACK_INT offsetRANK, const double TOL, double *WORK, const LAPACK_INT strideWORK, const LAPACK_INT offsetWORK ); +``` + +Negative positions are uplo `-1`, N/count guards `-2`, A `-3`, strideA1 `-4`, strideA2 `-5`, offsetA `-6`, PIV `-7`, stridePIV `-8`, offsetPIV `-9`, RANK `-10`, offsetRANK `-11`, nonfinite TOL `-12`, WORK `-13`, strideWORK `-14`, offsetWORK `-15`. Matrix collisions map to the second matrix stride; physical-envelope overlap maps to the later validated buffer. + +The C validation order is selectors/N/TOL, main LDA, active RANK, then A/PIV/WORK. Geometry, integer/count/helper intermediates, pointer-byte representability and physical-envelope disjointness are checked before writes. Capacities cannot be inferred from pointers. `LAPACK_INT`, actual called BLAS/Fortran integer widths and an API64 suffix are distinct configuration choices and must not be narrowed unchecked. For `N=0`, only the validated RANK scalar is written to zero; inactive pointers and unused ndarray metadata are not accessed. This is package-defined empty behavior, not original-reference rank parity. + +
+ + + +
+ +### Examples + +```c +#include "stdlib/lapack/base/dpstf2.h" +#include "stdlib/lapack/base/shared.h" +#include + +int main( void ) { + double A[] = { 4.0, 0.0, 999.0, 1.0 }; + double WORK[ 4 ] = { 0.0, 0.0, 0.0, 0.0 }; + LAPACK_INT PIV[ 2 ] = { -99, -99 }; + LAPACK_INT RANK = -9; + LAPACK_INT info; + + info = API_SUFFIX(c_dpstf2)( LAPACK_ROW_MAJOR, LAPACK_UPPER_TRIANGLE, 2, A, 2, PIV, &RANK, -1.0, WORK ); + if ( info != 0 || RANK != 2 || PIV[ 0 ] != 1 || PIV[ 1 ] != 2 || A[ 2 ] != 999.0 ) { + return 1; + } + printf( "INFO: %d; RANK: %d\n", (int)info, (int)RANK ); + return 0; +} +``` + +
+ + + +
+ + + +
+ +## References + +The factorization is adapted from [Reference-LAPACK `DPSTF2`][lapack-source] at commit `2e5d9c1273435fbd953adb294ed603e4789afaba`. Package-local ordered accumulation helpers follow [reference `DGEMV`][dgemv-source] and retain its arithmetic order across layouts. The original copyright, conditions and disclaimer are retained in [NOTICE][lapack-notice] and reproduced below for source and binary distributions. The public API, validation and rank-zero empty convention are package adaptations. + +```text +Copyright (c) 1992-2025 The University of Tennessee and The University + of Tennessee Research Foundation. All rights + reserved. +Copyright (c) 2000-2025 The University of California Berkeley. All + rights reserved. +Copyright (c) 2006-2025 The University of Colorado Denver. All rights + reserved. + +$COPYRIGHT$ + +Additional copyrights may follow + +$HEADER$ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + +- Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +The copyright holders provide no reassurances that the source code +provided does not infringe any patent, copyright, or any other +intellectual property rights of third parties. The copyright holders +disclaim any liability to any recipient for claims brought against +recipient by any third party for infringement of that parties +intellectual property rights. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/benchmark.js new file mode 100644 index 000000000000..5f3ee891364f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/benchmark.js @@ -0,0 +1,146 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dpstf2 = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a bounded reset-and-factor benchmark. +* +* @private +* @param {PositiveInteger} N - matrix order +* @param {string} uplo - stored triangle +* @param {boolean} truncated - whether to use a cutoff after the first step +* @returns {Function} benchmark function +*/ +function createBenchmark( N, uplo, truncated ) { + var original; + var WORK; + var RANK; + var PIV; + var tol; + var A; + var i; + var j; + + original = new Float64Array( N*N ); + A = new Float64Array( N*N ); + WORK = new Float64Array( 2*N ); + PIV = new Int32Array( N ); + RANK = new Int32Array( 1 ); + tol = ( truncated ) ? N+2.0 : -1.0; + for ( i = 0; i < N; i++ ) { + for ( j = 0; j < N; j++ ) { + if ( i === j ) { + original[ (i*N)+j ] = N + 2.0; + } else if ( ( uplo === 'upper' && i < j ) || ( uplo === 'lower' && i > j ) ) { + original[ (i*N)+j ] = 0.25; + } else { + original[ (i*N)+j ] = 999.0; + } + } + } + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var expectedInfo; + var expectedRank; + var info; + var i; + + expectedInfo = ( truncated ) ? 1 : 0; + expectedRank = ( truncated ) ? 1 : N; + info = 0; + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + // Reset the changed matrix before each factorization: + A.set( original ); + info = dpstf2( 'row-major', uplo, N, A, N, PIV, RANK, tol, WORK ); + if ( info !== expectedInfo || RANK[ 0 ] !== expectedRank ) { + b.fail( 'should produce the expected factorization status and rank' ); + break; + } + } + b.toc(); + for ( i = 0; i < N; i++ ) { + if ( PIV[ i ] !== i+1 ) { + b.fail( 'should produce the complete identity permutation' ); + break; + } + } + if ( ( uplo === 'upper' && A[ N ] !== 999.0 ) || ( uplo === 'lower' && A[ 1 ] !== 999.0 ) ) { + b.fail( 'should preserve the ignored triangle' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var options; + var sizes; + var uplos; + var name; + var fcn; + var i; + var j; + var k; + + options = { + 'iterations': 200, + 'repeats': 2 + }; + sizes = [ 8, 16 ]; + uplos = [ 'upper', 'lower' ]; + for ( i = 0; i < sizes.length; i++ ) { + for ( j = 0; j < uplos.length; j++ ) { + for ( k = 0; k < 2; k++ ) { + name = format( '%s:triangle=%s:N=%d:cutoff=%s', pkg, uplos[ j ], sizes[ i ], ( k ) ? 'user' : 'default' ); + fcn = createBenchmark( sizes[ i ], uplos[ j ], k === 1 ); + bench( name, options, fcn ); + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..0562fc020921 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/benchmark.ndarray.js @@ -0,0 +1,146 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dpstf2 = require( './../lib' ).ndarray; + + +// FUNCTIONS // + +/** +* Creates a bounded reset-and-factor benchmark. +* +* @private +* @param {PositiveInteger} N - matrix order +* @param {string} uplo - stored triangle +* @param {boolean} truncated - whether to use a cutoff after the first step +* @returns {Function} benchmark function +*/ +function createBenchmark( N, uplo, truncated ) { + var original; + var WORK; + var RANK; + var PIV; + var tol; + var A; + var i; + var j; + + original = new Float64Array( N*N ); + A = new Float64Array( N*N ); + WORK = new Float64Array( 2*N ); + PIV = new Int32Array( N ); + RANK = new Int32Array( 1 ); + tol = ( truncated ) ? N+2.0 : -1.0; + for ( i = 0; i < N; i++ ) { + for ( j = 0; j < N; j++ ) { + if ( i === j ) { + original[ (i*N)+j ] = N + 2.0; + } else if ( ( uplo === 'upper' && i < j ) || ( uplo === 'lower' && i > j ) ) { + original[ (i*N)+j ] = 0.25; + } else { + original[ (i*N)+j ] = 999.0; + } + } + } + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var expectedInfo; + var expectedRank; + var info; + var i; + + expectedInfo = ( truncated ) ? 1 : 0; + expectedRank = ( truncated ) ? 1 : N; + info = 0; + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + // Reset the changed matrix before each factorization: + A.set( original ); + info = dpstf2( uplo, N, A, N, 1, 0, PIV, 1, 0, RANK, 0, tol, WORK, 1, 0 ); // eslint-disable-line max-len + if ( info !== expectedInfo || RANK[ 0 ] !== expectedRank ) { + b.fail( 'should produce the expected factorization status and rank' ); + break; + } + } + b.toc(); + for ( i = 0; i < N; i++ ) { + if ( PIV[ i ] !== i+1 ) { + b.fail( 'should produce the complete identity permutation' ); + break; + } + } + if ( ( uplo === 'upper' && A[ N ] !== 999.0 ) || ( uplo === 'lower' && A[ 1 ] !== 999.0 ) ) { + b.fail( 'should preserve the ignored triangle' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var options; + var sizes; + var uplos; + var name; + var fcn; + var i; + var j; + var k; + + options = { + 'iterations': 200, + 'repeats': 2 + }; + sizes = [ 8, 16 ]; + uplos = [ 'upper', 'lower' ]; + for ( i = 0; i < sizes.length; i++ ) { + for ( j = 0; j < uplos.length; j++ ) { + for ( k = 0; k < 2; k++ ) { + name = format( '%s:ndarray:triangle=%s:N=%d:cutoff=%s', pkg, uplos[ j ], sizes[ i ], ( k ) ? 'user' : 'default' ); + fcn = createBenchmark( sizes[ i ], uplos[ j ], k === 1 ); + bench( name, options, fcn ); + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/c/Makefile b/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/c/Makefile new file mode 100644 index 000000000000..979768abbcec --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := benchmark.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled benchmarks. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/c/benchmark.c new file mode 100644 index 000000000000..e42fd7adcfae --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/benchmark/c/benchmark.c @@ -0,0 +1,182 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/lapack/base/dpstf2.h" +#include "stdlib/lapack/base/shared.h" +#include +#include +#include +#include + +#define ITERATIONS 200 +#define REPEATS 2 + +/** +* Returns a clock time in seconds. +* +* @return clock time +*/ +static double tic( void ) { + struct timeval now; + gettimeofday( &now, NULL ); + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; +} + +/** +* Resets and factors a bounded matrix, then validates its outputs. +* +* @param N matrix order +* @param uplo selected triangle +* @param ndarray whether to use explicit indexing +* @param truncated whether to stop using a cutoff after the first step +* @return elapsed seconds or -1 on failure +*/ +static double benchmark( const LAPACK_INT N, const LAPACK_UPLO uplo, const int ndarray, const int truncated ) { + double *original; + double *WORK; + double *A; + LAPACK_INT *PIV; + LAPACK_INT RANK; + LAPACK_INT expectedRank; + LAPACK_INT expectedInfo; + LAPACK_INT info; + LAPACK_INT i; + LAPACK_INT j; + double elapsed; + double tol; + double t; + int k; + + original = (double *)malloc( (size_t)(N*N) * sizeof( double ) ); + A = (double *)malloc( (size_t)(N*N) * sizeof( double ) ); + WORK = (double *)malloc( (size_t)(2*N) * sizeof( double ) ); + PIV = (LAPACK_INT *)malloc( (size_t)N * sizeof( LAPACK_INT ) ); + if ( original == NULL || A == NULL || WORK == NULL || PIV == NULL ) { + fprintf( stderr, "Error allocating bounded benchmark buffers.\n" ); + free( original ); + free( A ); + free( WORK ); + free( PIV ); + return -1.0; + } + for ( i = 0; i < N; i++ ) { + PIV[ i ] = -99; + for ( j = 0; j < N; j++ ) { + if ( i == j ) { + original[ (i*N)+j ] = (double)N + 2.0; + } else if ( ( uplo == LAPACK_UPPER_TRIANGLE && i < j ) || ( uplo == LAPACK_LOWER_TRIANGLE && i > j ) ) { + original[ (i*N)+j ] = 0.25; + } else { + original[ (i*N)+j ] = 999.0; + } + } + } + for ( i = 0; i < 2*N; i++ ) { + WORK[ i ] = -9.0; + } + expectedRank = truncated ? 1 : N; + expectedInfo = truncated ? 1 : 0; + tol = truncated ? (double)N+2.0 : -1.0; + RANK = -9; + info = -9; + t = tic(); + for ( k = 0; k < ITERATIONS; k++ ) { + // Include resetting the changed input in the measured workload: + memcpy( A, original, (size_t)(N*N) * sizeof( double ) ); + if ( ndarray ) { + info = API_SUFFIX(c_dpstf2_ndarray)( uplo, N, A, N, 1, 0, PIV, 1, 0, &RANK, 0, tol, WORK, 1, 0 ); + } else { + info = API_SUFFIX(c_dpstf2)( LAPACK_ROW_MAJOR, uplo, N, A, N, PIV, &RANK, tol, WORK ); + } + if ( info != expectedInfo || RANK != expectedRank ) { + break; + } + } + elapsed = tic() - t; + if ( info != expectedInfo || RANK != expectedRank ) { + elapsed = -1.0; + } + for ( i = 0; i < N; i++ ) { + if ( PIV[ i ] != i+1 ) { + elapsed = -1.0; + } + for ( j = 0; j < N; j++ ) { + if ( ( uplo == LAPACK_UPPER_TRIANGLE && i > j ) || ( uplo == LAPACK_LOWER_TRIANGLE && i < j ) ) { + if ( A[ (i*N)+j ] != 999.0 ) { + elapsed = -1.0; + } + } + } + } + free( original ); + free( A ); + free( WORK ); + free( PIV ); + return elapsed; +} + +/** +* Main execution sequence. +*/ +int main( void ) { + const LAPACK_INT sizes[] = { 8, 16 }; + const LAPACK_UPLO uplos[] = { LAPACK_UPPER_TRIANGLE, LAPACK_LOWER_TRIANGLE }; + double elapsed; + int count; + int passing; + int i; + int j; + int k; + int truncated; + int r; + + count = 0; + passing = 0; + printf( "TAP version 13\n" ); + for ( i = 0; i < 2; i++ ) { + for ( j = 0; j < 2; j++ ) { + for ( k = 0; k < 2; k++ ) { + for ( truncated = 0; truncated < 2; truncated++ ) { + for ( r = 0; r < REPEATS; r++ ) { + count += 1; + printf( "# c::dpstf2:N=%d:uplo=%s:ndarray=%d:cutoff=%s\n", (int)sizes[ i ], j ? "lower" : "upper", k, truncated ? "user" : "default" ); + elapsed = benchmark( sizes[ i ], uplos[ j ], k, truncated ); + if ( elapsed < 0.0 ) { + printf( "not ok %d benchmark failed\n", count ); + } else { + printf( " ---\n" ); + printf( " iterations: %d\n", ITERATIONS ); + printf( " elapsed: %0.9f\n", elapsed ); + printf( " ...\n" ); + printf( "ok %d benchmark finished\n", count ); + passing += 1; + } + } + } + } + } + } + printf( "1..%d\n", count ); + printf( "# total %d\n", count ); + printf( "# pass %d\n", passing ); + if ( passing == count ) { + printf( "# ok\n" ); + return EXIT_SUCCESS; + } + return EXIT_FAILURE; +} diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/binding.gyp b/lib/node_modules/@stdlib/lapack/base/dpstf2/binding.gyp new file mode 100644 index 000000000000..864d9109e892 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/binding.gyp @@ -0,0 +1,265 @@ +# @license Apache-2.0 +# +# Copyright (c) 2018 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + + # Fortran compiler (to override -Dfortran_compiler=): + 'fortran_compiler%': 'gfortran', + + # Fortran compiler flags: + 'fflags': [ + # Specify the Fortran standard to which a program is expected to conform: + '-std=f95', + + # Indicate that the layout is free-form source code: + '-ffree-form', + + # Aggressive optimization: + '-O3', + + # Enable commonly used warning options: + '-Wall', + + # Warn if source code contains problematic language features: + '-Wextra', + + # Warn if a procedure is called without an explicit interface: + '-Wimplicit-interface', + + # Do not transform names of entities specified in Fortran source files by appending underscores (i.e., don't mangle names, thus allowing easier usage in C wrappers): + '-fno-underscoring', + + # Warn if source code contains Fortran 95 extensions and C-language constructs: + '-pedantic', + + # Compile but do not link (output is an object file): + '-c', + ], + + # Set variables based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + { + # Define the object file suffix: + 'obj': 'obj', + }, + { + # Define the object file suffix: + 'obj': 'o', + } + ], # end condition (OS=="win") + ], # end conditions + }, # end variables + + # Define compile targets: + 'targets': [ + + # Target to generate an add-on: + { + # The target name should match the add-on export name: + 'target_name': '<(addon_target_name)', + + # Define dependencies: + 'dependencies': [], + + # Define directories which contain relevant include headers: + 'include_dirs': [ + # Local include directory: + '<@(include_dirs)', + ], + + # List of source files: + 'sources': [ + '<@(src_files)', + ], + + # Settings which should be applied when a target's object files are used as linker input: + 'link_settings': { + # Define libraries: + 'libraries': [ + '<@(libraries)', + ], + + # Define library directories: + 'library_dirs': [ + '<@(library_dirs)', + ], + }, + + # C/C++ compiler flags: + 'cflags': [ + # Enable commonly used warning options: + '-Wall', + + # Aggressive optimization: + '-O3', + ], + + # C specific compiler flags: + 'cflags_c': [ + # Specify the C standard to which a program is expected to conform: + '-std=c99', + ], + + # C++ specific compiler flags: + 'cflags_cpp': [ + # Specify the C++ standard to which a program is expected to conform: + '-std=c++11', + ], + + # Linker flags: + 'ldflags': [], + + # Apply conditions based on the host OS: + 'conditions': [ + [ + 'OS=="mac"', + { + # Linker flags: + 'ldflags': [ + '-undefined dynamic_lookup', + '-Wl,-no-pie', + '-Wl,-search_paths_first', + ], + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', + ], + }, + ], # end condition (OS!="win") + ], # end conditions + + # Define custom build actions for particular inputs: + 'rules': [ + { + # Define a rule for processing Fortran files: + 'extension': 'f', + + # Define the pathnames to be used as inputs when performing processing: + 'inputs': [ + # Full path of the current input: + '<(RULE_INPUT_PATH)' + ], + + # Define the outputs produced during processing: + 'outputs': [ + # Store an output object file in a directory for placing intermediate results (only accessible within a single target): + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).<(obj)' + ], + + # Define the rule for compiling Fortran based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + + # Rule to compile Fortran on Windows: + { + 'rule_name': 'compile_fortran_windows', + 'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Windows...', + + 'process_outputs_as_sources': 0, + + # Define the command-line invocation: + 'action': [ + '<(fortran_compiler)', + '<@(fflags)', + '<@(_inputs)', + '-o', + '<@(_outputs)', + ], + }, + + # Rule to compile Fortran on non-Windows: + { + 'rule_name': 'compile_fortran_linux', + 'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Linux...', + + 'process_outputs_as_sources': 1, + + # Define the command-line invocation: + 'action': [ + '<(fortran_compiler)', + '<@(fflags)', + '-fPIC', # generate platform-independent code + '<@(_inputs)', + '-o', + '<@(_outputs)', + ], + } + ], # end condition (OS=="win") + ], # end conditions + }, # end rule (extension=="f") + ], # end rules + }, # end target <(addon_target_name) + + # Target to copy a generated add-on to a standard location: + { + 'target_name': 'copy_addon', + + # Declare that the output of this target is not linked: + 'type': 'none', + + # Define dependencies: + 'dependencies': [ + # Require that the add-on be generated before building this target: + '<(addon_target_name)', + ], + + # Define a list of actions: + 'actions': [ + { + 'action_name': 'copy_addon', + 'message': 'Copying addon...', + + # Explicitly list the inputs in the command-line invocation below: + 'inputs': [], + + # Declare the expected outputs: + 'outputs': [ + '<(addon_output_dir)/<(addon_target_name).node', + ], + + # Define the command-line invocation: + 'action': [ + 'cp', + '<(PRODUCT_DIR)/<(addon_target_name).node', + '<(addon_output_dir)/<(addon_target_name).node', + ], + }, + ], # end actions + }, # end target copy_addon + ], # end targets +} diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dpstf2/docs/repl.txt new file mode 100644 index 000000000000..4be2380dcfeb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/docs/repl.txt @@ -0,0 +1,164 @@ +{{alias}}( order, uplo, N, A, LDA, PIV, RANK, TOL, WORK ) + Computes an unblocked Cholesky factorization with complete pivoting. + + Returns numeric INFO and writes RANK[0] separately. INFO=0 indicates + complete factorization; INFO=1 indicates early termination from a + cutoff or deficient/nonpositive remainder, not PSD certification. + PIV contains the full positive 1-based permutation, including early + termination. Incoming PIV/RANK contents are not input. + + The first positive maximum diagonal is accepted before testing TOL. + Later candidates at or below the cutoff stop. Negative TOL requests + N*2^-53*max(initial diagonal); nonnegative TOL is used directly. + TOL is always required and must be a primitive finite number. + + Only the selected triangle changes; ignored storage/guards remain. + WORK is mutable 2N output scratch. It remains unchanged if the initial + maximum is nonpositive; otherwise its first half is zero-initialized + and its second half stores candidate diagonals. Prior scratch values + do not affect defined results. Finite selected inputs and finite + intermediates define the reference-comparison domain. + + Active arrays require intrinsic ordinary ArrayBuffer backing. + SharedArrayBuffer-backed views, including cloned shared storage, are + rejected before writes. All four full indexed-byte envelopes must + be disjoint. Disjoint subviews of one ordinary buffer are allowed. + Externally aliased ordinary buffers from foreign addons are outside + the caller contract. The matrix must be injective and full active + views must fit; all indexing uses exact safe integers. + + Validation checks layout/uplo/N, finite primitive TOL, LDA, then RANK. + For N=0, only RANK[0]=0 is written and INFO0 is returned. A/PIV/WORK + are not accessed; inactive aliases may observe the rank byte write. + This is package-defined empty behavior, not original-reference rank + parity. Invalid types/selectors/backing throw TypeError; invalid + geometry or nonfinite TOL throws RangeError before routine writes. + + Parameters + ---------- + order: string|number + Row-major (101) or column-major (102) layout. + + uplo: string|number + Upper (121) or lower (122) selected triangle. + + N: integer + Nonnegative safe matrix order, at most 2147483647. + + A: Float64Array + Input/output full N-by-N matrix view. + + LDA: integer + Matrix leading dimension, at least max(1,N), even when N=0. + + PIV: Int32Array + Complete positive 1-based permutation output. + + RANK: Int32Array + One active rank output scalar at index zero. + + TOL: number + Required primitive finite tolerance; negative requests default. + + WORK: Float64Array + Mutable 2N output scratch. + + Returns + ------- + info: number + Zero on complete factorization or one on early termination. + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}( [ 4, 0, 999, 1 ] ); + > var P = new {{alias:@stdlib/array/int32}}( 2 ); + > var R = new {{alias:@stdlib/array/int32}}( 1 ); + > var W = new {{alias:@stdlib/array/float64}}( 4 ); + > {{alias}}( 'row-major', 'upper', 2, A, 2, P, R, -1, W ) + 0 + > R + [ 2 ] + > P + [ 1, 2 ] + + +{{alias}}.ndarray( uplo, N, A, r, c, oa, PIV, sp, op, RANK, or, TOL, W, sw, ow ) + Computes the factorization using explicit element strides/offsets. + + The matrix is A[oa+i*r+j*c], permutation PIV[op+i*sp], rank RANK[or], + and scratch W[ow+i*sw]. Positive and negative strides are supported; + mutable broadcasts with extent greater than one are rejected. + All scalar, backing, envelope, and finite-domain rules above apply. + + For N=0 validate uplo/N, required primitive finite TOL and active + RANK/or; write only RANK[or]=0 and return INFO0. A/PIV/W and unused + strides/offsets are not inspected. Inactive aliases can observe that + scalar write. This is new package behavior, not reference rank parity. + + Parameters + ---------- + uplo: string|number + Upper (121) or lower (122) selected triangle. + + N: integer + Nonnegative safe matrix order, at most 2147483647. + + A: Float64Array + Full input/output N-by-N matrix. + + r: integer + Matrix row stride. + + c: integer + Matrix column stride. + + oa: integer + Matrix starting index. + + PIV: Int32Array + Complete positive 1-based permutation output. + + sp: integer + Permutation stride. + + op: integer + Permutation starting index. + + RANK: Int32Array + Active output scalar buffer. + + or: integer + Index of the active rank scalar. + + TOL: number + Required primitive finite tolerance. + + W: Float64Array + Mutable 2N output scratch. + + sw: integer + Scratch stride. + + ow: integer + Scratch starting index. + + Returns + ------- + info: number + Zero or one. + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}( [ 4 ] ); + > var P = new {{alias:@stdlib/array/int32}}( 1 ); + > var R = new {{alias:@stdlib/array/int32}}( 1 ); + > var W = new {{alias:@stdlib/array/float64}}( 2 ); + > {{alias}}.ndarray( 'lower', 1, A, 1, 1, 0, P, 1, 0, R, 0, 100, W, 1, 0 ) + 0 + > R + [ 1 ] + > A + [ 2 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dpstf2/docs/types/index.d.ts new file mode 100644 index 000000000000..c0221a3756df --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/docs/types/index.d.ts @@ -0,0 +1,167 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Layout, MatrixTriangle } from '@stdlib/types/blas'; + +/** +* Interface describing `dpstf2`. +*/ +interface Routine { + /** + * Computes an unblocked Cholesky factorization with complete pivoting in place. + * + * ## Notes + * + * - INFO is numeric, independent of the one-element RANK output. + * - PIV is the complete positive 1-based permutation, including early termination; incoming PIV/RANK values are not input. + * - INFO=1 reports an early cutoff or deficient/nonpositive remainder, not positive semidefiniteness certification. + * - The first positive maximum diagonal is accepted before testing TOL; later candidates stop at or below the cutoff. + * - Negative TOL requests N*2^-53*max(initial diagonal); TOL must always be a primitive finite number. + * - Only the selected triangle changes; WORK is mutable 2N output scratch, not a factorization result. + * - Full active indexed views must fit, the matrix must be injective, and all four indexed-byte envelopes must be disjoint. + * - Active buffers require intrinsic ordinary ArrayBuffer backing; SharedArrayBuffer views are rejected before routine-owned writes. + * - Externally aliased ordinary buffers from foreign addons are outside the caller contract; types cannot encode this runtime precondition. + * - For N=0, validate scalar selectors/N, finite TOL, main LDA and active RANK, then write only rank zero without inactive buffer/metadata access. + * - Inactive storage aliased to RANK may observe the scalar write; this empty behavior is package-defined, not original-reference parity. + * - Finite stored-triangle inputs with finite intermediates define the reference-comparison domain; no universal active nonfinite guarantee is given. + * + * @param order - row-major (101) or column-major (102) layout + * @param uplo - upper (121) or lower (122) stored triangle + * @param N - nonnegative safe integer matrix order, at most 2147483647 + * @param A - input/output N-by-N matrix + * @param LDA - matrix leading dimension, at least max(1,N) + * @param PIV - complete positive 1-based permutation output + * @param RANK - one active Int32 rank output scalar + * @param TOL - required primitive finite tolerance; negative requests the default cutoff + * @param WORK - mutable 2N scratch output + * @throws selectors, primitive TOL, active types and backing stores must be valid + * @throws dimensions, finite TOL, active metadata, bounds, collisions and aliases must satisfy the preconditions + * @returns numeric INFO, zero or one + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var Int32Array = require( '@stdlib/array/int32' ); + * + * var A = new Float64Array( [ 4.0, 0.0, 999.0, 1.0 ] ); + * var PIV = new Int32Array( 2 ); + * var RANK = new Int32Array( 1 ); + * var WORK = new Float64Array( 4 ); + * + * var info = dpstf2( 'row-major', 'upper', 2, A, 2, PIV, RANK, -1.0, WORK ); + * // returns 0 + * // RANK => [ 2 ] + * // PIV => [ 1, 2 ] + * // A => [ 2.0, 0.0, 999.0, 1.0 ] + */ + ( order: Layout | 101 | 102, uplo: MatrixTriangle | 121 | 122, N: number, A: Float64Array, LDA: number, PIV: Int32Array, RANK: Int32Array, TOL: number, WORK: Float64Array ): number; + + /** + * Computes a pivoted Cholesky factorization with alternative indexing semantics. + * + * ## Notes + * + * - INFO is numeric, independent of the one-element RANK output. + * - PIV is the complete positive 1-based permutation, including early termination; incoming PIV/RANK values are not input. + * - INFO=1 reports an early cutoff or deficient/nonpositive remainder, not positive semidefiniteness certification. + * - The first positive maximum diagonal is accepted before testing TOL; later candidates stop at or below the cutoff. + * - Negative TOL requests N*2^-53*max(initial diagonal); TOL must always be a primitive finite number. + * - Only the selected triangle changes; WORK is mutable 2N output scratch, not a factorization result. + * - Full active indexed views must fit, the matrix must be injective, and all four indexed-byte envelopes must be disjoint. + * - Active buffers require intrinsic ordinary ArrayBuffer backing; SharedArrayBuffer views are rejected before routine-owned writes. + * - Externally aliased ordinary buffers from foreign addons are outside the caller contract; types cannot encode this runtime precondition. + * - For N=0, validate scalar selectors/N, finite TOL, main LDA and active RANK, then write only rank zero without inactive buffer/metadata access. + * - Inactive storage aliased to RANK may observe the scalar write; this empty behavior is package-defined, not original-reference parity. + * - Finite stored-triangle inputs with finite intermediates define the reference-comparison domain; no universal active nonfinite guarantee is given. + * + * - Strides and offsets are element indices relative to actual typed-array views. + * - Positive and negative strides are supported; mutable zero strides are rejected when an extent exceeds one. + * + * @param uplo - upper (121) or lower (122) stored triangle + * @param N - nonnegative safe integer matrix order, at most 2147483647 + * @param A - input/output N-by-N matrix + * @param strideA1 - matrix row stride + * @param strideA2 - matrix column stride + * @param offsetA - starting matrix index + * @param PIV - complete positive 1-based permutation output + * @param stridePIV - permutation stride + * @param offsetPIV - starting permutation index + * @param RANK - one active Int32 rank output scalar + * @param offsetRANK - index of the active rank scalar + * @param TOL - required primitive finite tolerance; negative requests the default cutoff + * @param WORK - mutable 2N scratch output + * @param strideWORK - scratch stride + * @param offsetWORK - starting scratch index + * @throws selectors, primitive TOL, active types and backing stores must be valid + * @throws dimensions, finite TOL, active metadata, bounds, collisions and aliases must satisfy the preconditions + * @returns numeric INFO, zero or one + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var Int32Array = require( '@stdlib/array/int32' ); + * + * var A = new Float64Array( [ 9.0, 1.0, 0.0, 999.0, 4.0, 9.0 ] ); + * var PIV = new Int32Array( [ 8, -99, -99, 8 ] ); + * var RANK = new Int32Array( [ 7, -9, 7 ] ); + * var WORK = new Float64Array( 6 ); + * + * var info = dpstf2.ndarray( 'lower', 2, A, -2, -1, 4, PIV, -1, 2, RANK, 1, -1.0, WORK, -1, 4 ); + * // returns 0 + * // RANK => [ 7, 2, 7 ] + * // PIV => [ 8, 2, 1, 8 ] + * // A => [ 9.0, 1.0, 0.0, 999.0, 2.0, 9.0 ] + */ + ndarray( uplo: MatrixTriangle | 121 | 122, N: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, PIV: Int32Array, stridePIV: number, offsetPIV: number, RANK: Int32Array, offsetRANK: number, TOL: number, WORK: Float64Array, strideWORK: number, offsetWORK: number ): number; +} + +/** +* Computes an unblocked Cholesky factorization with complete pivoting. +* +* @param order - row-major (101) or column-major (102) layout +* @param uplo - upper (121) or lower (122) stored triangle +* @param N - nonnegative safe integer matrix order, at most 2147483647 +* @param A - input/output N-by-N matrix +* @param LDA - matrix leading dimension, at least max(1,N) +* @param PIV - complete positive 1-based permutation output +* @param RANK - one active Int32 rank output scalar +* @param TOL - required primitive finite tolerance; negative requests the default cutoff +* @param WORK - mutable 2N scratch output +* @returns numeric INFO, independent of the mutable rank scalar +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); +* +* var A = new Float64Array( [ 4.0 ] ); +* var PIV = new Int32Array( 1 ); +* var RANK = new Int32Array( 1 ); +* var WORK = new Float64Array( 2 ); +* +* var info = dpstf2( 'column-major', 'lower', 1, A, 1, PIV, RANK, 100.0, WORK ); +* // returns 0 +* // RANK => [ 1 ] +*/ +declare var dpstf2: Routine; + + +// EXPORTS // + +export = dpstf2; diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dpstf2/docs/types/test.ts new file mode 100644 index 000000000000..ac887c36d3f1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/docs/types/test.ts @@ -0,0 +1,104 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import dpstf2 = require( './index' ); + + +// TESTS // + +const A = new Float64Array( 4 ); +const PIV = new Int32Array( 2 ); +const RANK = new Int32Array( 1 ); +const WORK = new Float64Array( 4 ); + +// Numeric status and rank/permutation outputs have separate roles: +dpstf2( 'row-major', 'upper', 2, A, 2, PIV, RANK, -1, WORK ); // $ExpectType number +dpstf2( 'column-major', 'lower', 2, A, 2, PIV, RANK, -1, WORK ); // $ExpectType number +dpstf2( 101, 121, 2, A, 2, PIV, RANK, -1, WORK ); // $ExpectType number +dpstf2( 102, 122, 2, A, 2, PIV, RANK, -1, WORK ); // $ExpectType number +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0, -1, WORK, 1, 0 ); // $ExpectType number +dpstf2.ndarray( 122, 2, A, -2, -1, 3, PIV, -1, 1, RANK, 0, -1, WORK, -1, 3 ); // $ExpectType number + +// Invalid enums, primitive tolerance and buffer roles are rejected: +dpstf2( 103, 'upper', 2, A, 2, PIV, RANK, -1, WORK ); // $ExpectError +dpstf2( 'row-major', 123, 2, A, 2, PIV, RANK, -1, WORK ); // $ExpectError +// Deliberately supply a boxed primitive to verify its declared rejection: +// eslint-disable-next-line no-new-wrappers +dpstf2( 'row-major', 'upper', 2, A, 2, PIV, RANK, new Number( -1 ), WORK ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, 2, WORK, RANK, -1, WORK ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, 2, PIV, WORK, -1, WORK ); // $ExpectError +dpstf2.ndarray( 'all', 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, WORK, 0, -1, WORK, 1, 0 ); // $ExpectError + +// Each required dpstf2 argument has its declared type: +dpstf2( false, 'upper', 2, A, 2, PIV, RANK, -1, WORK ); // $ExpectError +dpstf2( 'row-major', false, 2, A, 2, PIV, RANK, -1, WORK ); // $ExpectError +dpstf2( 'row-major', 'upper', false, A, 2, PIV, RANK, -1, WORK ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, false, 2, PIV, RANK, -1, WORK ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, false, PIV, RANK, -1, WORK ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, 2, false, RANK, -1, WORK ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, 2, PIV, false, -1, WORK ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, 2, PIV, RANK, false, WORK ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, 2, PIV, RANK, -1, false ); // $ExpectError + +// Missing and extra arguments are rejected: +dpstf2(); // $ExpectError +dpstf2( 'row-major' ); // $ExpectError +dpstf2( 'row-major', 'upper' ); // $ExpectError +dpstf2( 'row-major', 'upper', 2 ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, 2 ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, 2, PIV ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, 2, PIV, RANK ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, 2, PIV, RANK, -1 ); // $ExpectError +dpstf2( 'row-major', 'upper', 2, A, 2, PIV, RANK, -1, WORK, 0 ); // $ExpectError + +// Each required dpstf2.ndarray argument has its declared type: +dpstf2.ndarray( false, 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', false, A, 2, 1, 0, PIV, 1, 0, RANK, 0, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, false, 2, 1, 0, PIV, 1, 0, RANK, 0, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, false, 1, 0, PIV, 1, 0, RANK, 0, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, false, 0, PIV, 1, 0, RANK, 0, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, false, PIV, 1, 0, RANK, 0, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, false, 1, 0, RANK, 0, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, false, 0, RANK, 0, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, false, RANK, 0, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, false, 0, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK, false, -1, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0, false, WORK, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0, -1, false, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0, -1, WORK, false, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0, -1, WORK, 1, false ); // $ExpectError + +// Missing and extra arguments are rejected: +dpstf2.ndarray(); // $ExpectError +dpstf2.ndarray( 'upper' ); // $ExpectError +dpstf2.ndarray( 'upper', 2 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0, -1 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0, -1, WORK ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0, -1, WORK, 1 ); // $ExpectError +dpstf2.ndarray( 'upper', 2, A, 2, 1, 0, PIV, 1, 0, RANK, 0, -1, WORK, 1, 0, 0 ); // $ExpectError diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/examples/c/Makefile b/lib/node_modules/@stdlib/lapack/base/dpstf2/examples/c/Makefile new file mode 100644 index 000000000000..c8f8e9a1517b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := example.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled examples. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/examples/c/example.c b/lib/node_modules/@stdlib/lapack/base/dpstf2/examples/c/example.c new file mode 100644 index 000000000000..f09850fdcd5c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/examples/c/example.c @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/lapack/base/dpstf2.h" +#include "stdlib/lapack/base/shared.h" +#include +#include + +/** +* Main execution sequence. +*/ +int main( void ) { + double A[] = { 1.0, 0.0, 0.0, 999.0, 0.0, 0.0, 999.0, 999.0, 4.0 }; + double B[] = { 9.0, 1.0, 0.0, 999.0, 4.0, 9.0 }; + double WORK[ 6 ] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + LAPACK_INT PIV[ 3 ] = { -99, -99, -99 }; + LAPACK_INT P[ 4 ] = { 8, -99, -99, 8 }; + LAPACK_INT R[ 3 ] = { 7, -9, 7 }; + LAPACK_INT RANK = -9; + LAPACK_INT info; + + // Positive semidefinite rank deficiency still gives all permutation slots: + info = API_SUFFIX(c_dpstf2)( LAPACK_ROW_MAJOR, LAPACK_UPPER_TRIANGLE, 3, A, 3, PIV, &RANK, -1.0, WORK ); + if ( + info != 1 || RANK != 2 || + PIV[ 0 ] != 3 || PIV[ 1 ] != 1 || PIV[ 2 ] != 2 || + A[ 0 ] != 2.0 || A[ 4 ] != 1.0 || A[ 8 ] != 0.0 || + A[ 3 ] != 999.0 || A[ 6 ] != 999.0 || A[ 7 ] != 999.0 + ) { + fprintf( stderr, "Unexpected rank-deficient factorization.\n" ); + return EXIT_FAILURE; + } + printf( "INFO: %d; RANK: %d; PIV: %d, %d, %d\n", (int)info, (int)RANK, (int)PIV[ 0 ], (int)PIV[ 1 ], (int)PIV[ 2 ] ); + + // Full lower diagonal factor with signed strides and preserved guards: + info = API_SUFFIX(c_dpstf2_ndarray)( LAPACK_LOWER_TRIANGLE, 2, B, -2, -1, 4, P, -1, 2, R, 1, -1.0, WORK, -1, 4 ); + if ( + info != 0 || R[ 0 ] != 7 || R[ 1 ] != 2 || R[ 2 ] != 7 || + P[ 0 ] != 8 || P[ 1 ] != 2 || P[ 2 ] != 1 || P[ 3 ] != 8 || + B[ 0 ] != 9.0 || B[ 1 ] != 1.0 || B[ 3 ] != 999.0 || + B[ 4 ] != 2.0 || B[ 5 ] != 9.0 + ) { + fprintf( stderr, "Unexpected strided factorization.\n" ); + return EXIT_FAILURE; + } + printf( "Strided INFO: %d; RANK: %d; guarded PIV: %d, %d, %d, %d\n", (int)info, (int)R[ 1 ], (int)P[ 0 ], (int)P[ 1 ], (int)P[ 2 ], (int)P[ 3 ] ); + return EXIT_SUCCESS; +} diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/examples/index.js new file mode 100644 index 000000000000..16efcfe8723f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/examples/index.js @@ -0,0 +1,80 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var dpstf2 = require( './../lib' ); + + +// MAIN // + +var A = new Float64Array( [ 1, 0, 0, 999, 0, 0, 999, 999, 4 ] ); +var WORK = new Float64Array( 6 ); +var PIV = new Int32Array( [ -99, -99, -99 ] ); +var RANK = new Int32Array( 1 ); +var info; + +// A rank-deficient diagonal matrix still produces a complete permutation: +info = dpstf2( 'row-major', 'upper', 3, A, 3, PIV, RANK, -1.0, WORK ); +if ( + info !== 1 || + RANK[ 0 ] !== 2 || + PIV[ 0 ] !== 3 || + PIV[ 1 ] !== 1 || + PIV[ 2 ] !== 2 || + A[ 0 ] !== 2.0 || + A[ 4 ] !== 1.0 || + A[ 8 ] !== 0.0 || + A[ 3 ] !== 999.0 || + A[ 6 ] !== 999.0 || + A[ 7 ] !== 999.0 +) { + throw new Error( 'Unexpected rank-deficient factorization.' ); +} +console.log( 'INFO: %d; RANK: %d', info, RANK[ 0 ] ); +console.log( 'Pivots: %s', PIV.join( ', ' ) ); + +// A lower diagonal matrix using negative strides and guarded output views: +A = new Float64Array( [ 9.0, 1.0, 0.0, 999.0, 4.0, 9.0 ] ); +WORK = new Float64Array( 6 ); +PIV = new Int32Array( [ 8, -99, -99, 8 ] ); +RANK = new Int32Array( [ 7, -9, 7 ] ); +info = dpstf2.ndarray( 'lower', 2, A, -2, -1, 4, PIV, -1, 2, RANK, 1, -1.0, WORK, -1, 4 ); +if ( + info !== 0 || + RANK[ 0 ] !== 7 || + RANK[ 1 ] !== 2 || + RANK[ 2 ] !== 7 || + PIV[ 0 ] !== 8 || + PIV[ 1 ] !== 2 || + PIV[ 2 ] !== 1 || + PIV[ 3 ] !== 8 || + A[ 0 ] !== 9.0 || + A[ 1 ] !== 1.0 || + A[ 3 ] !== 999.0 || + A[ 4 ] !== 2.0 || + A[ 5 ] !== 9.0 +) { + throw new Error( 'Unexpected strided factorization.' ); +} +console.log( 'Strided INFO: %d; RANK: %d', info, RANK[ 1 ] ); +console.log( 'Guarded pivots: %s', PIV.join( ', ' ) ); diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/include.gypi b/lib/node_modules/@stdlib/lapack/base/dpstf2/include.gypi new file mode 100644 index 000000000000..dcb556d250e8 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/include.gypi @@ -0,0 +1,70 @@ +# @license Apache-2.0 +# +# Copyright (c) 2026 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A GYP include file for building a Node.js native add-on. +# +# Note that nesting variables is required due to how GYP processes a configuration. Any variables defined within a nested 'variables' section is defined in the outer scope. Thus, conditions in the outer variable scope are free to use these variables without running into "variable undefined" errors. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +# +# Variable nesting hacks: +# +# [3]: https://chromium.googlesource.com/external/skia/gyp/+/master/common_variables.gypi +# [4]: https://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi?revision=127004 +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + 'variables': { + # Host BLAS library (to override -Dblas=): + 'blas%': '', + + # Path to BLAS library (to override -Dblas_dir=): + 'blas_dir%': '', + }, # end variables + + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + '<@(blas_dir)', + ' ajj)) { + pvt = i; + ajj = value; + } + } + if (((ajj <= 0) || isNaNValue(ajj))) { + R[orank] = 0; + return 1; + } + stop = (tol < 0) ? ((N * 1.1102230246251565e-16) * ajj) : tol; + for (i = 0; (i < N); i++) { + W[(ow + (i * sw))] = 0; + } + for (j = 0; (j < N); j++) { + for (i = j; (i < N); i++) { + pos = (ow + (i * sw)); + if ((j > 0)) { + value = (u === 121) ? A[((oa + ((j - 1) * ra)) + (i * ca))] : A[((oa + (i * ra)) + ((j - 1) * ca))]; + W[pos] += (value * value); + } + W[(ow + ((N + i) * sw))] = (A[((oa + (i * ra)) + (i * ca))] - W[pos]); + } + if ((j > 0)) { + pvt = j; + ajj = W[(ow + ((N + j) * sw))]; + for (i = (j + 1); (i < N); i++) { + value = W[(ow + ((N + i) * sw))]; + if ((value > ajj)) { + ajj = value; + pvt = i; + } + } + if (((ajj <= stop) || isNaNValue(ajj))) { + A[((oa + (j * ra)) + (j * ca))] = ajj; + R[orank] = j; + return 1; + } + } + if ((j !== pvt)) { + A[((oa + (pvt * ra)) + (pvt * ca))] = A[((oa + (j * ra)) + (j * ca))]; + if ((u === 121)) { + if ((j > 0)) { + dswap(j, A, ra, (oa + (j * ca)), A, ra, (oa + (pvt * ca))); + } + if ((pvt < (N - 1))) { + dswap(((N - pvt) - 1), A, ca, ((oa + (j * ra)) + ((pvt + 1) * ca)), A, ca, ((oa + (pvt * ra)) + ((pvt + 1) * ca))); + } + if ((((pvt - j) - 1) > 0)) { + dswap(((pvt - j) - 1), A, ca, ((oa + (j * ra)) + ((j + 1) * ca)), A, ra, ((oa + ((j + 1) * ra)) + (pvt * ca))); + } + } else { + if ((j > 0)) { + dswap(j, A, ca, (oa + (j * ra)), A, ca, (oa + (pvt * ra))); + } + if ((pvt < (N - 1))) { + dswap(((N - pvt) - 1), A, ra, ((oa + ((pvt + 1) * ra)) + (j * ca)), A, ra, ((oa + ((pvt + 1) * ra)) + (pvt * ca))); + } + if ((((pvt - j) - 1) > 0)) { + dswap(((pvt - j) - 1), A, ra, ((oa + ((j + 1) * ra)) + (j * ca)), A, ca, ((oa + (pvt * ra)) + ((j + 1) * ca))); + } + } + temp = W[(ow + (j * sw))]; + W[(ow + (j * sw))] = W[(ow + (pvt * sw))]; + W[(ow + (pvt * sw))] = temp; + temp = P[(op + (pvt * sp))]; + P[(op + (pvt * sp))] = P[(op + (j * sp))]; + P[(op + (j * sp))] = temp; + } + ajj = sqrt(ajj); + A[((oa + (j * ra)) + (j * ca))] = ajj; + if ((j < (N - 1))) { + if ((u === 121)) { + // Trans: complete each ascending-row dot before its output update. + if ((j > 0)) { + for (i = (j + 1); (i < N); i++) { + temp = 0; + for (k = 0; (k < j); k++) { // eslint-disable-line max-depth + temp += (A[((oa + (k * ra)) + (i * ca))] * A[((oa + (k * ra)) + (j * ca))]); + } + A[((oa + (j * ra)) + (i * ca))] += -temp; + } + } + dscal(((N - j) - 1), (1 / ajj), A, ca, ((oa + (j * ra)) + ((j + 1) * ca))); + } else { + // NoTrans: unconditional ascending-column scaled additions. + for (k = 0; (k < j); k++) { + temp = -A[((oa + (j * ra)) + (k * ca))]; + for (i = (j + 1); (i < N); i++) { + A[((oa + (i * ra)) + (j * ca))] += (temp * A[((oa + (i * ra)) + (k * ca))]); + } + } + dscal(((N - j) - 1), (1 / ajj), A, ra, ((oa + ((j + 1) * ra)) + (j * ca))); + } + } + } + R[orank] = N; + return 0; +} + + +// EXPORTS // + +module.exports = dpstf2; diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/can_use_native.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/can_use_native.js new file mode 100644 index 000000000000..7d4c5a5c0937 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/can_use_native.js @@ -0,0 +1,99 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +'use strict'; + +// MODULES // + +var abs = require( '@stdlib/math/base/special/abs' ); +var min = require( '@stdlib/math/base/special/min' ); +var max = require( '@stdlib/math/base/special/max' ); + + +// MAIN // + +/** +* Checks the conservative signed32 native geometry and helper domain. +* @private +* @param {ArrayLike} a - validated normalized arguments +* @returns {boolean} eligible +*/ +function canUseNative(a) { + var starts; + var limit; + var slots; + var sizes; + var r; + var c; + var o; + var x; + var y; + var i; + limit = 2147483640; + if ((a[1] === 0)) { + return ((a[10] >= 0) && (a[10] <= limit)); + } + slots = [ + 1, + 3, + 4, + 5, + 7, + 8, + 10, + 13, + 14 + ]; + for (i = 0; (i < slots.length); i++) { + x = a[slots[i]]; + if (((x < -limit) || (x > limit))) { + return false; + } + } + if ((a[1] > ((limit - 2) / 2))) { + return false; + } + sizes = [ + a[1], + a[1], + (2 * a[1]) + ]; + starts = [ + 3, + 7, + 13 + ]; + for (i = 0; (i < 3); i++) { + r = a[starts[i]]; + c = (i === 0) ? a[4] : 0; + o = a[(starts[i] + ((i === 0) ? 2 : 1))]; + x = ((sizes[i] - 1) * r); + y = (i === 0) ? ((a[1] - 1) * c) : 0; + if (((((abs(x) > limit) || (abs(y) > limit)) || (((o + min(x, 0)) + min(y, 0)) < 0)) || (((o + max(x, 0)) + max(y, 0)) > limit))) { + return false; + } + } + if (((a[1] > 1) && (((((a[1] + 1) * abs(a[3])) + 1) > limit) || ((((a[1] + 1) * abs(a[4])) + 1) > limit)))) { + return false; + } + return true; +} + + +// EXPORTS // + +module.exports = canUseNative; diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/factory.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/factory.js new file mode 100644 index 000000000000..94908d01693e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/factory.js @@ -0,0 +1,133 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +'use strict'; + +// MODULES // + +var isSafeInteger = require( '@stdlib/assert/is-safe-integer' ).isPrimitive; +var isFiniteValue = require( '@stdlib/math/base/assert/is-finite' ); +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var validate = require( './validate.js' ); + + +// FUNCTIONS // + +/** +* Validates selectors, dimensions and the required tolerance in that order. +* @private +* @param {string|integer} u - triangle +* @param {integer} N - order +* @param {number} tol - tolerance +* @throws {TypeError} invalid selector or nonprimitive tolerance +* @throws {RangeError} invalid dimension or nonfinite tolerance +* @returns {integer} triangle +*/ +function scalars(u, N, tol) { + if (((((u !== 'upper') && (u !== 'lower')) && (u !== 121)) && (u !== 122))) { + throw new TypeError('invalid argument. Invalid triangle selector.'); + } + if (((!isSafeInteger(N) || (N < 0)) || (N > 2147483647))) { + throw new RangeError('invalid argument. Dimension must be a nonnegative signed32 integer.'); + } + if ((typeof tol !== 'number')) { + throw new TypeError('invalid argument. TOL must be a primitive finite Number.'); + } + if (!isFiniteValue(tol)) { + throw new RangeError('invalid argument. TOL must be finite.'); + } + return ((u === 'upper') || (u === 121)) ? 121 : 122; +} + + +// MAIN // + +/** +* Creates the contiguous and indexed factorization interfaces. +* @private +* @param {Function} base - normalized kernel +* @returns {Function} interface +*/ +function factory(base) { + setReadOnly(dpstf2, 'ndarray', ndarray); + return dpstf2; + /** +* Computes a complete-pivoting Cholesky factorization. +* @private +* @param {string|integer} order - layout +* @param {string|integer} uplo - triangle +* @param {integer} N - order +* @param {Float64Array} A - matrix +* @param {integer} LDA - leading dimension +* @param {Int32Array} PIV - positive one-based permutation output +* @param {Int32Array} RANK - rank output +* @param {number} TOL - tolerance +* @param {Float64Array} WORK - scratch +* @throws {TypeError} invalid selector +* @throws {RangeError} invalid metadata +* @returns {integer} INFO +*/ + function dpstf2(order, uplo, N, A, LDA, PIV, RANK, TOL, WORK) { // eslint-disable-line max-params + var column; + var r; + var c; + var u; + if (((((order !== 'row-major') && (order !== 'column-major')) && (order !== 101)) && (order !== 102))) { + throw new TypeError('invalid argument. Invalid layout.'); + } + u = scalars(uplo, N, TOL); + if (((!isSafeInteger(LDA) || (LDA < 1)) || (LDA < N))) { + throw new RangeError('invalid argument. Invalid leading dimension.'); + } + column = ((order === 'column-major') || (order === 102)); + r = ( column ) ? 1 : LDA; + c = ( column ) ? LDA : 1; + validate(N, A, r, c, 0, PIV, 1, 0, RANK, 0, WORK, 1, 0); + return base(u, N, A, r, c, 0, PIV, 1, 0, RANK, 0, TOL, WORK, 1, 0); + } + /** +* Computes a factorization using independent indexed views. +* @private +* @param {string|integer} uplo - triangle +* @param {integer} N - order +* @param {Float64Array} A - matrix +* @param {integer} ra - row stride +* @param {integer} ca - column stride +* @param {integer} oa - matrix offset +* @param {Int32Array} P - permutation +* @param {integer} sp - pivot stride +* @param {integer} op - pivot offset +* @param {Int32Array} R - rank +* @param {integer} orank - rank offset +* @param {number} tol - tolerance +* @param {Float64Array} W - scratch +* @param {integer} sw - scratch stride +* @param {integer} ow - scratch offset +* @returns {integer} INFO +*/ + function ndarray(uplo, N, A, ra, ca, oa, P, sp, op, R, orank, tol, W, sw, ow) { // eslint-disable-line max-params + var u; + u = scalars(uplo, N, tol); + validate(N, A, ra, ca, oa, P, sp, op, R, orank, W, sw, ow); + return base(u, N, A, ra, ca, oa, P, sp, op, R, orank, tol, W, sw, ow); + } +} + + +// EXPORTS // + +module.exports = factory; diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/index.js new file mode 100644 index 000000000000..2299525c7897 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/index.js @@ -0,0 +1,30 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** +* Compute a complete-pivoting Cholesky factorization. +* @module @stdlib/lapack/base/dpstf2 +*/ +'use strict'; + +var resolve = require( 'path' ).resolve; +var tryRequire = require( '@stdlib/utils/try-require' ); +var main = tryRequire(resolve(__dirname, './native.js')); +if ((main instanceof Error)) { + main = require( './main.js' ); +} +module.exports = main; diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/main.js new file mode 100644 index 000000000000..49eccc607e1a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/main.js @@ -0,0 +1,23 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +'use strict'; + +var factory = require( './factory.js' ); +var base = require( './base.js' ); +var main = factory(base); +module.exports = main; diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/native.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/native.js new file mode 100644 index 000000000000..b645f3600454 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/native.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +'use strict'; + +var factory = require( './factory.js' ); +var base = require( './base.js' ); +var canUseNative = require( './can_use_native.js' ); +var addon = require( './../src/addon.node' ); +var main; +/** +* Dispatches only eligible geometry to the actual addon. +* @private +* @returns {integer} INFO +*/ +function dispatch() { + if (canUseNative(arguments)) { + return addon.apply(null, arguments); + } + return base.apply(null, arguments); +} +main = factory(dispatch); +module.exports = main; diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/validate.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/validate.js new file mode 100644 index 000000000000..e1e20430cd20 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/lib/validate.js @@ -0,0 +1,201 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +'use strict'; + +// MODULES // + +var Float64Array = require( '@stdlib/array/float64' ); +var ArrayBuffer = require( '@stdlib/array/buffer' ); +var Symbol = require( '@stdlib/symbol/ctor' ); +var getPrototypeOf = require( '@stdlib/utils/get-prototype-of' ); +var descriptor = require( '@stdlib/utils/property-descriptor' ); +var isSafeInteger = require( '@stdlib/assert/is-safe-integer' ).isPrimitive; + + +// VARIABLES // + +var prototype = getPrototypeOf(Float64Array.prototype); +var getLength = descriptor(prototype, 'length').get; +var getBuffer = descriptor(prototype, 'buffer').get; +var getOffset = descriptor(prototype, 'byteOffset').get; +var getTag = descriptor(prototype, Symbol.toStringTag).get; +var getBufferLength = descriptor(ArrayBuffer.prototype, 'byteLength').get; +var MAX = 9007199254740991; + + +// FUNCTIONS // + +/** +* Adds exactly representable indexed integers. +* @private +* @param {integer} a - first integer +* @param {integer} b - second integer +* @throws {RangeError} invalid argument +* @returns {integer} exact sum +*/ +function add(a, b) { + if ((((b > 0) && (a > (MAX - b))) || ((b < 0) && (a < (-MAX - b))))) { + throw new RangeError('invalid argument. Inexact indexed arithmetic.'); + } + return (a + b); +} +/** +* Resolves a positive greatest common divisor. +* @private +* @param {integer} a - first magnitude +* @param {integer} b - second magnitude +* @returns {integer} divisor +*/ +function gcd(a, b) { + var r; + while ((b !== 0)) { + r = (a % b); + a = b; + b = r; + } + return a; +} +/** +* Captures and validates an ordinary typed view and exact byte envelope. +* @private +* @param {TypedArray} x - view +* @param {integer} rows - row extent +* @param {integer} cols - column extent +* @param {integer} r - row stride +* @param {integer} c - column stride +* @param {integer} o - offset +* @param {string} dtype - intrinsic type +* @throws {RangeError} invalid argument +* @throws {TypeError} invalid argument +* @returns {Array} backing buffer and half-open envelope +*/ +function view(x, rows, cols, r, c, o, dtype) { + var buffer; + var bytes; + var lo; + var hi; + var a; + var b; + var g; + if ((getTag.call(x) !== dtype)) { + throw new TypeError('invalid argument. Incorrect intrinsic typed-array dtype.'); + } + buffer = getBuffer.call(x); + getBufferLength.call(buffer); + if (((!isSafeInteger(r) || !isSafeInteger(c)) || !isSafeInteger(o))) { + throw new RangeError('invalid argument. Strides and offsets must be safe integers.'); + } + if ((((rows > 1) && (r === 0)) || ((cols > 1) && (c === 0)))) { + throw new RangeError('invalid argument. Mutable indexed views must be injective.'); + } + if (((rows > 1) && (cols > 1))) { + g = gcd((r < 0) ? -r : r, (c < 0) ? -c : c); + if ((((((r < 0) ? -r : r) / g) < cols) && ((((c < 0) ? -c : c) / g) < rows))) { + throw new RangeError('invalid argument. Matrix coordinates collide.'); + } + } + a = ((rows - 1) * r); + b = ((cols - 1) * c); + if ((!isSafeInteger(a) || !isSafeInteger(b))) { + throw new RangeError('invalid argument. Inexact indexed products.'); + } + lo = add(add(o, (a < 0) ? a : 0), (b < 0) ? b : 0); + hi = add(add(o, (a > 0) ? a : 0), (b > 0) ? b : 0); + if (((lo < 0) || (hi >= getLength.call(x)))) { + throw new RangeError('invalid argument. Insufficient indexed storage.'); + } + bytes = (dtype === 'Float64Array') ? 8 : 4; + a = (lo * bytes); + b = ((hi + 1) * bytes); + if ((!isSafeInteger(a) || !isSafeInteger(b))) { + throw new RangeError('invalid argument. Inexact byte envelope.'); + } + return [ + buffer, + add(getOffset.call(x), a), + add(getOffset.call(x), b) + ]; +} +/** +* Rejects every pair of overlapping active byte envelopes. +* @private +* @param {Array} views - captured envelopes +* @throws {RangeError} invalid argument +* @returns {void} +*/ +function disjoint(views) { + var a; + var b; + var i; + var j; + for (i = 0; (i < views.length); i++) { + a = views[i]; + for (j = (i + 1); (j < views.length); j++) { + b = views[j]; + if ((((a[0] === b[0]) && (a[1] < b[2])) && (b[1] < a[2]))) { + throw new RangeError('invalid argument. Active indexed byte envelopes must be disjoint.'); + } + } + } +} + + +// MAIN // + +/** +* Validates the active rank, matrix, permutation and scratch before writes. +* @private +* @param {integer} N - order +* @param {Float64Array} A - matrix +* @param {integer} ra - row stride +* @param {integer} ca - column stride +* @param {integer} oa - matrix offset +* @param {Int32Array} P - output permutation +* @param {integer} sp - pivot stride +* @param {integer} op - pivot offset +* @param {Int32Array} R - output rank +* @param {integer} orank - rank offset +* @param {Float64Array} W - scratch +* @param {integer} sw - scratch stride +* @param {integer} ow - scratch offset +* @returns {void} +*/ +function validate(N, A, ra, ca, oa, P, sp, op, R, orank, W, sw, ow) { // eslint-disable-line max-params + var rank; + var a; + var p; + var w; + rank = view(R, 1, 1, 0, 0, orank, 'Int32Array'); + if ((N === 0)) { + return; + } + a = view(A, N, N, ra, ca, oa, 'Float64Array'); + p = view(P, N, 1, sp, 0, op, 'Int32Array'); + w = view(W, (2 * N), 1, sw, 0, ow, 'Float64Array'); + disjoint([ + rank, + a, + p, + w + ]); +} + + +// EXPORTS // + +module.exports = validate; diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/manifest.json b/lib/node_modules/@stdlib/lapack/base/dpstf2/manifest.json new file mode 100644 index 000000000000..0cf779d61c84 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/manifest.json @@ -0,0 +1,98 @@ +{ + "options": { + "task": "build", + "wasm": false + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "wasm": false, + "src": [ + "./src/dpstf2.c", + "./src/dpstf2_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lm" + ], + "libpath": [], + "dependencies": [ + "@stdlib/lapack/base/shared", + "@stdlib/lapack/base/xerbla", + "@stdlib/blas/base/dscal", + "@stdlib/blas/base/dswap", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-float64array", + "@stdlib/napi/argv-int32array", + "@stdlib/napi/create-int32" + ] + }, + { + "task": "benchmark", + "wasm": false, + "src": [ + "./src/dpstf2.c", + "./src/dpstf2_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lm" + ], + "libpath": [], + "dependencies": [ + "@stdlib/lapack/base/shared", + "@stdlib/lapack/base/xerbla", + "@stdlib/blas/base/dscal", + "@stdlib/blas/base/dswap" + ] + }, + { + "task": "examples", + "wasm": false, + "src": [ + "./src/dpstf2.c", + "./src/dpstf2_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lm" + ], + "libpath": [], + "dependencies": [ + "@stdlib/lapack/base/shared", + "@stdlib/lapack/base/xerbla", + "@stdlib/blas/base/dscal", + "@stdlib/blas/base/dswap" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/package.json b/lib/node_modules/@stdlib/lapack/base/dpstf2/package.json new file mode 100644 index 000000000000..571307a56204 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/package.json @@ -0,0 +1,81 @@ +{ + "name": "@stdlib/lapack/base/dpstf2", + "version": "0.0.0", + "description": "Compute a complete-pivoting Cholesky factorization.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "browser": "./lib/main.js", + "gypfile": true, + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "include": "./include", + "lib": "./lib", + "src": "./src", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=8.0.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "lapack", + "dpstf2", + "cholesky", + "complete", + "pivot", + "factor", + "rank", + "positive", + "semidefinite", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "matrix", + "float64", + "double", + "float64array", + "int32array" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/src/Makefile b/lib/node_modules/@stdlib/lapack/base/dpstf2/src/Makefile new file mode 100644 index 000000000000..2caf905cedbe --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + + +# RULES # + +#/ +# Removes generated files for building an add-on. +# +# @example +# make clean-addon +#/ +clean-addon: + $(QUIET) -rm -f *.o *.node + +.PHONY: clean-addon + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: clean-addon + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/src/addon.c b/lib/node_modules/@stdlib/lapack/base/dpstf2/src/addon.c new file mode 100644 index 000000000000..16fb9212f67b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/src/addon.c @@ -0,0 +1,187 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +#include "stdlib/lapack/base/dpstf2.h" +#include "stdlib/napi/export.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/create_int32.h" +#include +#include +#include +#include +#include + +#define META_MAX INT64_C(2147483640) + +/** Captured intrinsic typed view and its physical indexed envelope. */ +typedef struct view_s { + void *data; + size_t length; + uintptr_t lo; + uintptr_t hi; +} view_t; + +/** +* Parses exact Numbers in the conservative native metadata domain. +* @param env environment +* @param value argument +* @param out integer output +* @return success +*/ +static int integer( napi_env env, napi_value value, int64_t *out ) { + napi_valuetype type; + double v; + if ( napi_typeof(env,value,&type) != napi_ok || type != napi_number || napi_get_value_double(env,value,&v) != napi_ok ) { + napi_throw_type_error(env,NULL,"invalid argument. Metadata must be Numbers."); return 0; + } + if ( !(v >= -(double)META_MAX && v <= (double)META_MAX) ) { + napi_throw_range_error(env,NULL,"invalid argument. Metadata exceeds the conservative native domain."); return 0; + } + *out = (int64_t)v; + if ( v != (double)*out ) { napi_throw_range_error(env,NULL,"invalid argument. Metadata must be integral."); return 0; } + return 1; +} + +/** +* Extracts an intrinsic ordinary-ArrayBuffer-backed typed view. +* @param env environment +* @param value view argument +* @param dtype required dtype +* @param out view output +* @return success +*/ +static int typed( napi_env env, napi_value value, napi_typedarray_type dtype, view_t *out ) { + napi_typedarray_type type; + napi_value buffer; + bool is_array; + if ( napi_get_typedarray_info(env,value,&type,&out->length,&out->data,&buffer,NULL) != napi_ok || type != dtype || napi_is_arraybuffer(env,buffer,&is_array) != napi_ok || !is_array ) { + napi_throw_type_error(env,NULL,"invalid argument. Must provide the documented intrinsic ordinary typed buffers."); return 0; + } + return 1; +} + +/** +* Validates injective rectangles and exact physical pointer envelopes. +* @param v intrinsic view +* @param rows first extent +* @param cols second extent +* @param r first stride +* @param c second stride +* @param o offset +* @param size element size +* @return success +*/ +static int bounds( view_t *v, int64_t rows, int64_t cols, int64_t r, int64_t c, int64_t o, size_t size ) { + int64_t a; + int64_t b; + int64_t lo; + int64_t hi; + uint64_t x; + uint64_t y; + uint64_t g; + uint64_t q; + uintptr_t base; + uintptr_t end; + if ( (rows > 1 && r == 0) || (cols > 1 && c == 0) ) { return 0; } + if ( rows > 1 && cols > 1 ) { + x=(uint64_t)((r < 0) ? -r : r); y=(uint64_t)((c < 0) ? -c : c); g=x; q=y; + while ( q != 0 ) { uint64_t next=g%q; g=q; q=next; } + if ( x/g < (uint64_t)cols && y/g < (uint64_t)rows ) { return 0; } + } + a=(rows-1)*r; b=(cols-1)*c; + if ( a < -META_MAX || a > META_MAX || b < -META_MAX || b > META_MAX ) { return 0; } + lo=o+((a < 0) ? a : 0)+((b < 0) ? b : 0); + hi=o+((a > 0) ? a : 0)+((b > 0) ? b : 0); + if ( lo < 0 || hi > META_MAX || (uintmax_t)hi >= v->length || v->data == NULL || (uintmax_t)hi+1 > UINTPTR_MAX/size || (uintmax_t)hi+1 > (uintmax_t)PTRDIFF_MAX/size ) { return 0; } + base=(uintptr_t)v->data; end=((uintptr_t)hi+1)*size; + if ( base > UINTPTR_MAX-end ) { return 0; } + v->lo=base+(uintptr_t)lo*size; v->hi=base+end; + return 1; +} + +/** +* Checks physical disjointness without using buffer object identity. +* @param v four captured active views +* @return success +*/ +static int disjoint( const view_t *v ) { + size_t i; + size_t j; + for ( i=0; i<4; i++ ) { + for ( j=i+1; j<4; j++ ) { + if ( v[i].lo < v[j].hi && v[j].lo < v[i].hi ) { return 0; } + } + } + return 1; +} + +/** +* Executes a validated factorization with configured-width output staging. +* @param env environment +* @param info call metadata +* @return INFO numeric result +*/ +static napi_value addon( napi_env env, napi_callback_info info ) { + view_t v[4]; + int64_t n[15]; + const size_t slots[]={3,4,5,7,8,13,14}; + LAPACK_INT *pivots; + LAPACK_INT rank; + LAPACK_INT result; + napi_valuetype type; + double tol; + int64_t i; + int32_t *p; + int32_t *r; + STDLIB_NAPI_ARGV(env,info,argv,argc,15); + if ( !integer(env,argv[0],&n[0]) || !integer(env,argv[1],&n[1]) ) { return NULL; } + if ( (n[0] != LAPACK_UPPER_TRIANGLE && n[0] != LAPACK_LOWER_TRIANGLE) || n[1] < 0 ) { + napi_throw_range_error(env,NULL,"invalid argument. Invalid triangle or dimension."); return NULL; + } + if ( napi_typeof(env,argv[11],&type) != napi_ok || type != napi_number || napi_get_value_double(env,argv[11],&tol) != napi_ok ) { + napi_throw_type_error(env,NULL,"invalid argument. TOL must be a primitive finite Number."); return NULL; + } + if ( !isfinite(tol) ) { napi_throw_range_error(env,NULL,"invalid argument. TOL must be finite."); return NULL; } + if ( !typed(env,argv[9],napi_int32_array,&v[0]) || !integer(env,argv[10],&n[10]) ) { return NULL; } + if ( !bounds(&v[0],1,1,0,0,n[10],4) ) { napi_throw_range_error(env,NULL,"invalid argument. Invalid rank view."); return NULL; } + r=(int32_t *)v[0].data; + if ( n[1] == 0 ) { + r[n[10]]=0; + STDLIB_NAPI_CREATE_INT32(env,0,empty); return empty; + } + for ( i=0; i<(int64_t)(sizeof(slots)/sizeof(slots[0])); i++ ) { + if ( !integer(env,argv[slots[i]],&n[slots[i]]) ) { return NULL; } + } + if ( !typed(env,argv[2],napi_float64_array,&v[1]) || !typed(env,argv[6],napi_int32_array,&v[2]) || !typed(env,argv[12],napi_float64_array,&v[3]) ) { return NULL; } + if ( n[1] > (META_MAX-2)/2 || !bounds(&v[1],n[1],n[1],n[3],n[4],n[5],8) || !bounds(&v[2],n[1],1,n[7],0,n[8],4) || !bounds(&v[3],2*n[1],1,n[13],0,n[14],8) || !disjoint(v) || (n[1] > 1 && ((n[1]+1)*((n[3] < 0) ? -n[3] : n[3])+1 > META_MAX || (n[1]+1)*((n[4] < 0) ? -n[4] : n[4])+1 > META_MAX)) ) { + napi_throw_range_error(env,NULL,"invalid argument. Invalid, overlapping or unrepresentable indexed geometry."); return NULL; + } + if ( (uintmax_t)n[1] > SIZE_MAX/sizeof(LAPACK_INT) ) { napi_throw_range_error(env,NULL,"invalid argument. Pivot workspace is too large."); return NULL; } + pivots=(LAPACK_INT *)malloc((size_t)n[1]*sizeof(LAPACK_INT)); + if ( pivots == NULL ) { napi_throw_error(env,NULL,"allocation failed. Unable to stage permutation output."); return NULL; } + result=API_SUFFIX(c_dpstf2_ndarray)((LAPACK_UPLO)n[0],(LAPACK_INT)n[1],(double *)v[1].data,(LAPACK_INT)n[3],(LAPACK_INT)n[4],(LAPACK_INT)n[5],pivots,1,0,&rank,0,tol,(double *)v[3].data,(LAPACK_INT)n[13],(LAPACK_INT)n[14]); + if ( result < 0 ) { free(pivots); napi_throw_range_error(env,NULL,"invalid argument. Native core rejected metadata."); return NULL; } + p=(int32_t *)v[2].data; + for ( i=0; i dpstf2_lapack_max()/2 ) return dpstf2_error( "c_dpstf2", -3 ); + if ( !isfinite( TOL ) ) return dpstf2_error( "c_dpstf2", -8 ); + if ( LDA < 1 || LDA < N ) return dpstf2_error( "c_dpstf2", -5 ); + stride1 = layout == LAPACK_COL_MAJOR ? 1 : LDA; + stride2 = layout == LAPACK_COL_MAJOR ? LDA : 1; + info = dpstf2_validate( 1, uplo, N, A, stride1, stride2, 0, PIV, 1, 0, RANK, 0, TOL, WORK, 1, 0 ); + if ( info != 0 ) return dpstf2_error( "c_dpstf2", info ); + return API_SUFFIX(c_dpstf2_ndarray)( uplo, N, A, stride1, stride2, 0, PIV, 1, 0, RANK, 0, TOL, WORK, 1, 0 ); +} diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/src/dpstf2_ndarray.c b/lib/node_modules/@stdlib/lapack/base/dpstf2/src/dpstf2_ndarray.c new file mode 100644 index 000000000000..260aad42aaf5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/src/dpstf2_ndarray.c @@ -0,0 +1,186 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* Adapted from Reference-LAPACK DPSTF2, commit +* 2e5d9c1273435fbd953adb294ed603e4789afaba, SRC/dpstf2.f, +* blob 3deeaac58c9941aeddded8fd9380513e0e22d6c2. +* Private ordered DGEMV provenance is retained in panel.h. +* The upstream algorithm is licensed under these BSD terms: +* +* Copyright (c) 1992-2025 The University of Tennessee and The University +* of Tennessee Research Foundation. All rights +* reserved. +* Copyright (c) 2000-2025 The University of California Berkeley. All +* rights reserved. +* Copyright (c) 2006-2025 The University of Colorado Denver. All rights +* reserved. +* +* $COPYRIGHT$ +* +* Additional copyrights may follow +* +* $HEADER$ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* +* - Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer listed +* in this license in the documentation and/or other materials +* provided with the distribution. +* +* - Neither the name of the copyright holders nor the names of its +* contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. +* +* The copyright holders provide no reassurances that the source code +* provided does not infringe any patent, copyright, or any other +* intellectual property rights of third parties. The copyright holders +* disclaim any liability to any recipient for claims brought against +* recipient by any third party for infringement of that parties +* intellectual property rights. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "stdlib/lapack/base/dpstf2.h" +#include "validate.h" +#include "panel.h" + +/** +* Computes a complete-pivoting Cholesky factorization with alternative indexing. +* +* @param uplo selected matrix triangle +* @param N matrix order +* @param A input/output matrix +* @param strideA1 matrix row stride +* @param strideA2 matrix column stride +* @param offsetA matrix offset +* @param PIV complete permutation output +* @param stridePIV permutation stride +* @param offsetPIV permutation offset +* @param RANK rank output +* @param offsetRANK rank offset +* @param TOL finite tolerance +* @param WORK 2N-element scratch +* @param strideWORK scratch stride +* @param offsetWORK scratch offset +* @return INFO or a negative argument position +*/ +LAPACK_INT API_SUFFIX(c_dpstf2_ndarray)( const LAPACK_UPLO uplo, const LAPACK_INT N, double *A, const LAPACK_INT strideA1, const LAPACK_INT strideA2, const LAPACK_INT offsetA, LAPACK_INT *PIV, const LAPACK_INT stridePIV, const LAPACK_INT offsetPIV, LAPACK_INT *RANK, const LAPACK_INT offsetRANK, const double TOL, double *WORK, const LAPACK_INT strideWORK, const LAPACK_INT offsetWORK ) { + dpstf2_view a; + intmax_t pvt; + intmax_t j; + intmax_t i; + LAPACK_INT info; + LAPACK_INT item; + double ajj; + double dstop; + double temp; + volatile double product; + + info = dpstf2_validate( 0, uplo, N, A, strideA1, strideA2, offsetA, PIV, stridePIV, offsetPIV, RANK, offsetRANK, TOL, WORK, strideWORK, offsetWORK ); + if ( info != 0 ) return dpstf2_error( "c_dpstf2_ndarray", info ); + if ( N == 0 ) { + RANK[ offsetRANK ] = 0; + return 0; + } + a.data = A; + a.stride1 = strideA1; + a.stride2 = strideA2; + a.offset = offsetA; + for ( i = 1; i <= N; i++ ) PIV[ offsetPIV+(i-1)*stridePIV ] = (LAPACK_INT)i; + pvt = 1; + ajj = DPSTF2_CELL( &a, 1, 1 ); + for ( i = 2; i <= N; i++ ) { + if ( DPSTF2_CELL( &a, i, i ) > ajj ) { + pvt = i; + ajj = DPSTF2_CELL( &a, pvt, pvt ); + } + } + if ( ajj <= 0.0 || isnan( ajj ) ) { + RANK[ offsetRANK ] = 0; + return 1; + } + product = (double)N*0x1p-53; + dstop = TOL < 0.0 ? product*ajj : TOL; + for ( i = 1; i <= N; i++ ) WORK[ offsetWORK+(i-1)*strideWORK ] = 0.0; + for ( j = 1; j <= N; j++ ) { + for ( i = j; i <= N; i++ ) { + if ( j > 1 ) { + temp = uplo == LAPACK_UPPER_TRIANGLE ? DPSTF2_CELL( &a, j-1, i ) : DPSTF2_CELL( &a, i, j-1 ); + product = temp*temp; + WORK[ offsetWORK+(i-1)*strideWORK ] += product; + } + WORK[ offsetWORK+(N+i-1)*strideWORK ] = DPSTF2_CELL( &a, i, i )-WORK[ offsetWORK+(i-1)*strideWORK ]; + } + if ( j > 1 ) { + pvt = j+dpstf2_first_max( N-j+1, WORK, strideWORK, offsetWORK+(N+j-1)*strideWORK ); + ajj = WORK[ offsetWORK+(N+pvt-1)*strideWORK ]; + if ( ajj <= dstop || isnan( ajj ) ) { + // This reference diagnostic pivot is an observable output on early return. + // cppcheck-suppress unreadVariable + DPSTF2_CELL( &a, j, j ) = ajj; + RANK[ offsetRANK ] = (LAPACK_INT)(j-1); + return 1; + } + } + if ( j != pvt ) { + DPSTF2_CELL( &a, pvt, pvt ) = DPSTF2_CELL( &a, j, j ); + if ( uplo == LAPACK_UPPER_TRIANGLE ) { + dpstf2_swap( j-1, &a, 1, j, 0, 1, pvt, 0 ); + dpstf2_swap( N-pvt, &a, j, pvt+1, 1, pvt, pvt+1, 1 ); + dpstf2_swap( pvt-j-1, &a, j, j+1, 1, j+1, pvt, 0 ); + } else { + dpstf2_swap( j-1, &a, j, 1, 1, pvt, 1, 1 ); + dpstf2_swap( N-pvt, &a, pvt+1, j, 0, pvt+1, pvt, 0 ); + dpstf2_swap( pvt-j-1, &a, j+1, j, 0, pvt, j+1, 1 ); + } + temp = WORK[ offsetWORK+(j-1)*strideWORK ]; + WORK[ offsetWORK+(j-1)*strideWORK ] = WORK[ offsetWORK+(pvt-1)*strideWORK ]; + WORK[ offsetWORK+(pvt-1)*strideWORK ] = temp; + item = PIV[ offsetPIV+(j-1)*stridePIV ]; + PIV[ offsetPIV+(j-1)*stridePIV ] = PIV[ offsetPIV+(pvt-1)*stridePIV ]; + PIV[ offsetPIV+(pvt-1)*stridePIV ] = item; + } + ajj = sqrt( ajj ); + DPSTF2_CELL( &a, j, j ) = ajj; + if ( j < N ) { + dpstf2_gemv( uplo, N, j, &a ); + if ( uplo == LAPACK_UPPER_TRIANGLE ) dpstf2_scale( N-j, 1.0/ajj, &a, j, j+1, 1 ); + else dpstf2_scale( N-j, 1.0/ajj, &a, j+1, j, 0 ); + } + } + RANK[ offsetRANK ] = N; + return 0; +} diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/src/panel.h b/lib/node_modules/@stdlib/lapack/base/dpstf2/src/panel.h new file mode 100644 index 000000000000..9d82ebe82ef3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/src/panel.h @@ -0,0 +1,141 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* Private reference-order helpers adapted from Reference-LAPACK DGEMV at +* commit 2e5d9c1273435fbd953adb294ed603e4789afaba, BLAS/SRC/dgemv.f, +* blob f6defb8c2950028e68ceb23fdf64673e64d2751e. Written 22-October-1986 +* by Jack Dongarra (Argonne National Lab.), Jeremy Du Croz and Sven +* Hammarling (NAG Central Office), and Richard Hanson (Sandia National Labs). +* The full upstream BSD license is retained in dpstf2_ndarray.c and NOTICE. +*/ +#ifndef STDLIB_LAPACK_BASE_DPSTF2_PANEL_H +#define STDLIB_LAPACK_BASE_DPSTF2_PANEL_H + +#include "stdlib/blas/base/dscal.h" +#include "stdlib/blas/base/dswap.h" +#include + +typedef struct dpstf2_view { + double *data; + intmax_t stride1; + intmax_t stride2; + intmax_t offset; +} dpstf2_view; + +// One-based logical cells retain the pinned algorithm's coordinates. +#define DPSTF2_CELL( view, row, column ) ( (view)->data[ (view)->offset+((row)-1)*(view)->stride1+((column)-1)*(view)->stride2 ] ) + +/** +* Computes a prevalidated active matrix cell's physical element index. +*/ +static intmax_t dpstf2_cell_index( const dpstf2_view *a, const intmax_t row, const intmax_t column ) { + return a->offset+(row-1)*a->stride1+(column-1)*a->stride2; +} + +/** +* Swaps logical fragments using the existing guarded DSWAP ndarray adapter. +* +* Zero counts return before index arithmetic or derived pointer formation. +* Singleton increments normalize to one, avoiding casts of unused strides. +*/ +static void dpstf2_swap( const intmax_t count, dpstf2_view *a, const intmax_t rowX, const intmax_t columnX, const int axisX, const intmax_t rowY, const intmax_t columnY, const int axisY ) { + intmax_t offsetX; + intmax_t offsetY; + intmax_t strideX; + intmax_t strideY; + + if ( count <= 0 ) return; + offsetX = dpstf2_cell_index( a, rowX, columnX ); + offsetY = dpstf2_cell_index( a, rowY, columnY ); + strideX = count == 1 ? 1 : ( axisX == 0 ? a->stride1 : a->stride2 ); + strideY = count == 1 ? 1 : ( axisY == 0 ? a->stride1 : a->stride2 ); + API_SUFFIX(c_dswap_ndarray)( (CBLAS_INT)count, a->data+offsetX, (CBLAS_INT)strideX, 0, a->data+offsetY, (CBLAS_INT)strideY, 0 ); +} + +/** +* Scales a logical fragment using the existing guarded DSCAL ndarray adapter. +*/ +static void dpstf2_scale( const intmax_t count, const double alpha, dpstf2_view *a, const intmax_t row, const intmax_t column, const int axis ) { + intmax_t offset; + intmax_t stride; + + if ( count <= 0 ) return; + offset = dpstf2_cell_index( a, row, column ); + stride = count == 1 ? 1 : ( axis == 0 ? a->stride1 : a->stride2 ); + API_SUFFIX(c_dscal_ndarray)( (CBLAS_INT)count, alpha, a->data+offset, (CBLAS_INT)stride, 0 ); +} + +/** +* Returns the first logical maximum ordinal, comparing actual candidate values. +*/ +static intmax_t dpstf2_first_max( const intmax_t count, const double *x, const intmax_t stride, const intmax_t offset ) { + intmax_t winner; + intmax_t i; + double maximum; + double value; + + if ( count < 1 ) return -1; + maximum = x[ offset ]; + winner = 0; + for ( i = 1; i < count; i++ ) { + value = x[ offset+i*stride ]; + if ( value > maximum ) { + maximum = value; + winner = i; + } + } + return winner; +} + +/** +* Performs only the pinned GEMV modes, alpha=-1 and beta=1. +* +* Upper Trans computes each dot before updating its output; lower NoTrans +* performs ascending scaled column additions. Zero coefficients participate. +* Volatile products round multiplication before addition in both modes. +* Source, X and Y logical cells are disjoint within the injective A view. +*/ +static void dpstf2_gemv( const LAPACK_UPLO uplo, const intmax_t n, const intmax_t step, dpstf2_view *a ) { + intmax_t i; + intmax_t j; + double temp; + volatile double product; + + if ( step <= 1 || step >= n ) return; + if ( uplo == LAPACK_UPPER_TRIANGLE ) { + for ( j = step+1; j <= n; j++ ) { + temp = 0.0; + for ( i = 1; i < step; i++ ) { + product = DPSTF2_CELL( a, i, j )*DPSTF2_CELL( a, i, step ); + temp += product; + } + DPSTF2_CELL( a, step, j ) += -temp; + } + } else { + for ( j = 1; j < step; j++ ) { + temp = -DPSTF2_CELL( a, step, j ); + for ( i = step+1; i <= n; i++ ) { + product = temp*DPSTF2_CELL( a, i, j ); + DPSTF2_CELL( a, i, step ) += product; + } + } + } +} + +#endif // !STDLIB_LAPACK_BASE_DPSTF2_PANEL_H diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/src/validate.h b/lib/node_modules/@stdlib/lapack/base/dpstf2/src/validate.h new file mode 100644 index 000000000000..3864a734a23d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/src/validate.h @@ -0,0 +1,257 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef STDLIB_LAPACK_BASE_DPSTF2_VALIDATION_H +#define STDLIB_LAPACK_BASE_DPSTF2_VALIDATION_H + +#include "stdlib/lapack/base/shared.h" +#include "stdlib/lapack/base/xerbla.h" +#include +#include +#include +#include + +typedef char dpstf2_lapack_integer_check[ ( sizeof( LAPACK_INT ) <= sizeof( intmax_t ) && (LAPACK_INT)-1 < 0 ) ? 1 : -1 ]; +typedef char dpstf2_blas_integer_check[ ( sizeof( CBLAS_INT ) <= sizeof( intmax_t ) && (CBLAS_INT)-1 < 0 ) ? 1 : -1 ]; + +typedef struct dpstf2_envelope { + uintptr_t first; + uintptr_t last; +} dpstf2_envelope; + +/** +* Returns the largest configured LAPACK integer. +*/ +static intmax_t dpstf2_lapack_max( void ) { + return (intmax_t)( UINTMAX_MAX >> ( (sizeof( uintmax_t )-sizeof( LAPACK_INT ))*CHAR_BIT + 1 ) ); +} + +/** +* Returns the largest configured BLAS integer independently of LAPACK_INT. +*/ +static uintmax_t dpstf2_blas_max( void ) { + return UINTMAX_MAX >> ( (sizeof( uintmax_t )-sizeof( CBLAS_INT ))*CHAR_BIT + 1 ); +} + +/** +* Computes a magnitude without negating a minimum signed integer. +*/ +static uintmax_t dpstf2_magnitude( const intmax_t value ) { + return value < 0 ? (uintmax_t)( -(value+1) )+1 : (uintmax_t)value; +} + +/** +* Computes an exact, checked configured LAPACK integer product. +*/ +static int dpstf2_product( const uintmax_t count, const intmax_t stride, intmax_t *result ) { + const intmax_t limit = dpstf2_lapack_max(); + uintmax_t magnitude; + uintmax_t bound; + + if ( count == 0 || stride == 0 ) { + *result = 0; + return 1; + } + magnitude = dpstf2_magnitude( stride ); + bound = (uintmax_t)limit + ( stride < 0 ? 1 : 0 ); + if ( count > bound/magnitude ) { + return 0; + } + magnitude *= count; + if ( stride < 0 ) { + *result = magnitude == (uintmax_t)limit+1 ? -limit-1 : -(intmax_t)magnitude; + } else { + *result = (intmax_t)magnitude; + } + return 1; +} + +/** +* Computes an exact, checked configured LAPACK integer sum. +*/ +static int dpstf2_sum( const intmax_t x, const intmax_t y, intmax_t *result ) { + const intmax_t limit = dpstf2_lapack_max(); + const intmax_t minimum = -limit-1; + + if ( ( y > 0 && x > limit-y ) || ( y < 0 && x < minimum-y ) ) { + return 0; + } + *result = x+y; + return 1; +} + +/** +* Returns the greatest common divisor of two nonzero magnitudes. +*/ +static uintmax_t dpstf2_gcd( uintmax_t x, uintmax_t y ) { + uintmax_t remainder; + + while ( y != 0 ) { + remainder = x%y; + x = y; + y = remainder; + } + return x; +} + +/** +* Checks an inclusive physical byte envelope without forming derived pointers. +*/ +static int dpstf2_envelope_valid( const void *data, const intmax_t first, const intmax_t last, const size_t size, dpstf2_envelope *envelope ) { + const uintptr_t address = (uintptr_t)data; + uintmax_t last_byte; + uintmax_t first_byte; + + if ( first < 0 || last < first || (uintmax_t)last > ( (uintmax_t)PTRDIFF_MAX-(size-1) )/size ) { + return 0; + } + first_byte = (uintmax_t)first*size; + last_byte = (uintmax_t)last*size+(size-1); + if ( last_byte > UINTPTR_MAX || address > UINTPTR_MAX-(uintptr_t)last_byte ) { + return 0; + } + envelope->first = address+(uintptr_t)first_byte; + envelope->last = address+(uintptr_t)last_byte; + return 1; +} + +/** +* Checks conservative physical byte-envelope overlap. +*/ +static int dpstf2_overlap( const dpstf2_envelope *x, const dpstf2_envelope *y ) { + return x->first <= y->last && y->first <= x->last; +} + +/** +* Validates matrix geometry and reports the offending component (1,2,3). +*/ +static int dpstf2_matrix_valid( const void *data, const intmax_t rows, const intmax_t columns, const intmax_t stride1, const intmax_t stride2, const intmax_t offset, dpstf2_envelope *envelope ) { + uintmax_t magnitude1; + uintmax_t magnitude2; + uintmax_t divisor; + intmax_t delta1; + intmax_t delta2; + intmax_t corner1; + intmax_t corner2; + intmax_t corner3; + intmax_t first; + intmax_t last; + + if ( ( rows > 1 && stride1 == 0 ) || !dpstf2_product( (uintmax_t)(rows-1), stride1, &delta1 ) ) { + return 1; + } + if ( ( columns > 1 && stride2 == 0 ) || !dpstf2_product( (uintmax_t)(columns-1), stride2, &delta2 ) ) { + return 2; + } + if ( rows > 1 && columns > 1 ) { + magnitude1 = dpstf2_magnitude( stride1 ); + magnitude2 = dpstf2_magnitude( stride2 ); + divisor = dpstf2_gcd( magnitude1, magnitude2 ); + if ( magnitude2/divisor < (uintmax_t)rows && magnitude1/divisor < (uintmax_t)columns ) { + return 2; + } + } + if ( !dpstf2_sum( offset, delta1, &corner1 ) || !dpstf2_sum( offset, delta2, &corner2 ) || !dpstf2_sum( corner1, delta2, &corner3 ) ) { + return 3; + } + first = offset; + last = offset; + if ( corner1 < first ) first = corner1; + if ( corner2 < first ) first = corner2; + if ( corner3 < first ) first = corner3; + if ( corner1 > last ) last = corner1; + if ( corner2 > last ) last = corner2; + if ( corner3 > last ) last = corner3; + return dpstf2_envelope_valid( data, first, last, sizeof( double ), envelope ) ? 0 : 3; +} + +/** +* Guards every potential DSCAL/DSWAP call before factorization writes. +* +* Calls rebase operands to offset zero. Singleton strides normalize to one. +* The conservative count*abs(stride)+abs(stride)+1 bound covers signed +* casts, negative-stride rebasing, Fortran one-based indices, DSCAL's endpoint, +* both helpers' poststeps, and compiler loop-trip arithmetic. The count+2 +* bound covers the unit-stride unrolled loop terminal independently. +*/ +static int dpstf2_blas_valid( const intmax_t count, const intmax_t stride ) { + const uintmax_t limit = dpstf2_blas_max(); + const uintmax_t length = (uintmax_t)count; + const uintmax_t magnitude = dpstf2_magnitude( stride ); + + if ( count <= 1 ) return 1; + if ( length > limit-2 || magnitude == 0 || magnitude > limit ) return 0; + return length+1 <= (limit-1)/magnitude; +} + +/** +* Validates all active views and potential helper arithmetic before writes. +* +* The main flag selects public main9 error positions. Scalar validation and +* the active RANK envelope precede the safe-empty return. A, PIV and WORK +* are then validated in order, with overlap attributed to the later view. +*/ +static LAPACK_INT dpstf2_validate( const int main, const LAPACK_UPLO uplo, const LAPACK_INT N, const double *A, const LAPACK_INT strideA1, const LAPACK_INT strideA2, const LAPACK_INT offsetA, const LAPACK_INT *PIV, const LAPACK_INT stridePIV, const LAPACK_INT offsetPIV, const LAPACK_INT *RANK, const LAPACK_INT offsetRANK, const double TOL, const double *WORK, const LAPACK_INT strideWORK, const LAPACK_INT offsetWORK ) { + dpstf2_envelope rank; + dpstf2_envelope a; + dpstf2_envelope p; + dpstf2_envelope w; + intmax_t delta; + intmax_t endpoint; + intmax_t first; + intmax_t last; + int error; + + if ( uplo != LAPACK_UPPER_TRIANGLE && uplo != LAPACK_LOWER_TRIANGLE ) return main ? -2 : -1; + if ( N < 0 || (intmax_t)N > dpstf2_lapack_max()/2 ) return main ? -3 : -2; + if ( !isfinite( TOL ) ) return main ? -8 : -12; + if ( RANK == NULL ) return main ? -7 : -10; + if ( !dpstf2_envelope_valid( RANK, offsetRANK, offsetRANK, sizeof( LAPACK_INT ), &rank ) ) return main ? -7 : -11; + if ( N == 0 ) return 0; + if ( A == NULL ) return main ? -4 : -3; + error = dpstf2_matrix_valid( A, N, N, strideA1, strideA2, offsetA, &a ); + if ( error != 0 ) return main ? -4 : (LAPACK_INT)(-3-error); + if ( dpstf2_overlap( &rank, &a ) ) return main ? -4 : -3; + if ( PIV == NULL ) return main ? -6 : -7; + if ( ( N > 1 && stridePIV == 0 ) || !dpstf2_product( (uintmax_t)(N-1), stridePIV, &delta ) ) return main ? -6 : -8; + if ( !dpstf2_sum( offsetPIV, delta, &endpoint ) ) return main ? -6 : -9; + first = offsetPIV < endpoint ? offsetPIV : endpoint; + last = offsetPIV > endpoint ? offsetPIV : endpoint; + if ( !dpstf2_envelope_valid( PIV, first, last, sizeof( LAPACK_INT ), &p ) ) return main ? -6 : -9; + if ( dpstf2_overlap( &rank, &p ) || dpstf2_overlap( &a, &p ) ) return main ? -6 : -7; + if ( WORK == NULL ) return main ? -9 : -13; + if ( strideWORK == 0 || !dpstf2_product( (uintmax_t)N*2-1, strideWORK, &delta ) ) return main ? -9 : -14; + if ( !dpstf2_sum( offsetWORK, delta, &endpoint ) ) return main ? -9 : -15; + first = offsetWORK < endpoint ? offsetWORK : endpoint; + last = offsetWORK > endpoint ? offsetWORK : endpoint; + if ( !dpstf2_envelope_valid( WORK, first, last, sizeof( double ), &w ) ) return main ? -9 : -15; + if ( dpstf2_overlap( &rank, &w ) || dpstf2_overlap( &a, &w ) || dpstf2_overlap( &p, &w ) ) return main ? -9 : -13; + if ( !dpstf2_blas_valid( N-1, strideA1 ) ) return main ? -5 : -4; + if ( !dpstf2_blas_valid( N-1, strideA2 ) ) return -5; + return 0; +} + +/** +* Prints an adopted LAPACK diagnostic and returns this routine's status. +*/ +static LAPACK_INT dpstf2_error( const char *name, const LAPACK_INT info ) { + API_SUFFIX(lapack_xerbla)( name, info ); + return info; +} + +#endif // !STDLIB_LAPACK_BASE_DPSTF2_VALIDATION_H diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/test/common.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/test/common.js new file mode 100644 index 000000000000..67c2cbfed358 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/test/common.js @@ -0,0 +1,239 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +'use strict'; + +// MODULES // + +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var ArrayBuffer = require( '@stdlib/array/buffer' ); +var DataView = require( '@stdlib/array/dataview' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var max = require( '@stdlib/math/base/special/max' ); +var min = require( '@stdlib/math/base/special/min' ); +var fixtures = require( './fixtures/reference.json' ).cases; + + +// FUNCTIONS // + +/** +* Decodes canonical hexadecimal float64 reference bits. +* @private +* @param {string} s - bits +* @returns {number} value +*/ +function decode(s) { + var v = new DataView(new ArrayBuffer(8)); + v.setUint32(0, parseInt(s.slice(0, 8), 16), false); + v.setUint32(4, parseInt(s.slice(8), 16), false); + return v.getFloat64(0, false); +} +/** +* Encodes floating-point bits without losing signed zero. +* @private +* @param {number} x - value +* @returns {string} bits +*/ +function bits(x) { + var v = new DataView(new ArrayBuffer(8)); + var a; + var b; + v.setFloat64(0, x, false); + a = v.getUint32(0, false).toString(16); + b = v.getUint32(4, false).toString(16); + return (('00000000' + a).slice(-8) + ('00000000' + b).slice(-8)); +} +/** +* Captures a typed view as exact bits or integers. +* @private +* @param {TypedArray} a - view +* @param {boolean} integer - integer dtype +* @returns {Array} snapshot +*/ +function snapshot(a, integer) { + var out = []; + var i; + for (i = 0; (i < a.length); i++) { + out.push(( integer ) ? a[i] : bits(a[i])); + } + return out; +} +/** +* Exercises stored triangles, output masks and mathematical factor rows. +* @private +* @param {Object} t - tape assertion object +* @param {Function} f - public kernel +* @returns {void} +*/ +function check(t, f) { + var residual; + var strides; + var scale; + var info; + var sum; + var lhs; + var ra; + var ca; + var oa; + var sp; + var op; + var sw; + var ow; + var ea; + var ep; + var ew; + var c; + var n; + var a; + var p; + var r; + var w; + var i; + var j; + var k; + var z; + var h; + var u; + for (h = 0; (h < fixtures.length); h++) { + c = fixtures[h]; + n = c.n; + u = (c.uplo === 'U') ? 'upper' : 'lower'; + strides = [ + [ + (n + 3), + 1, + 1, + 1 + ], + [ + 1, + (n + 3), + -2, + -2 + ], + [ + (-2 * (n + 3)), + 2, + 2, + 3 + ], + [ + 2, + (-2 * (n + 3)), + -3, + -1 + ], + [ + -3, + (-3 * (n + 3)), + 1, + -3 + ] + ]; + for (z = 0; (z < strides.length); z++) { + ra = strides[z][0]; + ca = strides[z][1]; + sp = strides[z][2]; + sw = strides[z][3]; + oa = ((5 - min(0, ((n - 1) * ra))) - min(0, ((n - 1) * ca))); + op = (4 - min(0, ((n - 1) * sp))); + ow = (5 - min(0, (((2 * n) - 1) * sw))); + a = new Float64Array(new ArrayBuffer((8 * (((oa + max(0, ((n - 1) * ra))) + max(0, ((n - 1) * ca))) + 9))), 16); + p = new Int32Array(((op + max(0, ((n - 1) * sp))) + 5)); + r = new Int32Array([ + 81, + 82, + 83 + ]); + w = new Float64Array(new ArrayBuffer((8 * ((ow + max(0, (((2 * n) - 1) * sw))) + 9))), 16); + for (i = 0; (i < a.length); i++) { + a[i] = 117.25; + } + for (i = 0; (i < p.length); i++) { + p[i] = -2147483648; + } + for (i = 0; (i < w.length); i++) { + w[i] = 91.125; + } + for (i = 0; (i < n); i++) { + for (j = 0; (j < n); j++) { + a[((oa + (i * ra)) + (j * ca))] = decode(c.a[((i * n) + j)]); + } + } + for (i = 0; (i < (2 * n)); i++) { + w[(ow + (i * sw))] = decode(c.w[i]); + } + ea = snapshot(a, false); + ep = snapshot(p, true); + ew = snapshot(w, false); + for (i = 0; (i < n); i++) { + for (j = 0; (j < n); j++) { + ea[((oa + (i * ra)) + (j * ca))] = c.expected_a[((i * n) + j)]; + } + ep[(op + (i * sp))] = c.piv[i]; + } + for (i = 0; (i < (2 * n)); i++) { + ew[(ow + (i * sw))] = c.expected_w[i]; + } + info = f.ndarray(u, n, a, ra, ca, oa, p, sp, op, r, 1, decode(c.tol), w, sw, ow); + t.strictEqual(info, c.info, (c.name + ' INFO')); + t.deepEqual(snapshot(a, false), ea, 'factor and ignored cells, guards and padding'); + t.deepEqual(snapshot(p, true), ep, 'complete positive permutation and pivot guards'); + t.deepEqual(snapshot(w, false), ew, 'scratch mutation and guards'); + t.deepEqual(snapshot(r, true), [ + 81, + c.rank, + 83 + ], 'only active rank written'); + + // Independently reconstruct completed leading rows of P^T*A*P. + residual = 0; + scale = 1; + for (i = 0; (i < c.rank); i++) { + for (j = 0; (j < n); j++) { + sum = 0; + for (k = 0; (k <= min(i, j)); k++) { + if ((c.uplo === 'U')) { // eslint-disable-line max-depth + sum += (a[((oa + (k * ra)) + (i * ca))] * a[((oa + (k * ra)) + (j * ca))]); + } else { + sum += (a[((oa + (i * ra)) + (k * ca))] * a[((oa + (j * ra)) + (k * ca))]); + } + } + lhs = decode(c.a[((((c.piv[i] - 1) * n) + c.piv[j]) - 1)]); + + // The fixture's opposite triangle is deliberately unrelated storage. + if ((((c.uplo === 'U') && (c.piv[i] > c.piv[j])) || ((c.uplo === 'L') && (c.piv[i] < c.piv[j])))) { + lhs = decode(c.a[((((c.piv[j] - 1) * n) + c.piv[i]) - 1)]); + } + residual = max(residual, abs((lhs - sum))); + scale = max(scale, abs(lhs)); + } + } + t.ok((residual <= ((2e-13 * n) * scale)), 'independent completed-row reconstruction'); + } + } +} + + +// EXPORTS // + +module.exports = { + 'check': check, + 'bits': bits, + 'snapshot': snapshot +}; diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/test/fixtures/reference.json b/lib/node_modules/@stdlib/lapack/base/dpstf2/test/fixtures/reference.json new file mode 100644 index 000000000000..1122e1ee135f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/test/fixtures/reference.json @@ -0,0 +1,4581 @@ +{ + "reference_pin": "2e5d9c1273435fbd953adb294ed603e4789afaba", + "source": "SRC/dpstf2.f", + "execution": "GNU Fortran LP64 O0; unchanged reference calls, not a JS-generated oracle", + "cases": [ + { + "name": "one-positive", + "uplo": "U", + "n": 1, + "tol": "bff0000000000000", + "a": [ + "4010000000000000" + ], + "expected_a": [ + "4000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "expected_w": [ + "0000000000000000", + "4010000000000000" + ], + "piv": [ + 1 + ], + "rank": 1, + "info": 0 + }, + { + "name": "one-positive", + "uplo": "L", + "n": 1, + "tol": "bff0000000000000", + "a": [ + "4010000000000000" + ], + "expected_a": [ + "4000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "expected_w": [ + "0000000000000000", + "4010000000000000" + ], + "piv": [ + 1 + ], + "rank": 1, + "info": 0 + }, + { + "name": "one-positive-tol-above-max", + "uplo": "U", + "n": 1, + "tol": "4059000000000000", + "a": [ + "4010000000000000" + ], + "expected_a": [ + "4000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "expected_w": [ + "0000000000000000", + "4010000000000000" + ], + "piv": [ + 1 + ], + "rank": 1, + "info": 0 + }, + { + "name": "one-positive-tol-above-max", + "uplo": "L", + "n": 1, + "tol": "4059000000000000", + "a": [ + "4010000000000000" + ], + "expected_a": [ + "4000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "expected_w": [ + "0000000000000000", + "4010000000000000" + ], + "piv": [ + 1 + ], + "rank": 1, + "info": 0 + }, + { + "name": "one-zero", + "uplo": "U", + "n": 1, + "tol": "bff0000000000000", + "a": [ + "0000000000000000" + ], + "expected_a": [ + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "expected_w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "piv": [ + 1 + ], + "rank": 0, + "info": 1 + }, + { + "name": "one-zero", + "uplo": "L", + "n": 1, + "tol": "bff0000000000000", + "a": [ + "0000000000000000" + ], + "expected_a": [ + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "expected_w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "piv": [ + 1 + ], + "rank": 0, + "info": 1 + }, + { + "name": "one-negative", + "uplo": "U", + "n": 1, + "tol": "bff0000000000000", + "a": [ + "c000000000000000" + ], + "expected_a": [ + "c000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "expected_w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "piv": [ + 1 + ], + "rank": 0, + "info": 1 + }, + { + "name": "one-negative", + "uplo": "L", + "n": 1, + "tol": "bff0000000000000", + "a": [ + "c000000000000000" + ], + "expected_a": [ + "c000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "expected_w": [ + "412e240ce0000000", + "412e240d00000000" + ], + "piv": [ + 1 + ], + "rank": 0, + "info": 1 + }, + { + "name": "diagonal-pivot-order", + "uplo": "U", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4022000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "4010000000000000" + ], + "expected_a": [ + "4008000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3ff0000000000000", + "3ff0000000000000" + ], + "piv": [ + 2, + 3, + 1 + ], + "rank": 3, + "info": 0 + }, + { + "name": "diagonal-pivot-order", + "uplo": "L", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4022000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "4010000000000000" + ], + "expected_a": [ + "4008000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4000000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3ff0000000000000", + "3ff0000000000000" + ], + "piv": [ + 2, + 3, + 1 + ], + "rank": 3, + "info": 0 + }, + { + "name": "identity-ties", + "uplo": "U", + "n": 5, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "3ff0000000000000", + "0000000000000000", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "3ff0000000000000" + ], + "expected_a": [ + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "3ff0000000000000", + "0000000000000000", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3ff0000000000000", + "3ff0000000000000", + "3ff0000000000000", + "3ff0000000000000" + ], + "piv": [ + 1, + 2, + 3, + 4, + 5 + ], + "rank": 5, + "info": 0 + }, + { + "name": "identity-ties", + "uplo": "L", + "n": 5, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "0000000000000000", + "3ff0000000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "c0f81cfe00000000", + "c0f81d0000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "c0f81d1000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000" + ], + "expected_a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "0000000000000000", + "3ff0000000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "c0f81cfe00000000", + "c0f81d0000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "c0f81d1000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3ff0000000000000", + "3ff0000000000000", + "3ff0000000000000", + "3ff0000000000000" + ], + "piv": [ + 1, + 2, + 3, + 4, + 5 + ], + "rank": 5, + "info": 0 + }, + { + "name": "rank-two-diagonal", + "uplo": "U", + "n": 4, + "tol": "bff0000000000000", + "a": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4010000000000000", + "0000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000", + "0000000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "4022000000000000" + ], + "expected_a": [ + "4008000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000", + "0000000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4010000000000000", + "0000000000000000", + "0000000000000000" + ], + "piv": [ + 4, + 2, + 3, + 1 + ], + "rank": 2, + "info": 1 + }, + { + "name": "rank-two-diagonal", + "uplo": "L", + "n": 4, + "tol": "bff0000000000000", + "a": [ + "0000000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "0000000000000000", + "4010000000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81cfe00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4022000000000000" + ], + "expected_a": [ + "4008000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "0000000000000000", + "4000000000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81cfe00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4010000000000000", + "0000000000000000", + "0000000000000000" + ], + "piv": [ + 4, + 2, + 3, + 1 + ], + "rank": 2, + "info": 1 + }, + { + "name": "zero-matrix", + "uplo": "U", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "0000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000" + ], + "expected_a": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "0000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 0, + "info": 1 + }, + { + "name": "zero-matrix", + "uplo": "L", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "0000000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "0000000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "expected_a": [ + "0000000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "0000000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 0, + "info": 1 + }, + { + "name": "negative-diagonal", + "uplo": "U", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "bff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "c008000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "c000000000000000" + ], + "expected_a": [ + "bff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "c008000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "c000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 0, + "info": 1 + }, + { + "name": "negative-diagonal", + "uplo": "L", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "bff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "c008000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "c000000000000000" + ], + "expected_a": [ + "bff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "c008000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "c000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 0, + "info": 1 + }, + { + "name": "indefinite-diagonal", + "uplo": "U", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "4010000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "bff0000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "4000000000000000" + ], + "expected_a": [ + "4000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "3ff6a09e667f3bcd", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "bff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4010000000000000", + "bff0000000000000", + "bff0000000000000" + ], + "piv": [ + 1, + 3, + 2 + ], + "rank": 2, + "info": 1 + }, + { + "name": "indefinite-diagonal", + "uplo": "L", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "4010000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "bff0000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "4000000000000000" + ], + "expected_a": [ + "4000000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "3ff6a09e667f3bcd", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "bff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4010000000000000", + "bff0000000000000", + "bff0000000000000" + ], + "piv": [ + 1, + 3, + 2 + ], + "rank": 2, + "info": 1 + }, + { + "name": "indefinite-off-diagonal", + "uplo": "U", + "n": 2, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "4000000000000000", + "c0f81ce800000000", + "3ff0000000000000" + ], + "expected_a": [ + "3ff0000000000000", + "4000000000000000", + "c0f81ce800000000", + "c008000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000" + ], + "expected_w": [ + "0000000000000000", + "4010000000000000", + "3ff0000000000000", + "c008000000000000" + ], + "piv": [ + 1, + 2 + ], + "rank": 1, + "info": 1 + }, + { + "name": "indefinite-off-diagonal", + "uplo": "L", + "n": 2, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "c0f81cda00000000", + "4000000000000000", + "3ff0000000000000" + ], + "expected_a": [ + "3ff0000000000000", + "c0f81cda00000000", + "4000000000000000", + "c008000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000" + ], + "expected_w": [ + "0000000000000000", + "4010000000000000", + "3ff0000000000000", + "c008000000000000" + ], + "piv": [ + 1, + 2 + ], + "rank": 1, + "info": 1 + }, + { + "name": "zero-diagonal-indefinite", + "uplo": "U", + "n": 2, + "tol": "bff0000000000000", + "a": [ + "0000000000000000", + "3ff0000000000000", + "c0f81ce800000000", + "0000000000000000" + ], + "expected_a": [ + "0000000000000000", + "3ff0000000000000", + "c0f81ce800000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000" + ], + "expected_w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000" + ], + "piv": [ + 1, + 2 + ], + "rank": 0, + "info": 1 + }, + { + "name": "zero-diagonal-indefinite", + "uplo": "L", + "n": 2, + "tol": "bff0000000000000", + "a": [ + "0000000000000000", + "c0f81cda00000000", + "3ff0000000000000", + "0000000000000000" + ], + "expected_a": [ + "0000000000000000", + "c0f81cda00000000", + "3ff0000000000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000" + ], + "expected_w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000" + ], + "piv": [ + 1, + 2 + ], + "rank": 0, + "info": 1 + }, + { + "name": "exact-rank-one-gram", + "uplo": "U", + "n": 4, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "4000000000000000", + "4008000000000000", + "0000000000000000", + "c0f81ce800000000", + "4010000000000000", + "4018000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "4022000000000000", + "0000000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "0000000000000000" + ], + "expected_a": [ + "4008000000000000", + "4000000000000000", + "3ff0000000000000", + "0000000000000000", + "c0f81ce800000000", + "0000000000000000", + "4000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "3ff0000000000000", + "0000000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000" + ], + "expected_w": [ + "0000000000000000", + "4010000000000000", + "3ff0000000000000", + "0000000000000000", + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "piv": [ + 3, + 2, + 1, + 4 + ], + "rank": 1, + "info": 1 + }, + { + "name": "exact-rank-one-gram", + "uplo": "L", + "n": 4, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "4000000000000000", + "4010000000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "4008000000000000", + "4018000000000000", + "4022000000000000", + "c0f81cfe00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "expected_a": [ + "4008000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "4000000000000000", + "0000000000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "3ff0000000000000", + "4000000000000000", + "3ff0000000000000", + "c0f81cfe00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000" + ], + "expected_w": [ + "0000000000000000", + "4010000000000000", + "3ff0000000000000", + "0000000000000000", + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "piv": [ + 3, + 2, + 1, + 4 + ], + "rank": 1, + "info": 1 + }, + { + "name": "exact-rank-two-gram", + "uplo": "U", + "n": 4, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "0000000000000000", + "4008000000000000", + "0000000000000000", + "c0f81ce800000000", + "4010000000000000", + "0000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "4022000000000000", + "0000000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "0000000000000000" + ], + "expected_a": [ + "4008000000000000", + "0000000000000000", + "3ff0000000000000", + "0000000000000000", + "c0f81ce800000000", + "4000000000000000", + "0000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000", + "0000000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "0000000000000000", + "3ff0000000000000", + "4010000000000000", + "0000000000000000", + "0000000000000000" + ], + "piv": [ + 3, + 2, + 1, + 4 + ], + "rank": 2, + "info": 1 + }, + { + "name": "exact-rank-two-gram", + "uplo": "L", + "n": 4, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "0000000000000000", + "4010000000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "4008000000000000", + "0000000000000000", + "4022000000000000", + "c0f81cfe00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "expected_a": [ + "4008000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "0000000000000000", + "4000000000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81cfe00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "0000000000000000", + "3ff0000000000000", + "4010000000000000", + "0000000000000000", + "0000000000000000" + ], + "piv": [ + 3, + 2, + 1, + 4 + ], + "rank": 2, + "info": 1 + }, + { + "name": "explicit-zero-tolerance", + "uplo": "U", + "n": 3, + "tol": "0000000000000000", + "a": [ + "4022000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4010000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000" + ], + "expected_a": [ + "4008000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4022000000000000", + "4010000000000000", + "0000000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 2, + "info": 1 + }, + { + "name": "explicit-zero-tolerance", + "uplo": "L", + "n": 3, + "tol": "0000000000000000", + "a": [ + "4022000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4010000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "expected_a": [ + "4008000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4000000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4022000000000000", + "4010000000000000", + "0000000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 2, + "info": 1 + }, + { + "name": "explicit-tolerance-equal", + "uplo": "U", + "n": 3, + "tol": "4010000000000000", + "a": [ + "4022000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4010000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "3ff0000000000000" + ], + "expected_a": [ + "4008000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4010000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4022000000000000", + "4010000000000000", + "3ff0000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 1, + "info": 1 + }, + { + "name": "explicit-tolerance-equal", + "uplo": "L", + "n": 3, + "tol": "4010000000000000", + "a": [ + "4022000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4010000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000" + ], + "expected_a": [ + "4008000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4010000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4022000000000000", + "4010000000000000", + "3ff0000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 1, + "info": 1 + }, + { + "name": "explicit-tolerance-below", + "uplo": "U", + "n": 3, + "tol": "400fffffffffffff", + "a": [ + "4022000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4010000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "3ff0000000000000" + ], + "expected_a": [ + "4008000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4022000000000000", + "4010000000000000", + "3ff0000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 2, + "info": 1 + }, + { + "name": "explicit-tolerance-below", + "uplo": "L", + "n": 3, + "tol": "400fffffffffffff", + "a": [ + "4022000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4010000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000" + ], + "expected_a": [ + "4008000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4000000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4022000000000000", + "4010000000000000", + "3ff0000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 2, + "info": 1 + }, + { + "name": "explicit-tolerance-above-max", + "uplo": "U", + "n": 3, + "tol": "4059000000000000", + "a": [ + "4022000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4010000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "3ff0000000000000" + ], + "expected_a": [ + "4008000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4010000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4022000000000000", + "4010000000000000", + "3ff0000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 1, + "info": 1 + }, + { + "name": "explicit-tolerance-above-max", + "uplo": "L", + "n": 3, + "tol": "4059000000000000", + "a": [ + "4022000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4010000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000" + ], + "expected_a": [ + "4008000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4010000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "4022000000000000", + "4010000000000000", + "3ff0000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 1, + "info": 1 + }, + { + "name": "negative-tolerance-any-value", + "uplo": "U", + "n": 3, + "tol": "c08f400000000000", + "a": [ + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4022000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "4010000000000000" + ], + "expected_a": [ + "4008000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "4000000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3ff0000000000000", + "3ff0000000000000" + ], + "piv": [ + 2, + 3, + 1 + ], + "rank": 3, + "info": 0 + }, + { + "name": "negative-tolerance-any-value", + "uplo": "L", + "n": 3, + "tol": "c08f400000000000", + "a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4022000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "4010000000000000" + ], + "expected_a": [ + "4008000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "4000000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3ff0000000000000", + "3ff0000000000000" + ], + "piv": [ + 2, + 3, + 1 + ], + "rank": 3, + "info": 0 + }, + { + "name": "default-cutoff-equal", + "uplo": "U", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "3cb8000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000" + ], + "expected_a": [ + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "3cb8000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3cb8000000000000", + "0000000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 1, + "info": 1 + }, + { + "name": "default-cutoff-equal", + "uplo": "L", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "3cb8000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "expected_a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "3cb8000000000000", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3cb8000000000000", + "0000000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 1, + "info": 1 + }, + { + "name": "default-cutoff-below", + "uplo": "U", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "3cb7ffffffffffff", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000" + ], + "expected_a": [ + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "3cb7ffffffffffff", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3cb7ffffffffffff", + "0000000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 1, + "info": 1 + }, + { + "name": "default-cutoff-below", + "uplo": "L", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "3cb7ffffffffffff", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "expected_a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "3cb7ffffffffffff", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3cb7ffffffffffff", + "0000000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 1, + "info": 1 + }, + { + "name": "default-cutoff-above", + "uplo": "U", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "3cb8000000000001", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000" + ], + "expected_a": [ + "3ff0000000000000", + "0000000000000000", + "0000000000000000", + "c0f81ce800000000", + "3e53988e1409212f", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3cb8000000000001", + "0000000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 2, + "info": 1 + }, + { + "name": "default-cutoff-above", + "uplo": "L", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "3cb8000000000001", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "expected_a": [ + "3ff0000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "3e53988e1409212f", + "c0f81cec00000000", + "0000000000000000", + "0000000000000000", + "0000000000000000" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "0000000000000000", + "3ff0000000000000", + "3cb8000000000001", + "0000000000000000" + ], + "piv": [ + 1, + 2, + 3 + ], + "rank": 2, + "info": 1 + }, + { + "name": "seeded-spd-2", + "uplo": "U", + "n": 2, + "tol": "bff0000000000000", + "a": [ + "4010000000000000", + "3ff0000000000000", + "c0f81ce800000000", + "401c000000000000" + ], + "expected_a": [ + "40052a7fa9d2f8ea", + "3fd83091e6a7f7e6", + "c0f81ce800000000", + "3fff6c6261db0fc0" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000" + ], + "expected_w": [ + "0000000000000000", + "3fc2492492492491", + "4010000000000000", + "400edb6db6db6db7" + ], + "piv": [ + 2, + 1 + ], + "rank": 2, + "info": 0 + }, + { + "name": "seeded-spd-2", + "uplo": "L", + "n": 2, + "tol": "bff0000000000000", + "a": [ + "4010000000000000", + "c0f81cda00000000", + "3ff0000000000000", + "401c000000000000" + ], + "expected_a": [ + "40052a7fa9d2f8ea", + "c0f81cda00000000", + "3fd83091e6a7f7e6", + "3fff6c6261db0fc0" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000" + ], + "expected_w": [ + "0000000000000000", + "3fc2492492492491", + "4010000000000000", + "400edb6db6db6db7" + ], + "piv": [ + 2, + 1 + ], + "rank": 2, + "info": 0 + }, + { + "name": "seeded-spd-3", + "uplo": "U", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "4031000000000000", + "bff0000000000000", + "c036000000000000", + "c0f81ce800000000", + "402a000000000000", + "0000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "4043000000000000" + ], + "expected_a": [ + "4018a85c24f70659", + "0000000000000000", + "c00c8d0c60b23d40", + "c0f81ce800000000", + "400cd82b446159f3", + "bfd1c01aa03be896", + "c0f81cf800000000", + "c0f81cfa00000000", + "40005e4478b037f7" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "4029a0a5d4783a0c", + "4031000000000000", + "402a000000000000", + "4010beb4570f8be8" + ], + "piv": [ + 3, + 2, + 1 + ], + "rank": 3, + "info": 0 + }, + { + "name": "seeded-spd-3", + "uplo": "L", + "n": 3, + "tol": "bff0000000000000", + "a": [ + "4031000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "bff0000000000000", + "402a000000000000", + "c0f81cec00000000", + "c036000000000000", + "0000000000000000", + "4043000000000000" + ], + "expected_a": [ + "4018a85c24f70659", + "c0f81cda00000000", + "c0f81cdc00000000", + "0000000000000000", + "400cd82b446159f3", + "c0f81cec00000000", + "c00c8d0c60b23d40", + "bfd1c01aa03be896", + "40005e4478b037f7" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000" + ], + "expected_w": [ + "0000000000000000", + "0000000000000000", + "4029a0a5d4783a0c", + "4031000000000000", + "402a000000000000", + "4010beb4570f8be8" + ], + "piv": [ + 3, + 2, + 1 + ], + "rank": 3, + "info": 0 + }, + { + "name": "seeded-spd-4", + "uplo": "U", + "n": 4, + "tol": "bff0000000000000", + "a": [ + "4048800000000000", + "4014000000000000", + "c028000000000000", + "c020000000000000", + "c0f81ce800000000", + "4043000000000000", + "c022000000000000", + "c032000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "402a000000000000", + "4028000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "404d000000000000" + ], + "expected_a": [ + "401e768d399dc470", + "bff0cea6317186dc", + "c002e87af79fb7b8", + "3ff935f94a2a4a4a", + "c0f81ce800000000", + "401baed4c107f871", + "3fd74743c46a3a28", + "bff7ea884107705a", + "c0f81cf800000000", + "c0f81cfa00000000", + "4016ba0a8ca10406", + "bfeaa6fc7897b1c6", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "400609f2e32132c5" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000" + ], + "expected_w": [ + "0000000000000000", + "3ff1a7b9611a7b95", + "4016dfbf1fe282db", + "4015a49ddfbe0bc6", + "4048800000000000", + "404034f72c234f73", + "402090dd2a93135a", + "401e5b622041f43a" + ], + "piv": [ + 4, + 1, + 2, + 3 + ], + "rank": 4, + "info": 0 + }, + { + "name": "seeded-spd-4", + "uplo": "L", + "n": 4, + "tol": "bff0000000000000", + "a": [ + "4048800000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "4014000000000000", + "4043000000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "c028000000000000", + "c022000000000000", + "402a000000000000", + "c0f81cfe00000000", + "c020000000000000", + "c032000000000000", + "4028000000000000", + "404d000000000000" + ], + "expected_a": [ + "401e768d399dc470", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "bff0cea6317186dc", + "401baed4c107f871", + "c0f81cec00000000", + "c0f81cee00000000", + "c002e87af79fb7b8", + "3fd74743c46a3a28", + "4016ba0a8ca10406", + "c0f81cfe00000000", + "3ff935f94a2a4a4a", + "bff7ea884107705a", + "bfeaa6fc7897b1c6", + "400609f2e32132c5" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000" + ], + "expected_w": [ + "0000000000000000", + "3ff1a7b9611a7b95", + "4016dfbf1fe282db", + "4015a49ddfbe0bc6", + "4048800000000000", + "404034f72c234f73", + "402090dd2a93135a", + "401e5b622041f43a" + ], + "piv": [ + 4, + 1, + 2, + 3 + ], + "rank": 4, + "info": 0 + }, + { + "name": "seeded-spd-5", + "uplo": "U", + "n": 5, + "tol": "bff0000000000000", + "a": [ + "4031000000000000", + "401c000000000000", + "4020000000000000", + "4018000000000000", + "c000000000000000", + "c0f81ce800000000", + "4052400000000000", + "c000000000000000", + "4018000000000000", + "4045000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "4056800000000000", + "4020000000000000", + "c048000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "4026000000000000", + "c000000000000000", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "404d800000000000" + ], + "expected_a": [ + "4022f9422c23c47e", + "bfcafc19d8606169", + "3feafc19d8606169", + "c0143d136248490f", + "3feafc19d8606169", + "c0f81ce800000000", + "40211532b3300ff3", + "3feae42832a28670", + "40132b5c0f7cf867", + "3fe725105e4e0fd8", + "c0f81cf800000000", + "c0f81cfa00000000", + "400f94770fc75584", + "bfdc8b46db0cbe7d", + "3ff2f9309aa393af", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "400997d94ce798e8", + "bfcad5119926b382", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "400711c6b5cb6342" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000" + ], + "expected_w": [ + "0000000000000000", + "3fa6c16c16c16c17", + "3ff6ad441306c8b8", + "404861faf9d32ee9", + "400579a1eae22de8", + "4031000000000000", + "40523d27d27d27d2", + "402f2a577d9f26e9", + "4020b8174c92a3ea", + "4020a19785477486" + ], + "piv": [ + 3, + 2, + 1, + 5, + 4 + ], + "rank": 5, + "info": 0 + }, + { + "name": "seeded-spd-5", + "uplo": "L", + "n": 5, + "tol": "bff0000000000000", + "a": [ + "4031000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "401c000000000000", + "4052400000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "4020000000000000", + "c000000000000000", + "4056800000000000", + "c0f81cfe00000000", + "c0f81d0000000000", + "4018000000000000", + "4018000000000000", + "4020000000000000", + "4026000000000000", + "c0f81d1000000000", + "c000000000000000", + "4045000000000000", + "c048000000000000", + "c000000000000000", + "404d800000000000" + ], + "expected_a": [ + "4022f9422c23c47e", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "bfcafc19d8606169", + "40211532b3300ff3", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "3feafc19d8606169", + "3feae42832a28670", + "400f94770fc75584", + "c0f81cfe00000000", + "c0f81d0000000000", + "c0143d136248490f", + "40132b5c0f7cf867", + "bfdc8b46db0cbe7d", + "400997d94ce798e8", + "c0f81d1000000000", + "3feafc19d8606169", + "3fe725105e4e0fd8", + "3ff2f9309aa393af", + "bfcad5119926b383", + "400711c6b5cb6342" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000" + ], + "expected_w": [ + "0000000000000000", + "3fa6c16c16c16c17", + "3ff6ad441306c8b8", + "404861faf9d32ee9", + "400579a1eae22de8", + "4031000000000000", + "40523d27d27d27d2", + "402f2a577d9f26e9", + "4020b8174c92a3ea", + "4020a19785477486" + ], + "piv": [ + 3, + 2, + 1, + 5, + 4 + ], + "rank": 5, + "info": 0 + }, + { + "name": "seeded-spd-6", + "uplo": "U", + "n": 6, + "tol": "bff0000000000000", + "a": [ + "4055800000000000", + "c03b000000000000", + "c04d800000000000", + "3ff0000000000000", + "4008000000000000", + "4022000000000000", + "c0f81ce800000000", + "4042800000000000", + "4038000000000000", + "c033000000000000", + "0000000000000000", + "4000000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "405c800000000000", + "c02c000000000000", + "c022000000000000", + "c045800000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "4053400000000000", + "4020000000000000", + "403e000000000000", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "4040000000000000", + "c020000000000000", + "c0f81d2800000000", + "c0f81d2a00000000", + "c0f81d2c00000000", + "c0f81d2e00000000", + "c0f81d3000000000", + "4050800000000000" + ], + "expected_a": [ + "40255aaa002a9d5a", + "bff4fac1f72e5bb7", + "c0161a7a122320a1", + "c0101bf9825f066c", + "bfeaf94286f275eb", + "4001fb81af4c4e9d", + "c0f81ce800000000", + "40215a570753bdce", + "bfe708e4a3a5fcf9", + "4006cac6e7ad6881", + "3fe96dc5c02993aa", + "bffd9a2b9476c06c", + "c0f81cf800000000", + "c0f81cfa00000000", + "401da68290599dfa", + "bff82ec7165fe815", + "bfc2c034570dd215", + "c0012bea987a742f", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "401919e948556e3c", + "c001b1e5454c0ea3", + "4000ac9da62fafc0", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "40144ba5e22b7d49", + "3ff8283f7d537527", + "c0f81d2800000000", + "c0f81d2a00000000", + "c0f81d2c00000000", + "c0f81d2e00000000", + "c0f81d3000000000", + "4010a253debc6c06" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000", + "412e240e20000000", + "412e240e40000000" + ], + "expected_w": [ + "0000000000000000", + "3ffb823ee08fb825", + "403f0da1db5e7100", + "403a9edd07a9b08c", + "401905ee82cc6750", + "4033b4e95e711d68", + "4055800000000000", + "403ff286bca1af28", + "404b792f1250c780", + "4037eac940eedeca", + "4039be845f4ce62c", + "40314b16a18ee298" + ], + "piv": [ + 3, + 4, + 1, + 6, + 5, + 2 + ], + "rank": 6, + "info": 0 + }, + { + "name": "seeded-spd-6", + "uplo": "L", + "n": 6, + "tol": "bff0000000000000", + "a": [ + "4055800000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "c0f81ce200000000", + "c03b000000000000", + "4042800000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "c0f81cf200000000", + "c04d800000000000", + "4038000000000000", + "405c800000000000", + "c0f81cfe00000000", + "c0f81d0000000000", + "c0f81d0200000000", + "3ff0000000000000", + "c033000000000000", + "c02c000000000000", + "4053400000000000", + "c0f81d1000000000", + "c0f81d1200000000", + "4008000000000000", + "0000000000000000", + "c022000000000000", + "4020000000000000", + "4040000000000000", + "c0f81d2200000000", + "4022000000000000", + "4000000000000000", + "c045800000000000", + "403e000000000000", + "c020000000000000", + "4050800000000000" + ], + "expected_a": [ + "40255aaa002a9d5a", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "c0f81ce200000000", + "bff4fac1f72e5bb7", + "40215a570753bdce", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "c0f81cf200000000", + "c0161a7a122320a1", + "bfe708e4a3a5fcf9", + "401da68290599dfa", + "c0f81cfe00000000", + "c0f81d0000000000", + "c0f81d0200000000", + "c0101bf9825f066c", + "4006cac6e7ad6881", + "bff82ec7165fe815", + "401919e948556e3c", + "c0f81d1000000000", + "c0f81d1200000000", + "bfeaf94286f275eb", + "3fe96dc5c02993aa", + "bfc2c034570dd217", + "c001b1e5454c0ea3", + "40144ba5e22b7d49", + "c0f81d2200000000", + "4001fb81af4c4e9d", + "bffd9a2b9476c06c", + "c0012bea987a742f", + "4000ac9da62fafc0", + "3ff8283f7d537527", + "4010a253debc6c06" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000", + "412e240e20000000", + "412e240e40000000" + ], + "expected_w": [ + "0000000000000000", + "3ffb823ee08fb825", + "403f0da1db5e7100", + "403a9edd07a9b08c", + "401905ee82cc6750", + "4033b4e95e711d68", + "4055800000000000", + "403ff286bca1af28", + "404b792f1250c780", + "4037eac940eedeca", + "4039be845f4ce62c", + "40314b16a18ee298" + ], + "piv": [ + 3, + 4, + 1, + 6, + 5, + 2 + ], + "rank": 6, + "info": 0 + }, + { + "name": "seeded-spd-7", + "uplo": "U", + "n": 7, + "tol": "bff0000000000000", + "a": [ + "4046800000000000", + "c034000000000000", + "c020000000000000", + "c03b000000000000", + "c02e000000000000", + "c045800000000000", + "c02a000000000000", + "c0f81ce800000000", + "404c800000000000", + "c020000000000000", + "4030000000000000", + "404b000000000000", + "4040000000000000", + "4022000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "405cc00000000000", + "c014000000000000", + "4014000000000000", + "c043000000000000", + "c043800000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "405a000000000000", + "c031000000000000", + "403d000000000000", + "c050000000000000", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "405d000000000000", + "4036000000000000", + "4040800000000000", + "c0f81d2800000000", + "c0f81d2a00000000", + "c0f81d2c00000000", + "c0f81d2e00000000", + "c0f81d3000000000", + "4055400000000000", + "4042000000000000", + "c0f81d3800000000", + "c0f81d3a00000000", + "c0f81d3c00000000", + "c0f81d3e00000000", + "c0f81d4000000000", + "c0f81d4200000000", + "405c400000000000" + ], + "expected_a": [ + "40258a68a4a8d9f3", + "3fddb614bfce6a6a", + "bff9412b3ca2a740", + "40005758364b20ee", + "400883045170b164", + "40140e1ace44ee3b", + "bff6488f8fdacfd0", + "c0f81ce800000000", + "40256d70e844195c", + "bfd97dad4088629d", + "c00d153435d81cba", + "c00e2efe99cb6225", + "bfeed8ba6139fc3e", + "bfe5f6a0e9c4a394", + "c0f81cf800000000", + "c0f81cfa00000000", + "4024227193ead9c3", + "400874d88181a9ec", + "c0181abdd6901386", + "4002b2b663dea4d8", + "c0076b75e277b29d", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "401e886db14716ee", + "40120d259cbde953", + "3ff74930974f1d29", + "c011a8fb90e315a3", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "4016df611dd9e77f", + "bfdbc854880bd920", + "bff94b06315409f3", + "c0f81d2800000000", + "c0f81d2a00000000", + "c0f81d2c00000000", + "c0f81d2e00000000", + "c0f81d3000000000", + "4013405ba8ee15fb", + "bfcd2f32374d528d", + "c0f81d3800000000", + "c0f81d3a00000000", + "c0f81d3c00000000", + "c0f81d3e00000000", + "c0f81d4000000000", + "c0f81d4200000000", + "400baf51b937d06c" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000", + "412e240e20000000", + "412e240e40000000", + "412e240e60000000", + "412e240e80000000" + ], + "expected_w": [ + "0000000000000000", + "3fcb9611a7b9611a", + "4005333d0b3f59e1", + "403abbd95b7faa68", + "40541361921ecbc9", + "4040eb11b7bb0148", + "404083196431d1fe", + "4046800000000000", + "403fdcb08d3dcb08", + "403eeecfc2c8746f", + "403978562207e8a2", + "402d0db2a45fb47c", + "403729dc9089fd70", + "4027f39a6f38b808" + ], + "piv": [ + 5, + 3, + 4, + 6, + 7, + 2, + 1 + ], + "rank": 7, + "info": 0 + }, + { + "name": "seeded-spd-7", + "uplo": "L", + "n": 7, + "tol": "bff0000000000000", + "a": [ + "4046800000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "c0f81ce200000000", + "c0f81ce400000000", + "c034000000000000", + "404c800000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "c0f81cf200000000", + "c0f81cf400000000", + "c020000000000000", + "c020000000000000", + "405cc00000000000", + "c0f81cfe00000000", + "c0f81d0000000000", + "c0f81d0200000000", + "c0f81d0400000000", + "c03b000000000000", + "4030000000000000", + "c014000000000000", + "405a000000000000", + "c0f81d1000000000", + "c0f81d1200000000", + "c0f81d1400000000", + "c02e000000000000", + "404b000000000000", + "4014000000000000", + "c031000000000000", + "405d000000000000", + "c0f81d2200000000", + "c0f81d2400000000", + "c045800000000000", + "4040000000000000", + "c043000000000000", + "403d000000000000", + "4036000000000000", + "4055400000000000", + "c0f81d3400000000", + "c02a000000000000", + "4022000000000000", + "c043800000000000", + "c050000000000000", + "4040800000000000", + "4042000000000000", + "405c400000000000" + ], + "expected_a": [ + "40258a68a4a8d9f3", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "c0f81ce200000000", + "c0f81ce400000000", + "3fddb614bfce6a6a", + "40256d70e844195c", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "c0f81cf200000000", + "c0f81cf400000000", + "bff9412b3ca2a740", + "bfd97dad4088629d", + "4024227193ead9c3", + "c0f81cfe00000000", + "c0f81d0000000000", + "c0f81d0200000000", + "c0f81d0400000000", + "40005758364b20ee", + "c00d153435d81cba", + "400874d88181a9ed", + "401e886db14716ee", + "c0f81d1000000000", + "c0f81d1200000000", + "c0f81d1400000000", + "400883045170b164", + "c00e2efe99cb6225", + "c0181abdd6901386", + "40120d259cbde953", + "4016df611dd9e77f", + "c0f81d2200000000", + "c0f81d2400000000", + "40140e1ace44ee3b", + "bfeed8ba6139fc3e", + "4002b2b663dea4d8", + "3ff74930974f1d29", + "bfdbc854880bd928", + "4013405ba8ee15fb", + "c0f81d3400000000", + "bff6488f8fdacfd0", + "bfe5f6a0e9c4a394", + "c0076b75e277b29d", + "c011a8fb90e315a3", + "bff94b06315409f3", + "bfcd2f32374d5293", + "400baf51b937d06c" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000", + "412e240e20000000", + "412e240e40000000", + "412e240e60000000", + "412e240e80000000" + ], + "expected_w": [ + "0000000000000000", + "3fcb9611a7b9611a", + "4005333d0b3f59e1", + "403abbd95b7faa68", + "40541361921ecbc9", + "4040eb11b7bb0148", + "404083196431d1fe", + "4046800000000000", + "403fdcb08d3dcb08", + "403eeecfc2c8746f", + "403978562207e8a2", + "402d0db2a45fb47c", + "403729dc9089fd70", + "4027f39a6f38b808" + ], + "piv": [ + 5, + 3, + 4, + 6, + 7, + 2, + 1 + ], + "rank": 7, + "info": 0 + }, + { + "name": "seeded-spd-8", + "uplo": "U", + "n": 8, + "tol": "bff0000000000000", + "a": [ + "4061200000000000", + "3ff0000000000000", + "4028000000000000", + "402a000000000000", + "4008000000000000", + "4038000000000000", + "c04a800000000000", + "4035000000000000", + "c0f81ce800000000", + "404a800000000000", + "4037000000000000", + "c024000000000000", + "c000000000000000", + "c022000000000000", + "401c000000000000", + "c018000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "4050000000000000", + "c020000000000000", + "c000000000000000", + "c037000000000000", + "4010000000000000", + "c008000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "4057000000000000", + "4041000000000000", + "402a000000000000", + "4034000000000000", + "4038000000000000", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "4048800000000000", + "4022000000000000", + "c014000000000000", + "4047800000000000", + "c0f81d2800000000", + "c0f81d2a00000000", + "c0f81d2c00000000", + "c0f81d2e00000000", + "c0f81d3000000000", + "4057400000000000", + "c03a000000000000", + "bff0000000000000", + "c0f81d3800000000", + "c0f81d3a00000000", + "c0f81d3c00000000", + "c0f81d3e00000000", + "c0f81d4000000000", + "c0f81d4200000000", + "4051000000000000", + "c043800000000000", + "c0f81d4800000000", + "c0f81d4a00000000", + "c0f81d4c00000000", + "c0f81d4e00000000", + "c0f81d5000000000", + "c0f81d5200000000", + "c0f81d5400000000", + "4057800000000000" + ], + "expected_a": [ + "402768ce6d3c11e0", + "3ffcb4d7c39dbff6", + "40006756b8ec6db1", + "3ff1c5489daacc2b", + "3ff06756b8ec6db1", + "3fb5df1e4be5e797", + "3fd06756b8ec6db1", + "c0121cc516da63c9", + "c0f81ce800000000", + "40230e49e5503bb2", + "bfdf6da062eb8882", + "40027a6a07d6a992", + "bfe040e1b8f2d1c7", + "bfe4aa886a94e359", + "401389d820bdf59d", + "c009ecb353982738", + "c0f81cf800000000", + "c0f81cfa00000000", + "4022d217ea309647", + "3ff428e541e89a4a", + "c0058d58c452df8a", + "bff023af29cb0c5f", + "3ff27cb2f95211d0", + "bfff2044a6173bb0", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "4022503162445963", + "bfdff311f2330cb4", + "bfe99fce811cdad8", + "400253d03ca62d89", + "400e8c751ea9a422", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "401db6e0e59df3f0", + "4004f6edc4ba8ee5", + "3fe34680f4d1255f", + "3fdf8c2b998dae9b", + "c0f81d2800000000", + "c0f81d2a00000000", + "c0f81d2c00000000", + "c0f81d2e00000000", + "c0f81d3000000000", + "401a8c44c3f0b336", + "3fd8a11f44b28131", + "3fe894177d7cb06d", + "c0f81d3800000000", + "c0f81d3a00000000", + "c0f81d3c00000000", + "c0f81d3e00000000", + "c0f81d4000000000", + "c0f81d4200000000", + "4010f61d7473db54", + "3ff27a0b71df442a", + "c0f81d4800000000", + "c0f81d4a00000000", + "c0f81d4c00000000", + "c0f81d4e00000000", + "c0f81d5000000000", + "c0f81d5200000000", + "c0f81d5400000000", + "40103ac63085d1f7" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000", + "412e240e20000000", + "412e240e40000000", + "412e240e60000000", + "412e240e80000000", + "412e240ea0000000", + "412e240ec0000000" + ], + "expected_w": [ + "0000000000000000", + "4009c077975b8fe2", + "4011c837d2b73c89", + "40204ff7a3b8f92a", + "4021a1ccedc4f04c", + "4021e6a59d4a74e8", + "403f04fb4d25254c", + "4049c4cddc3ed02e", + "4061200000000000", + "404a7f10d148e03c", + "404f587023e5e65a", + "4054f6010b88e0db", + "40327dd10af5eec5", + "403220ee672e75db", + "4031cbc8126ed102", + "4030766447825fa4" + ], + "piv": [ + 1, + 8, + 6, + 4, + 3, + 2, + 5, + 7 + ], + "rank": 8, + "info": 0 + }, + { + "name": "seeded-spd-8", + "uplo": "L", + "n": 8, + "tol": "bff0000000000000", + "a": [ + "4061200000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "c0f81ce200000000", + "c0f81ce400000000", + "c0f81ce600000000", + "3ff0000000000000", + "404a800000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "c0f81cf200000000", + "c0f81cf400000000", + "c0f81cf600000000", + "4028000000000000", + "4037000000000000", + "4050000000000000", + "c0f81cfe00000000", + "c0f81d0000000000", + "c0f81d0200000000", + "c0f81d0400000000", + "c0f81d0600000000", + "402a000000000000", + "c024000000000000", + "c020000000000000", + "4057000000000000", + "c0f81d1000000000", + "c0f81d1200000000", + "c0f81d1400000000", + "c0f81d1600000000", + "4008000000000000", + "c000000000000000", + "c000000000000000", + "4041000000000000", + "4048800000000000", + "c0f81d2200000000", + "c0f81d2400000000", + "c0f81d2600000000", + "4038000000000000", + "c022000000000000", + "c037000000000000", + "402a000000000000", + "4022000000000000", + "4057400000000000", + "c0f81d3400000000", + "c0f81d3600000000", + "c04a800000000000", + "401c000000000000", + "4010000000000000", + "4034000000000000", + "c014000000000000", + "c03a000000000000", + "4051000000000000", + "c0f81d4600000000", + "4035000000000000", + "c018000000000000", + "c008000000000000", + "4038000000000000", + "4047800000000000", + "bff0000000000000", + "c043800000000000", + "4057800000000000" + ], + "expected_a": [ + "402768ce6d3c11e0", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "c0f81ce200000000", + "c0f81ce400000000", + "c0f81ce600000000", + "3ffcb4d7c39dbff6", + "40230e49e5503bb2", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "c0f81cf200000000", + "c0f81cf400000000", + "c0f81cf600000000", + "40006756b8ec6db1", + "bfdf6da062eb8882", + "4022d217ea309647", + "c0f81cfe00000000", + "c0f81d0000000000", + "c0f81d0200000000", + "c0f81d0400000000", + "c0f81d0600000000", + "3ff1c5489daacc2b", + "40027a6a07d6a992", + "3ff428e541e89a4a", + "4022503162445963", + "c0f81d1000000000", + "c0f81d1200000000", + "c0f81d1400000000", + "c0f81d1600000000", + "3ff06756b8ec6db1", + "bfe040e1b8f2d1c7", + "c0058d58c452df8b", + "bfdff311f2330cb4", + "401db6e0e59df3f0", + "c0f81d2200000000", + "c0f81d2400000000", + "c0f81d2600000000", + "3fb5df1e4be5e797", + "bfe4aa886a94e359", + "bff023af29cb0c60", + "bfe99fce811cdad9", + "4004f6edc4ba8ee5", + "401a8c44c3f0b336", + "c0f81d3400000000", + "c0f81d3600000000", + "3fd06756b8ec6db1", + "401389d820bdf59d", + "3ff27cb2f95211d0", + "400253d03ca62d89", + "3fe34680f4d12560", + "3fd8a11f44b28131", + "4010f61d7473db54", + "c0f81d4600000000", + "c0121cc516da63c9", + "c009ecb353982738", + "bfff2044a6173bb0", + "400e8c751ea9a422", + "3fdf8c2b998dae9b", + "3fe894177d7cb06d", + "3ff27a0b71df442e", + "40103ac63085d1f6" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000", + "412e240e20000000", + "412e240e40000000", + "412e240e60000000", + "412e240e80000000", + "412e240ea0000000", + "412e240ec0000000" + ], + "expected_w": [ + "0000000000000000", + "4009c077975b8fe2", + "4011c837d2b73c89", + "40204ff7a3b8f92a", + "4021a1ccedc4f04d", + "4021e6a59d4a74e8", + "403f04fb4d25254c", + "4049c4cddc3ed02f", + "4061200000000000", + "404a7f10d148e03c", + "404f587023e5e65a", + "4054f6010b88e0db", + "40327dd10af5eec5", + "403220ee672e75db", + "4031cbc8126ed102", + "4030766447825fa2" + ], + "piv": [ + 1, + 8, + 6, + 4, + 3, + 2, + 5, + 7 + ], + "rank": 8, + "info": 0 + }, + { + "name": "seeded-spd-9", + "uplo": "U", + "n": 9, + "tol": "bff0000000000000", + "a": [ + "405d000000000000", + "4044000000000000", + "c047000000000000", + "402e000000000000", + "c01c000000000000", + "4033000000000000", + "c030000000000000", + "c020000000000000", + "4037000000000000", + "c0f81ce800000000", + "4052000000000000", + "c032000000000000", + "c008000000000000", + "4040000000000000", + "4010000000000000", + "4020000000000000", + "c042800000000000", + "c018000000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "4052800000000000", + "401c000000000000", + "4026000000000000", + "c03d000000000000", + "c022000000000000", + "4041800000000000", + "4024000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "404e800000000000", + "c040800000000000", + "403a000000000000", + "c03a000000000000", + "402e000000000000", + "4037000000000000", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "405fc00000000000", + "3ff0000000000000", + "4038000000000000", + "c02a000000000000", + "c000000000000000", + "c0f81d2800000000", + "c0f81d2a00000000", + "c0f81d2c00000000", + "c0f81d2e00000000", + "c0f81d3000000000", + "4058400000000000", + "4000000000000000", + "c036000000000000", + "c045800000000000", + "c0f81d3800000000", + "c0f81d3a00000000", + "c0f81d3c00000000", + "c0f81d3e00000000", + "c0f81d4000000000", + "c0f81d4200000000", + "404d000000000000", + "c030000000000000", + "c02c000000000000", + "c0f81d4800000000", + "c0f81d4a00000000", + "c0f81d4c00000000", + "c0f81d4e00000000", + "c0f81d5000000000", + "c0f81d5200000000", + "c0f81d5400000000", + "4054000000000000", + "403f000000000000", + "c0f81d5800000000", + "c0f81d5a00000000", + "c0f81d5c00000000", + "c0f81d5e00000000", + "c0f81d6000000000", + "c0f81d6200000000", + "c0f81d6400000000", + "c0f81d6600000000", + "4058800000000000" + ], + "expected_a": [ + "402689f26c6b01d0", + "bfe3e07508ef8098", + "3fb6b7612ec892f7", + "bff274fef602f769", + "bfc6b7612ec892f7", + "40010988e3166e39", + "3fef3c25a053ca14", + "4006b7612ec892f7", + "c0076d1c383ed78f", + "c0f81ce800000000", + "4025813afbe8c0bd", + "3ffc5ad20901ef29", + "bfe9f0ebbd584d42", + "400107caa24a19bf", + "bff5d7176987a017", + "c010e30c29988e90", + "400f12b5162464dd", + "3ff39d2f1ec5e300", + "c0f81cf800000000", + "c0f81cfa00000000", + "4023601a32e26516", + "c000e580089fb6f1", + "c0134e3fc7520542", + "3fdbf1f397ba214b", + "c001d756cc4332c3", + "bfd4b684470fcce0", + "4003e41f59a60f4e", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "40212704936c23e9", + "4004d3c55ecbc2c4", + "bff99c550eed5ac8", + "400a1cd465a7917b", + "c00d28b6fd5a1b1d", + "4000aab1ecbfc464", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "401fd73d4c2b466b", + "bfe1daf180284e94", + "bf89f33c45e0b418", + "bfe7778b433ae930", + "400a9457b6901124", + "c0f81d2800000000", + "c0f81d2a00000000", + "c0f81d2c00000000", + "c0f81d2e00000000", + "c0f81d3000000000", + "401bde114c5121b6", + "bff8756fe08f32ee", + "3fc52cd82ed2d7ee", + "c0000fd07a65f80b", + "c0f81d3800000000", + "c0f81d3a00000000", + "c0f81d3c00000000", + "c0f81d3e00000000", + "c0f81d4000000000", + "c0f81d4200000000", + "40186a8e3e9b39d3", + "3ff27777953b1d9e", + "3ffc2e745d13ff7f", + "c0f81d4800000000", + "c0f81d4a00000000", + "c0f81d4c00000000", + "c0f81d4e00000000", + "c0f81d5000000000", + "c0f81d5200000000", + "c0f81d5400000000", + "40172c6e14cca7e1", + "3ffac12c9ec83c05", + "c0f81d5800000000", + "c0f81d5a00000000", + "c0f81d5c00000000", + "c0f81d5e00000000", + "c0f81d6000000000", + "c0f81d6200000000", + "c0f81d6400000000", + "c0f81d6600000000", + "4011a1f8bfd3209e" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000", + "412e240e20000000", + "412e240e40000000", + "412e240e60000000", + "412e240e80000000", + "412e240ea0000000", + "412e240ec0000000", + "412e240ee0000000", + "412e240f00000000" + ], + "expected_w": [ + "0000000000000000", + "3fd8b162c58b162d", + "400930119319a5a9", + "4019cb7206a357e0", + "404151517c4736f4", + "4022ecf6fcab5e73", + "40425ec7d14018c8", + "404337e411e5ecd3", + "4044c8b3dd97cf19", + "405d000000000000", + "404ff7efdfbf7efe", + "404b9cb4fa050e62", + "40465ec23aac27a3", + "4041baf5588b0d5d", + "4043cc559b8767b1", + "4042a1382ebfe738", + "40363a6719603ee0", + "40336e9844d061ce" + ], + "piv": [ + 5, + 1, + 6, + 8, + 9, + 7, + 3, + 2, + 4 + ], + "rank": 9, + "info": 0 + }, + { + "name": "seeded-spd-9", + "uplo": "L", + "n": 9, + "tol": "bff0000000000000", + "a": [ + "405d000000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "c0f81ce200000000", + "c0f81ce400000000", + "c0f81ce600000000", + "c0f81ce800000000", + "4044000000000000", + "4052000000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "c0f81cf200000000", + "c0f81cf400000000", + "c0f81cf600000000", + "c0f81cf800000000", + "c047000000000000", + "c032000000000000", + "4052800000000000", + "c0f81cfe00000000", + "c0f81d0000000000", + "c0f81d0200000000", + "c0f81d0400000000", + "c0f81d0600000000", + "c0f81d0800000000", + "402e000000000000", + "c008000000000000", + "401c000000000000", + "404e800000000000", + "c0f81d1000000000", + "c0f81d1200000000", + "c0f81d1400000000", + "c0f81d1600000000", + "c0f81d1800000000", + "c01c000000000000", + "4040000000000000", + "4026000000000000", + "c040800000000000", + "405fc00000000000", + "c0f81d2200000000", + "c0f81d2400000000", + "c0f81d2600000000", + "c0f81d2800000000", + "4033000000000000", + "4010000000000000", + "c03d000000000000", + "403a000000000000", + "3ff0000000000000", + "4058400000000000", + "c0f81d3400000000", + "c0f81d3600000000", + "c0f81d3800000000", + "c030000000000000", + "4020000000000000", + "c022000000000000", + "c03a000000000000", + "4038000000000000", + "4000000000000000", + "404d000000000000", + "c0f81d4600000000", + "c0f81d4800000000", + "c020000000000000", + "c042800000000000", + "4041800000000000", + "402e000000000000", + "c02a000000000000", + "c036000000000000", + "c030000000000000", + "4054000000000000", + "c0f81d5800000000", + "4037000000000000", + "c018000000000000", + "4024000000000000", + "4037000000000000", + "c000000000000000", + "c045800000000000", + "c02c000000000000", + "403f000000000000", + "4058800000000000" + ], + "expected_a": [ + "402689f26c6b01d0", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "c0f81ce200000000", + "c0f81ce400000000", + "c0f81ce600000000", + "c0f81ce800000000", + "bfe3e07508ef8098", + "4025813afbe8c0bd", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "c0f81cf200000000", + "c0f81cf400000000", + "c0f81cf600000000", + "c0f81cf800000000", + "3fb6b7612ec892f7", + "3ffc5ad20901ef29", + "4023601a32e26516", + "c0f81cfe00000000", + "c0f81d0000000000", + "c0f81d0200000000", + "c0f81d0400000000", + "c0f81d0600000000", + "c0f81d0800000000", + "bff274fef602f769", + "bfe9f0ebbd584d42", + "c000e580089fb6f0", + "40212704936c23e9", + "c0f81d1000000000", + "c0f81d1200000000", + "c0f81d1400000000", + "c0f81d1600000000", + "c0f81d1800000000", + "bfc6b7612ec892f7", + "400107caa24a19bf", + "c0134e3fc7520541", + "4004d3c55ecbc2c6", + "401fd73d4c2b466c", + "c0f81d2200000000", + "c0f81d2400000000", + "c0f81d2600000000", + "c0f81d2800000000", + "40010988e3166e39", + "bff5d7176987a017", + "3fdbf1f397ba214b", + "bff99c550eed5ac8", + "bfe1daf180284e92", + "401bde114c5121b6", + "c0f81d3400000000", + "c0f81d3600000000", + "c0f81d3800000000", + "3fef3c25a053ca14", + "c010e30c29988e90", + "c001d756cc4332c3", + "400a1cd465a7917c", + "bf89f33c45e0b59a", + "bff8756fe08f32ee", + "40186a8e3e9b39d3", + "c0f81d4600000000", + "c0f81d4800000000", + "4006b7612ec892f7", + "400f12b5162464dd", + "bfd4b684470fccdf", + "c00d28b6fd5a1b1d", + "bfe7778b433ae92e", + "3fc52cd82ed2d7f2", + "3ff27777953b1d9d", + "40172c6e14cca7e1", + "c0f81d5800000000", + "c0076d1c383ed78f", + "3ff39d2f1ec5e300", + "4003e41f59a60f4f", + "4000aab1ecbfc464", + "400a9457b6901123", + "c0000fd07a65f80b", + "3ffc2e745d13ff7f", + "3ffac12c9ec83c07", + "4011a1f8bfd3209e" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000", + "412e240e20000000", + "412e240e40000000", + "412e240e60000000", + "412e240e80000000", + "412e240ea0000000", + "412e240ec0000000", + "412e240ee0000000", + "412e240f00000000" + ], + "expected_w": [ + "0000000000000000", + "3fd8b162c58b162d", + "400930119319a5a9", + "4019cb7206a357de", + "404151517c4736f3", + "4022ecf6fcab5e73", + "40425ec7d14018c8", + "404337e411e5ecd3", + "4044c8b3dd97cf1a", + "405d000000000000", + "404ff7efdfbf7efe", + "404b9cb4fa050e62", + "40465ec23aac27a2", + "4041baf5588b0d5d", + "4043cc559b8767b1", + "4042a1382ebfe738", + "40363a6719603ee0", + "40336e9844d061cc" + ], + "piv": [ + 5, + 1, + 6, + 8, + 9, + 7, + 3, + 2, + 4 + ], + "rank": 9, + "info": 0 + }, + { + "name": "seeded-spd-10", + "uplo": "U", + "n": 10, + "tol": "bff0000000000000", + "a": [ + "4055c00000000000", + "4031000000000000", + "4051800000000000", + "4022000000000000", + "c040000000000000", + "4030000000000000", + "4036000000000000", + "0000000000000000", + "402e000000000000", + "c041800000000000", + "c0f81ce800000000", + "4060800000000000", + "4040800000000000", + "c014000000000000", + "c042000000000000", + "c043800000000000", + "4053000000000000", + "c03b000000000000", + "403c000000000000", + "404b800000000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "4059400000000000", + "c031000000000000", + "c047800000000000", + "4041800000000000", + "4048000000000000", + "c03a000000000000", + "c031000000000000", + "c02c000000000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "405a000000000000", + "c033000000000000", + "c042800000000000", + "c031000000000000", + "4051400000000000", + "402e000000000000", + "c020000000000000", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "405cc00000000000", + "c028000000000000", + "c033000000000000", + "c030000000000000", + "4039000000000000", + "c01c000000000000", + "c0f81d2800000000", + "c0f81d2a00000000", + "c0f81d2c00000000", + "c0f81d2e00000000", + "c0f81d3000000000", + "4060c00000000000", + "4042800000000000", + "4018000000000000", + "c054c00000000000", + "c028000000000000", + "c0f81d3800000000", + "c0f81d3a00000000", + "c0f81d3c00000000", + "c0f81d3e00000000", + "c0f81d4000000000", + "c0f81d4200000000", + "4060000000000000", + "c048000000000000", + "c020000000000000", + "404a000000000000", + "c0f81d4800000000", + "c0f81d4a00000000", + "c0f81d4c00000000", + "c0f81d4e00000000", + "c0f81d5000000000", + "c0f81d5200000000", + "c0f81d5400000000", + "405f800000000000", + "c018000000000000", + "c034000000000000", + "c0f81d5800000000", + "c0f81d5a00000000", + "c0f81d5c00000000", + "c0f81d5e00000000", + "c0f81d6000000000", + "c0f81d6200000000", + "c0f81d6400000000", + "c0f81d6600000000", + "4063200000000000", + "0000000000000000", + "c0f81d6800000000", + "c0f81d6a00000000", + "c0f81d6c00000000", + "c0f81d6e00000000", + "c0f81d7000000000", + "c0f81d7200000000", + "c0f81d7400000000", + "c0f81d7600000000", + "c0f81d7800000000", + "4057c00000000000" + ], + "expected_a": [ + "4028bd171a07e38a", + "bfe4b24585e1ca13", + "40002b46509865df", + "bfdf0b6848d2af1c", + "c01ad73229a0d211", + "3ff367212d83ad72", + "40021bfcd52590d1", + "0000000000000000", + "3ff367212d83ad72", + "bff5fd69de3fe6b4", + "c0f81ce800000000", + "402697255c7e99da", + "bff90ff94ad0058c", + "c0111c05a2619039", + "400721cc9ac7178f", + "400023283927a807", + "401b6ebae766f4f3", + "40126a3645a0b215", + "bff6f8525e92c631", + "4010aefed83e7134", + "c0f81cf800000000", + "c0f81cfa00000000", + "4024d436ea20171a", + "c000af2844c0e011", + "3fe2b76e7c3771d0", + "c0080968b3f6cc5d", + "c006ea8e11b4cce4", + "3f94c5e95eb434d4", + "c002348973d8258d", + "c00cf3803469146e", + "c0f81d0800000000", + "c0f81d0a00000000", + "c0f81d0c00000000", + "40244f3e8774d5e1", + "3ff9bbffdfa1bd5c", + "3fd297fdb75a7ba3", + "bfd004251491ba99", + "bf9acfe48557bd71", + "40171f6d66106cee", + "bff9cc616d0fe6e9", + "c0f81d1800000000", + "c0f81d1a00000000", + "c0f81d1c00000000", + "c0f81d1e00000000", + "4021a0b174bd8fb0", + "4001c90d005447c3", + "c012dccce9de802f", + "c006f26e3713a905", + "c00da92bd5491c6a", + "4000b9e0f32d7985", + "c0f81d2800000000", + "c0f81d2a00000000", + "c0f81d2c00000000", + "c0f81d2e00000000", + "c0f81d3000000000", + "40206b94198ef012", + "3fd27a871a1f8a70", + "c0126fb16db85220", + "3ff3c85737c94b7d", + "40177bbe3a910864", + "c0f81d3800000000", + "c0f81d3a00000000", + "c0f81d3c00000000", + "c0f81d3e00000000", + "c0f81d4000000000", + "c0f81d4200000000", + "401c127e4893033e", + "3ff9b94b38c77dd6", + "c007b959a9cedf22", + "3fe6588e7da1a85b", + "c0f81d4800000000", + "c0f81d4a00000000", + "c0f81d4c00000000", + "c0f81d4e00000000", + "c0f81d5000000000", + "c0f81d5200000000", + "c0f81d5400000000", + "4019d864a1ee9deb", + "bfcaf926287fc38c", + "bfc880d56c0bc8b1", + "c0f81d5800000000", + "c0f81d5a00000000", + "c0f81d5c00000000", + "c0f81d5e00000000", + "c0f81d6000000000", + "c0f81d6200000000", + "c0f81d6400000000", + "c0f81d6600000000", + "4018945fed1c9501", + "bfeddfbb35d65bd5", + "c0f81d6800000000", + "c0f81d6a00000000", + "c0f81d6c00000000", + "c0f81d6e00000000", + "c0f81d7000000000", + "c0f81d7200000000", + "c0f81d7400000000", + "c0f81d7600000000", + "c0f81d7800000000", + "40144fb95acc2a2b" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000", + "412e240e20000000", + "412e240e40000000", + "412e240e60000000", + "412e240e80000000", + "412e240ea0000000", + "412e240ec0000000", + "412e240ee0000000", + "412e240f00000000", + "412e240f20000000", + "412e240f40000000" + ], + "expected_w": [ + "0000000000000000", + "3fdac5701ac5701b", + "401a27806b6fa1ff", + "4036e16ccbb7a528", + "404c2872063c6a73", + "40339811eac5bc52", + "4054afcc287d5c63", + "404aa02b73349ca6", + "40508f6011f224b3", + "4052cdc8d78f6c30", + "4055c00000000000", + "405fb80d62b80d63", + "40546dbe87f94906", + "4057d28c0379e1cf", + "4050812f5330988c", + "404ed2d87bcb8e56", + "4048a067af05473a", + "4042e6eef892ab72", + "403aa7f99e3b203c", + "4039c8dca1c24f40" + ], + "piv": [ + 9, + 7, + 5, + 8, + 6, + 1, + 2, + 10, + 4, + 3 + ], + "rank": 10, + "info": 0 + }, + { + "name": "seeded-spd-10", + "uplo": "L", + "n": 10, + "tol": "bff0000000000000", + "a": [ + "4055c00000000000", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "c0f81ce200000000", + "c0f81ce400000000", + "c0f81ce600000000", + "c0f81ce800000000", + "c0f81cea00000000", + "4031000000000000", + "4060800000000000", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "c0f81cf200000000", + "c0f81cf400000000", + "c0f81cf600000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "4051800000000000", + "4040800000000000", + "4059400000000000", + "c0f81cfe00000000", + "c0f81d0000000000", + "c0f81d0200000000", + "c0f81d0400000000", + "c0f81d0600000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "4022000000000000", + "c014000000000000", + "c031000000000000", + "405a000000000000", + "c0f81d1000000000", + "c0f81d1200000000", + "c0f81d1400000000", + "c0f81d1600000000", + "c0f81d1800000000", + "c0f81d1a00000000", + "c040000000000000", + "c042000000000000", + "c047800000000000", + "c033000000000000", + "405cc00000000000", + "c0f81d2200000000", + "c0f81d2400000000", + "c0f81d2600000000", + "c0f81d2800000000", + "c0f81d2a00000000", + "4030000000000000", + "c043800000000000", + "4041800000000000", + "c042800000000000", + "c028000000000000", + "4060c00000000000", + "c0f81d3400000000", + "c0f81d3600000000", + "c0f81d3800000000", + "c0f81d3a00000000", + "4036000000000000", + "4053000000000000", + "4048000000000000", + "c031000000000000", + "c033000000000000", + "4042800000000000", + "4060000000000000", + "c0f81d4600000000", + "c0f81d4800000000", + "c0f81d4a00000000", + "0000000000000000", + "c03b000000000000", + "c03a000000000000", + "4051400000000000", + "c030000000000000", + "4018000000000000", + "c048000000000000", + "405f800000000000", + "c0f81d5800000000", + "c0f81d5a00000000", + "402e000000000000", + "403c000000000000", + "c031000000000000", + "402e000000000000", + "4039000000000000", + "c054c00000000000", + "c020000000000000", + "c018000000000000", + "4063200000000000", + "c0f81d6a00000000", + "c041800000000000", + "404b800000000000", + "c02c000000000000", + "c020000000000000", + "c01c000000000000", + "c028000000000000", + "404a000000000000", + "c034000000000000", + "0000000000000000", + "4057c00000000000" + ], + "expected_a": [ + "4028bd171a07e38a", + "c0f81cda00000000", + "c0f81cdc00000000", + "c0f81cde00000000", + "c0f81ce000000000", + "c0f81ce200000000", + "c0f81ce400000000", + "c0f81ce600000000", + "c0f81ce800000000", + "c0f81cea00000000", + "bfe4b24585e1ca13", + "402697255c7e99da", + "c0f81cec00000000", + "c0f81cee00000000", + "c0f81cf000000000", + "c0f81cf200000000", + "c0f81cf400000000", + "c0f81cf600000000", + "c0f81cf800000000", + "c0f81cfa00000000", + "40002b46509865df", + "bff90ff94ad0058c", + "4024d436ea20171a", + "c0f81cfe00000000", + "c0f81d0000000000", + "c0f81d0200000000", + "c0f81d0400000000", + "c0f81d0600000000", + "c0f81d0800000000", + "c0f81d0a00000000", + "bfdf0b6848d2af1c", + "c0111c05a2619039", + "c000af2844c0e011", + "40244f3e8774d5e1", + "c0f81d1000000000", + "c0f81d1200000000", + "c0f81d1400000000", + "c0f81d1600000000", + "c0f81d1800000000", + "c0f81d1a00000000", + "c01ad73229a0d211", + "400721cc9ac7178f", + "3fe2b76e7c3771cf", + "3ff9bbffdfa1bd5c", + "4021a0b174bd8fb0", + "c0f81d2200000000", + "c0f81d2400000000", + "c0f81d2600000000", + "c0f81d2800000000", + "c0f81d2a00000000", + "3ff367212d83ad72", + "400023283927a807", + "c0080968b3f6cc5d", + "3fd297fdb75a7ba3", + "4001c90d005447c3", + "40206b94198ef012", + "c0f81d3400000000", + "c0f81d3600000000", + "c0f81d3800000000", + "c0f81d3a00000000", + "40021bfcd52590d1", + "401b6ebae766f4f3", + "c006ea8e11b4cce4", + "bfd004251491ba9a", + "c012dccce9de802f", + "3fd27a871a1f8a64", + "401c127e4893033e", + "c0f81d4600000000", + "c0f81d4800000000", + "c0f81d4a00000000", + "0000000000000000", + "40126a3645a0b215", + "3f94c5e95eb434d4", + "bf9acfe48557bd65", + "c006f26e3713a905", + "c0126fb16db85220", + "3ff9b94b38c77dd3", + "4019d864a1ee9dec", + "c0f81d5800000000", + "c0f81d5a00000000", + "3ff367212d83ad72", + "bff6f8525e92c631", + "c002348973d8258e", + "40171f6d66106cee", + "c00da92bd5491c6a", + "3ff3c85737c94b7c", + "c007b959a9cedf22", + "bfcaf926287fc39e", + "4018945fed1c9501", + "c0f81d6a00000000", + "bff5fd69de3fe6b4", + "4010aefed83e7134", + "c00cf3803469146e", + "bff9cc616d0fe6e9", + "4000b9e0f32d7985", + "40177bbe3a910865", + "3fe6588e7da1a863", + "bfc880d56c0bc87a", + "bfeddfbb35d65bd5", + "40144fb95acc2a2b" + ], + "w": [ + "412e240ce0000000", + "412e240d00000000", + "412e240d20000000", + "412e240d40000000", + "412e240d60000000", + "412e240d80000000", + "412e240da0000000", + "412e240dc0000000", + "412e240de0000000", + "412e240e00000000", + "412e240e20000000", + "412e240e40000000", + "412e240e60000000", + "412e240e80000000", + "412e240ea0000000", + "412e240ec0000000", + "412e240ee0000000", + "412e240f00000000", + "412e240f20000000", + "412e240f40000000" + ], + "expected_w": [ + "0000000000000000", + "3fdac5701ac5701b", + "401a27806b6fa1ff", + "4036e16ccbb7a528", + "404c2872063c6a73", + "40339811eac5bc52", + "4054afcc287d5c63", + "404aa02b73349ca5", + "40508f6011f224b3", + "4052cdc8d78f6c30", + "4055c00000000000", + "405fb80d62b80d63", + "40546dbe87f94906", + "4057d28c0379e1ce", + "4050812f5330988c", + "404ed2d87bcb8e56", + "4048a067af05473a", + "4042e6eef892ab72", + "403aa7f99e3b203c", + "4039c8dca1c24f40" + ], + "piv": [ + 9, + 7, + 5, + 8, + 6, + 1, + 2, + 10, + 4, + 3 + ], + "rank": 10, + "info": 0 + } + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/test/test.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/test/test.js new file mode 100644 index 000000000000..c5041b646f2c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/test/test.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var common = require( './common.js' ); +var main = require( './../lib/main.js' ); +var publicMain = require( './../lib' ); + + +// TESTS // + +tape('main export is a function', function test(t) { + t.ok(true, __filename); + t.strictEqual(typeof publicMain, 'function', 'public function'); + t.strictEqual(typeof publicMain.ndarray, 'function', 'indexed function'); + t.end(); +}); +tape('pure JavaScript finite reference outputs and reconstruction', function test(t) { + common.check(t, main); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/test/test.native.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/test/test.native.js new file mode 100644 index 000000000000..72b648255678 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/test/test.native.js @@ -0,0 +1,100 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var common = require( './common.js' ); +var publicMain = require( './../lib' ); +var native = tryRequire(resolve(__dirname, '../lib/native.js')); +var addon = tryRequire(resolve(__dirname, '../src/addon.node')); +var opts = { + 'skip': ((native instanceof Error) || (addon instanceof Error)) +}; + + +// TESTS // + +tape('main export is a function', opts, function test(t) { + t.ok( true, __filename ); + t.strictEqual(typeof addon, 'function', 'actual addon loaded'); + t.strictEqual(publicMain, native, 'public uses compiled native interface'); + common.check(t, native); + t.end(); +}); +tape('raw bridge validates active geometry before staging and writes', opts, function test(t) { + var before; + var a = new Float64Array([ + 4, + 0, + 0, + 9 + ]); + var p = new Int32Array([ + -3, + -4 + ]); + var r = new Int32Array([7]); + var w = new Float64Array([ + 11, + 12, + 13, + 14 + ]); + before = [ + common.snapshot(a, false), + common.snapshot(p, true), + common.snapshot(r, true), + common.snapshot(w, false) + ]; + t.throws(function call() { + addon(121, 2, a, 0, 0, 0, p, 1, 0, r, 0, -1, w, 1, 0); + }, RangeError, 'raw matrix broadcast'); + t.throws(function call() { + addon(121, 2, a, 1, 1, 0, p, 1, 0, r, 0, -1, w, 1, 0); + }, RangeError, 'raw matrix collision'); + t.throws(function call() { + addon(121, 2, a, 2, 1, 0, p, 1, 0, r, 0, -1, a, 1, 0); + }, RangeError, 'raw physical overlap'); + t.throws(function call() { + addon(121, 2, a, 2, 1, 0, p, 1, 0, r, 0, NaN, w, 1, 0); + }, RangeError, 'raw finite TOL before active buffers'); + t.throws(function call() { + addon(121, 2, a, 2, 1, 0, p, 1, 0, r, 0, '-1', w, 1, 0); + }, TypeError, 'raw primitive TOL'); + t.throws(function call() { + addon(121, 2, a, 2, 1, 0, p, 1, 0, r, 0, -1, w, 0, 0); + }, RangeError, 'raw scratch broadcast'); + t.throws(function call() { + addon(121, 1, a, 2147483648, 0, 0, p, 0, 0, r, 0, -1, w, 1, 0); + }, RangeError, 'raw conservative metadata cap'); + t.deepEqual([ + common.snapshot(a, false), + common.snapshot(p, true), + common.snapshot(r, true), + common.snapshot(w, false) + ], before, 'all rejected calls precede writes'); + t.strictEqual(addon(121, 0, null, null, null, null, null, null, null, r, 0, -1, null, null, null), 0, 'raw empty rank only'); + t.strictEqual(r[0], 0, 'raw rank zero'); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dpstf2/test/test_api.js b/lib/node_modules/@stdlib/lapack/base/dpstf2/test/test_api.js new file mode 100644 index 000000000000..bb4617a6208a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dpstf2/test/test_api.js @@ -0,0 +1,208 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var main = require( './../lib' ); +var pure = require( './../lib/main.js' ); +var canUseNative = require( './../lib/can_use_native.js' ); +var common = require( './common.js' ); + + +// TESTS // + +tape('rank-only empty output and tolerance validation precedence', function test(t) { + var rank; + var fs = [ + main, + pure + ]; + var i; + for (i = 0; (i < fs.length); i++) { + rank = new Int32Array([ + 17, + 18, + 19 + ]); + t.strictEqual(fs[i].ndarray('upper', 0, null, NaN, null, undefined, null, undefined, null, rank, 1, -1, null, null, null), 0, 'empty success'); + t.deepEqual(common.snapshot(rank, true), [ + 17, + 0, + 19 + ], 'only active rank'); + t.throws(function call() { // eslint-disable-line no-loop-func + fs[i]('row-major', 'upper', 0, null, 0, null, null, NaN, null); + }, RangeError, 'nonfinite TOL before LDA/buffers'); + + // eslint-disable-line no-loop-func + t.throws(function call() { // eslint-disable-line no-loop-func + fs[i]('row-major', 'upper', 0, null, 0, null, null, undefined, null); + }, TypeError, 'required primitive TOL'); + + // eslint-disable-line no-loop-func + t.throws(function call() { // eslint-disable-line no-loop-func + fs[i].ndarray('upper', 2147483648, null, 1, 1, 0, null, 1, 0, null, 0, -1, null, 1, 0); + }, RangeError, 'dimension before buffers'); // eslint-disable-line no-loop-func + } + t.end(); +}); +tape('invalid active views and aliases leave all outputs untouched', function test(t) { + var before; + var a = new Float64Array([ + 4, + 0, + 0, + 9 + ]); + var p = new Int32Array([ + -3, + -4 + ]); + var r = new Int32Array([7]); + var w = new Float64Array([ + 11, + 12, + 13, + 14 + ]); + before = [ + common.snapshot(a, false), + common.snapshot(p, true), + common.snapshot(r, true), + common.snapshot(w, false) + ]; + t.throws(function call() { // eslint-disable-line no-loop-func + main.ndarray('upper', 2, a, 1, 1, 0, p, 1, 0, r, 0, -1, w, 1, 0); + }, RangeError, 'matrix collision'); + t.throws(function call() { // eslint-disable-line no-loop-func + main.ndarray('upper', 2, a, 2, 1, 0, p, 0, 0, r, 0, -1, w, 1, 0); + }, RangeError, 'pivot broadcast'); + t.throws(function call() { // eslint-disable-line no-loop-func + main.ndarray('upper', 2, a, 2, 1, 0, p, 1, 0, r, 0, -1, w, 0, 0); + }, RangeError, 'scratch broadcast'); + t.throws(function call() { // eslint-disable-line no-loop-func + main('row-major', 'upper', 2, a, 2, p, r, -1, a); + }, RangeError, 'matrix/scratch overlap'); + t.throws(function call() { // eslint-disable-line no-loop-func + main('row-major', 'upper', 2, a, 2, p, p, -1, w); + }, RangeError, 'pivot/rank overlap'); + t.deepEqual([ + common.snapshot(a, false), + common.snapshot(p, true), + common.snapshot(r, true), + common.snapshot(w, false) + ], before, 'no writes after invalid calls'); + t.end(); +}); +tape('first pivot precedes tolerance cutoff and INFO1 still produces full permutation', function test(t) { + var a = new Float64Array([4]); + var p = new Int32Array([-1]); + var r = new Int32Array([-1]); + var w = new Float64Array(2); + t.strictEqual(main('row-major', 'lower', 1, a, 1, p, r, 100, w), 0, 'initial positive pivot retained'); + t.strictEqual(r[0], 1, 'full rank despite high TOL'); + t.strictEqual(a[0], 2, 'square root'); + a = new Float64Array([ + 0, + 2, + 2, + 0 + ]); + p = new Int32Array([ + -8, + -9 + ]); + r[0] = -9; + w = new Float64Array([ + 1, + 2, + 3, + 4 + ]); + t.strictEqual(main(101, 122, 2, a, 2, p, r, -1, w), 1, 'nonpositive initial maximum'); + t.deepEqual(common.snapshot(p, true), [ + 1, + 2 + ], 'all permutation slots produced'); + t.strictEqual(r[0], 0, 'rank zero'); + t.deepEqual(common.snapshot(w, false), [ + common.bits(1), + common.bits(2), + common.bits(3), + common.bits(4) + ], 'scratch untouched before positive pivot'); + t.end(); +}); +tape('native eligibility includes corner sums and helper post-steps', function test(t) { + t.strictEqual(canUseNative([ + 121, + 2, + null, + 1500000000, + 700000000, + 0, + null, + 1, + 0, + null, + 0, + -1, + null, + 1, + 0 + ]), false, 'summed corner exceeds width'); + t.strictEqual(canUseNative([ + 121, + 1, + null, + 2147483648, + 0, + 0, + null, + 0, + 0, + null, + 0, + -1, + null, + 1, + 0 + ]), false, 'wide unused metadata falls back'); + t.strictEqual(canUseNative([ + 121, + 0, + null, + null, + null, + null, + null, + null, + null, + null, + 2147483648, + -1, + null, + null, + null + ]), false, 'wide empty rank offset falls back'); + t.end(); +});