Skip to content
Closed
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
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/lapack/base/dgttrf/test/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2025 The Stdlib Authors.
* 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.
Expand Down
262 changes: 262 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/dlasq6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
<!--

@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.

-->

# dlasq6

> Compute one dqd transform in ping-pong form.

<section class="intro">

The `dlasq6` routine computes one dqd (shift equal to zero) transform in ping-pong form. This routine performs one dqd transform, updates the `Z` ( QD ) array in place, and returns the values `DMIN`, `DMIN1`, `DMIN2`, `DN`, `DNM1`, and `DNM2`.

Where:

- `d` is the current transformed diagonal element of the implicit tridiagonal matrix during iteration.
- `DMIN` is the minimum value of `d` over the whole transform.
- `DMIN1` is the minimum value of `d`, excluding `d[ N0 ]`.
- `DMIN2` is the minimum value of `d`, excluding `d[ N0 ]` and `d[ N0-1 ]`.
- `DN` is the final value `d[ N0 ]`.
- `DNM1` is the value `d[ N0-1 ]`.
- `DNM2` is the value `d[ N0-2 ]`.

</section>

<!-- /.intro -->

<section class="usage">

## Usage

```javascript
var dlasq6 = require( '@stdlib/lapack/base/dlasq6' );
```

#### dlasq6( I0, N0, Z, PP, out )

Computes one dqd transform in ping-pong form.

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var out = new Float64Array( 6 );
var Z = new Float64Array( [5, 0, 7, 0, 9, 0, 3, 0, 11, 0, 4, 0, 20, 0, 0, 0] );

var v = dlasq6( 0, 3, Z, 0, out );
// returns <Float64Array>[ 3.75, 3.75, 3.75, ~12.088, ~6.111, 3.75 ]

var bool = ( v === out );
// returns true
```

The function has the following parameters:

- **I0**: the first index.
- **N0**: the last index.
- **Z**: [`Float64Array`][@stdlib/array/float64] QD array.
- **PP**: ping-pong flag, where `0` corresponds to ping and `1` corresponds to pong.
- **out**: [`Float64Array`][@stdlib/array/float64] output array containing `DMIN`, `DMIN1`, `DMIN2`, `DN`, `DNM1`, and `DNM2` respectively.

On return, `Z` is updated in place and `out` contains the final scalar values from the transform.

Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.

<!-- eslint-disable stdlib/capitalized-comments -->

```javascript
var Float64Array = require( '@stdlib/array/float64' );

// Initial arrays...
var Z0 = new Float64Array( [0, 5, 0, 7, 0, 9, 0, 3, 0, 11, 0, 4, 0, 20, 0, 0, 0] ); // eslint-disable-line max-len
var out0 = new Float64Array( 7 );

// Create offset views...
var Z = new Float64Array( Z0.buffer, Z0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var out = new Float64Array( out0.buffer, out0.BYTES_PER_ELEMENT*1 ); // start at 2nd element

dlasq6( 0, 3, Z, 0, out );
// out0 => <Float64Array>[ 0.0, 3.75, 3.75, 3.75, ~12.088, ~6.111, 3.75 ]
```

#### dlasq6.ndarray( I0, N0, Z, strideZ, offsetZ, PP, out, strideOut, offsetOut )

Computes one dqd transform in ping-pong form using alternative indexing semantics.

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var out = new Float64Array( 6 );
var Z = new Float64Array( [5, 0, 7, 0, 9, 0, 3, 0, 11, 0, 4, 0, 20, 0, 0, 0] );

dlasq6.ndarray( 0, 3, Z, 1, 0, 0, out, 1, 0 );
// out => <Float64Array>[ 3.75, 3.75, 3.75, ~12.088, ~6.111, 3.75 ]
```

The function has the following additional parameters:

- **strideZ**: stride length for `Z`.
- **offsetZ**: starting index for `Z`.
- **strideOut**: stride length for `out`.
- **offsetOut**: starting index for `out`.

While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example,

<!-- eslint-disable max-len -->

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var out = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
var Z = new Float64Array( [5, 0, 7, 0, 9, 0, 3, 0, 11, 0, 4, 0, 20, 0, 0, 0] );

dlasq6.ndarray( 0, 3, Z, 1, 0, 0, out, 1, 0 );
// out => <Float64Array>[ 3.75, 3.75, 3.75, ~12.088, ~6.111, 3.75 ]
```

</section>

<!-- /.usage -->

<section class="notes">

## Notes

- `dlasq6()` corresponds to the [LAPACK][LAPACK] routine [`dlasq6`][lapack-dlasq6].

</section>

<!-- /.notes -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var dlasq6 = require( '@stdlib/lapack/base/dlasq6' );

var Z = new Float64Array( [6, 0, 3, 0, 8, 0, 2, 0, 10, 0, 4, 0, 18, 0, 0, 0] );
var out = new Float64Array( 6 );

dlasq6( 0, 3, Z, 0, out );
console.log( out );

// Redefine the `Z` array as it gets updated.
Z = new Float64Array( [6, 0, 3, 0, 8, 0, 2, 0, 10, 0, 4, 0, 18, 0, 0, 0] );

dlasq6.ndarray( 0, 3, Z, 1, 0, 0, out, 1, 0 );
console.log( out );
```

</section>

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
TODO
```

#### TODO

TODO.

```c
TODO
```

TODO

```c
TODO
```

</section>

<!-- /.usage -->

<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- C API usage examples. -->

<section class="examples">

### Examples

```c
TODO
```

</section>

<!-- /.examples -->

</section>

<!-- /.c -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

[lapack]: https://www.netlib.org/lapack/explore-html/

[lapack-dlasq6]: https://www.netlib.org/lapack/explore-html/d9/d79/group__lasq6_ga2f0fd49aec60432f288625107131fdbe.html#ga2f0fd49aec60432f288625107131fdbe

[@stdlib/array/float64]: https://stdlib.io/docs/api/latest/@stdlib/array/float64

[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray

</section>

<!-- /.links -->
108 changes: 108 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/dlasq6/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/**
* @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 Float64Array = require( '@stdlib/array/float64' );
var format = require( '@stdlib/string/format' );
var pkg = require( './../package.json' ).name;
var dlasq6 = require( './../lib/dlasq6.js' );


// VARIABLES //

var options = {
'dtype': 'float64'
};


// FUNCTIONS //

/**
* Creates a benchmark function.
*
* @private
* @param {PositiveInteger} len - array length
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var out = new Float64Array( 6 );
var N0 = floor( (len / 4) - 1 );
var N = len;
var Z = uniform( N, -10.0, 10.0, options );
return benchmark;

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

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = dlasq6( 0, N0, Z, 0, out, 1, 0 );
if ( isnan( out[ i%6 ] ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
}
}


// MAIN //

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

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

for ( i = min; i <= max; i++ ) {
len = pow( 10, i );
f = createBenchmark( len );
bench( format( '%s:len=%d', pkg, len ), f );
}
}

main();
Loading
Loading