Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
406 changes: 406 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/dgetc2/README.md

Large diffs are not rendered by default.

124 changes: 124 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/dgetc2/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/array/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pow = require( '@stdlib/math/base/special/pow' );
var floor = require( '@stdlib/math/base/special/floor' );
var Int32Array = require( '@stdlib/array/int32' );
var format = require( '@stdlib/string/format' );
var pkg = require( './../package.json' ).name;
var dgetc2 = require( './../lib/dgetc2.js' );


// VARIABLES //

var LAYOUTS = [
'row-major',
'column-major'
];


// FUNCTIONS //

/**
* Creates a benchmark function.
*
* @private
* @param {string} order - storage layout
* @param {PositiveInteger} N - matrix order (N-by-N)
* @returns {Function} benchmark function
*/
function createBenchmark( order, N ) {
var IPIV;
var JPIV;
var opts;
var A;

opts = {
'dtype': 'float64'
};

// Random input matrix and auxiliary arrays:
A = uniform( N*N, -1.0, 1.0, opts );
IPIV = new Int32Array( N );
JPIV = new Int32Array( N );

return benchmark;

/**
* Benchmark function.
*
* @private
* @param {Benchmark} b - benchmark instance
*/
function benchmark( b ) {
var i;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
dgetc2( order, N, A, N, IPIV, JPIV );
if ( isnan( A[ i%A.length ] ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( A[ i%A.length ] ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
}
}


// MAIN //

/**
* Main execution sequence.
*
* @private
*/
function main() {
var min;
var max;
var ord;
var N;
var f;
var i;
var k;

min = 1; // 10^min
max = 6; // 10^max

for ( k = 0; k < LAYOUTS.length; k++ ) {
ord = LAYOUTS[ k ];
for ( i = min; i <= max; i++ ) {
N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
f = createBenchmark( ord, N );
bench( format( '%s:order=%s,size=%d', pkg, ord, (N*N) ), f );
}
}
}

main();
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/array/uniform' );
var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pow = require( '@stdlib/math/base/special/pow' );
var floor = require( '@stdlib/math/base/special/floor' );
var Int32Array = require( '@stdlib/array/int32' );
var format = require( '@stdlib/string/format' );
var pkg = require( './../package.json' ).name;
var dgetc2 = require( './../lib/ndarray.js' );


// VARIABLES //

var LAYOUTS = [
'row-major',
'column-major'
];


// FUNCTIONS //

/**
* Creates a benchmark function.
*
* @private
* @param {string} order - storage layout
* @param {PositiveInteger} N - matrix order (N-by-N)
* @returns {Function} benchmark function
*/
function createBenchmark( order, N ) {
var IPIV;
var JPIV;
var sa1;
var sa2;
var A;

if ( isColumnMajor( order ) ) {
sa1 = 1;
sa2 = N;
} else {
sa1 = N;
sa2 = 1;
}

A = uniform( N*N, -1.0, 1.0, {
'dtype': 'float64'
});
IPIV = new Int32Array( N );
JPIV = new Int32Array( N );

return benchmark;

/**
* Benchmark function.
*
* @private
* @param {Benchmark} b - benchmark instance
*/
function benchmark( b ) {
var i;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
dgetc2( N, A, sa1, sa2, 0, IPIV, 1, 0, JPIV, 1, 0 );
if ( isnan( A[ i%A.length ] ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( A[ i%A.length ] ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
}
}


// MAIN //

/**
* Main execution sequence.
*
* @private
*/
function main() {
var min;
var max;
var ord;
var N;
var f;
var i;
var k;

min = 1; // 10^min
max = 6; // 10^max

for ( k = 0; k < LAYOUTS.length; k++ ) {
ord = LAYOUTS[ k ];
for ( i = min; i <= max; i++ ) {
N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
f = createBenchmark( ord, N );
bench( format( '%s:ndarray:order=%s,size=%d', pkg, ord, (N*N) ), f );
}
}
}

main();
115 changes: 115 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/dgetc2/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{{alias}}( order, N, A, LDA, IPIV, JPIV )
Computes the LU factorization with complete pivoting of the general
n-by-n matrix `A`.

The function overwrites the input matrix A with the factors L and U
from the factorization A = P*L*U*Q; the unit diagonal elements of L
are not stored.

Parameters
----------
order: string
Row-major (C-style) or column-major (Fortran-style) order. Must be
either 'row-major' or 'column-major'.

N: integer
Number of columns in matrix A.

A: Float64Array
Input matrix (overwritten with `L` and `U` on output).

LDA: integer
Stride of the first dimension of A (a.k.a., leading dimension of the
matrix A) `LDA` >= max(1,N).

IPIV: Int32Array
Vector of `N` pivot indices of rows.

JPIV: Int32Array
Vector of `N` pivot indices of rows.

Returns
-------
info: integer
Status code.

Examples
--------
> var A = new {{alias:@stdlib/array/float64}}([ 1,2,3,4,5,6,7,8,10 ]);
> var IPIV = new {{alias:@stdlib/array/int32}}( 3 );
> var JPIV = new {{alias:@stdlib/array/int32}}( 3 );
> {{alias}}( 'column-major', 3, A, 3, IPIV, JPIV )
0
> A
<Float64Array>[ 10, 0.7, 0.8, 3, ~-1.1, ~0.36, 6, ~-0.2, ~0.27 ]
> IPIV
<Int32Array>[ 3, 3, 3 ]
> JPIV
<Int32Array>[ 3, 3, 3 ]


{{alias}}.ndarray( N, A, sa1, sa2, oa, IPIV, si, oi, JPIV, sj, oj )
Computes the LU factorization with complete pivoting of the general
n-by-n matrix `A` using alternating indexing semantics.


While typed array views mandate a view offset based on the underlying
buffer, the offset parameters support indexing semantics based on starting
indices.

Parameters
----------
N: integer
Number of columns in matrix A.

A: Float64Array
Input matrix (overwritten with `L` and `U` on output).

sa1: integer
Stride of the first dimension of A.

sa2: integer
Stride of the second dimension of A.

oa: integer
Index offset for A.

IPIV: Int32Array
Vector of `N` pivot indices of rows.

si: integer
Stride length for IPIV.

oi: integer
Index offset for IPIV.

JPIV: Int32Array
Vector of `N` pivot indices of columns.

sj: integer
Stride length for JPIV.

oj: integer
Index offset for JPIV.

Returns
-------
info: integer
Status code.

Examples
--------
> var A = new {{alias:@stdlib/array/float64}}([ 1,2,3,4,5,6,7,8,10 ]);
> var IPIV = new {{alias:@stdlib/array/int32}}( 3 );
> var JPIV = new {{alias:@stdlib/array/int32}}( 3 );
> {{alias}}.ndarray( 3, A, 1, 3, 0, IPIV, 1, 0, JPIV, 1, 0 )
0
> A
<Float64Array>[ 10, 0.7, 0.8, 3, ~-1.1, ~0.36, 6, ~-0.2, ~0.27 ]
> IPIV
<Int32Array>[ 3, 3, 3 ]
> JPIV
<Int32Array>[ 3, 3, 3 ]

See Also
--------
Loading