0.2.1 • Published 3 months ago

@stdlib/blas-base-srotg v0.2.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 months ago

srotg

NPM version Build Status Coverage Status

Construct a Givens plane rotation.

Installation

npm install @stdlib/blas-base-srotg

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

Notice

This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

Community

Chat


License

See LICENSE.

Copyright

Copyright © 2016-2024. The Stdlib Authors.