Construct a Givens plane rotation.
var drotg = require( '@stdlib/blas/base/drotg' );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.
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 truevar 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 );
}#include "stdlib/blas/base/drotg.h"Constructs a Givens plane rotation provided two double-precision floating-point values a and b.
double Out[ 4 ];
c_drotg( 0.0, 2.0, Out, 1 );
// Out => [ 2.0, 1.0, 0.0, 1.0 ]The function accepts the following arguments:
- a:
[in] doublerotational elimination parameter. - b:
[in] doublerotational elimination parameter. - Out:
[out] double*output array. - strideOut:
[in] CBLAS_INTstride length forOut.
void c_drotg( const double a, const double b, double *Out, const CBLAS_INT strideOut );Constructs a Givens plane rotation provided two double-precision floating-point values a and b using alternative indexing semantics.
double Out[ 4 ];
c_drotg_assign( 0.0, 2.0, Out, 1, 0 );
// Out => [ 2.0, 1.0, 0.0, 1.0 ]The function accepts the following arguments:
- a:
[in] doublerotational elimination parameter. - b:
[in] doublerotational elimination parameter. - Out:
[out] double*output array. - strideOut:
[in] CBLAS_INTstride length forOut. - offsetOut:
[in] CBLAS_INTstarting index forOut.
void c_drotg_assign( const double a, const double b, double *Out, const CBLAS_INT strideOut, const CBLAS_INT offsetOut );#include "stdlib/blas/base/drotg.h"
#include <stdio.h>
int main( void ) {
// Specify rotational elimination parameters:
const double a = 0.0;
const double b = 2.0;
int i;
// Create strided arrays:
double Out[ 4 ];
// Specify stride lengths:
const int strideOut = 1;
// Apply plane rotation:
c_drotg( a, b, Out, strideOut );
// Print the result:
for ( i = 0; i < 4; i++ ) {
printf( "Out[%d] = %lf\n", i, Out[ i ] );
}
// Apply plane rotation using alternative indexing semantics:
c_drotg_assign( a, b, Out, strideOut, 0 );
// Print the result:
for ( i = 0; i < 4; i++ ) {
printf( "Out[%d] = %lf\n", i, Out[ i ] );
}
}