Solve one of the systems of equations
A*x = b
orA^T*x = b
.
var dtbsv = require( '@stdlib/blas/base/dtbsv' );
Solves one of the systems of equations A*x = b
or A^T*x = b
where b
and x
are N
element vectors and A
is an N
by N
unit, or non-unit, upper or lower triangular band matrix, with ( K
+ 1 ) diagonals.
var Float64Array = require( '@stdlib/array/float64' );
var A = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 ] );
var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
dtbsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, 1, A, 2, x, 1 );
// x => <Float64Array>[ 8.0, -7.0, 3.0 ]
The function has the following parameters:
- order: storage layout.
- uplo: specifies whether
A
is an upper or lower triangular matrix. - trans: specifies whether
A
should be transposed, conjugate-transposed, or not transposed. - diag: specifies whether
A
has a unit diagonal. - N: number of elements along each dimension of
A
. - K: number of super-diagonals or sub-diagonals of the matrix
A
. - A: input matrix stored in linear memory as a
Float64Array
. - lda: stride of the first dimension of
A
(a.k.a., leading dimension of the matrixA
). - x: input vector
Float64Array
. - sx:
x
stride length.
The stride parameters determine how elements in the input arrays are accessed at runtime. For example, to iterate over the elements of x
in reverse order,
var Float64Array = require( '@stdlib/array/float64' );
var A = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 ] );
var x = new Float64Array( [ 3.0, 2.0, 1.0 ] );
dtbsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, 1, A, 2, x, -1 );
// x => <Float64Array>[ 3.0, -7.0, 8.0 ]
Note that indexing is relative to the first index. To introduce an offset, use typed array
views.
var Float64Array = require( '@stdlib/array/float64' );
// Initial arrays...
var x0 = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );
var A = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 ] );
// Create offset views...
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
dtbsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, 1, A, 2, x1, 1 );
// x1 => <Float64Array>[ 8.0, -7.0, 3.0 ]
Solves one of the systems of equations A*x = b
or A^T*x = b
, using alternative indexing semantics and where b
and x
are N
element vectors and A
is an N
by N
unit, or non-unit, upper or lower triangular band matrix, with ( K
+ 1 ) diagonals.
var Float64Array = require( '@stdlib/array/float64' );
var A = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 ] );
var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
dtbsv.ndarray( 'upper', 'no-transpose', 'unit', 3, 1, A, 2, 1, 0, x, 1, 0 );
// x => <Float64Array>[ 8.0, -7.0, 3.0 ]
The function has the following additional parameters:
- sa1: stride of the first dimension of
A
. - sa2: stride of the second dimension of
A
. - oa: starting index for
A
. - ox: starting index for
x
.
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 A = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 ] );
var x = new Float64Array( [ 3.0, 2.0, 1.0 ] );
dtbsv.ndarray( 'upper', 'no-transpose', 'unit', 3, 1, A, 2, 1, 0, x, -1, 2 );
// x => <Float64Array>[ 3.0, -7.0, 8.0 ]
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var dtbsv = require( '@stdlib/blas/base/dtbsv' );
var opts = {
'dtype': 'float64'
};
var N = 3;
var A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 0.0 ];
var x = discreteUniform( N, -10, 10, opts );
dtbsv( 'row-major', 'upper', 'no-transpose', 'unit', N, 1, A, N, x, 1 );
console.log( x );
dtbsv.ndarray( 'upper', 'no-transpose', 'unit', N, 1, A, N, 1, 0, x, 1, 0 );
console.log( x );
TODO
TODO.
TODO
TODO
TODO
TODO