Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions lib/node_modules/@stdlib/blas/base/zrotg/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2025 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );
var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' );
var pkg = require( './../package.json' ).name;
var zrotg = require( './../lib' );


// VARIABLES //

var OPTS = {
'dtype': 'float64'
};


// MAIN //

bench( pkg, function benchmark( b ) {
var viewY;
var za;
var zb;
var z;
var i;

za = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) );
zb = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
z = zrotg( za, zb );

viewY = reinterpret( z, 0 );
if ( isnan( viewY[ i%4 ] ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( viewY[ i%4 ] ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});

bench( pkg+':assign', function benchmark( b ) {
var viewY;
var out;
var za;
var zb;
var z;
var i;

za = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) );
zb = new Complex128( discreteUniform( -5, 5 ), discreteUniform( -5, 5 ) );
out = new Complex128Array( 4 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
z = zrotg.assign( za, zb, out, 1, 0 );

viewY = reinterpret( z, 0 );
if ( typeof z !=='object' ) {
b.fail( 'should return an array' );
}
}
b.toc();
if ( isnan( viewY[ i%4 ] ) ) {
b.fail( 'should return the output array' );
}
b.pass( 'benchmark finished' );
b.end();
});
65 changes: 65 additions & 0 deletions lib/node_modules/@stdlib/blas/base/zrotg/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

{{alias}}( za, zb )
Constructs a Givens plane rotation from two double-precision complex
floating-point numbers.

Parameters
----------
za: Complex128
Rotational elimination parameter.

zb: Complex128
Rotational elimination parameter.

Returns
-------
out: Complex128Array
Computed values.

Examples
--------
// Standard usage:
> var za = new {{alias:@stdlib/complex/float64/ctor}}( 4.0, 3.0 );
> var zb = new {{alias:@stdlib/complex/float64/ctor}}( 0.0, 0.0 );
> var out = {{alias}}( za, zb )
out => <Complex128Array>[ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ]


{{alias}}.assign( za, zb, out, stride, offset )
Constructs a Givens plane rotation from two double-precision complex
floating-point numbers and assigns the results to an output array.

Parameters
----------
za: Complex128
Rotational elimination parameter.

zb: Complex128
Rotational elimination parameter.

out: Complex128Array
Output array.

stride: integer
Output array stride.

offset: integer
Output array index offset.

Returns
-------
out: Complex128Array
Output array.

Examples
--------
> var za = new {{alias:@stdlib/complex/float64/ctor}}( 4.0, 3.0 );
> var zb = new {{alias:@stdlib/complex/float64/ctor}}( 0.0, 0.0 );
> var out = new {{alias:@stdlib/array/complex128}}( 4 );
> var y = {{alias}}.assign( za, zb, out, 1, 0 )
<Complex128Array>[ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ]
> var bool = ( y === out )
true

See Also
--------
117 changes: 117 additions & 0 deletions lib/node_modules/@stdlib/blas/base/zrotg/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2025 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// TypeScript Version: 4.1

/// <reference types="@stdlib/types"/>

import { Complex128Array } from '@stdlib/types/array';
import { Complex128 } from '@stdlib/types/complex';

/**
* Interface describing `zrotg`.
*/
interface Routine {
/**
* Constructs a Givens plane rotation.
*
* @param za - rotational elimination parameter
* @param zb - rotational elimination parameter
* @returns output array
*
* @example
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
*
* var za = new Complex128( 4.0, 3.0 );
* var zb = new Complex128( 0.0, 0.0 );
*
* var out = zrotg( za, zb );
* // <Complex128Array>[ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ]
*
* @example
* var za = new Complex128( 1.0, 2.0 );
* var zb = new Complex128( 3.0, 4.0 );
*
* var out = zrotg( za, zb );
* // returns <Complex128Array>[ ~1.732, ~5.1961, 2.0, 4.0, ~0.5773, ~0.8082, ~0.1154 ]
*/
( za: Complex128, zb: Complex128 ): Complex128Array;

/**
* Constructs a Givens plane rotation.
*
* @param za - rotational elimination parameter
* @param zb - rotational elimination parameter
* @param out - output array
* @param stride - index increment
* @param offset - starting index
* @returns output array
*
* @example
* var Complex128Array = require( '@stdlib/array/complex128' );
*
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
*
* var za = new Complex128( 4.0, 3.0 );
* var zb = new Complex128( 0.0, 0.0 );
* var out = new Complex128Array( 4 );
*
* var y = zrotg.assign( za, zb, out, 1, 0 );
* // returns <Complex128Array>[ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ]
*
* var bool = ( y === out );
* // returns true
*/
assign( za: Complex128, zb: Complex128, out: Complex128Array, stride: number, offset: number ): Complex128Array;
}

/**
* Constructs a Givens plane rotation.
*
* @param za - rotational elimination parameter
* @param zb - rotational elimination parameter
* @returns output array
*
* @example
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
*
* var za = new Complex128( 4.0, 3.0 );
* var zb = new Complex128( 0.0, 0.0 );
*
* var out = zrotg( za, zb );
* // returns <Complex128Array>[ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ]
*
* @example
* var Complex128Array = require( '@stdlib/array/complex128' );
*
* var za = new Complex128( 4.0, 3.0 );
* var zb = new Complex128( 0.0, 0.0 );
* var out = new Complex128Array( 4 );
*
* var y = zrotg.assign( za, zb, out, 1, 0 );
* // returns <Complex128Array>[ 4.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0 ]
*
* var bool = ( y === out );
* // returns true
*/
declare var zrotg: Routine;


// EXPORTS //

export = zrotg;
Loading
Loading