From f9bd6eaf51129b2ff83fe8d0b3560c0e31d62d44 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sat, 10 Oct 2026 20:53:08 -0700 Subject: [PATCH 1/2] feat: add `assign` and `strided` methods to `math/base/special/ccis` --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/math/base/special/ccis/README.md | 66 +++++- .../ccis/benchmark/benchmark.assign.js | 69 ++++++ .../base/special/ccis/benchmark/benchmark.js | 22 +- .../ccis/benchmark/benchmark.native.js | 20 +- .../ccis/benchmark/benchmark.strided.js | 67 ++++++ .../base/special/ccis/benchmark/c/benchmark.c | 3 +- .../math/base/special/ccis/docs/repl.txt | 71 ++++++ .../base/special/ccis/docs/types/index.d.ts | 87 ++++++- .../math/base/special/ccis/docs/types/test.ts | 200 ++++++++++++++++ .../base/special/ccis/examples/c/example.c | 2 +- .../math/base/special/ccis/examples/index.js | 17 +- .../math/base/special/ccis/lib/assign.js | 69 ++++++ .../math/base/special/ccis/lib/index.js | 11 + .../math/base/special/ccis/lib/main.js | 23 +- .../math/base/special/ccis/lib/strided.js | 54 +++++ .../base/special/ccis/test/test.assign.js | 193 ++++++++++++++++ .../math/base/special/ccis/test/test.js | 131 +---------- .../math/base/special/ccis/test/test.main.js | 165 ++++++++++++++ .../base/special/ccis/test/test.native.js | 2 +- .../base/special/ccis/test/test.strided.js | 214 ++++++++++++++++++ 20 files changed, 1295 insertions(+), 191 deletions(-) create mode 100644 lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.assign.js create mode 100644 lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.strided.js create mode 100644 lib/node_modules/@stdlib/math/base/special/ccis/lib/assign.js create mode 100644 lib/node_modules/@stdlib/math/base/special/ccis/lib/strided.js create mode 100644 lib/node_modules/@stdlib/math/base/special/ccis/test/test.assign.js create mode 100644 lib/node_modules/@stdlib/math/base/special/ccis/test/test.main.js create mode 100644 lib/node_modules/@stdlib/math/base/special/ccis/test/test.strided.js diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/README.md b/lib/node_modules/@stdlib/math/base/special/ccis/README.md index 8e664ac6adb9..60759ac86125 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/README.md +++ b/lib/node_modules/@stdlib/math/base/special/ccis/README.md @@ -69,6 +69,55 @@ v = ccis( z ); // returns [ ~0.540, ~0.841 ] ``` +#### ccis.assign( re, im, out, strideOut, offsetOut ) + +Evaluates the [cis][cis] function for a double-precision complex floating-point number and assigns results to a provided output array. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var out = new Float64Array( 2 ); +var v = ccis.assign( 0.0, 0.0, out, 1, 0 ); +// returns [ 1.0, 0.0 ] + +var bool = ( out === v ); +// returns true +``` + +The function supports the following parameters: + +- **re**: real component. +- **im**: imaginary component. +- **out**: output array. +- **strideOut**: stride length for `out`. +- **offsetOut**: starting index for `out`. + +#### ccis.strided( z, sz, oz, out, so, oo ) + +Evaluates the [cis][cis] function for a double-precision complex floating-point number stored in a real-valued strided array view and assigns results to a provided strided output array. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var z = new Float64Array( [ 0.0, 0.0 ] ); +var out = new Float64Array( 2 ); + +var v = ccis.strided( z, 1, 0, out, 1, 0 ); +// returns [ 1.0, 0.0 ] + +var bool = ( out === v ); +// returns true +``` + +The function supports the following parameters: + +- **z**: complex number strided array view. +- **sz**: stride length for `z`. +- **oz**: starting index for `z`. +- **out**: output array. +- **so**: stride length for `out`. +- **oo**: starting index for `out`. + @@ -80,19 +129,16 @@ v = ccis( z ); ```javascript -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); var ccis = require( '@stdlib/math/base/special/ccis' ); -var z1; -var z2; -var i; +// Create an array of random numbers: +var arr = new Complex128Array( uniform( 200, -50.0, 50.0 ) ); -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( uniform( -50.0, 50.0 ), uniform( -50.0, 50.0 ) ); - z2 = ccis( z1 ); - console.log( 'ccis(%s) = %s', z1.toString(), z2.toString() ); -} +// Compute the cis function of each number in the array: +logEachMap( 'ccis(%s) = %s', arr, ccis ); ``` diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.assign.js b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.assign.js new file mode 100644 index 000000000000..8002388198cf --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.assign.js @@ -0,0 +1,69 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Float64Array = require( '@stdlib/array/float64' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var assign = require( './../lib' ).assign; + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// MAIN // + +bench( format( '%s:assign', pkg ), function benchmark( b ) { + var out; + var re; + var im; + var N; + var i; + var j; + + N = 100; + re = uniform( N, -50.0, 50.0, options ); + im = uniform( N, -50.0, 50.0, options ); + + out = new Float64Array( 2 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + j = i % N; + out = assign( re[ j ], im[ j ], out, 1, 0 ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.js index bfc0a79f3b3e..99632874a39c 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.js @@ -21,30 +21,36 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Complex128Array = require( '@stdlib/array/complex128' ); var real = require( '@stdlib/complex/float64/real' ); var imag = require( '@stdlib/complex/float64/imag' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); var pkg = require( './../package.json' ).name; var ccis = require( './../lib' ); +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + // MAIN // bench( pkg, function benchmark( b ) { - var values; + var zbuf; + var z; var y; var i; - values = [ - new Complex128( uniform( -50.0, 50.0 ), uniform( -50.0, 50.0 ) ), - new Complex128( uniform( -50.0, 50.0 ), uniform( -50.0, 50.0 ) ) - ]; + zbuf = uniform( 200, -50.0, 50.0, options ); + z = new Complex128Array( zbuf.buffer ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = ccis( values[ i%values.length ] ); + y = ccis( z.get( i%100 ) ); if ( isnan( real( y ) ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.native.js index ed793b028eb5..90b22e7627d1 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.native.js @@ -22,11 +22,11 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Complex128Array = require( '@stdlib/array/complex128' ); var real = require( '@stdlib/complex/float64/real' ); var imag = require( '@stdlib/complex/float64/imag' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); var tryRequire = require( '@stdlib/utils/try-require' ); var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; @@ -38,25 +38,25 @@ var ccis = tryRequire( resolve( __dirname, './../lib/native.js' ) ); var opts = { 'skip': ( ccis instanceof Error ) }; +var options = { + 'dtype': 'float64' +}; // MAIN // bench( format( '%s::native', pkg ), opts, function benchmark( b ) { - var values; - var y; + var zbuf; var z; + var y; var i; - values = [ - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; + zbuf = uniform( 200, -50.0, 50.0, options ); + z = new Complex128Array( zbuf.buffer ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - y = ccis( z ); + y = ccis( z.get( i%100 ) ); if ( isnan( real( y ) ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.strided.js b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.strided.js new file mode 100644 index 000000000000..e4aad30a4c99 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/benchmark.strided.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Float64Array = require( '@stdlib/array/float64' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var strided = require( './../lib' ).strided; + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// MAIN // + +bench( format( '%s:strided', pkg ), function benchmark( b ) { + var out; + var z; + var N; + var i; + var j; + + N = 50; + z = uniform( N*2, -50.0, 50.0, options ); + + out = new Float64Array( 2 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + j = ( i % N ) * 2; + out = strided( z, 1, j, out, 1, 0 ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( isnan( out[ 0 ] ) || isnan( out[ 1 ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/c/benchmark.c index 35e252f391f4..0799802ceb57 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/c/benchmark.c @@ -20,9 +20,10 @@ #include #include #include +#include #include -#define NAME "cis" +#define NAME "ccis" #define ITERATIONS 1000000 #define REPEATS 3 diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/docs/repl.txt b/lib/node_modules/@stdlib/math/base/special/ccis/docs/repl.txt index a1d607c7034c..605174d029e6 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/docs/repl.txt +++ b/lib/node_modules/@stdlib/math/base/special/ccis/docs/repl.txt @@ -20,6 +20,77 @@ > y = {{alias}}( new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 0.0 ) ) [ ~0.540, ~0.841 ] + +{{alias}}.assign( re, im, out, strideOut, offsetOut ) + Evaluates the cis function for a double-precision complex floating-point + number and assigns results to a provided output array. + + Parameters + ---------- + re: number + Real component. + + im: number + Imaginary component. + + out: ArrayLikeObject + Output array. + + strideOut: integer + Stride length. + + offsetOut: integer + Starting index. + + Returns + ------- + out: ArrayLikeObject + Output array. + + Examples + -------- + > var out = new {{alias:@stdlib/array/float64}}( 2 ); + > {{alias}}.assign( 0.0, 0.0, out, 1, 0 ) + [ 1.0, 0.0 ] + + +{{alias}}.strided( z, sz, oz, out, so, oo ) + Evaluates the cis function for a double-precision complex floating-point + number stored in a real-valued strided array view and assigns results to a + provided strided output array. + + Parameters + ---------- + z: ArrayLikeObject + Complex number view. + + sz: integer + Stride length for `z`. + + oz: integer + Starting index for `z`. + + out: ArrayLikeObject + Output array. + + so: integer + Stride length for `out`. + + oo: integer + Starting index for `out`. + + Returns + ------- + out: ArrayLikeObject + Output array. + + Examples + -------- + > var z = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0 ] ); + > var out = new {{alias:@stdlib/array/float64}}( 2 ); + > {{alias}}.strided( z, 1, 0, out, 1, 0 ) + [ 1.0, 0.0 ] + See Also -------- diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/ccis/docs/types/index.d.ts index 8fcf52aa67a0..d37bf1de3c6f 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/math/base/special/ccis/docs/types/index.d.ts @@ -21,6 +21,72 @@ /// import { Complex128 } from '@stdlib/types/complex'; +import { Collection, NumericArray } from '@stdlib/types/array'; + +/** +* Interface for evaluating the cis function for a double-precision complex floating-point number. +*/ +interface Ccis { + /** + * Evaluates the cis function for a double-precision complex floating-point number. + * + * @param z - complex number + * @returns result + * + * @example + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * + * var z = new Complex128( 0.0, 0.0 ); + * // returns + * + * var out = ccis( z ); + * // returns [ 1.0, 0.0 ] + */ + ( z: Complex128 ): Complex128; + + /** + * Evaluates the cis function for a double-precision complex floating-point number and assigns results to a provided output array. + * + * @param re - real component + * @param im - imaginary component + * @param out - output array + * @param strideOut - stride length + * @param offsetOut - starting index + * @returns output array + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var out = new Float64Array( 2 ); + * var v = ccis.assign( 0.0, 0.0, out, 1, 0 ); + * // returns [ 1.0, 0.0 ] + * + * var bool = ( out === v ); + * // returns true + */ + assign>( re: number, im: number, out: T, strideOut: number, offsetOut: number ): T; + + /** + * Evaluates the cis function for a double-precision complex floating-point number stored in a real-valued strided array view and assigns results to a provided strided output array. + * + * @param z - complex number view + * @param strideZ - stride length for `z` + * @param offsetZ - starting index for `z` + * @param out - output array + * @param strideOut - stride length for `out` + * @param offsetOut - starting index for `out` + * @returns output array + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var z = new Float64Array( [ 0.0, 0.0 ] ); + * + * var out = ccis.strided( z, 1, 0, new Float64Array( 2 ), 1, 0 ); + * // returns [ 1.0, 0.0 ] + */ + strided, U extends NumericArray | Collection>( z: T, strideZ: number, offsetZ: number, out: U, strideOut: number, offsetOut: number ): U; +} /** * Evaluates the cis function for a double-precision complex floating-point number. @@ -38,15 +104,24 @@ import { Complex128 } from '@stdlib/types/complex'; * // returns [ 1.0, 0.0 ] * * @example -* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var Float64Array = require( '@stdlib/array/float64' ); * -* var z = new Complex128( 1.0, 0.0 ); -* // returns +* var out = new Float64Array( 2 ); +* var v = ccis.assign( 0.0, 0.0, out, 1, 0 ); +* // returns [ 1.0, 0.0 ] * -* var out = ccis( z ); -* // returns [ ~0.540, ~0.841 ] +* var bool = ( out === v ); +* // returns true +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var z = new Float64Array( [ 0.0, 0.0 ] ); +* +* var out = ccis.strided( z, 1, 0, new Float64Array( 2 ), 1, 0 ); +* // returns [ 1.0, 0.0 ] */ -declare function ccis( z: Complex128 ): Complex128; +declare var ccis: Ccis; // EXPORTS // diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/docs/types/test.ts b/lib/node_modules/@stdlib/math/base/special/ccis/docs/types/test.ts index b4309e30057e..d91ddebf4a48 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/docs/types/test.ts +++ b/lib/node_modules/@stdlib/math/base/special/ccis/docs/types/test.ts @@ -49,3 +49,203 @@ import ccis = require( './index' ); ccis( z, z ); // $ExpectError ccis( z, z, z ); // $ExpectError } + +// Attached to the main export is an `assign` method which returns a collection... +{ + ccis.assign( 1.0, 1.0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array + ccis.assign( 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array + ccis.assign( 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] +} + +// The compiler throws an error if the `assign` method is provided a first argument which is not a number... +{ + const out = new Float64Array( 2 ); + + ccis.assign( true, 2.0, out, 1, 0 ); // $ExpectError + ccis.assign( false, 2.0, out, 1, 0 ); // $ExpectError + ccis.assign( null, 2.0, out, 1, 0 ); // $ExpectError + ccis.assign( undefined, 2.0, out, 1, 0 ); // $ExpectError + ccis.assign( '5', 2.0, out, 1, 0 ); // $ExpectError + ccis.assign( [], 2.0, out, 1, 0 ); // $ExpectError + ccis.assign( {}, 2.0, out, 1, 0 ); // $ExpectError + ccis.assign( ( x: number ): number => x, 2.0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a second argument which is not a number... +{ + const out = new Float64Array( 2 ); + + ccis.assign( 1.0, true, out, 1, 0 ); // $ExpectError + ccis.assign( 1.0, false, out, 1, 0 ); // $ExpectError + ccis.assign( 1.0, null, out, 1, 0 ); // $ExpectError + ccis.assign( 1.0, undefined, out, 1, 0 ); // $ExpectError + ccis.assign( 1.0, '5', out, 1, 0 ); // $ExpectError + ccis.assign( 1.0, [], out, 1, 0 ); // $ExpectError + ccis.assign( 1.0, {}, out, 1, 0 ); // $ExpectError + ccis.assign( 1.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a third argument which is not a collection... +{ + ccis.assign( 1.0, 2.0, 1, 1, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, true, 1, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, false, 1, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, null, 1, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, undefined, 1, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, '5', 1, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, [ '5' ], 1, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, {}, 1, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... +{ + const out = new Float64Array( 2 ); + + ccis.assign( 1.0, 2.0, out, true, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, out, false, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, out, null, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, out, undefined, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, out, '5', 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, out, [], 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, out, {}, 0 ); // $ExpectError + ccis.assign( 1.0, 2.0, out, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a fifth argument which is not a number... +{ + const out = new Float64Array( 2 ); + + ccis.assign( 1.0, 2.0, out, 1, true ); // $ExpectError + ccis.assign( 1.0, 2.0, out, 1, false ); // $ExpectError + ccis.assign( 1.0, 2.0, out, 1, null ); // $ExpectError + ccis.assign( 1.0, 2.0, out, 1, undefined ); // $ExpectError + ccis.assign( 1.0, 2.0, out, 1, '5' ); // $ExpectError + ccis.assign( 1.0, 2.0, out, 1, [] ); // $ExpectError + ccis.assign( 1.0, 2.0, out, 1, {} ); // $ExpectError + ccis.assign( 1.0, 2.0, out, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... +{ + const out = new Float64Array( 2 ); + + ccis.assign(); // $ExpectError + ccis.assign( 1.0 ); // $ExpectError + ccis.assign( 1.0, 2.0 ); // $ExpectError + ccis.assign( 1.0, 2.0, out ); // $ExpectError + ccis.assign( 1.0, 2.0, out, 1 ); // $ExpectError + ccis.assign( 1.0, 2.0, out, 1, 0, {} ); // $ExpectError +} + +// Attached to the main export is a `strided` method which returns a collection... +{ + const z = new Float64Array( 2 ); + + ccis.strided( z, 1, 0, new Float64Array( 2 ), 1, 0 ); // $ExpectType Float64Array + ccis.strided( z, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array + ccis.strided( z, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] +} + +// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... +{ + const out = new Float64Array( 2 ); + + ccis.strided( true, 1, 0, out, 1, 0 ); // $ExpectError + ccis.strided( false, 1, 0, out, 1, 0 ); // $ExpectError + ccis.strided( null, 1, 0, out, 1, 0 ); // $ExpectError + ccis.strided( undefined, 1, 0, out, 1, 0 ); // $ExpectError + ccis.strided( '5', 1, 0, out, 1, 0 ); // $ExpectError + ccis.strided( [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError + ccis.strided( {}, 1, 0, out, 1, 0 ); // $ExpectError + ccis.strided( ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a second argument which is not a number... +{ + const z = new Float64Array( 2 ); + const out = new Float64Array( 2 ); + + ccis.strided( z, true, 0, out, 1, 0 ); // $ExpectError + ccis.strided( z, false, 0, out, 1, 0 ); // $ExpectError + ccis.strided( z, null, 0, out, 1, 0 ); // $ExpectError + ccis.strided( z, undefined, 0, out, 1, 0 ); // $ExpectError + ccis.strided( z, '5', 0, out, 1, 0 ); // $ExpectError + ccis.strided( z, [], 0, out, 1, 0 ); // $ExpectError + ccis.strided( z, {}, 0, out, 1, 0 ); // $ExpectError + ccis.strided( z, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a third argument which is not a number... +{ + const z = new Float64Array( 2 ); + const out = new Float64Array( 2 ); + + ccis.strided( z, 1, true, out, 1, 0 ); // $ExpectError + ccis.strided( z, 1, false, out, 1, 0 ); // $ExpectError + ccis.strided( z, 1, null, out, 1, 0 ); // $ExpectError + ccis.strided( z, 1, undefined, out, 1, 0 ); // $ExpectError + ccis.strided( z, 1, '5', out, 1, 0 ); // $ExpectError + ccis.strided( z, 1, [], out, 1, 0 ); // $ExpectError + ccis.strided( z, 1, {}, out, 1, 0 ); // $ExpectError + ccis.strided( z, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... +{ + const z = new Float64Array( 2 ); + + ccis.strided( z, 1, 0, 1, 1, 0 ); // $ExpectError + ccis.strided( z, 1, 0, true, 1, 0 ); // $ExpectError + ccis.strided( z, 1, 0, false, 1, 0 ); // $ExpectError + ccis.strided( z, 1, 0, null, 1, 0 ); // $ExpectError + ccis.strided( z, 1, 0, undefined, 1, 0 ); // $ExpectError + ccis.strided( z, 1, 0, '5', 1, 0 ); // $ExpectError + ccis.strided( z, 1, 0, [ '5' ], 1, 0 ); // $ExpectError + ccis.strided( z, 1, 0, {}, 1, 0 ); // $ExpectError + ccis.strided( z, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... +{ + const z = new Float64Array( 2 ); + const out = new Float64Array( 2 ); + + ccis.strided( z, 1, 0, out, true, 0 ); // $ExpectError + ccis.strided( z, 1, 0, out, false, 0 ); // $ExpectError + ccis.strided( z, 1, 0, out, null, 0 ); // $ExpectError + ccis.strided( z, 1, 0, out, undefined, 0 ); // $ExpectError + ccis.strided( z, 1, 0, out, '5', 0 ); // $ExpectError + ccis.strided( z, 1, 0, out, [], 0 ); // $ExpectError + ccis.strided( z, 1, 0, out, {}, 0 ); // $ExpectError + ccis.strided( z, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... +{ + const z = new Float64Array( 2 ); + const out = new Float64Array( 2 ); + + ccis.strided( z, 1, 0, out, 1, true ); // $ExpectError + ccis.strided( z, 1, 0, out, 1, false ); // $ExpectError + ccis.strided( z, 1, 0, out, 1, null ); // $ExpectError + ccis.strided( z, 1, 0, out, 1, undefined ); // $ExpectError + ccis.strided( z, 1, 0, out, 1, '5' ); // $ExpectError + ccis.strided( z, 1, 0, out, 1, [] ); // $ExpectError + ccis.strided( z, 1, 0, out, 1, {} ); // $ExpectError + ccis.strided( z, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... +{ + const z = new Float64Array( 2 ); + const out = new Float64Array( 2 ); + + ccis.strided(); // $ExpectError + ccis.strided( z ); // $ExpectError + ccis.strided( z, 1 ); // $ExpectError + ccis.strided( z, 1, 0 ); // $ExpectError + ccis.strided( z, 1, 0, out ); // $ExpectError + ccis.strided( z, 1, 0, out, 1 ); // $ExpectError + ccis.strided( z, 1, 0, out, 1, 0, {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/ccis/examples/c/example.c index 6a414984e68f..d8e41fa0edfd 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/ccis/examples/c/example.c @@ -21,7 +21,7 @@ #include "stdlib/complex/float64/reim.h" #include -int main() { +int main( void ) { const stdlib_complex128_t x[] = { stdlib_complex128( 3.14, 1.5 ), stdlib_complex128( -3.14, 1.5 ), diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/examples/index.js b/lib/node_modules/@stdlib/math/base/special/ccis/examples/index.js index 4bc8aafcb87e..bc4d60a1aae4 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/examples/index.js +++ b/lib/node_modules/@stdlib/math/base/special/ccis/examples/index.js @@ -18,16 +18,13 @@ 'use strict'; -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var logEachMap = require( '@stdlib/console/log-each-map' ); var ccis = require( './../lib' ); -var z1; -var z2; -var i; +// Create an array of random numbers: +var arr = new Complex128Array( uniform( 200, -50.0, 50.0 ) ); -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( uniform( -50.0, 50.0 ), uniform( -50.0, 50.0 ) ); - z2 = ccis( z1 ); - console.log( 'ccis(%s) = %s', z1.toString(), z2.toString() ); -} +// Compute the cis function of each number in the array: +logEachMap( 'ccis(%s) = %s', arr, ccis ); diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/lib/assign.js b/lib/node_modules/@stdlib/math/base/special/ccis/lib/assign.js new file mode 100644 index 000000000000..073f9fd22bdf --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/ccis/lib/assign.js @@ -0,0 +1,69 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 sincos = require( '@stdlib/math/base/special/sincos' ).assign; +var exp = require( '@stdlib/math/base/special/exp' ); + + +// VARIABLES // + +// Pre-allocate workspace array: +var WORKSPACE = [ 0.0, 0.0 ]; + + +// MAIN // + +/** +* Evaluates the cis function for a double-precision complex floating-point number and assigns results to a provided output array. +* +* @param {number} re - real component +* @param {number} im - imaginary component +* @param {Collection} out - output array +* @param {integer} strideOut - stride length +* @param {NonNegativeInteger} offsetOut - starting index +* @returns {Collection} output array +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var out = assign( 0.0, 0.0, new Float64Array( 2 ), 1, 0 ); +* // returns [ 1.0, 0.0 ] +*/ +function assign( re, im, out, strideOut, offsetOut ) { + var e; + + sincos( re, WORKSPACE, 1, 0 ); + if ( im === 0.0 ) { + out[ offsetOut ] = WORKSPACE[ 1 ]; + out[ offsetOut+strideOut ] = WORKSPACE[ 0 ]; + return out; + } + e = exp( -im ); + out[ offsetOut ] = WORKSPACE[ 1 ] * e; + out[ offsetOut+strideOut ] = WORKSPACE[ 0 ] * e; + return out; +} + + +// EXPORTS // + +module.exports = assign; diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/lib/index.js b/lib/node_modules/@stdlib/math/base/special/ccis/lib/index.js index cfff45a8c8d3..c2c9d9283264 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/lib/index.js +++ b/lib/node_modules/@stdlib/math/base/special/ccis/lib/index.js @@ -46,9 +46,20 @@ // MODULES // +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); var main = require( './main.js' ); +var assign = require( './assign.js' ); +var strided = require( './strided.js' ); + + +// MAIN // + +setReadOnly( main, 'assign', assign ); +setReadOnly( main, 'strided', strided ); // EXPORTS // module.exports = main; + +// exports: { "assign": "main.assign", "strided": "main.strided" } diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/lib/main.js b/lib/node_modules/@stdlib/math/base/special/ccis/lib/main.js index bc72cce7eb06..c651f9d59409 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/lib/main.js +++ b/lib/node_modules/@stdlib/math/base/special/ccis/lib/main.js @@ -20,17 +20,16 @@ // MODULES // -var sincos = require( '@stdlib/math/base/special/sincos' ).assign; -var exp = require( '@stdlib/math/base/special/exp' ); var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var Float64Array = require( '@stdlib/array/float64' ); var real = require( '@stdlib/complex/float64/real' ); var imag = require( '@stdlib/complex/float64/imag' ); +var assign = require( './assign.js' ); // VARIABLES // -// Pre-allocate workspace array: -var WORKSPACE = [ 0.0, 0.0 ]; +var out = new Float64Array( 2 ); // MAIN // @@ -60,20 +59,8 @@ var WORKSPACE = [ 0.0, 0.0 ]; * // returns [ ~0.540, ~0.841 ] */ function ccis( z ) { - var re; - var im; - var e; - - re = real( z ); - im = imag( z ); - - sincos( re, WORKSPACE, 1, 0 ); - if ( im !== 0.0 ) { - e = exp( -im ); - WORKSPACE[ 0 ] *= e; - WORKSPACE[ 1 ] *= e; - } - return new Complex128( WORKSPACE[ 1 ], WORKSPACE[ 0 ] ); + assign( real( z ), imag( z ), out, 1, 0 ); + return new Complex128( out[ 0 ], out[ 1 ] ); } diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/lib/strided.js b/lib/node_modules/@stdlib/math/base/special/ccis/lib/strided.js new file mode 100644 index 000000000000..a77ad2f4f9b3 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/ccis/lib/strided.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 assign = require( './assign.js' ); + + +// MAIN // + +/** +* Evaluates the cis function for a double-precision complex floating-point number stored in a real-valued strided array view and assigns results to a provided strided output array. +* +* @param {Float64Array} z - complex number view +* @param {integer} strideZ - stride length for `z` +* @param {NonNegativeInteger} offsetZ - starting index for `z` +* @param {Collection} out - output array +* @param {integer} strideOut - stride length for `out` +* @param {NonNegativeInteger} offsetOut - starting index for `out` +* @returns {Collection} output array +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var z = new Float64Array( [ 0.0, 0.0 ] ); +* +* var out = strided( z, 1, 0, new Float64Array( 2 ), 1, 0 ); +* // returns [ 1.0, 0.0 ] +*/ +function strided( z, strideZ, offsetZ, out, strideOut, offsetOut ) { + return assign( z[ offsetZ ], z[ offsetZ+strideZ ], out, strideOut, offsetOut ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = strided; diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/test/test.assign.js b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.assign.js new file mode 100644 index 000000000000..356ad1a34f0f --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.assign.js @@ -0,0 +1,193 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 tape = require( 'tape' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var PINF = require( '@stdlib/constants/float64/pinf' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var Float64Array = require( '@stdlib/array/float64' ); +var ccis = require( './../lib/assign.js' ); + + +// FIXTURES // + +var pureReal = require( './fixtures/julia/pure_real.json' ); +var generalComplex = require( './fixtures/julia/general_complex.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof ccis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function evaluates the cis function', function test( t ) { + var expected; + var out; + var v; + + out = new Float64Array( 2 ); + v = ccis( 0.0, 0.0, out, 1, 0 ); + + expected = new Float64Array( [ 1.0, 0.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + + out = new Float64Array( 4 ); + v = ccis( 0.0, 0.0, out, 2, 0 ); + + expected = new Float64Array( [ 1.0, 0.0, 0.0, 0.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + + out = new Float64Array( 4 ); + v = ccis( 0.0, 0.0, out, 2, 1 ); + + expected = new Float64Array( [ 0.0, 1.0, 0.0, 0.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + + out = new Float64Array( 4 ); + v = ccis( 0.0, 0.0, out, -2, 3 ); + + expected = new Float64Array( [ 0.0, 0.0, 0.0, 1.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes cis(z) for pure real z', function test( t ) { + var expected; + var cisre; + var cisim; + var out; + var re; + var im; + var i; + + re = pureReal.re; + im = pureReal.im; + cisre = pureReal.cisre; + cisim = pureReal.cisim; + + out = new Float64Array( 2 ); + + for ( i = 0; i < re.length; i++ ) { + ccis( re[ i ], im[ i ], out, 1, 0 ); + expected = new Float64Array( [ cisre[ i ], cisim[ i ] ] ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function computes cis(z) for complex z', function test( t ) { + var expected; + var cisre; + var cisim; + var out; + var re; + var im; + var i; + + re = generalComplex.re; + im = generalComplex.im; + cisre = generalComplex.cisre; + cisim = generalComplex.cisim; + + out = new Float64Array( 2 ); + + for ( i = 0; i < re.length; i++ ) { + ccis( re[ i ], im[ i ], out, 1, 0 ); + expected = new Float64Array( [ cisre[ i ], cisim[ i ] ] ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + } + t.end(); +}); + +tape( 'if real component is `+Infinity`, all components are `NaN`', function test( t ) { + var out = new Float64Array( 2 ); + + ccis( PINF, 0.0, out, 1, 0 ); + t.strictEqual( isnan( out[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if real component is `-Infinity`, all components are `NaN`', function test( t ) { + var out = new Float64Array( 2 ); + + ccis( NINF, 0.0, out, 1, 0 ); + t.strictEqual( isnan( out[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if imaginary component is `+Infinity`, all components are zero', function test( t ) { + var out = new Float64Array( 2 ); + + ccis( 1.0, PINF, out, 1, 0 ); + t.strictEqual( out[ 0 ], 0.0, 'returns expected value' ); + t.strictEqual( out[ 1 ], 0.0, 'returns expected value' ); + t.end(); +}); + +tape( 'if imaginary component is `-Infinity`, the function computes the correct result according to IEEE 754 rules', function test( t ) { + var out = new Float64Array( 2 ); + + ccis( 0.0, NINF, out, 1, 0 ); + + // The real component is computed as Infinity * 1.0 = Infinity: + t.strictEqual( out[ 0 ], PINF, 'returns expected value' ); + + // The imaginary component is computed as Infinity * 0.0 = NaN: + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', function test( t ) { + var out; + + out = new Float64Array( 2 ); + ccis( NaN, 3.0, out, 1, 0 ); + t.strictEqual( isnan( out[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + + out = new Float64Array( 2 ); + ccis( 5.0, NaN, out, 1, 0 ); + t.strictEqual( isnan( out[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + + out = new Float64Array( 2 ); + ccis( NaN, NaN, out, 1, 0 ); + t.strictEqual( isnan( out[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/test/test.js b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.js index bccd2755bc92..08ecea7c47f4 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.js @@ -21,22 +21,10 @@ // MODULES // var tape = require( 'tape' ); -var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var real = require( '@stdlib/complex/float64/real' ); -var imag = require( '@stdlib/complex/float64/imag' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); +var isMethod = require( '@stdlib/assert/is-method' ); var ccis = require( './../lib' ); -// FIXTURES // - -var pureReal = require( './fixtures/julia/pure_real.json' ); -var generalComplex = require( './fixtures/julia/general_complex.json' ); - - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,121 +33,12 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function evaluates the cis function for a double-precision complex floating-point number', function test( t ) { - var v; - var z; - - z = new Complex128( 0.0, 0.0 ); - v = ccis( z ); - - t.strictEqual( real( v ), 1.0, 'returns expected value' ); - t.strictEqual( imag( v ), 0.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function computes cis(z) for pure real z', function test( t ) { - var cisre; - var cisim; - var re; - var im; - var i; - var q; - var z; - - re = pureReal.re; - im = pureReal.im; - cisre = pureReal.cisre; - cisim = pureReal.cisim; - - for ( i = 0; i < re.length; i++ ) { - z = new Complex128( re[ i ], im[ i ] ); - q = ccis( z ); - - t.strictEqual( isAlmostSameValue( real( q ), cisre[ i ], 0 ), true, 'returns expected value' ); - t.strictEqual( isAlmostSameValue( imag( q ), cisim[ i ], 0 ), true, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function computes cis(z) for complex z', function test( t ) { - var cisre; - var cisim; - var re; - var im; - var i; - var q; - var z; - - re = generalComplex.re; - im = generalComplex.im; - cisre = generalComplex.cisre; - cisim = generalComplex.cisim; - - for ( i = 0; i < re.length; i++ ) { - z = new Complex128( re[ i ], im[ i ] ); - q = ccis( z ); - - t.strictEqual( isAlmostSameValue( real( q ), cisre[ i ], 0 ), true, 'returns expected value' ); - t.strictEqual( isAlmostSameValue( imag( q ), cisim[ i ], 0 ), true, 'returns expected value' ); - } - t.end(); -}); - -tape( 'if real component is `+Infinity`, all components are `NaN`', function test( t ) { - var v; - - v = ccis( new Complex128( PINF, 0.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'if real component is `-Infinity`, all components are `NaN`', function test( t ) { - var v; - - v = ccis( new Complex128( NINF, 0.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'if imaginary component is `+Infinity`, all components are zero', function test( t ) { - var v; - - v = ccis( new Complex128( 1.0, PINF ) ); - t.strictEqual( real( v ), 0.0, 'returns expected value' ); - t.strictEqual( imag( v ), 0.0, 'returns expected value' ); - t.end(); -}); - -tape( 'if imaginary component is `-Infinity`, the function computes the correct result according to IEEE 754 rules', function test( t ) { - var v; - - v = ccis( new Complex128( 0.0, NINF ) ); - - // The real component is computed as Infinity * 1.0 = Infinity: - t.strictEqual( real( v ), PINF, 'returns expected value' ); - - // The imaginary component is computed as Infinity * 0.0 = NaN: - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); +tape( 'attached to the main export is an `assign` method', function test( t ) { + t.strictEqual( isMethod( ccis, 'assign' ), true, 'returns expected value' ); t.end(); }); -tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', function test( t ) { - var v; - - v = ccis( new Complex128( NaN, 3.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - v = ccis( new Complex128( 5.0, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - v = ccis( new Complex128( NaN, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - +tape( 'attached to the main export is a `strided` method', function test( t ) { + t.strictEqual( isMethod( ccis, 'strided' ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/test/test.main.js b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.main.js new file mode 100644 index 000000000000..c0ccee050ef1 --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.main.js @@ -0,0 +1,165 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); +var PINF = require( '@stdlib/constants/float64/pinf' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var ccis = require( './../lib' ); + + +// FIXTURES // + +var pureReal = require( './fixtures/julia/pure_real.json' ); +var generalComplex = require( './fixtures/julia/general_complex.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof ccis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function evaluates the cis function for a double-precision complex floating-point number', function test( t ) { + var v; + var z; + + z = new Complex128( 0.0, 0.0 ); + v = ccis( z ); + + t.strictEqual( real( v ), 1.0, 'returns expected value' ); + t.strictEqual( imag( v ), 0.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes cis(z) for pure real z', function test( t ) { + var cisre; + var cisim; + var re; + var im; + var i; + var q; + var z; + + re = pureReal.re; + im = pureReal.im; + cisre = pureReal.cisre; + cisim = pureReal.cisim; + + for ( i = 0; i < re.length; i++ ) { + z = new Complex128( re[ i ], im[ i ] ); + q = ccis( z ); + + t.strictEqual( isAlmostSameValue( real( q ), cisre[ i ], 0 ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( imag( q ), cisim[ i ], 0 ), true, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function computes cis(z) for complex z', function test( t ) { + var cisre; + var cisim; + var re; + var im; + var i; + var q; + var z; + + re = generalComplex.re; + im = generalComplex.im; + cisre = generalComplex.cisre; + cisim = generalComplex.cisim; + + for ( i = 0; i < re.length; i++ ) { + z = new Complex128( re[ i ], im[ i ] ); + q = ccis( z ); + + t.strictEqual( isAlmostSameValue( real( q ), cisre[ i ], 0 ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( imag( q ), cisim[ i ], 0 ), true, 'returns expected value' ); + } + t.end(); +}); + +tape( 'if real component is `+Infinity`, all components are `NaN`', function test( t ) { + var v; + + v = ccis( new Complex128( PINF, 0.0 ) ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if real component is `-Infinity`, all components are `NaN`', function test( t ) { + var v; + + v = ccis( new Complex128( NINF, 0.0 ) ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if imaginary component is `+Infinity`, all components are zero', function test( t ) { + var v; + + v = ccis( new Complex128( 1.0, PINF ) ); + t.strictEqual( real( v ), 0.0, 'returns expected value' ); + t.strictEqual( imag( v ), 0.0, 'returns expected value' ); + t.end(); +}); + +tape( 'if imaginary component is `-Infinity`, the function computes the correct result according to IEEE 754 rules', function test( t ) { + var v; + + v = ccis( new Complex128( 0.0, NINF ) ); + + // The real component is computed as Infinity * 1.0 = Infinity: + t.strictEqual( real( v ), PINF, 'returns expected value' ); + + // The imaginary component is computed as Infinity * 0.0 = NaN: + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', function test( t ) { + var v; + + v = ccis( new Complex128( NaN, 3.0 ) ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); + + v = ccis( new Complex128( 5.0, NaN ) ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); + + v = ccis( new Complex128( NaN, NaN ) ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.native.js index 5ba701e6ca01..5d8b7dbca2f5 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.native.js @@ -133,7 +133,7 @@ tape( 'if real component is `-Infinity`, all components are `NaN`', opts, functi t.end(); }); -tape( 'if imaginary component is `+Infinity`, all components are zeros', opts, function test( t ) { +tape( 'if imaginary component is `+Infinity`, all components are zero', opts, function test( t ) { var v; v = ccis( new Complex128( 1.0, PINF ) ); diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/test/test.strided.js b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.strided.js new file mode 100644 index 000000000000..47d897bfec4f --- /dev/null +++ b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.strided.js @@ -0,0 +1,214 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 tape = require( 'tape' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var PINF = require( '@stdlib/constants/float64/pinf' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var Float64Array = require( '@stdlib/array/float64' ); +var ccis = require( './../lib/strided.js' ); + + +// FIXTURES // + +var pureReal = require( './fixtures/julia/pure_real.json' ); +var generalComplex = require( './fixtures/julia/general_complex.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof ccis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function evaluates the cis function', function test( t ) { + var expected; + var out; + var z; + var v; + + z = new Float64Array( [ 0.0, 0.0 ] ); + out = new Float64Array( 2 ); + v = ccis( z, 1, 0, out, 1, 0 ); + + expected = new Float64Array( [ 1.0, 0.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + + z = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + out = new Float64Array( 4 ); + v = ccis( z, 2, 0, out, 2, 0 ); + + expected = new Float64Array( [ 1.0, 0.0, 0.0, 0.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + + z = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + out = new Float64Array( 4 ); + v = ccis( z, 2, 1, out, 2, 1 ); + + expected = new Float64Array( [ 0.0, 1.0, 0.0, 0.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + + z = new Float64Array( [ 0.0, 0.0 ] ); + out = new Float64Array( 4 ); + v = ccis( z, -1, 1, out, -2, 3 ); + + expected = new Float64Array( [ 0.0, 0.0, 0.0, 1.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes cis(z) for pure real z', function test( t ) { + var expected; + var cisre; + var cisim; + var out; + var re; + var im; + var z; + var i; + + re = pureReal.re; + im = pureReal.im; + cisre = pureReal.cisre; + cisim = pureReal.cisim; + + z = new Float64Array( 2 ); + out = new Float64Array( 2 ); + + for ( i = 0; i < re.length; i++ ) { + z[ 0 ] = re[ i ]; + z[ 1 ] = im[ i ]; + ccis( z, 1, 0, out, 1, 0 ); + expected = new Float64Array( [ cisre[ i ], cisim[ i ] ] ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + } + t.end(); +}); + +tape( 'the function computes cis(z) for complex z', function test( t ) { + var expected; + var cisre; + var cisim; + var out; + var re; + var im; + var z; + var i; + + re = generalComplex.re; + im = generalComplex.im; + cisre = generalComplex.cisre; + cisim = generalComplex.cisim; + + z = new Float64Array( 2 ); + out = new Float64Array( 2 ); + + for ( i = 0; i < re.length; i++ ) { + z[ 0 ] = re[ i ]; + z[ 1 ] = im[ i ]; + ccis( z, 1, 0, out, 1, 0 ); + expected = new Float64Array( [ cisre[ i ], cisim[ i ] ] ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + } + t.end(); +}); + +tape( 'if real component is `+Infinity`, all components are `NaN`', function test( t ) { + var out = new Float64Array( 2 ); + var z = new Float64Array( [ PINF, 0.0 ] ); + + ccis( z, 1, 0, out, 1, 0 ); + t.strictEqual( isnan( out[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if real component is `-Infinity`, all components are `NaN`', function test( t ) { + var out = new Float64Array( 2 ); + var z = new Float64Array( [ NINF, 0.0 ] ); + + ccis( z, 1, 0, out, 1, 0 ); + t.strictEqual( isnan( out[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if imaginary component is `+Infinity`, all components are zero', function test( t ) { + var out = new Float64Array( 2 ); + var z = new Float64Array( [ 1.0, PINF ] ); + + ccis( z, 1, 0, out, 1, 0 ); + t.strictEqual( out[ 0 ], 0.0, 'returns expected value' ); + t.strictEqual( out[ 1 ], 0.0, 'returns expected value' ); + t.end(); +}); + +tape( 'if imaginary component is `-Infinity`, the function computes the correct result according to IEEE 754 rules', function test( t ) { + var out = new Float64Array( 2 ); + var z = new Float64Array( [ 0.0, NINF ] ); + + ccis( z, 1, 0, out, 1, 0 ); + + // The real component is computed as Infinity * 1.0 = Infinity: + t.strictEqual( out[ 0 ], PINF, 'returns expected value' ); + + // The imaginary component is computed as Infinity * 0.0 = NaN: + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', function test( t ) { + var out; + var z; + + z = new Float64Array( [ NaN, 3.0 ] ); + out = new Float64Array( 2 ); + ccis( z, 1, 0, out, 1, 0 ); + t.strictEqual( isnan( out[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + + z = new Float64Array( [ 5.0, NaN ] ); + out = new Float64Array( 2 ); + ccis( z, 1, 0, out, 1, 0 ); + t.strictEqual( isnan( out[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + + z = new Float64Array( [ NaN, NaN ] ); + out = new Float64Array( 2 ); + ccis( z, 1, 0, out, 1, 0 ); + t.strictEqual( isnan( out[ 0 ] ), true, 'returns expected value' ); + t.strictEqual( isnan( out[ 1 ] ), true, 'returns expected value' ); + + t.end(); +}); From c952486f18dd6a9f8add98c732d52605cdfb10f1 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sat, 10 Oct 2026 21:06:42 -0700 Subject: [PATCH 2/2] chore: align `math/base/special/ccis` with current project conventions --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: passed - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/math/base/special/ccis/README.md | 16 ++++++++-------- .../special/ccis/benchmark/julia/benchmark.jl | 4 ++-- .../special/ccis/benchmark/python/benchmark.py | 6 +++--- .../math/base/special/ccis/examples/c/example.c | 14 +++++++------- .../@stdlib/math/base/special/ccis/package.json | 8 ++++++-- .../@stdlib/math/base/special/ccis/src/main.c | 4 ++-- 6 files changed, 28 insertions(+), 24 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/README.md b/lib/node_modules/@stdlib/math/base/special/ccis/README.md index 60759ac86125..7360b0736112 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/README.md +++ b/lib/node_modules/@stdlib/math/base/special/ccis/README.md @@ -223,7 +223,7 @@ stdlib_complex128_t stdlib_base_ccis( const stdlib_complex128_t z ); #include "stdlib/complex/float64/reim.h" #include -int main() { +int main( void ) { const stdlib_complex128_t x[] = { stdlib_complex128( 3.14, 1.5 ), stdlib_complex128( -3.14, 1.5 ), @@ -233,17 +233,17 @@ int main() { stdlib_complex128_t v; stdlib_complex128_t y; - double re; - double im; + double re1; + double im1; + double re2; + double im2; int i; for ( i = 0; i < 4; i++ ) { v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - y = stdlib_base_ccis( v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "ccis(z) = %lf + %lfi\n", re, im ); + stdlib_complex128_reim( v, &re1, &im1 ); + stdlib_complex128_reim( y, &re2, &im2 ); + printf( "ccis(%lf + %lfi) = %lf + %lfi\n", re1, im1, re2, im2 ); } } ``` diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/julia/benchmark.jl b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/julia/benchmark.jl index c23fe82d22d6..b877e12642b2 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/julia/benchmark.jl +++ b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/julia/benchmark.jl @@ -20,7 +20,7 @@ import BenchmarkTools using Printf # Benchmark variables: -name = "cis"; +name = "ccis"; repeats = 3; """ @@ -136,7 +136,7 @@ function main() @printf( "# julia::%s\n", name ); results = benchmark(); print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); + @printf( "ok %d benchmark finished\n", i ); end print_summary( repeats, repeats ); end diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/python/benchmark.py b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/python/benchmark.py index 91c0d32357ec..67e0de273dbe 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/python/benchmark.py +++ b/lib/node_modules/@stdlib/math/base/special/ccis/benchmark/python/benchmark.py @@ -16,12 +16,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Benchmark cis.""" +"""Benchmark ccis.""" from __future__ import print_function import timeit -NAME = "cis" +NAME = "ccis" REPEATS = 3 ITERATIONS = 1000000 @@ -73,7 +73,7 @@ def print_results(elapsed): def benchmark(): """Run the benchmark and print benchmark results.""" setup = "from random import random; from math import sin, cos, exp;" - stmt = "re = ( random() * 100.0 ) - 50.0; im = ( random() * 100.0 ) - 50.0; y = ( cos( re ) + 1.0j * sin( re ) ) / exp( im );" + stmt = "re = (random()*100.0) - 50.0; im = (random()*100.0) - 50.0; y = (cos(re) + 1.0j * sin(re)) / exp(im);" t = timeit.Timer(stmt, setup=setup) diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/ccis/examples/c/example.c index d8e41fa0edfd..8309e950045d 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/ccis/examples/c/example.c @@ -31,16 +31,16 @@ int main( void ) { stdlib_complex128_t v; stdlib_complex128_t y; - double re; - double im; + double re1; + double im1; + double re2; + double im2; int i; for ( i = 0; i < 4; i++ ) { v = x[ i ]; - stdlib_complex128_reim( v, &re, &im ); - printf( "z = %lf + %lfi\n", re, im ); - y = stdlib_base_ccis( v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "ccis(z) = %lf + %lfi\n", re, im ); + stdlib_complex128_reim( v, &re1, &im1 ); + stdlib_complex128_reim( y, &re2, &im2 ); + printf( "ccis(%lf + %lfi) = %lf + %lfi\n", re1, im1, re2, im2 ); } } diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/package.json b/lib/node_modules/@stdlib/math/base/special/ccis/package.json index 89849de4fa1c..29fb1be58743 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/package.json +++ b/lib/node_modules/@stdlib/math/base/special/ccis/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/math/base/special/ccis", "version": "0.0.0", - "description": "Compute the ccis function of a double-precision complex floating-point number.", + "description": "Evaluate the cis function for a double-precision complex floating-point number.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", @@ -60,7 +60,11 @@ "arithmetic", "complex", "cmplx", - "number" + "number", + "exponential", + "euler", + "exp", + "ccis" ], "__stdlib__": { "scaffold": { diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/src/main.c b/lib/node_modules/@stdlib/math/base/special/ccis/src/main.c index f1921c5a2b7e..4d5a12fc671a 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/ccis/src/main.c @@ -25,8 +25,8 @@ /** * Evaluates the cis function for a double-precision complex floating-point number. * -* @param z input value -* @return result +* @param z input value +* @return result * * @example * #include "stdlib/complex/float64/ctor.h"