Perform a series of row interchanges on an input matrix.
var dlaswp = require( '@stdlib/lapack/base/dlaswp' );
Perform a series of row interchanges on an input matrix.
var Int32Array = require( '@stdlib/array/int32' );
var Float64Array = require( '@stdlib/array/float64' );
var IPIV = new Int32Array( [ 2, 0, 1 ] );
var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
dlaswp( 'row-major', 2, A, 2, 0, 2, IPIV, 1 );
// A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.0 ]
The function has the following parameters:
- order: storage layout.
- N: number of columns in
A
. - A: input
Float64Array
. - LDA: stride of the first dimension of
A
(a.k.a., leading dimension of the matrixA
). - k1: index of first row to interchange.
- k2: index of last row to interchange.
- IPIV: vector of pivot indices.
- sipiv: index increment for
IPIV
.
The increment parameters determine how elements in the IPIV array are accessed at runtime. For example, to iterate over the elements of IPIV
in reverse order,
var Int32Array = require( '@stdlib/array/int32' );
var Float64Array = require( '@stdlib/array/float64' );
var IPIV = new Int32Array( [ 2, 0, 0, 0, 1 ] );
var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] );
dlaswp( 'row-major', 2, A, 2, 0, 2, IPIV, 2 );
// A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0, 9.0 ]
Note that indexing is relative to the first index. To introduce an offset, use typed array
views.
var Int32Array = require( '@stdlib/array/int32' );
var Float64Array = require( '@stdlib/array/float64' );
// Initial arrays...
var IPIV0 = new Int32Array( [ 0, 2, 0, 1] );
var A0 = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
// Create offset views...
var IPIV1 = new Int32Array( IPIV0.buffer, IPIV0.BYTES_PER_ELEMENT*1 ); // start at 1st element
var A1 = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 1st element
dlaswp( 'row-major', 2, A1, 2, 0, 2, IPIV1, 1 );
// A0 => <Float64Array>[ 0.0, 3.0, 4.0, 1.0, 2.0, 5.0, 6.0 ]
Performs a series of row interchanges on the matrix A
using pivot indices stored in IPIV
and alternative indexing semantics.
var Int32Array = require( '@stdlib/array/int32' );
var Float64Array = require( '@stdlib/array/float64' );
var IPIV = new Int32Array( [ 2, 0, 1 ] );
var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
dlaswp.ndarray( 'row-major', 2, A, 2, 1, 0, 0, 2, 1, IPIV, 1, 0 );
// A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.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
. - inck: direction in which to apply pivots (-1 to apply pivots in reverse order; otherwise, apply in provided order).
- oipiv: starting index for
IPIV
.
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 Int32Array = require( '@stdlib/array/int32' );
var Float64Array = require( '@stdlib/array/float64' );
var IPIV = new Int32Array( [ 2, 0, 1 ] );
var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
dlaswp.ndarray( 'row-major', 2, A, 2, 1, 0, 0, 2, 1, IPIV, 1, 0 );
// A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.0 ]
dlaswp()
is a LAPACK routine.
var Float64Array = require( '@stdlib/array/float64' );
var Int32Array = require( '@stdlib/array/int32' );
var dlaswp = require( '@stdlib/lapack/base/dlaswp' );
var IPIV = new Int32Array( [ 2, 0, 1 ] );
var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
dlaswp( 'column-major', 2, A, 2, 0, 2, IPIV, 1 );
console.log( A );
TODO
TODO.
TODO
TODO
TODO
TODO