Compute the singular values of a 2x2 upper triangular matrix.
The singular values of a 2x2 upper triangular matrix $ A = \begin{bmatrix} F & G \ 0 & H \end{bmatrix}$ are returned as $\begin{bmatrix} SSMIN & SSMAX \end{bmatrix}$.
var dlas2 = require( '@stdlib/lapack/base/dlas2' );Computes the singular values of 2x2 upper triangular matrix.
var Float64Array = require( '@stdlib/array/float64' );
var out = new Float64Array( 2 );
dlas2( 1.0, 2.0, 3.0, out );
// out => <Float64Array>[ ~0.822, ~3.65 ]The function has the following parameters:
- F: the (0,0) element of a 2x2 matrix.
- G: the (0,1) and (1,0) elements of a 2x2 matrix.
- H: the (1,1) element of a 2x2 matrix.
- out: output
Float64Arraycontaining the smaller and larger singular values respectively.
Note that indexing is relative to the first index. To introduce an offset, use typed array views.
var Float64Array = require( '@stdlib/array/float64' );
// Initial array:
var out0 = new Float64Array( [ 0.0, 0.0, 0.0 ] );
// Create an offset view...
var out1 = new Float64Array( out0.buffer, out0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
dlas2( 1.0, 2.0, 3.0, out1 );
// out0 => <Float64Array>[ 0.0, ~0.822, ~3.65 ]Computes the singular values of a 2x2 upper triangular matrix using alternative indexing semantics.
var Float64Array = require( '@stdlib/array/float64' );
var out = new Float64Array( 2 );
dlas2.ndarray( 1.0, 2.0, 3.0, out, 1, 0 );
// out => <Float64Array>[ ~0.822, ~3.65 ]The function has the following additional parameters:
- strideOut: stride length for
out. - offsetOut: starting index of
out
While typed array views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example,
var Float64Array = require( '@stdlib/array/float64' );
var out = new Float64Array( [ 0.0, 0.0, 0.0 ] );
dlas2.ndarray( 1.0, 2.0, 3.0, out, -1, 2 );
// out => <Float64Array>[ 0.0, ~3.65, ~0.822 ]var Float64Array = require( '@stdlib/array/float64' );
var dlas2 = require( '@stdlib/lapack/base/dlas2' );
var out = new Float64Array( 2 );
dlas2( 6.0, 8.0, 2.0, out );
console.log( out );
dlas2.ndarray( 6.0, 8.0, 2.0, out, 1, 0 );
console.log( out );TODOTODO.
TODOTODO
TODOTODO