diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/README.md b/lib/node_modules/@stdlib/lapack/base/dgttrf/README.md index abdee2ccf4c5..c516c97108b4 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgttrf/README.md +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/README.md @@ -341,58 +341,90 @@ console.log( info ); ## C APIs - -
+Compute a tridiagonal LU factorization using partial pivoting. The functions mutate the arrays in place, with zero-based pivot indices. +
- -
### Usage ```c -TODO +#include "stdlib/lapack/base/dgttrf.h" ``` -#### TODO +#### c_dgttrf( N, DL, D, DU, DU2, IPIV ) -TODO. +Computes the factorization for a matrix of order `N`. `DL`, `D`, and `DU` contain `N-1`, `N`, and `N-1` elements, respectively. `DU2` and `IPIV` contain at least `max(N-2, 0)` and `N` elements, respectively. ```c -TODO +double DL[] = { 3.0, 1.0 }; +double D[] = { 1.0, 4.0, 5.0 }; +double DU[] = { 2.0, 1.0 }; +double DU2[ 1 ]; +LAPACK_INT IPIV[ 3 ]; + +LAPACK_INT info = API_SUFFIX(c_dgttrf)( 3, DL, D, DU, DU2, IPIV ); ``` -TODO +#### c_dgttrf_ndarray( N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, offsetDU, DU2, strideDU2, offsetDU2, IPIV, strideIPIV, offsetIPIV ) + +Computes the factorization using independent strides and offsets for each array. The first indexed element is at its corresponding offset, and consecutive elements are separated by the associated stride. Negative and zero strides are supported. ```c -TODO +double DL[] = { 1.0, 3.0 }; +double D[] = { 5.0, 4.0, 1.0 }; +double DU[] = { 1.0, 2.0 }; +double DU2[ 1 ]; +LAPACK_INT IPIV[ 3 ]; + +LAPACK_INT info = API_SUFFIX(c_dgttrf_ndarray)( 3, DL, -1, 1, D, -1, 2, DU, -1, 1, DU2, 1, 0, IPIV, 1, 0 ); ```
- -
+### Notes + +- Both functions return `0` on successful factorization, or the zero-based index of the first exactly zero diagonal element of `U`, matching the current JavaScript interface. A zero at the first pivot also returns `0`. A negative matrix order returns `-1`. +- `LAPACK_INT` is a signed 32-bit integer by default and a signed 64-bit integer when compiled with `LAPACK_ILP64`. Compile callers and implementations with the same integer configuration. `API_SUFFIX` follows the shared BLAS API suffix configuration. +- The JavaScript native interface retains `Int32Array` pivot buffers using a separate width-correct workspace. Inputs which cannot safely use the native interface, including pivot buffers which overlap numeric buffers, retain the original JavaScript implementation. +
- -
### Examples ```c -TODO +#include "stdlib/lapack/base/dgttrf.h" +#include + +int main( void ) { + double DL[] = { 3.0, 1.0 }; + double D[] = { 1.0, 4.0, 5.0 }; + double DU[] = { 2.0, 1.0 }; + double DU2[ 1 ]; + LAPACK_INT IPIV[ 3 ]; + LAPACK_INT info; + LAPACK_INT i; + + info = API_SUFFIX(c_dgttrf)( 3, DL, D, DU, DU2, IPIV ); + printf( "status: %" LAPACK_IFMT "\n", info ); + for ( i = 0; i < 3; i++ ) { + printf( "D[%" LAPACK_IFMT "]: %g; pivot: %" LAPACK_IFMT "\n", i, D[ i ], IPIV[ i ] ); + } + return info != 0; +} ```
diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/benchmark/c/Makefile b/lib/node_modules/@stdlib/lapack/base/dgttrf/benchmark/c/Makefile new file mode 100644 index 000000000000..979768abbcec --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/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/dgttrf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/lapack/base/dgttrf/benchmark/c/benchmark.c new file mode 100644 index 000000000000..23cee0b8c6ef --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/benchmark/c/benchmark.c @@ -0,0 +1,92 @@ +/** +* @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/dgttrf.h" +#include +#include +#include + +#define NAME "dgttrf" +#define REPEATS 3 +#define ITERATIONS 10000 + +/** +* Runs a tridiagonal factorization benchmark. +* +* @param N matrix order +* @return elapsed time in seconds +*/ +static double benchmark( const LAPACK_INT N ) { + double *DL; + double *D; + double *DU; + double *DU2; + LAPACK_INT *IPIV; + LAPACK_INT info; + LAPACK_INT i; + LAPACK_INT j; + clock_t t; + + DL = (double *)malloc( N*sizeof( double ) ); + D = (double *)malloc( N*sizeof( double ) ); + DU = (double *)malloc( N*sizeof( double ) ); + DU2 = (double *)malloc( N*sizeof( double ) ); + IPIV = (LAPACK_INT *)malloc( N*sizeof( LAPACK_INT ) ); + if ( DL == NULL || D == NULL || DU == NULL || DU2 == NULL || IPIV == NULL ) { + free( DL ); free( D ); free( DU ); free( DU2 ); free( IPIV ); + exit( 1 ); + } + t = clock(); + for ( i = 0; i < ITERATIONS; i++ ) { + for ( j = 0; j < N; j++ ) { + DL[ j ] = 1.0; + D[ j ] = 4.0; + DU[ j ] = 1.0; + } + info = API_SUFFIX(c_dgttrf)( N, DL, D, DU, DU2, IPIV ); + if ( info != 0 || D[ N-1 ] <= 0.0 ) { + free( DL ); free( D ); free( DU ); free( DU2 ); free( IPIV ); + exit( 1 ); + } + } + t = clock() - t; + free( DL ); free( D ); free( DU ); free( DU2 ); free( IPIV ); + return (double)t / CLOCKS_PER_SEC; +} + +int main( void ) { + const LAPACK_INT orders[] = { 4, 16, 256 }; + double elapsed; + int count; + int i; + int j; + + printf( "TAP version 13\n" ); + count = 0; + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + elapsed = benchmark( orders[ i ] ); + printf( "# c::%s:N=%" LAPACK_IFMT "\n", NAME, orders[ i ] ); + printf( " ---\n iterations: %d\n elapsed: %0.9f\n rate: %0.9f\n ...\n", ITERATIONS, elapsed, ITERATIONS/elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + } + printf( "1..%d\n# total %d\n# pass %d\n# ok\n", count, count, count ); + return 0; +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/binding.gyp b/lib/node_modules/@stdlib/lapack/base/dgttrf/binding.gyp new file mode 100644 index 000000000000..529633429197 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/binding.gyp @@ -0,0 +1,176 @@ +# @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` 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', + + # 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': [], + + # Match Node-API integer arguments without narrowing indices: + 'defines': [ 'LAPACK_ILP64' ], + + # 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', + + # Keep separate multiply/subtract operations consistent with JavaScript: + '-ffp-contract=off', + ], + + # 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 + }, # 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/dgttrf/examples/c/Makefile b/lib/node_modules/@stdlib/lapack/base/dgttrf/examples/c/Makefile new file mode 100644 index 000000000000..c8f8e9a1517b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/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/dgttrf/examples/c/example.c b/lib/node_modules/@stdlib/lapack/base/dgttrf/examples/c/example.c new file mode 100644 index 000000000000..92cddbd4294d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/examples/c/example.c @@ -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. +*/ + +#include "stdlib/lapack/base/dgttrf.h" +#include + +int main( void ) { + double DL[] = { 3.0, 1.0 }; + double D[] = { 1.0, 4.0, 5.0 }; + double DU[] = { 2.0, 1.0 }; + double DU2[ 1 ]; + LAPACK_INT IPIV[ 3 ]; + LAPACK_INT info; + LAPACK_INT i; + + info = API_SUFFIX(c_dgttrf)( 3, DL, D, DU, DU2, IPIV ); + printf( "status: %" LAPACK_IFMT "\n", info ); + for ( i = 0; i < 3; i++ ) { + printf( "D[%" LAPACK_IFMT "]: %g; pivot: %" LAPACK_IFMT "\n", i, D[ i ], IPIV[ i ] ); + } + return info != 0; +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/include.gypi b/lib/node_modules/@stdlib/lapack/base/dgttrf/include.gypi new file mode 100644 index 000000000000..bee8d41a2caf --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/include.gypi @@ -0,0 +1,53 @@ +# @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. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + '= 0 && offset < length && last >= 0 && last < length; +} + + +// MAIN // + +/** +* Checks whether arguments can use the typed native interface. +* +* @private +* @param {Array} args - normalized ndarray arguments +* @returns {boolean} whether arguments can use the native interface +*/ +function canUseNative( args ) { + var pivotOffset; + var pivotLength; + var pivotBuffer; + var dataOffset; + var dataLength; + var lengths; + var pivots; + var data; + var N; + var i; + var j; + + N = args[ 0 ]; + if ( !isSafeInteger( N ) || N <= 0 || N > 2147483647 ) { + return false; + } + lengths = [ N-1, N, N-1, N-2, N ]; + for ( i = 0; i < 5; i++ ) { + j = 1 + (3*i); + data = args[ j ]; + if ( i === 4 ) { + if ( !isInt32Array( data ) ) { + return false; + } + } else if ( !isFloat64Array( data ) ) { + return false; + } + if ( !isView( data, lengths[ i ], args[ j+1 ], args[ j+2 ] ) ) { + return false; + } + } + // Deferred pivot copying must not change reads from aliased numeric views. + pivots = args[ 13 ]; + pivotBuffer = getBuffer.call( pivots ); + pivotOffset = getByteOffset.call( pivots ); + pivotLength = getByteLength.call( pivots ); + for ( i = 0; i < 4; i++ ) { + data = args[ 1+(3*i) ]; + dataOffset = getByteOffset.call( data ); + dataLength = getByteLength.call( data ); + if ( getBuffer.call( data ) === pivotBuffer && dataOffset < pivotOffset+pivotLength && pivotOffset < dataOffset+dataLength ) { + return false; + } + } + return true; +} + + +// EXPORTS // + +module.exports = canUseNative; diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/lib/factory.js b/lib/node_modules/@stdlib/lapack/base/dgttrf/lib/factory.js new file mode 100644 index 000000000000..cc5a8a0c3fed --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/lib/factory.js @@ -0,0 +1,95 @@ +/** +* @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 setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var canUseNative = require( './can_use_native.js' ); +var main = require( './main.js' ); + + +// MAIN // + +/** +* Returns a tridiagonal factorization interface with native dispatch. +* +* @private +* @param {Function} addon - native ndarray kernel +* @returns {Function} factorization interface +*/ +function factory( addon ) { + setReadOnly( dgttrf, 'ndarray', ndarray ); + return dgttrf; + + /** + * Computes a tridiagonal LU factorization. + * + * @private + * @param {NonNegativeInteger} N - matrix order + * @param {Float64Array} DL - subdiagonal elements + * @param {Float64Array} D - diagonal elements + * @param {Float64Array} DU - superdiagonal elements + * @param {Float64Array} DU2 - output second superdiagonal + * @param {Int32Array} IPIV - output pivot indices + * @returns {integer} status code + */ + function dgttrf( N, DL, D, DU, DU2, IPIV ) { + var args = [ N, DL, 1, 0, D, 1, 0, DU, 1, 0, DU2, 1, 0, IPIV, 1, 0 ]; + if ( canUseNative( args ) ) { + return addon.apply( null, args ); + } + return main( N, DL, D, DU, DU2, IPIV ); + } + + /** + * Computes a tridiagonal LU factorization using alternative indexing semantics. + * + * @private + * @param {NonNegativeInteger} N - matrix order + * @param {Float64Array} DL - subdiagonal elements + * @param {integer} strideDL - stride length for DL + * @param {NonNegativeInteger} offsetDL - starting index for DL + * @param {Float64Array} D - diagonal elements + * @param {integer} strideD - stride length for D + * @param {NonNegativeInteger} offsetD - starting index for D + * @param {Float64Array} DU - superdiagonal elements + * @param {integer} strideDU - stride length for DU + * @param {NonNegativeInteger} offsetDU - starting index for DU + * @param {Float64Array} DU2 - output second superdiagonal + * @param {integer} strideDU2 - stride length for DU2 + * @param {NonNegativeInteger} offsetDU2 - starting index for DU2 + * @param {Int32Array} IPIV - output pivot indices + * @param {integer} strideIPIV - stride length for IPIV + * @param {NonNegativeInteger} offsetIPIV - starting index for IPIV + * @returns {integer} status code + */ + function ndarray( N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, offsetDU, DU2, strideDU2, offsetDU2, IPIV, strideIPIV, offsetIPIV ) { // eslint-disable-line max-len, max-params + var args = [ N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, offsetDU, DU2, strideDU2, offsetDU2, IPIV, strideIPIV, offsetIPIV ]; + if ( canUseNative( args ) ) { + return addon.apply( null, args ); + } + return main.ndarray.apply( null, args ); + } +} + + +// EXPORTS // + +module.exports = factory; diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/lib/native.js b/lib/node_modules/@stdlib/lapack/base/dgttrf/lib/native.js new file mode 100644 index 000000000000..f938a5a093c1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/lib/native.js @@ -0,0 +1,34 @@ +/** +* @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 factory = require( './factory.js' ); +var addon = require( './../src/addon.node' ); + + +// MAIN // + +var dgttrf = factory( addon ); + + +// EXPORTS // + +module.exports = dgttrf; diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/manifest.json b/lib/node_modules/@stdlib/lapack/base/dgttrf/manifest.json new file mode 100644 index 000000000000..61bd9dba0088 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/manifest.json @@ -0,0 +1,104 @@ +{ + "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/dgttrf.c", + "./src/dgttrf_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/lapack/base/shared", + "@stdlib/math/base/special/abs", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-float64array", + "@stdlib/napi/argv-int32array", + "@stdlib/napi/create-int32" + ] + }, + { + "task": "benchmark", + "wasm": false, + "src": [ + "./src/dgttrf.c", + "./src/dgttrf_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/lapack/base/shared", + "@stdlib/math/base/special/abs" + ] + }, + { + "task": "examples", + "wasm": false, + "src": [ + "./src/dgttrf.c", + "./src/dgttrf_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/lapack/base/shared", + "@stdlib/math/base/special/abs" + ] + }, + { + "task": "", + "wasm": true, + "src": [ + "./src/dgttrf.c", + "./src/dgttrf_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/lapack/base/shared", + "@stdlib/math/base/special/abs" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/package.json b/lib/node_modules/@stdlib/lapack/base/dgttrf/package.json index 723279324d0f..c999a52145d1 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgttrf/package.json +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/package.json @@ -19,7 +19,9 @@ "doc": "./docs", "example": "./examples", "lib": "./lib", - "test": "./test" + "test": "./test", + "include": "./include", + "src": "./src" }, "types": "./docs/types", "scripts": {}, @@ -65,5 +67,8 @@ "float64", "double", "float64array" - ] + ], + "browser": "./lib/main.js", + "gypfile": true, + "__stdlib__": {} } diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/src/Makefile b/lib/node_modules/@stdlib/lapack/base/dgttrf/src/Makefile new file mode 100644 index 000000000000..2caf905cedbe --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/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/dgttrf/src/addon.c b/lib/node_modules/@stdlib/lapack/base/dgttrf/src/addon.c new file mode 100644 index 000000000000..b3490209bb12 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/src/addon.c @@ -0,0 +1,116 @@ +/** +* @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/dgttrf.h" +#include "stdlib/napi/export.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/argv_int64.h" +#include "stdlib/napi/argv_float64array.h" +#include "stdlib/napi/argv_int32array.h" +#include "stdlib/napi/create_int32.h" +#include +#include +#include + +/** +* Checks whether a typed array contains all indexed elements. +* +* @param count number of indexed elements +* @param stride stride length +* @param offset starting index +* @param length typed array length +* @return whether the indexed elements are in bounds +*/ +static int in_bounds( const int64_t count, const int64_t stride, const int64_t offset, const int64_t length ) { + double last; + + if ( count <= 0 ) { + return 1; + } + last = (double)offset + ( (double)(count-1)*(double)stride ); + return offset >= 0 && offset < length && last >= 0.0 && last < (double)length; +} + +/** +* Receives JavaScript callback invocation data. +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon( napi_env env, napi_callback_info info ) { + LAPACK_INT *pivots; + LAPACK_INT step; + LAPACK_INT result; + int64_t pos; + int64_t i; + size_t count; + + STDLIB_NAPI_ARGV( env, info, argv, argc, 16 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + if ( N < 0 || N > INT32_MAX ) { + napi_throw_range_error( env, NULL, "invalid argument. Matrix order must fit in a nonnegative signed 32-bit integer." ); + return NULL; + } + if ( N == 0 ) { + STDLIB_NAPI_CREATE_INT32( env, 0, zero ); + return zero; + } + STDLIB_NAPI_ARGV_FLOAT64ARRAY( env, DL, dllen, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, sdl, argv, 2 ); + STDLIB_NAPI_ARGV_INT64( env, odl, argv, 3 ); + STDLIB_NAPI_ARGV_FLOAT64ARRAY( env, D, dlen, argv, 4 ); + STDLIB_NAPI_ARGV_INT64( env, sd, argv, 5 ); + STDLIB_NAPI_ARGV_INT64( env, od, argv, 6 ); + STDLIB_NAPI_ARGV_FLOAT64ARRAY( env, DU, dulen, argv, 7 ); + STDLIB_NAPI_ARGV_INT64( env, sdu, argv, 8 ); + STDLIB_NAPI_ARGV_INT64( env, odu, argv, 9 ); + STDLIB_NAPI_ARGV_FLOAT64ARRAY( env, DU2, du2len, argv, 10 ); + STDLIB_NAPI_ARGV_INT64( env, sdu2, argv, 11 ); + STDLIB_NAPI_ARGV_INT64( env, odu2, argv, 12 ); + STDLIB_NAPI_ARGV_INT32ARRAY( env, IPIV, plen, argv, 13 ); + STDLIB_NAPI_ARGV_INT64( env, sp, argv, 14 ); + STDLIB_NAPI_ARGV_INT64( env, op, argv, 15 ); + if ( !in_bounds( N-1, sdl, odl, dllen ) || !in_bounds( N, sd, od, dlen ) || !in_bounds( N-1, sdu, odu, dulen ) || !in_bounds( N-2, sdu2, odu2, du2len ) || !in_bounds( N, sp, op, plen ) ) { + napi_throw_range_error( env, NULL, "invalid argument. Arrays have insufficient indexed elements." ); + return NULL; + } + // The JS pivot view is always Int32Array, even for an ILP64 build. + step = ( sp == 0 ) ? 0 : 1; + count = ( step == 0 ) ? 1 : (size_t)N; + if ( count > SIZE_MAX/sizeof( LAPACK_INT ) ) { + napi_throw_range_error( env, NULL, "invalid argument. Pivot workspace is too large." ); + return NULL; + } + pivots = (LAPACK_INT *)malloc( count*sizeof( LAPACK_INT ) ); + if ( pivots == NULL ) { + napi_throw_error( env, NULL, "allocation failed. Unable to allocate pivot workspace." ); + return NULL; + } + result = API_SUFFIX(c_dgttrf_ndarray)( N, DL, sdl, odl, D, sd, od, DU, sdu, odu, DU2, sdu2, odu2, pivots, step, 0 ); + pos = op; + for ( i = 0; i < N; i++ ) { + IPIV[ pos ] = (int32_t)pivots[ i*step ]; + pos += sp; + } + free( pivots ); + STDLIB_NAPI_CREATE_INT32( env, (int32_t)result, out ); + return out; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/src/dgttrf.c b/lib/node_modules/@stdlib/lapack/base/dgttrf/src/dgttrf.c new file mode 100644 index 000000000000..ff0421c94404 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/src/dgttrf.c @@ -0,0 +1,34 @@ +/** +* @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/dgttrf.h" + +/** +* Computes an LU factorization of a real tridiagonal matrix. +* +* @param N matrix order +* @param DL subdiagonal elements, overwritten by multipliers +* @param D diagonal elements, overwritten by the diagonal of U +* @param DU superdiagonal elements, overwritten by the first superdiagonal of U +* @param DU2 output second superdiagonal of U +* @param IPIV output zero-based pivot indices +* @return zero on success, a zero-based zero-pivot index, or -1 if N is negative +*/ +LAPACK_INT API_SUFFIX(c_dgttrf)( const LAPACK_INT N, double *DL, double *D, double *DU, double *DU2, LAPACK_INT *IPIV ) { + return API_SUFFIX(c_dgttrf_ndarray)( N, DL, 1, 0, D, 1, 0, DU, 1, 0, DU2, 1, 0, IPIV, 1, 0 ); +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/src/dgttrf_ndarray.c b/lib/node_modules/@stdlib/lapack/base/dgttrf/src/dgttrf_ndarray.c new file mode 100644 index 000000000000..6af23dcff1a6 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/src/dgttrf_ndarray.c @@ -0,0 +1,193 @@ +/** +* @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. +*/ + +/* +* 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/dgttrf.h" +#include "stdlib/math/base/special/abs.h" + +/** +* Computes an LU factorization of a real tridiagonal matrix. +* +* ## Notes +* +* - The factorization is adapted from the reference LAPACK DGTTRF routine. +* - Pivot indices and singular status indices are zero-based, matching the JavaScript API. A zero at the first pivot returns zero. +* - The arrays are updated in place, in the same order as the JavaScript implementation. +* +* @param N matrix order +* @param DL subdiagonal elements, overwritten by multipliers +* @param strideDL stride length for DL +* @param offsetDL starting index for DL +* @param D diagonal elements, overwritten by the diagonal of U +* @param strideD stride length for D +* @param offsetD starting index for D +* @param DU superdiagonal elements, overwritten by the first superdiagonal of U +* @param strideDU stride length for DU +* @param offsetDU starting index for DU +* @param DU2 output second superdiagonal of U +* @param strideDU2 stride length for DU2 +* @param offsetDU2 starting index for DU2 +* @param IPIV output zero-based pivot indices +* @param strideIPIV stride length for IPIV +* @param offsetIPIV starting index for IPIV +* @return zero on success, a zero-based zero-pivot index, or -1 if N is negative +*/ +LAPACK_INT API_SUFFIX(c_dgttrf_ndarray)( const LAPACK_INT N, double *DL, const LAPACK_INT strideDL, const LAPACK_INT offsetDL, double *D, const LAPACK_INT strideD, const LAPACK_INT offsetD, double *DU, const LAPACK_INT strideDU, const LAPACK_INT offsetDU, double *DU2, const LAPACK_INT strideDU2, const LAPACK_INT offsetDU2, LAPACK_INT *IPIV, const LAPACK_INT strideIPIV, const LAPACK_INT offsetIPIV ) { + double fact; + double temp; + LAPACK_INT idu2; + LAPACK_INT idu; + LAPACK_INT idl; + LAPACK_INT id; + LAPACK_INT ip; + LAPACK_INT i; + LAPACK_INT j; + + if ( N < 0 ) { + return -1; + } + if ( N == 0 ) { + return 0; + } + idu2 = offsetDU2; + ip = offsetIPIV; + for ( i = 0; i < N; i++ ) { + IPIV[ ip ] = i; + if ( i < N-2 ) { + DU2[ idu2 ] = 0.0; + } + if ( i < N-1 ) { + ip += strideIPIV; + } + if ( i < N-3 ) { + idu2 += strideDU2; + } + } + idu2 = offsetDU2; + ip = offsetIPIV; + idl = offsetDL; + id = offsetD; + idu = offsetDU; + for ( i = 0; i < N-2; i++ ) { + if ( stdlib_base_abs( D[ id ] ) >= stdlib_base_abs( DL[ idl ] ) ) { + if ( D[ id ] != 0.0 ) { + fact = DL[ idl ] / D[ id ]; + DL[ idl ] = fact; + D[ id+strideD ] = D[ id+strideD ] - ( fact*DU[ idu ] ); + } + } else { + fact = D[ id ] / DL[ idl ]; + D[ id ] = DL[ idl ]; + DL[ idl ] = fact; + temp = DU[ idu ]; + j = id + strideD; + DU[ idu ] = D[ j ]; + D[ j ] = temp - ( fact*D[ j ] ); + j = idu + strideDU; + DU2[ idu2 ] = DU[ j ]; + DU[ j ] *= -fact; + IPIV[ ip ] = i + 1; + } + id += strideD; + idl += strideDL; + idu += strideDU; + if ( i < N-3 ) { + idu2 += strideDU2; + } + ip += strideIPIV; + } + if ( N > 1 ) { + i = N - 2; + if ( stdlib_base_abs( D[ id ] ) >= stdlib_base_abs( DL[ idl ] ) ) { + if ( D[ id ] != 0.0 ) { + fact = DL[ idl ] / D[ id ]; + DL[ idl ] = fact; + D[ id+strideD ] = D[ id+strideD ] - ( fact*DU[ idu ] ); + } + } else { + fact = D[ id ] / DL[ idl ]; + D[ id ] = DL[ idl ]; + DL[ idl ] = fact; + temp = DU[ idu ]; + j = id + strideD; + DU[ idu ] = D[ j ]; + D[ j ] = temp - ( fact*D[ j ] ); + IPIV[ ip ] = i + 1; + } + } + id = offsetD; + for ( i = 0; i < N; i++ ) { + if ( D[ id ] == 0.0 ) { + return i; + } + if ( i < N-1 ) { + id += strideD; + } + } + return 0; +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/test/fixtures/lapack.json b/lib/node_modules/@stdlib/lapack/base/dgttrf/test/fixtures/lapack.json new file mode 100644 index 000000000000..15f68c62e305 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/test/fixtures/lapack.json @@ -0,0 +1,4359 @@ +{ + "routine": "scipy_dgttrf_ via ctypes, direct compiled Reference-LAPACK entrypoint", + "scipy_version": "1.17.0", + "reference_lapack": "https://github.com/Reference-LAPACK/lapack/blob/74d4d63747bf1770bb60e1110c2075227baa324e/SRC/dgttrf.f", + "normalization": "Reference pivot and positive singular status indices are converted from one-based to current JS zero-based conventions.", + "cases": [ + { + "name": "empty", + "N": 0, + "DL": [], + "D": [], + "DU": [], + "expectedDL": [], + "expectedD": [], + "expectedDU": [], + "expectedDU2": [], + "expectedIPIV": [], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "single_positive", + "N": 1, + "DL": [], + "D": [ + 2.0 + ], + "DU": [], + "expectedDL": [], + "expectedD": [ + 2.0 + ], + "expectedDU": [], + "expectedDU2": [], + "expectedIPIV": [ + 0 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "single_zero", + "N": 1, + "DL": [], + "D": [ + 0.0 + ], + "DU": [], + "expectedDL": [], + "expectedD": [ + 0.0 + ], + "expectedDU": [], + "expectedDU2": [], + "expectedIPIV": [ + 0 + ], + "referenceInfo": 1, + "expectedInfo": 0 + }, + { + "name": "single_negative", + "N": 1, + "DL": [], + "D": [ + -2.0 + ], + "DU": [], + "expectedDL": [], + "expectedD": [ + -2.0 + ], + "expectedDU": [], + "expectedDU2": [], + "expectedIPIV": [ + 0 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "two_no_swap", + "N": 2, + "DL": [ + 1.0 + ], + "D": [ + 2.0, + 3.0 + ], + "DU": [ + 1.0 + ], + "expectedDL": [ + 0.5 + ], + "expectedD": [ + 2.0, + 2.5 + ], + "expectedDU": [ + 1.0 + ], + "expectedDU2": [], + "expectedIPIV": [ + 0, + 1 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "two_tie", + "N": 2, + "DL": [ + -1.0 + ], + "D": [ + 1.0, + 2.0 + ], + "DU": [ + 3.0 + ], + "expectedDL": [ + -1.0 + ], + "expectedD": [ + 1.0, + 5.0 + ], + "expectedDU": [ + 3.0 + ], + "expectedDU2": [], + "expectedIPIV": [ + 0, + 1 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "two_swap", + "N": 2, + "DL": [ + 3.0 + ], + "D": [ + 0.0, + 2.0 + ], + "DU": [ + 4.0 + ], + "expectedDL": [ + 0.0 + ], + "expectedD": [ + 3.0, + 4.0 + ], + "expectedDU": [ + 2.0 + ], + "expectedDU2": [], + "expectedIPIV": [ + 1, + 1 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "three_no_swap", + "N": 3, + "DL": [ + 1.0, + 1.0 + ], + "D": [ + 2.0, + 3.0, + 1.0 + ], + "DU": [ + 1.0, + 1.0 + ], + "expectedDL": [ + 0.5, + 0.4 + ], + "expectedD": [ + 2.0, + 2.5, + 0.6 + ], + "expectedDU": [ + 1.0, + 1.0 + ], + "expectedDU2": [ + 0.0 + ], + "expectedIPIV": [ + 0, + 1, + 2 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "three_first_swap", + "N": 3, + "DL": [ + 3.0, + 1.0 + ], + "D": [ + 1.0, + 4.0, + 5.0 + ], + "DU": [ + 2.0, + 1.0 + ], + "expectedDL": [ + 0.3333333333333333, + 0.6666666666666667 + ], + "expectedD": [ + 3.0, + 1.0, + -3.6666666666666674 + ], + "expectedDU": [ + 4.0, + 5.0 + ], + "expectedDU2": [ + 1.0 + ], + "expectedIPIV": [ + 1, + 2, + 2 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "three_final_swap", + "N": 3, + "DL": [ + 1.0, + 8.0 + ], + "D": [ + 4.0, + 2.0, + 1.0 + ], + "DU": [ + 1.0, + 3.0 + ], + "expectedDL": [ + 0.25, + 0.21875 + ], + "expectedD": [ + 4.0, + 8.0, + 2.78125 + ], + "expectedDU": [ + 1.0, + 1.0 + ], + "expectedDU2": [ + 0.0 + ], + "expectedIPIV": [ + 0, + 2, + 2 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "consecutive_swaps", + "N": 9, + "DL": [ + 3.0, + 3.0, + 3.0, + 3.0, + 3.0, + 3.0, + 3.0, + 3.0 + ], + "D": [ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0 + ], + "DU": [ + 4.0, + 4.0, + 4.0, + 4.0, + 4.0, + 4.0, + 4.0, + 4.0 + ], + "expectedDL": [ + 0.3333333333333333, + 0.8181818181818182, + 0.6969696969696969, + 0.908256880733945, + 0.8493506493506494, + -0.7991341991341993, + 0.6251127548259066, + -0.3327319742618318 + ], + "expectedD": [ + 3.0, + 3.6666666666666665, + 3.0, + 3.303030303030303, + 3.532110091743119, + 3.0, + 4.799134199134199, + 3.0, + 4.332731974261832 + ], + "expectedDU": [ + 1.0, + -1.3333333333333333, + 1.0, + -2.7878787878787876, + 4.0, + 1.0, + 3.196536796536797, + 1.0 + ], + "expectedDU2": [ + 4.0, + 0.0, + 4.0, + 0.0, + 0.0, + 4.0, + 0.0 + ], + "expectedIPIV": [ + 1, + 1, + 3, + 3, + 4, + 6, + 6, + 8, + 8 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "zero_pivot_first", + "N": 3, + "DL": [ + 0.0, + 0.0 + ], + "D": [ + 0.0, + 2.0, + 3.0 + ], + "DU": [ + 1.0, + 1.0 + ], + "expectedDL": [ + 0.0, + 0.0 + ], + "expectedD": [ + 0.0, + 2.0, + 3.0 + ], + "expectedDU": [ + 1.0, + 1.0 + ], + "expectedDU2": [ + 0.0 + ], + "expectedIPIV": [ + 0, + 1, + 2 + ], + "referenceInfo": 1, + "expectedInfo": 0 + }, + { + "name": "zero_pivot_middle", + "N": 3, + "DL": [ + 0.0, + 0.0 + ], + "D": [ + 2.0, + 0.0, + 3.0 + ], + "DU": [ + 1.0, + 1.0 + ], + "expectedDL": [ + 0.0, + 0.0 + ], + "expectedD": [ + 2.0, + 0.0, + 3.0 + ], + "expectedDU": [ + 1.0, + 1.0 + ], + "expectedDU2": [ + 0.0 + ], + "expectedIPIV": [ + 0, + 1, + 2 + ], + "referenceInfo": 2, + "expectedInfo": 1 + }, + { + "name": "zero_pivot_last", + "N": 3, + "DL": [ + 0.0, + 0.0 + ], + "D": [ + 2.0, + 3.0, + 0.0 + ], + "DU": [ + 1.0, + 1.0 + ], + "expectedDL": [ + 0.0, + 0.0 + ], + "expectedD": [ + 2.0, + 3.0, + 0.0 + ], + "expectedDU": [ + 1.0, + 1.0 + ], + "expectedDU2": [ + 0.0 + ], + "expectedIPIV": [ + 0, + 1, + 2 + ], + "referenceInfo": 3, + "expectedInfo": 2 + }, + { + "name": "zero_offdiagonals", + "N": 5, + "DL": [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + "D": [ + 1.0, + 2.0, + 3.0, + 4.0, + 5.0 + ], + "DU": [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + "expectedDL": [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + "expectedD": [ + 1.0, + 2.0, + 3.0, + 4.0, + 5.0 + ], + "expectedDU": [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + "expectedDU2": [ + 0.0, + 0.0, + 0.0 + ], + "expectedIPIV": [ + 0, + 1, + 2, + 3, + 4 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "tiny", + "N": 3, + "DL": [ + -1e-250, + 1e-250 + ], + "D": [ + 3e-250, + 4e-250, + 5e-250 + ], + "DU": [ + 1e-250, + -1e-250 + ], + "expectedDL": [ + -0.3333333333333333, + 0.23076923076923075 + ], + "expectedD": [ + 3e-250, + 4.333333333333334e-250, + 5.230769230769231e-250 + ], + "expectedDU": [ + 1e-250, + -1e-250 + ], + "expectedDU2": [ + 0.0 + ], + "expectedIPIV": [ + 0, + 1, + 2 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "huge", + "N": 3, + "DL": [ + -1e+250, + 1e+250 + ], + "D": [ + 3e+250, + 4e+250, + 5e+250 + ], + "DU": [ + 1e+250, + -1e+250 + ], + "expectedDL": [ + -0.3333333333333333, + 0.23076923076923078 + ], + "expectedD": [ + 3e+250, + 4.333333333333333e+250, + 5.230769230769231e+250 + ], + "expectedDU": [ + 1e+250, + -1e+250 + ], + "expectedDU2": [ + 0.0 + ], + "expectedIPIV": [ + 0, + 1, + 2 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "near_singular", + "N": 3, + "DL": [ + 1.0, + 0.0 + ], + "D": [ + 1.0, + 1.0000000000000002, + 2.0 + ], + "DU": [ + 1.0, + 0.0 + ], + "expectedDL": [ + 1.0, + 0.0 + ], + "expectedD": [ + 1.0, + 2.220446049250313e-16, + 2.0 + ], + "expectedDU": [ + 1.0, + 0.0 + ], + "expectedDU2": [ + 0.0 + ], + "expectedIPIV": [ + 0, + 1, + 2 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_0", + "N": 5, + "DL": [ + -0.0054521612615618335, + 0.792550065985383, + 2.0085761763371073, + -1.0223874710439476 + ], + "D": [ + -0.3743336102304693, + 0.7777782916583257, + -0.697841706351602, + 0.2709709596032369, + -0.06051979192635551 + ], + "DU": [ + -0.44337594803206914, + 0.8060722261490828, + 0.3602134458922244, + -0.9347104969187414 + ], + "expectedDL": [ + 0.014564979239254133, + 0.9895097947680457, + 0.7451016533069046, + 0.5461096294009999 + ], + "expectedD": [ + -0.3743336102304693, + 0.792550065985383, + 2.0085761763371073, + -1.0223874710439476, + 0.7295047777578002 + ], + "expectedDU": [ + -0.44337594803206914, + -0.697841706351602, + 0.2709709596032369, + -0.06051979192635551 + ], + "expectedDU2": [ + 0.0, + 0.3602134458922244, + -0.9347104969187414 + ], + "expectedIPIV": [ + 0, + 2, + 3, + 4, + 4 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_1", + "N": 4, + "DL": [ + 0.49589765291190485, + 0.3654938394271016, + 0.8416822857532903 + ], + "D": [ + 0.387599324995002, + 1.572083023456009, + 0.2799241245301951, + 0.22608114255773246 + ], + "DU": [ + -0.8566997224316625, + -0.49056717593177024, + -0.12863131802831068 + ], + "expectedDL": [ + 0.781611533587674, + -0.1752583120877188, + 0.4124168278799983 + ], + "expectedD": [ + 0.49589765291190485, + -2.085457945322261, + 0.8416822857532903, + -0.22187098568545638 + ], + "expectedDU": [ + 1.572083023456009, + 0.3834329627078052, + 0.22608114255773246 + ], + "expectedDU2": [ + -0.49056717593177024, + 0.0 + ], + "expectedIPIV": [ + 1, + 1, + 3, + 3 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_2", + "N": 13, + "DL": [ + -1.2248321316547603, + 0.46289514446896957, + 1.5047379727743255, + 0.7771704897231232, + -0.08246177515681999, + 0.32027215855603364, + 0.8348953975153898, + -0.7497193278743526, + 0.09019611859573297, + 0.8322208672809104, + -0.2071620245315509, + 1.4149326757530776 + ], + "D": [ + 0.5757567006694296, + 1.0467089627051598, + 1.2465298197222947, + 0.06458124843634003, + -0.6019596407272718, + -1.16027228834295, + 1.7138141849522335, + -0.8940398605434845, + -0.029676005358031502, + -0.5337078637026887, + 1.4196877507110297, + -0.6771552630169625, + 0.5905528406905304 + ], + "DU": [ + 0.13570704640135972, + 1.2831761338480274, + -0.2769918797011528, + -0.49298025408555435, + 0.17571309980041705, + -1.0105943588168491, + -2.2560200440670033, + -0.9963558903610281, + -1.171587910422963, + 0.3962339909365251, + 1.6949343519088025, + -0.06222787873651169 + ], + "expectedDL": [ + -0.47006988614152095, + 0.7374072139442723, + 0.5328095240073585, + -0.4006860631716224, + -0.2603356021903516, + -0.7233048159048713, + 0.8549732800367296, + -0.6683796302426237, + -0.08875904505311359, + -0.7248220189040041, + -0.1453508560399828, + -0.352375772890467 + ], + "expectedD": [ + -1.2248321316547603, + 0.6277334093234836, + 1.5047379727743255, + 0.7771704897231232, + -0.08246177515681999, + 0.32027215855603364, + 0.9765163625692755, + -0.7497193278743526, + -1.0161907278493074, + 0.8322208672809104, + 1.4252549326201782, + 1.4149326757530776, + 0.14586863493447477 + ], + "expectedDU": [ + 1.0467089627051598, + 0.6031824591374593, + 0.06458124843634003, + -0.6019596407272718, + -1.16027228834295, + 1.7138141849522335, + -1.6317901626515834, + -0.029676005358031502, + -0.7830654943652281, + 1.4196877507110297, + 1.228525738860288, + 0.5905528406905304 + ], + "expectedDU2": [ + 1.2831761338480274, + 0.0, + -0.49298025408555435, + 0.17571309980041705, + -1.0105943588168491, + -2.2560200440670033, + 0.0, + -1.171587910422963, + 0.0, + 1.6949343519088025, + 0.0 + ], + "expectedIPIV": [ + 1, + 1, + 3, + 4, + 5, + 6, + 6, + 8, + 8, + 10, + 10, + 12, + 12 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_3", + "N": 6, + "DL": [ + 1.3898767190749177, + -1.2168894636043597, + -0.9448400506929705, + -0.04842361462353984, + 0.36636512236188234 + ], + "D": [ + 1.8467058052271212, + -0.49353331238363646, + -1.1357630223083843, + -0.05532792374952467, + 0.3240441104030467, + 0.012275317827674498 + ], + "DU": [ + 0.11282835317333773, + 0.26208732897546705, + 0.5970038001122803, + -0.21551580970106074, + -1.4417101645699157 + ], + "expectedDL": [ + 0.7526248713470528, + 0.475351915252582, + -0.8487938845465213, + 0.14640597192250038, + 0.9575855178738293 + ], + "expectedD": [ + 1.8467058052271212, + -1.2168894636043597, + -0.9448400506929705, + -0.33074890311969485, + 0.36636512236188234, + -1.4534648311489953 + ], + "expectedDU": [ + 0.11282835317333773, + -1.1357630223083843, + -0.05532792374952467, + -0.1829285012973522, + 0.012275317827674498 + ], + "expectedDU2": [ + 0.0, + 0.5970038001122803, + -0.21551580970106074, + 0.0 + ], + "expectedIPIV": [ + 0, + 2, + 3, + 3, + 5, + 5 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_4", + "N": 5, + "DL": [ + -0.6977557945120381, + -0.38737566216534336, + -0.3320819875908143, + -0.4063163479438743 + ], + "D": [ + -0.9098950590573759, + -1.5056741768370574, + 0.33036199118515075, + -0.6642388533149433, + 0.8465576813444847 + ], + "DU": [ + 0.8014848479209679, + 1.0751758196102288, + -1.4846241917298706, + -1.5619770159856456 + ], + "expectedDL": [ + 0.7668530426298745, + 0.18269892285650893, + -0.4032995828307984, + 0.23184804258775724 + ], + "expectedD": [ + -0.9098950590573759, + -2.120295271086994, + -0.3320819875908143, + -1.752511444171795, + 0.9926091220949043 + ], + "expectedDU": [ + 0.8014848479209679, + 1.0751758196102288, + -0.6642388533149433, + -0.6299446789383062 + ], + "expectedDU2": [ + 0.0, + 0.0, + -1.5619770159856456 + ], + "expectedIPIV": [ + 0, + 1, + 3, + 3, + 4 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_5", + "N": 8, + "DL": [ + 0.3692688024491529, + 0.5106155057784874, + 0.08586060831830084, + -0.7519351195605275, + 0.3007250665901918, + 1.5277961398038926, + 1.253156615784252 + ], + "D": [ + -0.3012423735191056, + -1.2596002311713688, + -0.910729496675331, + 0.562035901734013, + -1.3306269529965105, + 0.6749617522940812, + 0.4224944278766332, + -1.2769895220666434 + ], + "DU": [ + -0.8815452214932817, + 0.42190899656189634, + 0.9227340111233889, + 0.14645961728986318, + -1.905236060148493, + -0.3898558642930238, + -0.353118460771689 + ], + "expectedDL": [ + -0.8157807307877998, + -0.2674635964125924, + -0.10487784882693495, + -0.8761530652340433, + -0.295009763884837, + 0.11945855650461266, + -0.35137382928217875 + ], + "expectedD": [ + 0.3692688024491529, + -1.9091028185787424, + -0.818672477350145, + -0.7519351195605275, + -1.0193732662610648, + 1.5277961398038926, + 1.253156615784252, + -0.4065176767228591 + ], + "expectedDU": [ + -1.2596002311713688, + 0.3441852295412111, + 0.9227340111233889, + -1.3306269529965105, + -1.6692784140935344, + 0.4224944278766332, + -1.2769895220666434 + ], + "expectedDU2": [ + 0.42190899656189634, + 0.0, + 0.0, + -1.905236060148493, + 0.0, + -0.353118460771689 + ], + "expectedIPIV": [ + 1, + 1, + 2, + 4, + 4, + 6, + 7, + 7 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_6", + "N": 14, + "DL": [ + -0.49636806377894405, + 0.5669727480614339, + -0.4614061871873629, + 1.1602118294138482, + -0.6007385189440726, + 0.7584549142212273, + 0.7600868879506131, + -1.0680460540877825, + 1.2234828397851083, + 0.3571537996609789, + -0.4716014722302863, + -0.3628423628267548, + -0.7516937953041664 + ], + "D": [ + -0.6694893431228686, + -1.3147496346522334, + -1.3499293940821164, + -0.8859434332592082, + 0.47619649393179797, + -0.7229207041872286, + 0.08602170948045487, + -1.3833188735011401, + -0.011575896890580792, + 1.461099181707299, + -0.6427284949946108, + -1.25671234269302, + 0.6727737957609293, + -1.046714657458578 + ], + "DU": [ + 0.8592892609047248, + 0.047410823207484076, + -0.17091361314649564, + -0.11642434587951744, + 0.4860764714214724, + -0.6573565757849108, + -1.2809211238672875, + -0.6593646745770245, + 3.2018368277182683, + 0.6007221464321085, + -0.02362217022772988, + -0.9988682163907382, + 0.6200286378720689 + ], + "expectedDL": [ + 0.7414129423832333, + -0.29048148571194105, + 0.3453232213627681, + -0.7127344962604639, + -0.371172007974272, + 0.1029929902999003, + -0.3326619591623682, + 0.30733849768316224, + -0.17637176319159886, + -0.4917095998302592, + 0.7984696871078619, + 0.293122867292405, + -0.7785015656967955 + ], + "expectedD": [ + -0.6694893431228686, + -1.951837813937919, + -1.3361574277179802, + 1.1602118294138482, + -0.6007385189440726, + 0.7584549142212273, + 0.7600868879506131, + -1.0680460540877825, + 1.2234828397851083, + -0.726351081582036, + -0.5906316543317688, + -1.2378507558224758, + 0.9655649113966329, + -0.5640213920983209 + ], + "expectedDU": [ + 0.8592892609047248, + 0.047410823207484076, + -0.17091361314649564, + 0.47619649393179797, + -0.7229207041872286, + 0.08602170948045487, + -1.3833188735011401, + -0.011575896890580792, + 1.461099181707299, + 0.10595042415447282, + -0.02362217022772988, + -0.9988682163907382, + 0.6200286378720689 + ], + "expectedDU2": [ + 0.0, + 0.0, + 0.0, + 0.4860764714214724, + -0.6573565757849108, + -1.2809211238672875, + -0.6593646745770245, + 3.2018368277182683, + 0.6007221464321085, + 0.0, + 0.0, + 0.0 + ], + "expectedIPIV": [ + 0, + 1, + 2, + 4, + 5, + 6, + 7, + 8, + 9, + 9, + 10, + 11, + 12, + 13 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_7", + "N": 9, + "DL": [ + 0.9922718042870315, + 0.18999259632292, + 0.299958951218234, + 0.15221946889570298, + 1.2867112924746282, + 1.0380818842731152, + 2.1163064618504692, + -0.34621108527418076 + ], + "D": [ + -1.7338346842864931, + -0.3916739262545783, + -1.49416683265666, + 0.2714488563748921, + -1.1396040246892183, + -0.18392432523260652, + -1.2578970443046857, + -0.809640337492287, + 0.3882084226380786 + ], + "DU": [ + -0.15164529473327074, + 0.6308133135943876, + 0.5777905419870988, + 1.232201058740986, + -1.3666625023679275, + 0.2900490650184045, + 0.8304105916259747, + 0.9482279179264003 + ], + "expectedDL": [ + -0.5722989701843292, + -0.3970916032690702, + -0.24118734461520253, + 0.3705398147813337, + -0.8061173609364053, + -0.8074595665133354, + -0.483717349283252, + -0.7890428078796538 + ], + "expectedD": [ + -1.7338346842864931, + -0.47846037226372823, + -1.2436761625979897, + 0.4108046229405391, + -1.5961835767684664, + -1.285614694932184, + 2.1163064618504692, + 0.4387735137014081, + 0.7501220762479535 + ], + "expectedDU": [ + -0.15164529473327074, + 0.6308133135943876, + 0.5777905419870988, + 1.232201058740986, + -1.3666625023679275, + 0.2900490650184045, + -0.809640337492287, + 0.45867429497573536 + ], + "expectedDU2": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.9482279179264003 + ], + "expectedIPIV": [ + 0, + 1, + 2, + 3, + 4, + 5, + 7, + 7, + 8 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_8", + "N": 3, + "DL": [ + 0.8424457176373391, + -1.0647088850364497 + ], + "D": [ + 0.07677606853723702, + -0.08687387917129168, + 0.17908647433281255 + ], + "DU": [ + -0.9359865146557086, + 0.8654811712296893 + ], + "expectedDL": [ + 0.0911347365531841, + 0.8716648274540396 + ], + "expectedD": [ + 0.8424457176373391, + -1.0647088850364497, + -0.2349787792804223 + ], + "expectedDU": [ + -0.08687387917129168, + 0.17908647433281255 + ], + "expectedDU2": [ + 0.8654811712296893 + ], + "expectedIPIV": [ + 1, + 2, + 2 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_9", + "N": 8, + "DL": [ + 0.8468499703599948, + 1.041315530659946, + 1.7594940851955738, + -0.1797350686367498, + -1.323251067532416, + 0.8142307805522968, + -0.76402519181952 + ], + "D": [ + 0.2929669325144109, + 0.21987952690289955, + -1.65568849332126, + 1.1496747326554713, + -2.3179637339331642, + 0.9291619537464024, + -0.03244811445538483, + 0.8614934397996259 + ], + "DU": [ + -0.36409952510818316, + 0.061108385741352425, + 0.7788378097103312, + -2.688497161792971, + 1.6893713685426668, + 1.2494621725053736, + -2.765459842398589 + ], + "expectedDL": [ + 0.34594903792683734, + -0.4227024594755526, + -0.40977914707147733, + -0.22457636954845842, + 0.515811483998396, + 0.07094401549745653, + -0.6103587312091627 + ], + "expectedD": [ + 0.8468499703599948, + 1.041315530659946, + 1.7594940851955738, + 0.8003293890542972, + -2.565377291089027, + 0.8142307805522968, + 1.2517641720401598, + 0.9812414440984948 + ], + "expectedDU": [ + 0.21987952690289955, + -1.65568849332126, + 1.1496747326554713, + -1.1016900738636113, + 1.6893713685426668, + -0.03244811445538483, + 0.1961928259167192 + ], + "expectedDU2": [ + 0.061108385741352425, + 0.7788378097103312, + -2.688497161792971, + 0.0, + 0.0, + -2.765459842398589 + ], + "expectedIPIV": [ + 1, + 2, + 3, + 3, + 4, + 6, + 6, + 7 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_10", + "N": 9, + "DL": [ + -0.6870135180043316, + -1.3384645136672804, + -0.6605771226837471, + -0.06647272257719522, + -0.7394171493310014, + -0.009612598047425073, + -0.3245712785826307, + 0.9931885123868681 + ], + "D": [ + -0.634997890463988, + -1.116160899640792, + -1.3452656945710828, + -0.6823533437947686, + 0.3654993819090677, + 0.924890203375454, + -1.252341544218044, + -0.321781409869825, + 2.3940938773442753 + ], + "DU": [ + -1.6653536714978583, + 0.550124637368625, + -0.6634973039437293, + 1.2021147186483145, + -1.137979273899211, + 0.5545846099914029, + 1.6930151053436162, + 0.7165915461375058 + ], + "expectedDL": [ + 0.9242873303403971, + 0.473453189731754, + -0.19444679098423992, + -0.36633475633327567, + -0.6101145484878887, + 0.016755726848687924, + 0.2580035269149, + -0.7637878093712726 + ], + "expectedD": [ + -0.6870135180043316, + -1.3384645136672804, + -0.6605771226837471, + 0.18145349691231913, + -0.7394171493310014, + -0.5736903050659242, + -1.2580110142823258, + 0.9931885123868681, + 2.5451712641434656 + ], + "expectedDU": [ + -1.116160899640792, + -1.3452656945710828, + -0.6823533437947686, + 0.2337473494360872, + 0.924890203375454, + 0.33836013892323663, + 1.6930151053436162, + 2.3940938773442753 + ], + "expectedDU2": [ + 0.550124637368625, + -0.6634973039437293, + 1.2021147186483145, + 0.0, + 0.5545846099914029, + 0.0, + 0.0 + ], + "expectedIPIV": [ + 1, + 2, + 3, + 3, + 5, + 5, + 6, + 8, + 8 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_11", + "N": 12, + "DL": [ + -0.6853121349796745, + -0.45588308522048393, + -0.12019448964496653, + -0.21199963932779903, + 1.1130521431578486, + 0.2975866333560362, + 0.901362145331129, + 0.0648886016939532, + 1.4720155094439267, + 2.5806832403034856, + 0.36528582860950876 + ], + "D": [ + 1.0135120763344616, + -0.5166215127582295, + 2.627570415142299, + -0.1087100235480486, + -1.0471401561050153, + 1.2424057053636663, + -0.3113906263542291, + -1.0763833898968345, + 0.24529872089896704, + -1.4332226041553515, + 0.5451360036075538, + -0.5437460014801557 + ], + "DU": [ + -0.9345773299028387, + 0.10893944776942585, + -1.3879801411635952, + -1.4724635212600639, + 0.38989679376943787, + 1.7817672861645606, + 0.785972148444422, + 1.0744769133837568, + 1.6663411891728719, + 0.657409222918212, + -0.8008163651743473 + ], + "expectedDL": [ + -0.6761755986748792, + 0.3969171184628536, + -0.04650894706185682, + 0.8172821378645391, + -0.5540212824937694, + 0.8050202943660223, + -0.8149335950398272, + -0.14887204338639834, + 0.27530844068280824, + 0.7985945106660489, + -0.5926761527018721 + ], + "expectedD": [ + 1.0135120763344616, + -1.1485598983132514, + 2.584330483446724, + -0.21199963932779903, + 1.1130521431578486, + 0.3696635171047391, + -1.106055942247758, + -0.4358682813638449, + 1.4720155094439267, + 2.5806832403034856, + -0.6163329280995296, + -0.16471327165545901 + ], + "expectedDU": [ + -0.9345773299028387, + 0.10893944776942585, + -1.3879801411635952, + -1.0471401561050153, + 1.2424057053636663, + 0.9871369969863328, + 0.785972148444422, + 1.0744769133837568, + -1.4332226041553515, + 0.5451360036075538, + 0.6395275532797718 + ], + "expectedDU2": [ + 0.0, + 0.0, + 0.0, + 0.38989679376943787, + 1.7817672861645606, + 0.0, + 0.0, + 0.0, + 0.657409222918212, + -0.8008163651743473 + ], + "expectedIPIV": [ + 0, + 1, + 2, + 4, + 5, + 5, + 6, + 7, + 9, + 10, + 10, + 11 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_12", + "N": 9, + "DL": [ + 0.379521755523352, + 0.6076799786995792, + -0.9747638019566475, + 0.5847795677157177, + 2.4000068950553746, + -1.6246699021320454, + -0.9757084805449567, + 1.4914704250312356 + ], + "D": [ + -2.2844261691397922, + 0.8198871030389407, + -1.211132151353135, + 0.7482253819673331, + -0.26790532391537825, + 1.1357720345506825, + -1.6105166604612449, + 0.8657426069919512, + -1.0102251553804702 + ], + "DU": [ + 1.2976272033432323, + -2.461224234165949, + -1.606802385960634, + -0.8837388314107152, + 0.18098297846954528, + 1.089895229915513, + -0.8713676935432425, + -0.4167701631067724 + ], + "expectedDL": [ + -0.16613439324513696, + 0.5868652695370171, + -0.2393142541336162, + -0.40958367750782915, + -0.14771987062581898, + -0.21466457648788884, + 0.1893205790141476, + -0.23530782953692997 + ], + "expectedD": [ + -2.2844261691397922, + 1.0354676111247527, + -0.9747638019566475, + -1.4277413867512816, + 2.4000068950553746, + -1.6246699021320454, + -0.9757084805449567, + 1.4914704250312356, + -0.1588107200609914 + ], + "expectedDU": [ + 1.2976272033432323, + -2.461224234165949, + 0.7482253819673331, + -0.2114912992879689, + 1.1357720345506825, + -1.6105166604612449, + 0.8657426069919512, + -1.0102251553804702 + ], + "expectedDU2": [ + 0.0, + 0.0, + -0.8837388314107152, + 0.0, + 1.089895229915513, + -0.8713676935432425, + -0.4167701631067724 + ], + "expectedIPIV": [ + 0, + 1, + 3, + 3, + 5, + 6, + 7, + 8, + 8 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_13", + "N": 16, + "DL": [ + -2.020855700903005, + 1.3608358130876543, + -0.9552373586914223, + -2.554429474046401, + 0.8719419133091422, + 0.6523251710154934, + 1.6131630809992876, + 0.10457808724109606, + 0.47077067083685853, + -0.35335663629016156, + 0.7393954360352878, + -0.7203465767942813, + 2.5095974414874402, + -0.11909425703204442, + -0.08125579112695691 + ], + "D": [ + -0.6691476336642037, + 1.258880195288771, + 1.1837194112835459, + -1.4718901963692252, + 0.7611204539398022, + -0.13309984036717812, + -0.5584936387209027, + 0.887043467318516, + 1.3205226474955105, + 2.1686420768477404, + 0.3045215606737259, + 0.8503091267647227, + -0.10730988834951033, + -1.4397037330087645, + 1.0363165746942264, + -1.4290158645841544 + ], + "DU": [ + 0.3724909253994835, + 0.16017821469039417, + -0.7573528520480051, + 0.2716078354890144, + -1.80844102431289, + 0.00963481350129905, + 2.121850004422643, + 1.2206487594136948, + 1.3615589988530883, + -0.9234097230090789, + -0.002410597133709714, + -0.24390411379997476, + 0.024749737210452306, + -0.09127516021189651, + 0.2683452766412182 + ], + "expectedDL": [ + 0.3311209372174371, + -0.03259075362543228, + 0.015137654263359387, + 0.0009402237668926477, + -0.005536067225848547, + 0.0014770081101735868, + 0.0005444202259940159, + -0.034585773802782147, + 0.0956022847265864, + 0.45346980724538705, + -0.06736754344800884, + -0.08103928295032607, + -0.010012576907154739, + 0.1041985037967447, + 0.7461742497408318 + ], + "expectedD": [ + -2.020855700903005, + 1.3608358130876543, + -0.9552373586914223, + -2.554429474046401, + 0.8719419133091422, + 0.6523251710154934, + 1.6131630809992876, + 0.10457808724109606, + 0.47077067083685853, + -0.35335663629016156, + 0.7393954360352878, + -0.7203465767942813, + 2.5095974414874402, + -0.11909425703204442, + -0.1088965361042403, + -1.40815195481653 + ], + "expectedDU": [ + 1.258880195288771, + 1.1837194112835459, + -1.4718901963692252, + 0.7611204539398022, + -0.13309984036717812, + -0.5584936387209027, + 0.887043467318516, + 1.3205226474955105, + 2.1686420768477404, + 0.3045215606737259, + 0.8503091267647227, + -0.10730988834951033, + -1.4397037330087645, + 1.0363165746942264, + -0.02796117632693848 + ], + "expectedDU2": [ + 0.16017821469039417, + -0.7573528520480051, + 0.2716078354890144, + -1.80844102431289, + 0.00963481350129905, + 2.121850004422643, + 1.2206487594136948, + 1.3615589988530883, + -0.9234097230090789, + -0.002410597133709714, + -0.24390411379997476, + 0.024749737210452306, + -0.09127516021189651, + 0.2683452766412182 + ], + "expectedIPIV": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 14, + 15 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_14", + "N": 11, + "DL": [ + 1.2470027212467947, + -0.6172309143920597, + 1.6082365612584417, + 0.823151728553684, + -1.8368210850304876, + -0.08908316790757671, + -0.3307003625362658, + 1.313837122889751, + -0.886067438966298, + -1.3756115687313037 + ], + "D": [ + 0.67330116620542, + -0.051866848481349793, + -0.10739499875744031, + 0.4308095727546014, + -0.6402520810475516, + 1.4453358350334822, + -1.6888638899120971, + -0.5322138012613685, + -2.0242662587239937, + -0.18938458629111515, + 0.27485234501405187 + ], + "DU": [ + 0.16493043901927043, + 0.09356059030189358, + 1.858273821885605, + 1.1352365821040153, + -0.012494854968642149, + -0.5738013037304794, + 0.5681735609616453, + -0.21808363864342845, + 1.5188598209721227, + -0.4489790284037757 + ], + "expectedDL": [ + 0.5399356029730482, + -0.31258187597163845, + -0.0522848602912884, + 0.7330210393869825, + -0.2878200475378625, + -0.20953073098214972, + 0.19188074427005963, + -0.48806306036084474, + 0.734683529247033, + 0.5335845104678283 + ], + "expectedD": [ + 1.2470027212467947, + -0.6172309143920597, + 1.6082365612584417, + 0.823151728553684, + -1.8368210850304876, + 0.4251556203236167, + -1.723468208309775, + 1.313837122889751, + -1.2060532238614583, + -1.3756115687313037, + -0.5956359823690331 + ], + "expectedDU": [ + -0.051866848481349793, + -0.10739499875744031, + 0.4308095727546014, + -0.6402520810475516, + 1.4453358350334822, + -0.16515151851699408, + 0.5681735609616453, + -2.0242662587239937, + 0.741299372482779, + 0.27485234501405187 + ], + "expectedDU2": [ + 0.09356059030189358, + 1.858273821885605, + 1.1352365821040153, + -0.012494854968642149, + -0.5738013037304794, + 0.0, + 0.0, + 1.5188598209721227, + 0.0 + ], + "expectedIPIV": [ + 1, + 2, + 3, + 4, + 5, + 5, + 6, + 8, + 8, + 10, + 10 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_15", + "N": 17, + "DL": [ + -1.350847297372821, + -1.6809176118565345, + 0.17253053824075038, + -0.9234558676952125, + -0.4461722671446689, + -0.8759407952701769, + -0.5766495547982357, + -0.6316319636100818, + -2.861386100836924, + 0.15147230758067995, + 1.6056899569562038, + -1.4495084330538144, + -1.4800841591440745, + 0.993139671694932, + 0.7314122723829626, + -1.1701119304961187 + ], + "D": [ + -1.521807404057214, + -2.045715179339704, + 1.6568690202583458, + -0.42621395380380267, + -1.2001083630807372, + -1.0609337505097367, + -0.6662666286412956, + -0.40132813651361277, + -0.48747545995944147, + 0.3727195049206647, + -1.170873280120736, + 1.2505931165869022, + 1.4160809868582984, + 1.385865364452048, + -0.22298626619456988, + 0.6130461595573198, + 1.0753918749524638 + ], + "DU": [ + -0.20586933384723918, + 0.05859902013724288, + 0.2777939159346632, + -0.41033635021164727, + 0.08554494393422676, + 1.1460743644084772, + 0.5924450786530543, + 0.9583185212912964, + 0.8384780724252484, + -0.7309041622873452, + -3.2960069230920794, + -0.6108229390111481, + 0.904029969961999, + -1.382707535283, + 0.002939909719626045, + -0.6836743259561546 + ], + "expectedDL": [ + 0.8876598272366103, + 0.9022768410944724, + 0.10756291565041744, + 0.49389937657769734, + -0.40880268804441106, + 0.5433736687387651, + -0.6942984030681981, + 0.9892406637888321, + -0.5034444909273151, + -0.23600690859899773, + -0.7832873711809744, + 0.6257501739604339, + -0.8627858356815037, + 0.45854507332353356, + 0.5619914752285617, + 0.2919266071651505 + ], + "expectedD": [ + -1.521807404057214, + -1.8629732420235476, + 1.603996481477683, + -0.9234558676952125, + -0.4461722671446689, + -0.8759407952701769, + 0.8305500232320047, + -0.6316319636100818, + -2.861386100836924, + -0.6418130235248682, + 1.6056899569562038, + -2.316433128383703, + 1.7154710913571902, + 2.165849617566836, + 0.7314122723829626, + -1.1701119304961187, + 0.07028364159214939 + ], + "expectedDU": [ + -0.20586933384723918, + 0.05859902013724288, + 0.2777939159346632, + -1.2001083630807372, + -1.0609337505097367, + -0.6662666286412956, + -0.3219190559139364, + -0.48747545995944147, + 0.3727195049206647, + -0.36796967389940827, + 1.2505931165869022, + -0.4784498941550789, + 0.904029969961999, + -1.382707535283, + 0.6130461595573198, + 1.0753918749524638 + ], + "expectedDU2": [ + 0.0, + 0.0, + 0.0, + 0.08554494393422676, + 1.1460743644084772, + 0.5924450786530543, + 0.0, + 0.8384780724252484, + -0.7309041622873452, + 0.0, + -0.6108229390111481, + 0.0, + 0.0, + 0.0, + -0.6836743259561546 + ], + "expectedIPIV": [ + 0, + 1, + 2, + 4, + 5, + 6, + 6, + 8, + 9, + 9, + 11, + 11, + 12, + 13, + 15, + 16, + 16 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_16", + "N": 4, + "DL": [ + 0.2796466180573507, + 0.6353223984221223, + -1.4787805338374966 + ], + "D": [ + -0.6890780176616801, + 0.8403489725338269, + -1.6822541792242836, + -0.737162137282068 + ], + "DU": [ + -0.6201690256956169, + 1.6158443394313422, + -1.3032394719903515 + ], + "expectedDL": [ + -0.40582722259274, + 0.926565001894684, + -0.4658218825480052 + ], + "expectedD": [ + -0.6890780176616801, + 0.6353223984221223, + 3.174562186191631, + -0.1746654054658836 + ], + "expectedDU": [ + -0.6201690256956169, + -1.6822541792242836, + 1.207536083833967 + ], + "expectedDU2": [ + 0.0, + -1.3032394719903515 + ], + "expectedIPIV": [ + 0, + 2, + 2, + 3 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_17", + "N": 16, + "DL": [ + 0.10588431408256124, + 0.39814087109333096, + -1.0254853796468548, + -0.6155125587447241, + -0.8072934964930651, + -0.10198461357286077, + -1.3057133691446154, + -0.17427408416228138, + 0.06824686957472816, + -1.0161860908285998, + 0.1010926740127516, + 1.0570396300221219, + -0.8844915662371013, + -0.8993695297291039, + 0.3434210721214046 + ], + "D": [ + -0.2674222109317032, + 0.727107461170906, + 0.4619901151541268, + 0.7237192913622036, + 1.359813942944144, + -1.0663350423251041, + -0.5563694419467872, + -0.5158322288040896, + -0.015269265330031014, + 0.17178110631519547, + -0.875825013961301, + -1.389089529160338, + -1.3858403675503166, + 0.3133876100782952, + -0.5891153917224609, + -0.7293223796825972 + ], + "DU": [ + 0.6814987776570226, + 0.5264759497263886, + 0.39543781138525996, + 0.0040586982015130965, + 0.4299296223111373, + 0.19834641278263537, + 0.3255266759730389, + -0.20867013433687923, + -0.16893820867972215, + -1.0485231462393485, + -1.314977331447353, + -0.6614109245646879, + -0.17934872149960399, + -0.5972985004297512, + 0.46988418914750096 + ], + "expectedDL": [ + -0.39594435224231606, + 0.3993616985420615, + -0.24547964371421976, + -0.931087687872256, + -0.6371178286079311, + 0.12570589589674128, + 0.4451993593696217, + -0.3139084614082872, + 0.2035664231696645, + 0.20065918624625947, + 0.25975384376347327, + -0.7251775288018218, + 0.47413600298991815, + -0.4430028846446212, + -0.4001278661927246 + ], + "expectedD": [ + -0.2674222109317032, + 0.996943053244246, + -1.0254853796468548, + -0.6155125587447241, + 1.26710234786077, + -0.8112953878999765, + -1.3057133691446154, + 0.5551748537788237, + 0.06824686957472816, + -1.0161860908285998, + 0.38918644108614076, + -1.4576287709419524, + -1.8654807073486652, + -0.8993695297291039, + -0.8582783183513474, + -0.6460317425528709 + ], + "expectedDU": [ + 0.6814987776570226, + 0.5264759497263886, + 0.7237192913622036, + 1.359813942944144, + 0.40030217798546913, + 0.19834641278263537, + -0.5158322288040896, + 0.09289981012635153, + 0.17178110631519547, + -0.875825013961301, + 0.26386228126050365, + -0.6614109245646879, + -0.17934872149960399, + -0.5891153917224609, + 0.20816005124124173 + ], + "expectedDU2": [ + 0.0, + 0.0, + 0.0040586982015130965, + 0.4299296223111373, + 0.0, + 0.0, + -0.20867013433687923, + 0.0, + -1.0485231462393485, + -1.314977331447353, + 0.0, + 0.0, + 0.0, + 0.46988418914750096 + ], + "expectedIPIV": [ + 0, + 1, + 3, + 4, + 4, + 5, + 7, + 7, + 9, + 10, + 10, + 11, + 12, + 14, + 14, + 15 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_18", + "N": 11, + "DL": [ + 1.0520940738880449, + 0.47419561824540357, + -1.9009572058595345, + -1.2791406156980252, + 1.5276136031232166, + -0.25663985799573574, + -1.065668634798521, + -0.4176980959224534, + -0.6952906348523403, + 2.366100008973764 + ], + "D": [ + 0.5912746851042144, + -0.04835238551676167, + -0.8221494796363381, + 1.0305413426604901, + -0.2241491933956514, + 0.8323262095923889, + 1.9699676359291496, + -1.0124962843250753, + -0.9234228699256434, + 0.3986677718821225, + 0.3391869884509942 + ], + "DU": [ + -0.15348369172356896, + 0.8411559063643053, + -0.9529336233980069, + -0.3775626215385897, + 1.1240828582712896, + -1.0778827788283922, + 0.5407606229619938, + -0.6663191997762641, + -0.15141589137282294, + -0.009774775330719849 + ], + "expectedDL": [ + 0.5619979237399763, + -0.26636634037792134, + 0.3638802698559085, + 0.49159810581842955, + 0.16206906445505628, + 0.373299044360857, + -0.5594779194311877, + 0.5883464092222424, + 0.764279474948334, + -0.19276847344400277 + ], + "expectedD": [ + 1.0520940738880449, + 0.47419561824540357, + -1.9009572058595345, + -1.2791406156980252, + 1.5276136031232166, + -0.6874913340191937, + 1.904755483258337, + -0.709952656079986, + -0.6952906348523403, + 2.366100008973764, + 0.07285521813326724 + ], + "expectedDU": [ + -0.04835238551676167, + -0.8221494796363381, + 1.0305413426604901, + -0.2241491933956514, + 0.8323262095923889, + 0.17469145355693388, + 0.5407606229619938, + -0.6663191997762641, + 0.3986677718821225, + 0.3391869884509942 + ], + "expectedDU2": [ + 0.8411559063643053, + -0.9529336233980069, + -0.3775626215385897, + 1.1240828582712896, + -1.0778827788283922, + 0.0, + 0.0, + 0.0, + -0.009774775330719849 + ], + "expectedIPIV": [ + 1, + 2, + 3, + 4, + 5, + 5, + 6, + 7, + 9, + 10, + 10 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_19", + "N": 12, + "DL": [ + -2.3103185320346, + 0.2532904427062057, + -0.45082938649651516, + -0.8821917378615078, + -1.6881654508713213, + -1.2239735527499929, + -0.9663079753030712, + 0.7661720737345041, + -0.22985403999203893, + -1.41116176154678, + -1.1496720490589059 + ], + "D": [ + 0.4374271268797016, + -2.269245016494479, + -0.200327242118726, + -0.5226758707701183, + -0.31753946221942236, + 0.5204537093591161, + -0.871006094775897, + 0.9090058588142207, + -1.4362221691163581, + -0.025697776268902742, + -0.8830115422597153, + 0.4969474926918511 + ], + "DU": [ + -0.04626279276954776, + 0.7892280622319992, + 0.28341782476865035, + 0.46931424459645465, + 1.1998121300326745, + 0.8074898047932748, + -3.8789663943656554, + 0.0769312596948778, + -1.710120383743926, + 0.641608639259366, + -0.1293343263708504 + ], + "expectedDL": [ + -0.18933628450553006, + -0.5322198163033206, + 0.26794592354367397, + -0.48001661713887217, + 0.16477949896420796, + -0.4004740603233702, + 0.49867446519078323, + -0.38180252515062674, + 0.1584250261687019, + -0.17377744845393475, + -0.4246090412389306 + ], + "expectedD": [ + -2.3103185320346, + -0.47591321282530263, + -0.45082938649651516, + -0.8821917378615078, + -1.6881654508713213, + -1.2239735527499929, + -0.9663079753030712, + -2.0067234323089873, + -1.4508695093872004, + -1.41116176154678, + -1.1496720490589059, + 0.18853300918374255 + ], + "expectedDU": [ + -2.269245016494479, + 0.14942950893050597, + -0.5226758707701183, + -0.31753946221942236, + 0.5204537093591161, + -0.871006094775897, + 0.9090058588142207, + -0.03836365478479644, + -1.710120383743926, + -0.8830115422597153, + 0.4969474926918511 + ], + "expectedDU2": [ + 0.7892280622319992, + 0.0, + 0.46931424459645465, + 1.1998121300326745, + 0.8074898047932748, + -3.8789663943656554, + 0.0769312596948778, + 0.0, + 0.0, + -0.1293343263708504 + ], + "expectedIPIV": [ + 1, + 1, + 3, + 4, + 5, + 6, + 7, + 7, + 8, + 10, + 11, + 11 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_20", + "N": 5, + "DL": [ + 0.23263407153756466, + 2.118800814677653, + -0.05323463575313748, + 0.1975767593051604 + ], + "D": [ + 1.1268767942225155, + -0.39668024239538235, + -0.6274002115708005, + 0.21743865576504492, + -1.0426653241869848 + ], + "DU": [ + -0.0589455404451624, + 2.1642446671005775, + -0.01569908930077035, + 0.6514885031598362 + ], + "expectedDL": [ + 0.2064414430488558, + -0.18147597324908832, + -0.025963218679313914, + 0.9089643888975275 + ], + "expectedD": [ + 1.1268767942225155, + 2.118800814677653, + 2.0503866030890827, + 0.21736468636004427, + -1.6348451733354303 + ], + "expectedDU": [ + -0.0589455404451624, + -0.6274002115708005, + -0.0028490075099816487, + 0.6514885031598362 + ], + "expectedDU2": [ + 0.0, + -0.01569908930077035, + 0.0 + ], + "expectedIPIV": [ + 0, + 2, + 2, + 3, + 4 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_21", + "N": 14, + "DL": [ + 2.425112490333516, + 0.3821410283515966, + -0.3964064686732501, + 0.8077893268188734, + 0.9598948798899788, + -1.3528736306942368, + -1.4422289452816146, + 0.8580942098408958, + -0.5852498587182695, + 1.854821579602788, + 1.2676422991805143, + -1.7496685605212545, + -1.1314025636505236 + ], + "D": [ + 0.4512247646205624, + -0.7137384235276839, + -0.9574862353850578, + 0.969778054142865, + -0.14597600366347746, + 0.5735793422592976, + 0.20734810911219756, + 0.1456496411740897, + 2.2953542025617297, + 2.9802439542434866, + 0.05999038061340811, + 0.6968213712724239, + -0.1309227421781887, + 0.31015977369134745 + ], + "DU": [ + 0.03783183245681892, + 0.10457471225895079, + -0.0853402210921899, + 0.3585757040453931, + -0.012808952420024078, + -1.9177738753380456, + 0.06620362377357362, + 0.02086711727280821, + -0.710733888453587, + 0.37567845885072704, + 0.563345104487754, + -0.41805882653481885, + -0.44020047087117303 + ], + "expectedDL": [ + 0.18606343681752563, + 0.4465169763716359, + -0.9714027526474588, + 0.8023380901955889, + -0.45179421030717837, + -0.18207973603426628, + 0.5745864741467411, + -0.08348031558800069, + -0.30692349122492846, + 0.4611627335144461, + 0.06913560419754855, + 0.17601558476108659, + -0.045913978149396836 + ], + "expectedD": [ + 2.425112490333516, + 0.3821410283515966, + 0.40807632837449226, + 1.0067941889957581, + 0.9598948798899788, + -1.3528736306942368, + -1.4422289452816146, + 0.8580942098408958, + -0.5852498587182695, + 1.854821579602788, + 1.2676422991805143, + -1.7496685605212545, + -1.1314025636505236, + 0.09172281236458157 + ], + "expectedDU": [ + -0.7137384235276839, + -0.9574862353850578, + 0.03810585748497154, + 0.3585757040453931, + 0.5735793422592976, + 0.20734810911219756, + 0.1456496411740897, + 2.2953542025617297, + 2.9802439542434866, + 0.05999038061340811, + 0.6968213712724239, + -0.1309227421781887, + 0.31015977369134745 + ], + "expectedDU2": [ + 0.10457471225895079, + -0.0853402210921899, + 0.0, + 0.0, + -1.9177738753380456, + 0.06620362377357362, + 0.02086711727280821, + -0.710733888453587, + 0.37567845885072704, + 0.563345104487754, + -0.41805882653481885, + -0.44020047087117303 + ], + "expectedIPIV": [ + 1, + 2, + 2, + 3, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 13 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_22", + "N": 4, + "DL": [ + -0.7826401721361638, + -0.4851611094637993, + 0.11506574919299231 + ], + "D": [ + -0.5336782352399937, + -0.22647907122873653, + 1.7385552378210622, + -0.5198808445512328 + ], + "DU": [ + 0.8994171936766123, + 0.8355716546191523, + -0.5561239193956226 + ], + "expectedDL": [ + 0.6818947636988206, + -0.46036926406349893, + 0.0779446358025742 + ], + "expectedD": [ + -0.7826401721361638, + 1.05385208643486, + 1.4762497509699333, + -0.4765339681928409 + ], + "expectedDU": [ + -0.22647907122873653, + -0.5697719359799595, + -0.5561239193956226 + ], + "expectedDU2": [ + 0.8355716546191523, + 0.0 + ], + "expectedIPIV": [ + 1, + 1, + 2, + 3 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_23", + "N": 9, + "DL": [ + -0.5849845044499826, + 0.866490481778113, + 0.4993202484629263, + 0.0495048308847662, + 1.433655894228659, + 0.4814532323629985, + 1.777063266941895, + 0.15490262993130804 + ], + "D": [ + -0.26271569856602983, + -0.4807755011020979, + 0.36135858345740096, + -0.9881125635068918, + 0.46232462616189096, + 0.8922475063635541, + -0.6101609988909048, + 1.1231758114164199, + -1.6960448838207682 + ], + "DU": [ + 1.4533708713332327, + -0.2552742034636507, + 0.6977116524528374, + 0.7764058354311485, + 1.7210017227820498, + 1.7393067696262032, + 0.5035172448274194, + -2.038356169972756 + ], + "expectedDL": [ + 0.4490985599918443, + 0.5190783633175928, + 0.604521326149634, + 0.03822628807075457, + 0.33499411185105843, + 0.3385499312485346, + -0.2323509472198727, + 0.20262265422554462 + ], + "expectedD": [ + -0.5849845044499826, + 1.6692864565575423, + 0.4993202484629263, + 1.2950467697291381, + 1.433655894228659, + 1.4221040618364693, + 1.777063266941895, + 0.7644882085044737, + -1.6000799607239122 + ], + "expectedDU": [ + -0.4807755011020979, + 0.1146432771785906, + -0.9881125635068918, + -0.4693538852651524, + 0.8922475063635541, + -0.5826575265274634, + 1.1231758114164199, + -0.47361398686464173 + ], + "expectedDU2": [ + -0.2552742034636507, + 0.0, + 0.7764058354311485, + 0.0, + 1.7393067696262032, + 0.0, + -2.038356169972756 + ], + "expectedIPIV": [ + 1, + 1, + 3, + 3, + 5, + 5, + 7, + 7, + 8 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_24", + "N": 7, + "DL": [ + 0.8385370511303424, + -1.118238015566365, + -0.8594229710773853, + 0.10140825090014674, + -1.3132027696549387, + -0.49559207841841507 + ], + "D": [ + -0.30469047160924206, + -0.4458103128620398, + -0.5705434988691054, + 2.0493865837281877, + 0.14299683174014105, + -1.4574333157943087, + -1.3513768338702965 + ], + "DU": [ + 1.7466174968143218, + 1.012102560592805, + -1.7632112109592375, + 0.006534281057459557, + -0.07365989248683445, + 1.6488627604609143 + ], + "expectedDL": [ + -0.3633595810686258, + -0.7056785450493248, + 0.36189998409557506, + -0.040484207448681385, + -0.10881875957106593, + 0.4686434432332255 + ], + "expectedD": [ + 0.8385370511303424, + 1.584628048296698, + -0.8594229710773853, + -2.5048841830161535, + -1.3132027696549387, + -0.49559207841841507, + 0.8127410928268707 + ], + "expectedDU": [ + -0.4458103128620398, + 0.36775716241548506, + 2.0493865837281877, + -0.002364756210770631, + -1.4574333157943087, + -1.3513768338702965 + ], + "expectedDU2": [ + 1.012102560592805, + 0.0, + 0.006534281057459557, + 0.0, + 1.6488627604609143 + ], + "expectedIPIV": [ + 1, + 1, + 3, + 3, + 5, + 6, + 6 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_25", + "N": 4, + "DL": [ + -0.004322380307016612, + 0.7759158686313499, + 1.7243474437917465 + ], + "D": [ + 1.390533457037963, + -0.7486165504491016, + -0.36247479603601684, + 0.8304219320866854 + ], + "DU": [ + 1.2853307335439534, + 0.043808230420679474, + 2.3586304113599312 + ], + "expectedDL": [ + -0.0031084331593314593, + -0.959667427719573, + -0.17632584767011847 + ], + "expectedD": [ + 1.390533457037963, + 0.7759158686313499, + 1.7243474437917465, + 2.409925630909986 + ], + "expectedDU": [ + 1.2853307335439534, + -0.36247479603601684, + 0.8304219320866854 + ], + "expectedDU2": [ + 0.0, + 2.3586304113599312 + ], + "expectedIPIV": [ + 0, + 2, + 3, + 3 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_26", + "N": 16, + "DL": [ + 0.7912187441120329, + -0.6374216143253149, + -0.1198347458231469, + -0.2278748173679039, + -0.32086101165332354, + -0.15832214179797136, + 1.0334933850181844, + 0.1565588098874084, + 0.03318544089494769, + 0.5718749636720428, + -0.2183820464338738, + 0.2727731315763815, + -0.341943026563187, + -1.5283007639288726, + 0.23530389793954426 + ], + "D": [ + -0.1505026970756032, + -0.886830473322961, + 0.5863640195207854, + -0.3566461399538086, + -0.7483069087539151, + -0.795557556275413, + 0.5638709196820714, + 0.28702902428844274, + -1.3756590918514022, + -1.763630753036693, + 1.1383307891820855, + -0.34421705795695434, + -0.3076112409425465, + -0.8205137315343145, + 0.7100870315369716, + 0.17466212129343997 + ], + "DU": [ + -0.7664665051945326, + 0.6885652942055751, + -1.695418244827931, + -0.6036003633937634, + 1.7604025092448041, + 0.6440727350586753, + 1.613586306483267, + 0.07924415635958458, + 0.32506368753819087, + 0.41614896067690205, + 1.697504114318768, + 0.4306763805308782, + 0.7443403561049495, + 0.2271446650348713, + 1.634926776771863 + ], + "expectedDL": [ + -0.19021629378170132, + 0.6816205409967223, + -0.24107357310360597, + 0.2977328711419222, + 0.5643047801698384, + 0.08849948786197859, + 0.49044417683872865, + 0.10629906210745532, + -0.024195966704829548, + -0.3257126058240799, + -0.17143119818698593, + -0.19507747483937696, + -0.9225039597925515, + 0.4492325388727485, + -0.39034429844717 + ], + "expectedD": [ + 0.7912187441120329, + -0.9351561110426982, + 0.49708785695745106, + -0.7653666741395222, + -0.5685952395383824, + -1.788961107265234, + 1.0334933850181844, + 1.4728145929372982, + -1.3715277963382149, + -1.7557655228760698, + 1.2738757515751418, + 0.2727731315763815, + 0.3706683564155991, + -1.5283007639288726, + 0.23530389793954426, + -0.666283943598681 + ], + "expectedDU": [ + -0.886830473322961, + 0.13097633829049127, + -1.695418244827931, + -0.6036003633937634, + 1.7604025092448041, + 0.6440727350586753, + 0.28702902428844274, + -0.038864835035055965, + 0.32506368753819087, + 0.41614896067690205, + 1.697504114318768, + -0.3076112409425465, + 0.14520403708999619, + 0.7100870315369716, + 0.17466212129343997 + ], + "expectedDU2": [ + 0.6885652942055751, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.07924415635958458, + 0.0, + 0.0, + 0.0, + 0.0, + 0.7443403561049495, + 0.0, + 1.634926776771863 + ], + "expectedIPIV": [ + 1, + 1, + 2, + 3, + 4, + 5, + 7, + 7, + 8, + 9, + 10, + 12, + 12, + 14, + 15, + 15 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_27", + "N": 6, + "DL": [ + -0.6390924114056249, + -0.09074449714347314, + 1.46093071163975, + 0.8590895836340569, + -1.8203189524672159 + ], + "D": [ + -0.9685250228760502, + 1.3470178462632403, + -0.486163111098376, + 0.7062196919858659, + 0.06161975076744702, + -0.5811729240366608 + ], + "DU": [ + 0.13060896519868379, + 0.27714019314717137, + -0.5779501435652685, + 0.4862159583416416, + -0.9057261100859957 + ], + "expectedDL": [ + 0.659861538226271, + -0.07197180292252368, + -0.31912316444631067, + -0.41041014508985946, + -0.09913215804217647 + ], + "expectedD": [ + -0.9685250228760502, + 1.2608340135810954, + 1.46093071163975, + 0.8590895836340569, + -1.8203189524672159, + -0.4293321104075036 + ], + "expectedDU": [ + 0.13060896519868379, + 0.27714019314717137, + 0.7062196919858659, + 0.06161975076744702, + -0.5811729240366608 + ], + "expectedDU2": [ + 0.0, + 0.0, + 0.4862159583416416, + -0.9057261100859957 + ], + "expectedIPIV": [ + 0, + 1, + 3, + 4, + 5, + 5 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_28", + "N": 3, + "DL": [ + -0.7609613249621455, + 0.2542894046305837 + ], + "D": [ + -0.2868641596842977, + -0.6011919450026476, + -1.130380817120446 + ], + "DU": [ + 0.7440401618127127, + 2.439997783688658 + ], + "expectedDL": [ + 0.37697600426482636, + 0.2619716987518499 + ], + "expectedD": [ + -0.7609613249621455, + 0.97067509903601, + -0.8894138480855067 + ], + "expectedDU": [ + -0.6011919450026476, + -0.9198206149099823 + ], + "expectedDU2": [ + 2.439997783688658 + ], + "expectedIPIV": [ + 1, + 1, + 2 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_29", + "N": 12, + "DL": [ + -0.042167848790594986, + -1.5316772790979796, + 2.1899216088612374, + -0.7524727186565017, + -0.7152508836345924, + -0.6161835729102386, + 0.1542449438604875, + 0.02856582235094034, + -0.37748247706930216, + 1.0956970096763083, + 0.4712579521022539 + ], + "D": [ + -1.4571343742737577, + 0.16110606213248235, + 1.5720323513043304, + 0.44585361421355285, + -1.737212356417584, + -0.3663733167939199, + 1.358575325834523, + -0.4648865987972554, + -0.3880112113388677, + -1.1863482161207621, + 0.1825583539103583, + -1.033399832699419 + ], + "DU": [ + 1.8376072968581012, + 0.0497114728551482, + -0.65532094470548, + -1.3397336605154901, + 1.3269087390238723, + 0.2717086103410916, + -0.44937799365356473, + 0.36209737351777843, + 0.5585314443278807, + -0.956860725001979, + 1.4533738569523138 + ], + "expectedDL": [ + 0.028938888228212743, + -0.07046376637833093, + 0.0732824373928554, + 0.10478734918299587, + -0.39177417645796175, + 0.4585952405361142, + -0.2985842008276153, + -0.07082079650475605, + 0.95995763762971, + 0.6455242376438045, + -0.870829227268656 + ], + "expectedD": [ + -1.4571343742737577, + -1.5316772790979796, + 2.1899216088612374, + -0.7524727186565017, + -0.7152508836345924, + -0.6161835729102386, + -0.5165877612845944, + -0.40335358765729173, + -0.37748247706930216, + 1.697375475281388, + 0.4712579521022539, + 0.5534590791831204 + ], + "expectedDU": [ + 1.8376072968581012, + 1.5720323513043304, + 0.44585361421355285, + -1.737212356417584, + -0.3663733167939199, + 1.358575325834523, + 0.20608260909119294, + 0.36209737351777843, + -1.1863482161207621, + 0.9185457611135514, + -1.033399832699419 + ], + "expectedDU2": [ + 0.0, + -0.65532094470548, + -1.3397336605154901, + 1.3269087390238723, + 0.2717086103410916, + -0.44937799365356473, + 0.0, + 0.0, + -0.956860725001979, + 0.0 + ], + "expectedIPIV": [ + 0, + 2, + 3, + 4, + 5, + 6, + 6, + 7, + 9, + 9, + 11, + 11 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_30", + "N": 4, + "DL": [ + -0.18443519084152146, + 0.10622390859946738, + -0.05571717582707295 + ], + "D": [ + 0.5363197548056013, + -0.375938037579179, + -0.2848587338657349, + 0.5282841158815873 + ], + "DU": [ + 0.1211594868318648, + -1.0485213027616689, + 0.05113592900328793 + ], + "expectedDL": [ + -0.3438903549401668, + -0.317776430128397, + 0.09014935212812082 + ], + "expectedD": [ + 0.5363197548056013, + -0.33427245864820054, + -0.6180540903709142, + 0.5236742450114713 + ], + "expectedDU": [ + 0.1211594868318648, + -1.0485213027616689, + 0.05113592900328793 + ], + "expectedDU2": [ + 0.0, + 0.0 + ], + "expectedIPIV": [ + 0, + 1, + 2, + 3 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_31", + "N": 17, + "DL": [ + 0.057254991297114734, + 0.49922994226836875, + 0.6603798340661784, + -0.6569211426358307, + -1.132196545725384, + -0.12730311380552478, + 1.0476772589897052, + -1.6999795066566505, + -1.7015373303591388, + -1.2391545085004236, + -0.8158094644365285, + 0.7147015616886155, + -0.6628644029389034, + -0.9332850948786109, + 0.37629129423188656, + 0.8913796583485417 + ], + "D": [ + -1.1739457182623174, + 0.4679939007608269, + 2.685031840031989, + 0.9124330750761804, + 0.5166699134930671, + 0.09926915666493911, + 0.5921298283061407, + -0.5321086091643745, + -0.3837806115035446, + 1.7644949715099008, + 0.37686633064517927, + 1.076170920030022, + -0.7103371276418018, + -0.4764247537902423, + -0.8292589801120215, + -0.28858047701361056, + -0.5513412209891991 + ], + "DU": [ + -0.03439018404682514, + 1.0613519315745457, + -0.17751661554135603, + 0.8644447982123431, + -1.4013506804486207, + -0.45578170901808096, + 1.055136766412109, + -1.812575327401057, + 0.3431971957645599, + 1.081995053147747, + 1.7724072639809798, + -0.34649923866574406, + -0.6392104242014747, + 0.12009770508326037, + 0.9267402956557036, + 0.14494209151280166 + ], + "expectedDL": [ + -0.04877141285703054, + 0.9340718643149298, + -0.4564856185003144, + -0.6648162000363852, + -0.9639375985576709, + 0.09750086280348484, + 0.6060705734679713, + -0.8103816139672149, + -0.46284016384528187, + -0.8835055125251561, + -0.9784771305344081, + 0.27400007281157807, + 0.9283894387596991, + 0.210978098224674, + 0.1686407379440609, + -0.1647507648961466 + ], + "expectedD": [ + -1.1739457182623174, + 0.49922994226836875, + -1.4466607649890806, + 0.9881244509382857, + -1.132196545725384, + -1.305661407962174, + 1.0476772589897052, + -1.6999795066566505, + -1.7015373303591388, + -1.2391545085004236, + 0.8337542482888317, + 2.608399167032686, + -0.6628644029389034, + -0.9332850948786109, + 0.37629129423188656, + 0.8913796583485417, + -0.11527702914862042 + ], + "expectedDU": [ + -0.03439018404682514, + 2.685031840031989, + 0.16581327602559107, + 0.8644447982123431, + 0.09926915666493911, + -0.4393451260574001, + -0.5321086091643745, + -0.3837806115035446, + 1.7644949715099008, + 0.37686633064517927, + 1.5659315881668252, + -0.34649923866574406, + -0.4764247537902423, + -0.8292589801120215, + -0.28858047701361056, + -0.5513412209891991 + ], + "expectedDU2": [ + 0.0, + -0.17751661554135603, + 0.0, + 0.0, + -0.45578170901808096, + 0.0, + -1.812575327401057, + 0.3431971957645599, + 1.081995053147747, + 1.7724072639809798, + 0.0, + 0.0, + 0.12009770508326037, + 0.9267402956557036, + 0.14494209151280166 + ], + "expectedIPIV": [ + 0, + 2, + 2, + 3, + 5, + 5, + 7, + 8, + 9, + 10, + 10, + 11, + 13, + 14, + 15, + 16, + 16 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_32", + "N": 14, + "DL": [ + -0.6148483382681046, + -0.6374109020803773, + 0.489896955978003, + -1.3023173487285196, + 1.1767830196168105, + 1.2915212973163777, + -1.1868303288765414, + 0.865287640010067, + 0.006598408005757717, + -0.3731047608056072, + -1.2255736176659122, + 0.7596060801434675, + -1.6502153625615104 + ], + "D": [ + -1.8032066167332512, + 0.4683739154267355, + -0.6767793910707492, + -1.0868847775264534, + 1.6654246760177729, + -0.012684673230541042, + -0.671593746440049, + 0.03173703280833279, + 1.3381656240113942, + -0.5915497981995995, + 0.5131084207931286, + 0.46376717145808743, + -0.9117385517590754, + -1.013250063252092 + ], + "DU": [ + 0.44233778891767167, + 0.6307736288611165, + -0.05477374025205644, + -2.059746671571105, + 0.2256638547629693, + 0.5539441821069396, + -0.6494558846732309, + 0.2943441638447828, + 0.1731667236829709, + 2.5192177467110732, + 1.425376768277072, + 0.42532445554023823, + -0.3879498648014451 + ], + "expectedDL": [ + 0.34097497899712914, + -0.49818381848268606, + 0.5993364195557223, + -0.47923974948987513, + 0.5789491673513983, + -0.058300502396354315, + -0.4337519161399737, + -0.0278492427873189, + 0.04000508204557033, + 0.6305185428071417, + 0.8773892211590943, + 0.7458287943508385, + 0.3838370655095923 + ], + "expectedD": [ + -1.8032066167332512, + -0.6374109020803773, + 0.489896955978003, + -1.3023173487285196, + 2.032618899860256, + 1.2915212973163777, + -1.1868303288765414, + 0.865287640010067, + 0.16493924442503033, + -0.5917427251933013, + -1.2255736176659122, + 1.0184724509123044, + -1.6502153625615104, + 0.0009730661046466471 + ], + "expectedDU": [ + 0.44233778891767167, + -0.6767793910707492, + -1.0868847775264534, + 1.6654246760177729, + 0.10814708922552498, + -0.671593746440049, + 0.03173703280833279, + 1.3381656240113942, + 0.004822562130531623, + 2.5192177467110732, + 0.46376717145808743, + -0.37317509278636546, + -1.013250063252092 + ], + "expectedDU2": [ + 0.0, + -0.05477374025205644, + -2.059746671571105, + 0.2256638547629693, + 0.0, + -0.6494558846732309, + 0.2943441638447828, + 0.1731667236829709, + 0.0, + 0.0, + 0.42532445554023823, + 0.0 + ], + "expectedIPIV": [ + 0, + 2, + 3, + 4, + 4, + 6, + 7, + 8, + 8, + 9, + 11, + 11, + 13, + 13 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_33", + "N": 5, + "DL": [ + -0.07716620105029949, + -0.7286835214482583, + 1.1969322254010828, + -0.8770271852007752 + ], + "D": [ + 1.57616086606128, + -1.770505134751132, + -2.0196577066490886, + -0.5265286228982548, + -0.47055529671805196 + ], + "DU": [ + -0.6747833238903935, + 0.6516119651745931, + 0.08833821369259193, + 0.6810968586978295 + ], + "expectedDL": [ + -0.04895832824674339, + 0.40402927383225334, + -0.5242969629960708, + 0.5475465000925794 + ], + "expectedD": [ + 1.57616086606128, + -1.8035413982175865, + -2.282928015758987, + -0.8770271852007752, + 0.9387477645158242 + ], + "expectedDU": [ + -0.6747833238903935, + 0.6516119651745931, + 0.08833821369259193, + -0.47055529671805196 + ], + "expectedDU2": [ + 0.0, + 0.0, + 0.0 + ], + "expectedIPIV": [ + 0, + 1, + 2, + 4, + 4 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_34", + "N": 9, + "DL": [ + 1.1965946801643577, + 0.4011287169008341, + 0.8846756626946768, + 1.5602619075349062, + -0.8656007481058773, + -1.3161763340322623, + 0.8875122920758173, + -0.6906319065193628 + ], + "D": [ + 1.2292381543842827, + 1.2456856265146337, + -0.03191698406793715, + -1.3509594748116476, + 0.5883164365403646, + 0.17818940443992073, + 1.4624334393712346, + 1.736851511095114, + 0.49721153171480786 + ], + "DU": [ + 0.28887605619421236, + 0.44612622904218296, + 0.744401368044041, + 1.16560123166441, + 0.05666541887074245, + -0.44951978522892644, + -1.6373576383969632, + 0.35748398691463645 + ], + "expectedDL": [ + 0.9734441417202219, + 0.4159011420345197, + -0.24580917209337316, + 0.26426533649105777, + -0.1513906185590038, + -0.009118457658913068, + -0.061653164055285134, + -0.13343173691384144 + ], + "expectedD": [ + 1.2292381543842827, + 0.964480921929136, + 0.8846756626946768, + 1.5602619075349062, + -0.8656007481058773, + -1.3161763340322623, + 0.8875122920758173, + -0.6906319065193628, + 0.08838381718268387 + ], + "expectedDU": [ + 0.28887605619421236, + 0.44612622904218296, + -1.3509594748116476, + 0.5883164365403646, + 0.17818940443992073, + 1.4624334393712346, + 1.736851511095114, + 0.49721153171480786 + ], + "expectedDU2": [ + 0.0, + 0.0, + 1.16560123166441, + 0.05666541887074245, + -0.44951978522892644, + -1.6373576383969632, + 0.35748398691463645 + ], + "expectedIPIV": [ + 0, + 1, + 3, + 4, + 5, + 6, + 7, + 8, + 8 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_35", + "N": 10, + "DL": [ + -0.07932607303498426, + -0.8446253355794008, + -0.135614297719193, + -1.6931109280486252, + 0.8603319302129314, + -1.0915324223560727, + 0.5436920701995286, + 0.5306453052114379, + -0.05762449233631976 + ], + "D": [ + -1.6018018215414196, + 0.09522098176861965, + -0.6577265175020125, + 0.01199012637370913, + -0.48823997353829107, + 0.589200645402348, + 0.6947668276606123, + -1.8371911670919023, + -0.8415594652123805, + -2.1291821948924934 + ], + "DU": [ + -0.7721380666672747, + -2.2477525366526248, + -0.4569904804586901, + -0.15926708317647867, + 1.1237468401176192, + 2.0858268495962817, + -1.5611577615725718, + 0.6007926560573964, + 1.4686896796078523 + ], + "expectedDL": [ + 0.04952302586261795, + -0.15801040957662435, + 0.05766698179115478, + -0.009541144518893808, + -0.19053744905566505, + -0.11267335394001463, + 0.8749618797973184, + 0.37067331848865503, + 0.08910443076939317 + ], + "expectedD": [ + -1.6018018215414196, + -0.8446253355794008, + -2.3516801730725247, + -1.6931109280486252, + 0.8603319302129314, + -1.0915324223560727, + 0.5436920701995286, + 1.4315713560798928, + -0.6467073728965835, + -2.2600489527708336 + ], + "expectedDU": [ + -0.7721380666672747, + -0.6577265175020125, + -0.07220925298989597, + -0.48823997353829107, + 0.589200645402348, + 0.6947668276606123, + -1.8371911670919023, + -0.5256706717124033, + 1.4686896796078523 + ], + "expectedDU2": [ + 0.0, + -0.4569904804586901, + 0.0, + 1.1237468401176192, + 2.0858268495962817, + -1.5611577615725718, + 0.6007926560573964, + 0.0 + ], + "expectedIPIV": [ + 0, + 2, + 2, + 4, + 5, + 6, + 7, + 7, + 8, + 9 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_36", + "N": 15, + "DL": [ + 2.192314353649037, + -0.9767384375358731, + 0.5061587834805721, + 0.35487925219763833, + -0.9011832602233891, + 0.5631846651745176, + -1.6097312460858302, + 0.9206141204265306, + -1.3151066841395276, + -1.611615990533143, + -0.46877883718510244, + 0.20251890257410426, + -2.2287936701478412, + 2.047590662990895 + ], + "D": [ + -0.9378543138334577, + -0.7803111288936555, + 0.03526386096915403, + -0.4856745422667309, + 0.24723417491098185, + 0.06877935092620448, + -0.101344621325634, + 1.930881827719172, + 1.3652702467133475, + 0.03190454074524702, + -0.2416919760548522, + -0.6594441947533751, + -1.658341769597495, + -1.4928180532688062, + -1.0839623708975599 + ], + "DU": [ + -1.5746246792366712, + 1.3246783922145764, + -0.4540868818960214, + -2.0450337133853207, + -0.04648875307799275, + 1.9656497772058061, + -1.8246451616704205, + -0.15439050778603186, + 1.3727965049560744, + -0.25116909910829194, + 0.04299869803114108, + 1.457590015744398, + 0.3666658386980257, + -0.1624721631644958 + ], + "expectedDL": [ + -0.42779189593519257, + 0.5118006135426965, + -0.5033336145134057, + -0.5080276349315401, + 0.3059267320025525, + -0.11990773064670932, + 0.3811175422296631, + -0.9643149480507168, + -0.9248214542651879, + -0.8075721564653496, + 0.9521607504543412, + 0.3056328896190711, + 0.5537372628740638, + 0.5827799682095879 + ], + "expectedD": [ + 2.192314353649037, + -1.9084354564854185, + 0.5061587834805721, + -0.6985432047322789, + -0.9011832602233891, + 0.5631846651745176, + -1.6097312460858302, + -0.9546819970876487, + 1.4220114359094738, + -1.611615990533143, + -0.46877883718510244, + 0.6626214306533433, + -2.2287936701478412, + 2.047590662990895, + 0.7216784469760056 + ], + "expectedDU": [ + -0.7803111288936555, + 0.5666866809098563, + -0.4856745422667309, + -1.0293342107600056, + 0.06877935092620448, + -0.101344621325634, + 1.930881827719172, + 0.058840930871002124, + 1.3727965049560744, + -0.2416919760548522, + -0.6594441947533751, + -1.387860003245941, + -1.4928180532688062, + -1.0839623708975599 + ], + "expectedDU2": [ + 1.3246783922145764, + 0.0, + -2.0450337133853207, + 0.0, + 1.9656497772058061, + -1.8246451616704205, + -0.15439050778603186, + 0.0, + 0.0, + 0.04299869803114108, + 1.457590015744398, + 0.0, + -0.1624721631644958 + ], + "expectedIPIV": [ + 1, + 1, + 3, + 3, + 5, + 6, + 7, + 7, + 8, + 10, + 11, + 11, + 13, + 14, + 14 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_37", + "N": 13, + "DL": [ + 0.36034044706488605, + -0.24222917010813816, + -0.5462356435557892, + -1.04765248753937, + -0.6453522602038066, + 0.5748143101595787, + -1.9457753609511672, + 0.6409186009879806, + 0.1615649937233083, + -2.3472639166725853, + 0.5434241900372851, + -0.5207650381352549 + ], + "D": [ + -0.006155518902482001, + 1.9964923192933959, + 0.5450939815296667, + 0.6538222289012899, + -0.3924281216602171, + 0.3251773785581163, + 0.355807796329008, + 0.20996801952418265, + 0.2028265864955911, + 0.007898913118308787, + 0.8621437471023061, + 0.40412822905901175, + 1.1332470999240247 + ], + "DU": [ + -0.13301128688392586, + 0.27141589716609466, + 1.1696990071013587, + -0.6887908220460529, + 2.678702431681519, + -1.2722941917644006, + -0.29346866973012226, + -0.5965876613667486, + -0.46847987477004244, + -1.3135824245671763, + -0.6089715290248762, + -1.0802679910744706 + ], + "expectedDL": [ + -0.017082508923494742, + 0.4083165911840969, + 0.3989751575147511, + 0.7048771866976896, + -0.8544543671750803, + -0.3569594550293539, + 0.016573862248954917, + -0.4633172610447778, + 0.6428423499894215, + 0.09463467943531516, + 0.7123719487631166, + -0.6971941882032753 + ], + "expectedD": [ + 0.36034044706488605, + -0.24222917010813816, + -0.5462356435557892, + -1.04765248753937, + -0.6453522602038066, + -1.6103070028284023, + -1.9457753609511672, + 0.6409186009879806, + 0.1615649937233083, + -2.3472639166725853, + 0.7628377155793774, + -0.5207650381352549, + -0.29017469920922423 + ], + "expectedDU": [ + 1.9964923192933959, + 0.5450939815296667, + 0.6538222289012899, + -0.3924281216602171, + 0.3251773785581163, + -1.0871173284845812, + 0.20996801952418265, + 0.2028265864955911, + 0.007898913118308787, + 0.8621437471023061, + 0.057629825434502874, + 1.1332470999240247 + ], + "expectedDU2": [ + 0.27141589716609466, + 1.1696990071013587, + -0.6887908220460529, + 2.678702431681519, + -1.2722941917644006, + 0.0, + -0.5965876613667486, + -0.46847987477004244, + -1.3135824245671763, + -0.6089715290248762, + 0.0 + ], + "expectedIPIV": [ + 1, + 2, + 3, + 4, + 5, + 5, + 7, + 8, + 9, + 10, + 10, + 12, + 12 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_38", + "N": 10, + "DL": [ + 1.4118645549549302, + 0.2943269827979802, + 1.1007213045447723, + 1.6111749275222345, + -0.24303853757465232, + 0.1468209489716764, + 0.6263067207641103, + 0.8984735915146846, + 2.6624937978400136 + ], + "D": [ + 0.5017777267760064, + 1.2332990977425335, + -0.43595429597182084, + 1.6030686416232707, + -0.4123273326579863, + -0.2696982753717496, + -1.1093825599784104, + 0.6380014900887855, + -1.2868464425354806, + -1.56250406287684 + ], + "DU": [ + -0.18334437473326642, + -0.2788883821484594, + -0.803655346069138, + -0.46478807105119907, + 0.46308182716271185, + -1.5158392173589375, + 0.6089595967706768, + 0.33868042210036653, + -0.8302938023106369 + ], + "expectedDL": [ + 0.35540075357442785, + -0.4734534566379386, + -0.35342910259157573, + -0.14714990322753602, + 0.9255468708393266, + 0.4620485915079075, + -0.3563364154637654, + 0.9516094607999775, + 0.5871396480555704 + ], + "expectedD": [ + 1.4118645549549302, + -0.6216598034536248, + 1.1007213045447723, + 1.6111749275222345, + -0.24303853757465232, + 0.3177608408945095, + -1.757627605780856, + 0.8984735915146846, + 2.6624937978400136, + 1.7075235230852952 + ], + "expectedDU": [ + 1.2332990977425335, + 0.09911714117871548, + 1.6030686416232707, + -0.4123273326579863, + -0.2696982753717496, + 1.4029802443220984, + 0.6089595967706768, + -1.2868464425354806, + -1.56250406287684 + ], + "expectedDU2": [ + -0.2788883821484594, + 0.0, + -0.46478807105119907, + 0.46308182716271185, + -1.5158392173589375, + 0.0, + 0.0, + -0.8302938023106369 + ], + "expectedIPIV": [ + 1, + 1, + 3, + 4, + 5, + 5, + 6, + 8, + 9, + 9 + ], + "referenceInfo": 0, + "expectedInfo": 0 + }, + { + "name": "random_39", + "N": 11, + "DL": [ + 1.9744271658647787, + -1.0210897320724976, + 0.2613985087539984, + 0.18068782627914212, + 0.30142470471061245, + -0.21555449129242307, + 0.4134339282233136, + -0.30735085768152337, + 0.09969786814450192, + -1.002824674755495 + ], + "D": [ + 0.2276811451784893, + -0.5382645008211823, + 0.8339860170555088, + 2.867430398841243, + 0.6586649984452719, + -0.5927451967477317, + 0.9232984651886833, + -1.7248160484524955, + -0.40909637191517445, + 1.3410860838447516, + -1.5802457022646241 + ], + "DU": [ + -0.9799958452747074, + 0.12846836441053952, + 1.5508577996998143, + -0.3409426515549999, + 2.1575009566512677, + 2.3280109525749206, + -0.14493984452574707, + -1.1578131908510285, + 0.7158793357487658, + -1.654541250130495 + ], + "expectedDL": [ + 0.11531503876911424, + 0.8989668827942948, + -0.341902921180862, + 0.07557757832102667, + 0.4404008467874457, + 0.13970641782270726, + 0.6912912677840588, + 0.18918318258307218, + -0.5245666294410338, + -0.5841881485839039 + ], + "expectedD": [ + 1.9744271658647787, + -1.0210897320724976, + -0.7645401444690264, + 2.3907596709654353, + 0.6844326183961484, + -1.5429104450016742, + 0.5980603943524128, + -1.6246203995778674, + -0.19005758763331493, + 1.7166124940849679, + -2.5468090919340556 + ], + "expectedDU": [ + -0.5382645008211823, + 0.8339860170555088, + -1.3941698018533608, + -0.3409426515549999, + 2.1575009566512677, + 2.3280109525749206, + -0.14493984452574707, + -1.1578131908510285, + 0.7158793357487658, + -1.654541250130495 + ], + "expectedDU2": [ + 0.12846836441053952, + 1.5508577996998143, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "expectedIPIV": [ + 1, + 2, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "referenceInfo": 0, + "expectedInfo": 0 + } + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgttrf/test/test.native.js b/lib/node_modules/@stdlib/lapack/base/dgttrf/test/test.native.js new file mode 100644 index 000000000000..330255c2b45b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgttrf/test/test.native.js @@ -0,0 +1,381 @@ +/** +* @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 isError = require( '@stdlib/assert/is-error' ); +var ArrayBuffer = require( '@stdlib/array/buffer' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var max = require( '@stdlib/math/base/special/max' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); +var native = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var main = require( './../lib/main.js' ); +var factory = require( './../lib/factory.js' ); +var addon = tryRequire( resolve( __dirname, './../src/addon.node' ) ); +var fixtures = require( './fixtures/lapack.json' ).cases; + + +// VARIABLES // + +var opts = { + 'skip': isError( native ) +}; + + +// FUNCTIONS // + +/** +* Tests exact numeric equality, including signed zero and NaN. +* +* @private +* @param {number} x - first value +* @param {number} y - second value +* @returns {boolean} whether the values agree +*/ +function same( x, y ) { + return ( x === y && ( x !== 0.0 || 1.0/x === 1.0/y ) ) || ( x !== x && y !== y ); +} + +/** +* Compares all elements of two buffers. +* +* @private +* @param {TypedArray} actual - actual buffer +* @param {TypedArray} expected - expected buffer +* @returns {boolean} whether all elements agree +*/ +function sameBuffer( actual, expected ) { + var i; + if ( actual.length !== expected.length ) { + return false; + } + for ( i = 0; i < actual.length; i++ ) { + if ( !same( actual[ i ], expected[ i ] ) ) { + return false; + } + } + return true; +} + +/** +* Returns separate typed inputs for one reference fixture. +* +* @private +* @param {Object} data - fixture +* @returns {Array} typed inputs +*/ +function inputs( data ) { + return [ + new Float64Array( data.DL ), + new Float64Array( data.D ), + new Float64Array( data.DU ), + new Float64Array( ( data.N > 1 ) ? data.N-2 : 0 ), + new Int32Array( data.N ) + ]; +} + +/** +* Packs values in a guarded typed view with independent indexing. +* +* @private +* @param {Array} values - initial values +* @param {integer} stride - stride length +* @param {boolean} pivot - whether to create pivot indices +* @returns {Object} view and offset +*/ +function packed( values, stride, pivot ) { + var buffer; + var offset; + var length; + var data; + var i; + length = 5 + ( values.length*3 ); + buffer = ( pivot ) ? new Int32Array( length+2 ) : new Float64Array( length+2 ); + for ( i = 0; i < buffer.length; i++ ) { + buffer[ i ] = 97; + } + data = buffer.subarray( 1, length+1 ); + offset = ( stride < 0 ) ? 2 + ( (values.length-1)*(-stride) ) : 2; + for ( i = 0; i < values.length; i++ ) { + data[ offset+(i*stride) ] = values[ i ]; + } + return { + 'data': data, + 'offset': offset, + 'buffer': buffer + }; +} + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof native, 'function', 'main export is a function' ); + t.strictEqual( require( './../lib' ), native, 'selects the compiled interface' ); + t.strictEqual( native.length, 6, 'preserves main arity' ); + t.strictEqual( native.ndarray.length, 16, 'preserves ndarray arity' ); + t.end(); +}); + +tape( 'native factors and pivots agree with the independent compiled LAPACK oracle', opts, function test( t ) { + var expected; + var actual; + var values; + var data; + var info; + var i; + var j; + var k; + for ( i = 0; i < fixtures.length; i++ ) { + data = fixtures[ i ]; + values = inputs( data ); + info = native.apply( null, [ data.N ].concat( values ) ); + t.strictEqual( info, data.expectedInfo, data.name+': status' ); + t.deepEqual( Array.prototype.slice.call( values[ 4 ] ), data.expectedIPIV, data.name+': pivots' ); + expected = [ data.expectedDL, data.expectedD, data.expectedDU, data.expectedDU2 ]; + for ( j = 0; j < 4; j++ ) { + actual = values[ j ]; + for ( k = 0; k < actual.length; k++ ) { + t.ok( same( actual[ k ], expected[ j ][ k ] ) || isAlmostSameValue( actual[ k ], expected[ j ][ k ], 4 ), data.name+': factor' ); + } + } + } + t.end(); +}); + +tape( 'native indexed mutation agrees with original JS across independent strides', opts, function test( t ) { + var expected; + var strides = [ -2, 0, 3 ]; + var actual; + var argsJS; + var viewJS; + var values; + var kernel; + var stride; + var infoJS; + var argsC; + var viewC; + var calls; + var infoC; + var index; + var code; + var i; + var j; + calls = 0; + kernel = factory( function instrument() { + calls += 1; + return addon.apply( null, arguments ); + } ); + values = [ [ 3, -2, 4, 1 ], [ 1, 5, -1, 4, 2 ], [ 2, -3, 1, 5 ], [ 11, 12, 13 ], [ 17, 18, 19, 20, 21 ] ]; + for ( code = 0; code < 243; code++ ) { + argsJS = [ 5 ]; + argsC = [ 5 ]; + expected = []; + actual = []; + index = code; + for ( i = 0; i < 5; i++ ) { + stride = strides[ index%3 ]; + index = floor( index/3 ); + viewJS = packed( values[ i ], stride, i === 4 ); + viewC = packed( values[ i ], stride, i === 4 ); + argsJS.push( viewJS.data, stride, viewJS.offset ); + argsC.push( viewC.data, stride, viewC.offset ); + expected.push( viewJS.buffer ); + actual.push( viewC.buffer ); + } + infoJS = main.ndarray.apply( null, argsJS ); + infoC = kernel.ndarray.apply( null, argsC ); + t.strictEqual( infoC, infoJS, 'same status for stride combination '+code ); + for ( j = 0; j < 5; j++ ) { + t.ok( sameBuffer( actual[ j ], expected[ j ] ), 'same complete guarded view '+j+' for combination '+code ); + } + } + t.strictEqual( calls, 243, 'all stride combinations execute the real addon' ); + t.end(); +}); + +tape( 'native factorization preserves signed zero and nonfinite operations', opts, function test( t ) { + var cases = [ + [ [ 0, -0 ], [ -0, 1, 2 ], [ -0, 0 ] ], + [ [ NaN, 1 ], [ 2, 3, 4 ], [ 1, 1 ] ], + [ [ 1, NaN ], [ 2, 3, 4 ], [ 1, 1 ] ], + [ [ Infinity, 1 ], [ 2, 3, 4 ], [ 1, -Infinity ] ], + [ [ 1, -Infinity ], [ Infinity, 3, 4 ], [ 1, 1 ] ], + [ [ 1e-300, -1e-300 ], [ 2e-300, 3e-300, 4e-300 ], [ 1e-300, 1e-300 ] ], + [ [ 1e300, -1e300 ], [ 2e300, 3e300, 4e300 ], [ 1e300, 1e300 ] ] + ]; + var data; + var a; + var b; + var i; + var j; + for ( i = 0; i < cases.length; i++ ) { + data = { + 'N': 3, + 'DL': cases[ i ][ 0 ], + 'D': cases[ i ][ 1 ], + 'DU': cases[ i ][ 2 ] + }; + a = inputs( data ); + b = inputs( data ); + t.strictEqual( native.apply( null, [ 3 ].concat( a ) ), main.apply( null, [ 3 ].concat( b ) ), 'same status' ); + for ( j = 0; j < 5; j++ ) { + t.ok( sameBuffer( a[ j ], b[ j ] ), 'same nonfinite/signed-zero buffer' ); + } + } + t.end(); +}); + +tape( 'native dispatch preserves original fallback and error behavior', function test( t ) { + var metadata = [ 'length', 'buffer', 'byteOffset', 'byteLength' ]; + var kernel = factory( function unexpected() { + t.fail( 'fallback must not call addon' ); + } ); + var views; + var count; + var data; + var a; + var b; + var i; + data = fixtures[ 7 ]; + a = [ data.DL.slice(), data.D.slice(), data.DU.slice(), [ 8 ], [ 8, 8, 8 ] ]; + b = [ data.DL.slice(), data.D.slice(), data.DU.slice(), [ 8 ], [ 8, 8, 8 ] ]; + t.strictEqual( kernel.apply( null, [ 3 ].concat( a ) ), main.apply( null, [ 3 ].concat( b ) ), 'ordinary buffers use fallback' ); + t.deepEqual( a, b, 'ordinary buffer mutations match' ); + t.strictEqual( kernel( 0, null, null, null, null, null ), 0, 'empty call ignores unused buffers' ); + t.throws( function negative() { + kernel( -1, null, null, null, null, null ); + }, RangeError, 'preserves negative-order error' ); + for ( i = 0; i < metadata.length; i++ ) { + views = inputs( data ); + count = 0; + Object.defineProperty( views[ 1 ], metadata[ i ], { + 'get': untrusted + }); + t.strictEqual( kernel.apply( null, [ 3 ].concat( views ) ), 0, 'own metadata stays on JS' ); + t.strictEqual( count, 0, 'does not invoke ignored metadata getter' ); + } + views = inputs( data ); + views[ 1 ] = new Float64Array( [ 2 ] ); + t.strictEqual( kernel.apply( null, [ 3 ].concat( views ) ), 0, 'short buffer retains JS behavior' ); + views = inputs( data ); + t.strictEqual( kernel.apply( null, [ '3' ].concat( views ) ), 0, 'coercible order retains JS behavior' ); + t.end(); + + function untrusted() { + count += 1; + throw new Error( 'unused metadata' ); + } +}); + +tape( 'pivot/numeric byte aliases retain sequential JavaScript mutations', function test( t ) { + var kernel; + var calls = 0; + var ab = new ArrayBuffer( 80 ); + var bb = new ArrayBuffer( 80 ); + var a = [ new Float64Array( ab, 0, 2 ), new Float64Array( ab, 16, 3 ), new Float64Array( ab, 40, 2 ), new Float64Array( ab, 56, 1 ), new Int32Array( ab, 16, 3 ) ]; + var b = [ new Float64Array( bb, 0, 2 ), new Float64Array( bb, 16, 3 ), new Float64Array( bb, 40, 2 ), new Float64Array( bb, 56, 1 ), new Int32Array( bb, 16, 3 ) ]; + var i; + kernel = factory( function instrument() { + calls += 1; + return addon.apply( null, arguments ); + } ); + a[ 0 ].set( [ 1, 1 ] ); + a[ 1 ].set( [ 2, 3, 1 ] ); + a[ 2 ].set( [ 1, 1 ] ); + b[ 0 ].set( [ 1, 1 ] ); + b[ 1 ].set( [ 2, 3, 1 ] ); + b[ 2 ].set( [ 1, 1 ] ); + t.strictEqual( kernel.apply( null, [ 3 ].concat( a ) ), main.apply( null, [ 3 ].concat( b ) ), 'same alias status' ); + for ( i = 0; i < 5; i++ ) { + t.ok( sameBuffer( a[ i ], b[ i ] ), 'same cross-type alias view' ); + } + t.strictEqual( calls, 0, 'overlapping pivot bytes use original JS' ); + t.end(); +}); + +tape( 'the native factors reconstruct the original dense tridiagonal matrix', opts, function test( t ) { + var expected; + var matrix; + var factor; + var scale; + var error; + var temp; + var data; + var out; + var N; + var i; + var j; + var k; + for ( k = 0; k < fixtures.length; k++ ) { + data = fixtures[ k ]; + N = data.N; + out = inputs( data ); + native.apply( null, [ N ].concat( out ) ); + matrix = []; + for ( i = 0; i < N; i++ ) { + matrix[ i ] = []; + for ( j = 0; j < N; j++ ) { + matrix[ i ][ j ] = ( j === i ) ? out[ 1 ][ i ] : 0.0; + if ( j === i+1 ) { + matrix[ i ][ j ] = out[ 2 ][ i ]; + } + if ( j === i+2 ) { + matrix[ i ][ j ] = out[ 3 ][ i ]; + } + } + } + for ( i = N-2; i >= 0; i-- ) { + factor = out[ 0 ][ i ]; + for ( j = 0; j < N; j++ ) { + matrix[ i+1 ][ j ] += factor*matrix[ i ][ j ]; + } + if ( out[ 4 ][ i ] === i+1 ) { + temp = matrix[ i ]; + matrix[ i ] = matrix[ i+1 ]; + matrix[ i+1 ] = temp; + } + } + scale = 0.0; + error = 0.0; + for ( i = 0; i < N; i++ ) { + for ( j = 0; j < N; j++ ) { + expected = ( j === i ) ? data.D[ i ] : 0.0; + if ( j === i+1 ) { + expected = data.DU[ i ]; + } + if ( j === i-1 ) { + expected = data.DL[ j ]; + } + scale = max( scale, abs( expected ) ); + error = max( error, abs( matrix[ i ][ j ]-expected ) ); + } + } + t.ok( error === 0.0 || error/scale <= 64.0*2.220446049250313e-16, data.name+': reconstructed matrix residual' ); + } + t.end(); +});