srotg

Construct a Givens plane rotation.

Usage

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

srotg( a, b )

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

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

The function has the following parameters:

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

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

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

var Float32Array = require( '@stdlib/array/float32' );

var out = new Float32Array( 4 );

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

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

Notes

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

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