drotg

Construct a Givens plane rotation.

Usage

var drotg = require( '@stdlib/blas/base/drotg' );

drotg( a, b )

Constructs a Givens plane rotation provided two double-precision floating-point values a and b.

var out = drotg( 0.0, 2.0 );
// returns <Float64Array>[ 2.0, 1.0, 0.0, 1.0 ]

The function has the following parameters:

  • a: rotational elimination parameter.
  • b: rotational elimination parameter.

drotg.assign( a, b, out, stride, offset )

Constructs a Givens plane rotation provided two double-precision floating-point values a and b and assigns results to an output array.

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

var out = new Float64Array( 4 );

var y = drotg.assign( 0.0, 2.0, out, 1, 0 );
// returns <Float64Array>[ 2.0, 1.0, 0.0, 1.0 ]

var bool = ( y === out );
// returns true

Notes

  • drotg() corresponds to the BLAS level 1 function drotg.
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var drotg = require( '@stdlib/blas/base/drotg' );

var out;
var i;

for ( i = 0; i < 100; i++ ) {
    out = drotg( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) );
    console.log( out );
}
Did you find this page helpful?