Skip to content
Merged
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
18 changes: 14 additions & 4 deletions lib/node_modules/@stdlib/fft/base/fftpack/float32/sinqi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ var sinqi = require( '@stdlib/fft/base/fftpack/float32/sinqi' );

Initializes a single-precision floating-point workspace array for performing a quarter-wave sine transform.

<!-- eslint-disable max-len -->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't inline lint disable comments in README examples. Always use HTML comments.


```javascript
var Float32Array = require( '@stdlib/array/float32' );
var Uint32Array = require( '@stdlib/array/uint32' );

var N = 8;
var workspace = new Float32Array( ( 3*N ) + 34 );
Expand All @@ -62,8 +65,9 @@ var cosineTable = workspace.slice( 0, N );
var twiddleFactors = workspace.slice( 2*N, 3*N );
// returns <Float32Array>[ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ]

var factors = workspace.slice( 3*N, ( 3*N ) + 4 );
// returns <Float32Array>[ 8, 2, 2, 4 ]
var fview = new Uint32Array( workspace.buffer, workspace.byteOffset, workspace.length );
var factors = fview.slice( 3*N, ( 3*N ) + 4 );
// returns <Uint32Array>[ 8, 2, 2, 4 ]
```

The function accepts the following arguments:
Expand Down Expand Up @@ -114,10 +118,13 @@ The function accepts the following arguments:

## Examples

<!-- eslint-disable max-len -->

<!-- eslint no-undef: "error" -->

```javascript
var Float32Array = require( '@stdlib/array/float32' );
var Uint32Array = require( '@stdlib/array/uint32' );
var zeroTo = require( '@stdlib/array/zero-to' );
var logEach = require( '@stdlib/console/log-each' );
var sinqi = require( '@stdlib/fft/base/fftpack/float32/sinqi' );
Expand All @@ -136,12 +143,15 @@ console.log( 'Twiddle factors:' );
idx = zeroTo( N, 'float32' );
logEach( ' workspace[ %d ] = %0.4f', idx, workspace.slice( 2*N, 3*N ) );

// Create an unsigned integer view over the workspace to read the factorization section:
var fview = new Uint32Array( workspace.buffer, workspace.byteOffset, workspace.length );

console.log( 'Factorization:' );
var nf = workspace[ (3*N)+1 ];
var nf = fview[ (3*N)+1 ];

console.log( ' number of factors: %d', nf );
idx = zeroTo( nf, 'float32' );
logEach( ' factor[ %d ]: %d', idx, workspace.slice( (3*N)+2, (3*N)+2+nf ) );
logEach( ' factor[ %d ]: %d', idx, fview.slice( (3*N)+2, (3*N)+2+nf ) );
```

</section>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

{{alias}}( N, workspace, strideW, offsetW )
{{alias}}( N, w, strideW, offsetW )
Initializes a single-precision floating-point workspace array for performing
a quarter-wave sine transform.

Expand Down Expand Up @@ -27,14 +27,14 @@
N: integer
Length of the sequence.

workspace: Float32Array
w: Float32Array
Workspace array.

strideW: integer
Stride length for `workspace`.
Stride length for `w`.

offsetW: integer
Starting index for `workspace`.
Starting index for `w`.

Returns
-------
Expand All @@ -44,18 +44,18 @@
Examples
--------
> var N = 8;
> var workspace = new {{alias:@stdlib/array/float32}}( ( 3*N ) + 34 );
> var out = {{alias}}( N, workspace, 1, 0 )
> var w = new {{alias:@stdlib/array/float32}}( ( 3*N ) + 34 );
> var out = {{alias}}( N, w, 1, 0 )
<Float32Array>
> var bool = ( out === workspace )
> var bool = ( out === w )
true
> var cosineTable = workspace.slice( 0, N )
> var cosineTable = w.slice( 0, N )
<Float32Array>[ ~0.98, ~0.92, ~0.83, ~0.7, ~0.56, ~0.38, ~0.2, ~0.0 ]
> var twiddleFactors = workspace.slice( 2*N, 3*N )
> var twiddleFactors = w.slice( 2*N, 3*N )
<Float32Array>[ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ]
> var factors = workspace.slice( 3*N, ( 3*N ) + 4 )
<Float32Array>[ 8, 2, 2, 4 ]
> var fview = new {{alias:@stdlib/array/uint32}}( w.buffer, w.byteOffset, w.length );
> var factors = fview.slice( 3*N, ( 3*N ) + 4 )
<Uint32Array>[ 8, 2, 2, 4 ]

See Also
--------

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*
* @example
* var Float32Array = require( '@stdlib/array/float32' );
* var Uint32Array = require( '@stdlib/array/uint32' );
*
* var N = 8;
* var workspace = new Float32Array( ( 3*N ) + 34 );
Expand All @@ -49,8 +50,9 @@
* var twiddleFactors = workspace.slice( 2*N, 3*N );
* // returns <Float32Array>[ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ]
*
* var factors = workspace.slice( 3*N, ( 3*N ) + 4 );
* // returns <Float32Array>[ 8, 2, 2, 4 ]
* var fview = new Uint32Array( workspace.buffer, workspace.byteOffset, workspace.length );
* var factors = fview.slice( 3*N, ( 3*N ) + 4 );
* // returns <Uint32Array>[ 8, 2, 2, 4 ]
*/
declare function sinqi( N: number, workspace: Float32Array, strideW: number, offsetW: number ): Float32Array;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'use strict';

var Float32Array = require( '@stdlib/array/float32' );
var Uint32Array = require( '@stdlib/array/uint32' );
var zeroTo = require( '@stdlib/array/zero-to' );
var logEach = require( '@stdlib/console/log-each' );
var sinqi = require( './../lib' );
Expand All @@ -37,9 +38,12 @@ console.log( 'Twiddle factors:' );
idx = zeroTo( N, 'float32' );
logEach( ' workspace[ %d ] = %0.4f', idx, workspace.slice( 2*N, 3*N ) );

// Create an unsigned integer view over the workspace to read the factorization section:
var fview = new Uint32Array( workspace.buffer, workspace.byteOffset, workspace.length ); // eslint-disable-line max-len

console.log( 'Factorization:' );
var nf = workspace[ (3*N)+1 ];
var nf = fview[ (3*N)+1 ];

console.log( ' number of factors: %d', nf );
idx = zeroTo( nf, 'float32' );
logEach( ' factor[ %d ]: %d', idx, workspace.slice( (3*N)+2, (3*N)+2+nf ) );
logEach( ' factor[ %d ]: %d', idx, fview.slice( (3*N)+2, (3*N)+2+nf ) );
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*
* @example
* var Float32Array = require( '@stdlib/array/float32' );
* var Uint32Array = require( '@stdlib/array/uint32' );
* var sinqi = require( '@stdlib/fft/base/fftpack/float32/sinqi' );
*
* var N = 8;
Expand All @@ -42,8 +43,9 @@
* var twiddleFactors = workspace.slice( 2*N, 3*N );
* // returns <Float32Array>[ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ]
*
* var factors = workspace.slice( 3*N, ( 3*N ) + 4 );
* // returns <Float32Array>[ 8, 2, 2, 4 ]
* var fview = new Uint32Array( workspace.buffer, workspace.byteOffset, workspace.length );
* var factors = fview.slice( 3*N, ( 3*N ) + 4 );
* // returns <Uint32Array>[ 8, 2, 2, 4 ]
*/

// MODULES //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ var cosqi = require( '@stdlib/fft/base/fftpack/float32/cosqi' );
*
* @example
* var Float32Array = require( '@stdlib/array/float32' );
* var Uint32Array = require( '@stdlib/array/uint32' );
*
* var N = 8;
* var workspace = new Float32Array( ( 3*N ) + 34 );
Expand All @@ -153,8 +154,9 @@ var cosqi = require( '@stdlib/fft/base/fftpack/float32/cosqi' );
* var twiddleFactors = workspace.slice( 2*N, 3*N );
* // returns <Float32Array>[ ~0.707, ~0.707, 0, 0, 0, 0, 0, 0 ]
*
* var factors = workspace.slice( 3*N, ( 3*N ) + 4 );
* // returns <Float32Array>[ 8, 2, 2, 4 ]
* var fview = new Uint32Array( workspace.buffer, workspace.byteOffset, workspace.length );
* var factors = fview.slice( 3*N, ( 3*N ) + 4 );
* // returns <Uint32Array>[ 8, 2, 2, 4 ]
*/
function sinqi( N, workspace, strideW, offsetW ) {
return cosqi( N, workspace, strideW, offsetW );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

var tape = require( 'tape' );
var Float32Array = require( '@stdlib/array/float32' );
var Uint32Array = require( '@stdlib/array/uint32' );
var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' );
var sinqi = require( './../lib' );

Expand Down Expand Up @@ -286,6 +287,7 @@ tape( 'the function correctly handles stride and offset parameters', function te
var expected;
var stride;
var offset;
var fview;
var nf;
var N;
var i;
Expand All @@ -297,12 +299,15 @@ tape( 'the function correctly handles stride and offset parameters', function te

sinqi( N, workspace, stride, offset );

t.strictEqual( workspace[ offset + ( 3*N * stride ) ], N, 'returns expected value' );
// Create an unsigned integer view over the workspace to read the factorization section:
fview = new Uint32Array( workspace.buffer, workspace.byteOffset, workspace.length ); // eslint-disable-line max-len

nf = workspace[ offset + ( ( ( 3*N ) + 1 ) * stride ) ];
t.strictEqual( fview[ offset + ( 3*N * stride ) ], N, 'returns expected value' );

nf = fview[ offset + ( ( ( 3*N ) + 1 ) * stride ) ];
t.strictEqual( nf, 2, 'returns expected value' );
t.strictEqual( workspace[ offset + ( ( ( 3*N ) + 2 ) * stride ) ], 2, 'returns expected value' );
t.strictEqual( workspace[ offset + ( ( ( 3*N ) + 3 ) * stride ) ], 4, 'returns expected value' );
t.strictEqual( fview[ offset + ( ( ( 3*N ) + 2 ) * stride ) ], 2, 'returns expected value' );
t.strictEqual( fview[ offset + ( ( ( 3*N ) + 3 ) * stride ) ], 4, 'returns expected value' );

expected = new Float32Array( ( 3*N ) + 34 );
sinqi( N, expected, 1, 0 );
Expand Down
Loading