Skip to content

Latest commit

 

History

History
252 lines (157 loc) · 6.16 KB

File metadata and controls

252 lines (157 loc) · 6.16 KB

dsymv

Perform a series of row interchanges on an input matrix.

Usage

var dlaswp = require( '@stdlib/lapack/base/dlaswp' );

dlaswp( N, A, LDA, k1, k2, IPIV, sipiv )

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 matrix A).
  • 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 ]

dlaswp.ndarray( order, N, A, sa1, sa2, oa, k1, k2, inck, IPIV, sipiv, oipiv )

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 ]

Notes

  • dlaswp() is a LAPACK routine.

Examples

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 );

C APIs

Usage

TODO

TODO

TODO.

TODO

TODO

TODO

Examples

TODO