From 60a012e9125c585fea6c3871da8fd7f2c26eae45 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jul 2024 03:43:04 +0000 Subject: [PATCH] Auto-generated commit --- CHANGELOG.md | 44 +++ base/ops/README.md | 8 +- base/ops/cdiv/README.md | 4 +- base/ops/cmul/README.md | 240 ---------------- base/ops/cmul/benchmark/benchmark.js | 60 ---- base/ops/cmul/benchmark/benchmark.native.js | 69 ----- base/ops/cmul/benchmark/c/Makefile | 126 -------- base/ops/cmul/benchmark/c/benchmark.c | 148 ---------- base/ops/cmul/benchmark/c/native/Makefile | 146 ---------- base/ops/cmul/benchmark/c/native/benchmark.c | 150 ---------- base/ops/cmul/benchmark/julia/REQUIRE | 2 - base/ops/cmul/benchmark/julia/benchmark.jl | 144 ---------- base/ops/cmul/binding.gyp | 170 ----------- base/ops/cmul/docs/repl.txt | 33 --- base/ops/cmul/docs/types/index.d.ts | 57 ---- base/ops/cmul/docs/types/test.ts | 67 ----- base/ops/cmul/examples/c/Makefile | 146 ---------- base/ops/cmul/examples/c/example.c | 46 --- base/ops/cmul/examples/index.js | 37 --- base/ops/cmul/include.gypi | 53 ---- .../cmul/include/stdlib/math/base/ops/cmul.h | 40 --- base/ops/cmul/lib/index.js | 55 ---- base/ops/cmul/lib/main.js | 70 ----- base/ops/cmul/lib/native.js | 65 ----- base/ops/cmul/manifest.json | 75 ----- base/ops/cmul/package.json | 69 ----- base/ops/cmul/src/Makefile | 70 ----- base/ops/cmul/src/addon.c | 23 -- base/ops/cmul/src/main.c | 61 ---- base/ops/cmul/test/test.js | 110 ------- base/ops/cmul/test/test.native.js | 119 -------- base/ops/cmulf/README.md | 240 ---------------- base/ops/cmulf/benchmark/benchmark.js | 60 ---- base/ops/cmulf/benchmark/benchmark.native.js | 69 ----- base/ops/cmulf/benchmark/c/Makefile | 126 -------- base/ops/cmulf/benchmark/c/benchmark.c | 148 ---------- base/ops/cmulf/benchmark/c/native/Makefile | 146 ---------- base/ops/cmulf/benchmark/c/native/benchmark.c | 150 ---------- base/ops/cmulf/benchmark/julia/REQUIRE | 2 - base/ops/cmulf/benchmark/julia/benchmark.jl | 144 ---------- base/ops/cmulf/binding.gyp | 170 ----------- base/ops/cmulf/docs/repl.txt | 33 --- base/ops/cmulf/docs/types/index.d.ts | 57 ---- base/ops/cmulf/docs/types/test.ts | 67 ----- base/ops/cmulf/examples/c/Makefile | 146 ---------- base/ops/cmulf/examples/c/example.c | 46 --- base/ops/cmulf/examples/index.js | 37 --- base/ops/cmulf/include.gypi | 53 ---- .../include/stdlib/math/base/ops/cmulf.h | 40 --- base/ops/cmulf/lib/index.js | 55 ---- base/ops/cmulf/lib/main.js | 71 ----- base/ops/cmulf/lib/native.js | 65 ----- base/ops/cmulf/manifest.json | 75 ----- base/ops/cmulf/package.json | 69 ----- base/ops/cmulf/src/Makefile | 70 ----- base/ops/cmulf/src/addon.c | 23 -- base/ops/cmulf/src/main.c | 61 ---- base/ops/cmulf/test/test.js | 110 ------- base/ops/cmulf/test/test.native.js | 119 -------- base/ops/csub/README.md | 4 +- base/ops/csubf/README.md | 4 +- base/ops/docs/types/index.d.ts | 4 +- base/ops/lib/index.js | 36 +-- strided/ops/mul/lib/data.js | 4 +- strided/ops/mul/manifest.json | 4 +- strided/ops/mul/src/addon.c | 268 +++++++++--------- 66 files changed, 212 insertions(+), 5071 deletions(-) delete mode 100644 base/ops/cmul/README.md delete mode 100644 base/ops/cmul/benchmark/benchmark.js delete mode 100644 base/ops/cmul/benchmark/benchmark.native.js delete mode 100644 base/ops/cmul/benchmark/c/Makefile delete mode 100644 base/ops/cmul/benchmark/c/benchmark.c delete mode 100644 base/ops/cmul/benchmark/c/native/Makefile delete mode 100644 base/ops/cmul/benchmark/c/native/benchmark.c delete mode 100644 base/ops/cmul/benchmark/julia/REQUIRE delete mode 100644 base/ops/cmul/benchmark/julia/benchmark.jl delete mode 100644 base/ops/cmul/binding.gyp delete mode 100644 base/ops/cmul/docs/repl.txt delete mode 100644 base/ops/cmul/docs/types/index.d.ts delete mode 100644 base/ops/cmul/docs/types/test.ts delete mode 100644 base/ops/cmul/examples/c/Makefile delete mode 100644 base/ops/cmul/examples/c/example.c delete mode 100644 base/ops/cmul/examples/index.js delete mode 100644 base/ops/cmul/include.gypi delete mode 100644 base/ops/cmul/include/stdlib/math/base/ops/cmul.h delete mode 100644 base/ops/cmul/lib/index.js delete mode 100644 base/ops/cmul/lib/main.js delete mode 100644 base/ops/cmul/lib/native.js delete mode 100644 base/ops/cmul/manifest.json delete mode 100644 base/ops/cmul/package.json delete mode 100644 base/ops/cmul/src/Makefile delete mode 100644 base/ops/cmul/src/addon.c delete mode 100644 base/ops/cmul/src/main.c delete mode 100644 base/ops/cmul/test/test.js delete mode 100644 base/ops/cmul/test/test.native.js delete mode 100644 base/ops/cmulf/README.md delete mode 100644 base/ops/cmulf/benchmark/benchmark.js delete mode 100644 base/ops/cmulf/benchmark/benchmark.native.js delete mode 100644 base/ops/cmulf/benchmark/c/Makefile delete mode 100644 base/ops/cmulf/benchmark/c/benchmark.c delete mode 100644 base/ops/cmulf/benchmark/c/native/Makefile delete mode 100644 base/ops/cmulf/benchmark/c/native/benchmark.c delete mode 100644 base/ops/cmulf/benchmark/julia/REQUIRE delete mode 100644 base/ops/cmulf/benchmark/julia/benchmark.jl delete mode 100644 base/ops/cmulf/binding.gyp delete mode 100644 base/ops/cmulf/docs/repl.txt delete mode 100644 base/ops/cmulf/docs/types/index.d.ts delete mode 100644 base/ops/cmulf/docs/types/test.ts delete mode 100644 base/ops/cmulf/examples/c/Makefile delete mode 100644 base/ops/cmulf/examples/c/example.c delete mode 100644 base/ops/cmulf/examples/index.js delete mode 100644 base/ops/cmulf/include.gypi delete mode 100644 base/ops/cmulf/include/stdlib/math/base/ops/cmulf.h delete mode 100644 base/ops/cmulf/lib/index.js delete mode 100644 base/ops/cmulf/lib/main.js delete mode 100644 base/ops/cmulf/lib/native.js delete mode 100644 base/ops/cmulf/manifest.json delete mode 100644 base/ops/cmulf/package.json delete mode 100644 base/ops/cmulf/src/Makefile delete mode 100644 base/ops/cmulf/src/addon.c delete mode 100644 base/ops/cmulf/src/main.c delete mode 100644 base/ops/cmulf/test/test.js delete mode 100644 base/ops/cmulf/test/test.native.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 80ef3cd28..8ca184fcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -671,6 +671,20 @@ This release closes the following issue: +
+ +##### BREAKING CHANGES + +- [`b82c6f0`](https://github.com/stdlib-js/stdlib/commit/b82c6f020ef6fe6b045fc71ccf773bb18c451303): remove `math/base/ops/cmul` + + - To migrate, users should update their require/import paths to use + `@stdlib/complex/float64/base/mul` which provides the same API and + implementation. + +
+ + + @@ -693,6 +707,20 @@ This release closes the following issue: +
+ +##### BREAKING CHANGES + +- [`4aa299e`](https://github.com/stdlib-js/stdlib/commit/4aa299e35880a36de22c0c483bb128057b6e3784): remove `math/base/ops/cmulf` + + - To migrate, users should update their require/import paths to use + `@stdlib/complex/float32/base/mul` which provides the same API and + implementation. + +
+ + + @@ -5240,6 +5268,18 @@ This release closes the following issue: ### BREAKING CHANGES +- [`b82c6f0`](https://github.com/stdlib-js/stdlib/commit/b82c6f020ef6fe6b045fc71ccf773bb18c451303): remove `math/base/ops/cmul` + + - To migrate, users should update their require/import paths to use + `@stdlib/complex/float64/base/mul` which provides the same API and + implementation. + +- [`4aa299e`](https://github.com/stdlib-js/stdlib/commit/4aa299e35880a36de22c0c483bb128057b6e3784): remove `math/base/ops/cmulf` + + - To migrate, users should update their require/import paths to use + `@stdlib/complex/float32/base/mul` which provides the same API and + implementation. + - [`691e774`](https://github.com/stdlib-js/stdlib/commit/691e774930ab3d983998e53ad16dbf4bd5eb0c76): make base parameter compulsory in `math/base/special/floorsd` - [`691e774`](https://github.com/stdlib-js/stdlib/commit/691e774930ab3d983998e53ad16dbf4bd5eb0c76): The base parameter must now be provided explicitly. @@ -5329,6 +5369,10 @@ A total of 29 people contributed to this release. Thank you to the following con
+- [`b82c6f0`](https://github.com/stdlib-js/stdlib/commit/b82c6f020ef6fe6b045fc71ccf773bb18c451303) - **remove:** remove `math/base/ops/cmul` _(by Athan Reines)_ +- [`e3a3679`](https://github.com/stdlib-js/stdlib/commit/e3a3679f1e733cf02ce47cdc4bd0137bd37bef41) - **refactor:** update paths _(by Athan Reines)_ +- [`4aa299e`](https://github.com/stdlib-js/stdlib/commit/4aa299e35880a36de22c0c483bb128057b6e3784) - **remove:** remove `math/base/ops/cmulf` _(by Athan Reines)_ +- [`ddd4403`](https://github.com/stdlib-js/stdlib/commit/ddd44032f9d8a6d318c80e3b239ff72280ffc599) - **refactor:** update paths _(by Athan Reines)_ - [`310150f`](https://github.com/stdlib-js/stdlib/commit/310150f9e910eb0b202ef2cefcf6a99d1ee0c1ed) - **docs:** fix notes [(#2623)](https://github.com/stdlib-js/stdlib/pull/2623) _(by Gunj Joshi)_ - [`81b48ae`](https://github.com/stdlib-js/stdlib/commit/81b48aeb9d5d2b16fe039f9db7e710c95a35585f) - **feat:** update namespace TypeScript declarations [(##2621)](#2621) _(by stdlib-bot, Philipp Burckhardt)_ - [`691e774`](https://github.com/stdlib-js/stdlib/commit/691e774930ab3d983998e53ad16dbf4bd5eb0c76) - **refactor:** make base parameter compulsory in `math/base/special/floorsd` [(##2617)](#2617) _(by Gunj Joshi)_ diff --git a/base/ops/README.md b/base/ops/README.md index d9b11249c..eedb55c38 100644 --- a/base/ops/README.md +++ b/base/ops/README.md @@ -53,8 +53,8 @@ The namespace contains the following functions: - [`cadd( z1, z2 )`][@stdlib/complex/float64/base/add]: add two double-precision complex floating-point numbers. - [`caddf( z1, z2 )`][@stdlib/complex/float32/base/add]: add two single-precision complex floating-point numbers. - [`cdiv( z1, z2 )`][@stdlib/math/base/ops/cdiv]: divide two double-precision complex floating-point numbers. -- [`cmul( z1, z2 )`][@stdlib/math/base/ops/cmul]: multiply two double-precision complex floating-point numbers. -- [`cmulf( z1, z2 )`][@stdlib/math/base/ops/cmulf]: multiply two single-precision complex floating-point numbers. +- [`cmul( z1, z2 )`][@stdlib/complex/float64/base/mul]: multiply two double-precision complex floating-point numbers. +- [`cmulf( z1, z2 )`][@stdlib/complex/float32/base/mul]: multiply two single-precision complex floating-point numbers. - [`cneg( z )`][@stdlib/math/base/ops/cneg]: negate a double-precision complex floating-point number. - [`cnegf( z )`][@stdlib/math/base/ops/cnegf]: negate a single-precision complex floating-point number. - [`csub( z1, z2 )`][@stdlib/math/base/ops/csub]: subtract two double-precision complex floating-point numbers. @@ -160,9 +160,9 @@ console.log( ns.imuldw( 0x80000000|0, 0x40000000|0 ) ); [@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math/tree/main/base/ops/cdiv -[@stdlib/math/base/ops/cmul]: https://github.com/stdlib-js/math/tree/main/base/ops/cmul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul -[@stdlib/math/base/ops/cmulf]: https://github.com/stdlib-js/math/tree/main/base/ops/cmulf +[@stdlib/complex/float32/base/mul]: https://github.com/stdlib-js/complex-float32-base-mul [@stdlib/math/base/ops/cneg]: https://github.com/stdlib-js/math/tree/main/base/ops/cneg diff --git a/base/ops/cdiv/README.md b/base/ops/cdiv/README.md index d29927772..c167e04ea 100644 --- a/base/ops/cdiv/README.md +++ b/base/ops/cdiv/README.md @@ -234,7 +234,7 @@ int main( void ) { ## See Also - [`@stdlib/complex/float64/base/add`][@stdlib/complex/float64/base/add]: add two double-precision complex floating-point numbers. -- [`@stdlib/math/base/ops/cmul`][@stdlib/math/base/ops/cmul]: multiply two double-precision complex floating-point numbers. +- [`@stdlib/complex/float64/base/mul`][@stdlib/complex/float64/base/mul]: multiply two double-precision complex floating-point numbers. - [`@stdlib/math/base/ops/csub`][@stdlib/math/base/ops/csub]: subtract two double-precision complex floating-point numbers. @@ -257,7 +257,7 @@ int main( void ) { [@stdlib/complex/float64/base/add]: https://github.com/stdlib-js/complex-float64-base-add -[@stdlib/math/base/ops/cmul]: https://github.com/stdlib-js/math/tree/main/base/ops/cmul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul [@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math/tree/main/base/ops/csub diff --git a/base/ops/cmul/README.md b/base/ops/cmul/README.md deleted file mode 100644 index 987851cd5..000000000 --- a/base/ops/cmul/README.md +++ /dev/null @@ -1,240 +0,0 @@ - - -# cmul - -> Multiply two double-precision complex floating-point numbers. - -
- -
- - - -
- -## Usage - -```javascript -var cmul = require( '@stdlib/math/base/ops/cmul' ); -``` - -#### cmul( z1, z2 ) - -Multiplies two double-precision complex floating-point numbers. - -```javascript -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var real = require( '@stdlib/complex/float64/real' ); -var imag = require( '@stdlib/complex/float64/imag' ); - -var z1 = new Complex128( 5.0, 3.0 ); -var z2 = new Complex128( -2.0, 1.0 ); - -var v = cmul( z1, z2 ); -// returns - -var re = real( v ); -// returns -13.0 - -var im = imag( v ); -// returns -1.0 -``` - -
- - - -
- -## Examples - - - -```javascript -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; -var cmul = require( '@stdlib/math/base/ops/cmul' ); - -var rand; -var z1; -var z2; -var z3; -var i; - -rand = discreteUniform( -50, 50 ); -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = cmul( z1, z2 ); - console.log( '(%s) * (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} -``` - -
- - - - - -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/math/base/ops/cmul.h" -``` - -#### stdlib_base_cmul( z1, z2 ) - -Multiplies two double-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" - -stdlib_complex128_t z1 = stdlib_complex128( 5.0, 3.0 ); -stdlib_complex128_t z2 = stdlib_complex128( -2.0, 1.0 ); - -stdlib_complex128_t out = stdlib_base_cmul( z1, z2 ); - -double re = stdlib_complex128_real( out ); -// returns -13.0 - -double im = stdlib_complex128_imag( out ); -// returns -1.0 -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex128_t` input value. -- **z2**: `[in] stdlib_complex128_t` input value. - -```c -stdlib_complex128_t stdlib_base_cmul( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/math/base/ops/cmul.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - 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_cmul( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cmul(z, z) = %lf + %lfi\n", re, im ); - } -} -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/base/ops/cmul/benchmark/benchmark.js b/base/ops/cmul/benchmark/benchmark.js deleted file mode 100644 index 31aba62a0..000000000 --- a/base/ops/cmul/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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/base/uniform' ); -var isnan = require( './../../../../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 pkg = require( './../package.json' ).name; -var cmul = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - 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 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cmul( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/ops/cmul/benchmark/benchmark.native.js b/base/ops/cmul/benchmark/benchmark.native.js deleted file mode 100644 index e19deef3c..000000000 --- a/base/ops/cmul/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/base/uniform' ); -var isnan = require( './../../../../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 tryRequire = require( '@stdlib/utils/try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cmul = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cmul instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - 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 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cmul( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnan( real( out ) ) || isnan( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/ops/cmul/benchmark/c/Makefile b/base/ops/cmul/benchmark/c/Makefile deleted file mode 100644 index d7adc1ad0..000000000 --- a/base/ops/cmul/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/base/ops/cmul/benchmark/c/benchmark.c b/base/ops/cmul/benchmark/c/benchmark.c deleted file mode 100644 index 973b26592..000000000 --- a/base/ops/cmul/benchmark/c/benchmark.c +++ /dev/null @@ -1,148 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ - -/** -* Benchmark `cmul`. -*/ -#include -#include -#include -#include -#include - -#define NAME "cmul" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -void print_version() { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -double tic() { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1]. -* -* @return random number -*/ -double rand_double() { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -double benchmark() { - double elapsed; - double re; - double im; - double t; - int i; - - double complex z1; - double complex z2; - double complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = re + im*I; - - re = ( creal(z1)*creal(z2) ) - ( cimag(z1)*cimag(z2) ); - im = ( creal(z1)*cimag(z2) ) + ( cimag(z1)*creal(z2) ); - z3 = re + im*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/base/ops/cmul/benchmark/c/native/Makefile b/base/ops/cmul/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4c2..000000000 --- a/base/ops/cmul/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/base/ops/cmul/benchmark/c/native/benchmark.c b/base/ops/cmul/benchmark/c/native/benchmark.c deleted file mode 100644 index c2f888819..000000000 --- a/base/ops/cmul/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/** -* Benchmark `cmul`. -*/ -#include "stdlib/math/base/ops/cmul.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include -#include -#include -#include -#include - -#define NAME "cmul" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -void print_version() { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -double tic() { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1]. -* -* @return random number -*/ -double rand_double() { - int r = rand(); - return (double)r / ( (double)RAND_MAX + 1.0 ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -double benchmark() { - double elapsed; - double re; - double im; - double t; - int i; - - stdlib_complex128_t z1; - stdlib_complex128_t z2; - stdlib_complex128_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 =stdlib_complex128( re, im ); - - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z2 = stdlib_complex128( re, im ); - - z3 = stdlib_base_cmul( z1, z2 ); - stdlib_complex128_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/base/ops/cmul/benchmark/julia/REQUIRE b/base/ops/cmul/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e192..000000000 --- a/base/ops/cmul/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/base/ops/cmul/benchmark/julia/benchmark.jl b/base/ops/cmul/benchmark/julia/benchmark.jl deleted file mode 100644 index 024e64d0d..000000000 --- a/base/ops/cmul/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2018 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. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "cmul"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) * ComplexF64( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/base/ops/cmul/binding.gyp b/base/ops/cmul/binding.gyp deleted file mode 100644 index 1058b57ba..000000000 --- a/base/ops/cmul/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/base/ops/cmul/docs/repl.txt b/base/ops/cmul/docs/repl.txt deleted file mode 100644 index 971b25501..000000000 --- a/base/ops/cmul/docs/repl.txt +++ /dev/null @@ -1,33 +0,0 @@ - -{{alias}}( z1, z2 ) - Multiplies two double-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex128 - Complex number. - - z2: Complex128 - Complex number. - - Returns - ------- - out: Complex128 - Result. - - Examples - -------- - > var z1 = new {{alias:@stdlib/complex/float64/ctor}}( 5.0, 3.0 ) - - > var z2 = new {{alias:@stdlib/complex/float64/ctor}}( -2.0, 1.0 ) - - > var out = {{alias}}( z1, z2 ) - - > var re = {{alias:@stdlib/complex/float64/real}}( out ) - -13.0 - > var im = {{alias:@stdlib/complex/float64/imag}}( out ) - -1.0 - - See Also - -------- - diff --git a/base/ops/cmul/docs/types/index.d.ts b/base/ops/cmul/docs/types/index.d.ts deleted file mode 100644 index 696bc4a06..000000000 --- a/base/ops/cmul/docs/types/index.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 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 - -/// - -import { Complex128 } from '@stdlib/types/complex'; - -/** -* Multiplies two double-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex128 = require( '@stdlib/complex/float64/ctor' ); -* var real = require( '@stdlib/complex/float64/real' ); -* var imag = require( '@stdlib/complex/float64/imag' ); -* -* var z1 = new Complex128( 5.0, 3.0 ); -* // returns -* -* var z2 = new Complex128( -2.0, 1.0 ); -* // returns -* -* var out = cmul( z1, z2 ); -* // returns -* -* var re = real( out ); -* // returns -13.0 -* -* var im = imag( out ); -* // returns -1.0 -*/ -declare function cmul( z1: Complex128, z2: Complex128 ): Complex128; - - -// EXPORTS // - -export = cmul; diff --git a/base/ops/cmul/docs/types/test.ts b/base/ops/cmul/docs/types/test.ts deleted file mode 100644 index 9133c8a1b..000000000 --- a/base/ops/cmul/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 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. -*/ - -import Complex128 = require( '@stdlib/complex/float64/ctor' ); -import cmul = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - cmul( z, z ); // $ExpectType Complex128 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - cmul( true, z ); // $ExpectError - cmul( false, z ); // $ExpectError - cmul( null, z ); // $ExpectError - cmul( undefined, z ); // $ExpectError - cmul( '5', z ); // $ExpectError - cmul( [], z ); // $ExpectError - cmul( {}, z ); // $ExpectError - cmul( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex128( 1.0, 1.0 ); - - cmul( z, true ); // $ExpectError - cmul( z, false ); // $ExpectError - cmul( z, null ); // $ExpectError - cmul( z, undefined ); // $ExpectError - cmul( z, '5' ); // $ExpectError - cmul( z, [] ); // $ExpectError - cmul( z, {} ); // $ExpectError - cmul( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex128( 1.0, 1.0 ); - - cmul(); // $ExpectError - cmul( z ); // $ExpectError - cmul( z, z, z ); // $ExpectError -} diff --git a/base/ops/cmul/examples/c/Makefile b/base/ops/cmul/examples/c/Makefile deleted file mode 100644 index 70c91f4e1..000000000 --- a/base/ops/cmul/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/base/ops/cmul/examples/c/example.c b/base/ops/cmul/examples/c/example.c deleted file mode 100644 index fd8b0c14c..000000000 --- a/base/ops/cmul/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -#include "stdlib/math/base/ops/cmul.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" -#include - -int main( void ) { - const stdlib_complex128_t x[] = { - stdlib_complex128( 3.14, 1.5 ), - stdlib_complex128( -3.14, 1.5 ), - stdlib_complex128( 0.0, -0.0 ), - stdlib_complex128( 0.0/0.0, 0.0/0.0 ) - }; - - stdlib_complex128_t v; - stdlib_complex128_t y; - double re; - double im; - 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_cmul( v, v ); - stdlib_complex128_reim( y, &re, &im ); - printf( "cmul(z, z) = %lf + %lfi\n", re, im ); - } -} diff --git a/base/ops/cmul/examples/index.js b/base/ops/cmul/examples/index.js deleted file mode 100644 index 7d93f8be7..000000000 --- a/base/ops/cmul/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; -var cmul = require( './../lib' ); - -var rand; -var z1; -var z2; -var z3; -var i; - -rand = discreteUniform( -50, 50 ); -for ( i = 0; i < 100; i++ ) { - z1 = new Complex128( rand(), rand() ); - z2 = new Complex128( rand(), rand() ); - z3 = cmul( z1, z2 ); - console.log( '(%s) * (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/base/ops/cmul/include.gypi b/base/ops/cmul/include.gypi deleted file mode 100644 index 3b437d524..000000000 --- a/base/ops/cmul/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' -* -* var z2 = new Complex128( -2.0, 1.0 ); -* // returns -* -* var out = cmul( z1, z2 ); -* // returns -* -* var re = real( out ); -* // returns -13.0 -* -* var im = imag( out ); -* // returns -1.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/ops/cmul/lib/main.js b/base/ops/cmul/lib/main.js deleted file mode 100644 index 7f81e3b58..000000000 --- a/base/ops/cmul/lib/main.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 Complex128 = require( '@stdlib/complex/float64/ctor' ); -var real = require( '@stdlib/complex/float64/real' ); -var imag = require( '@stdlib/complex/float64/imag' ); - - -// MAIN // - -/** -* Multiplies two double-precision complex floating-point numbers. -* -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex/float64/ctor' ); -* var real = require( '@stdlib/complex/float64/real' ); -* var imag = require( '@stdlib/complex/float64/imag' ); -* -* var z1 = new Complex128( 5.0, 3.0 ); -* // returns -* -* var z2 = new Complex128( -2.0, 1.0 ); -* // returns -* -* var out = cmul( z1, z2 ); -* // returns -* -* var re = real( out ); -* // returns -13.0 -* -* var im = imag( out ); -* // returns -1.0 -*/ -function cmul( z1, z2 ) { - var re1 = real( z1 ); - var re2 = real( z2 ); - var im1 = imag( z1 ); - var im2 = imag( z2 ); - var re = (re1*re2) - (im1*im2); - var im = (re1*im2) + (im1*re2); - return new Complex128( re, im ); -} - - -// EXPORTS // - -module.exports = cmul; diff --git a/base/ops/cmul/lib/native.js b/base/ops/cmul/lib/native.js deleted file mode 100644 index 0f9facc1b..000000000 --- a/base/ops/cmul/lib/native.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 Complex128 = require( '@stdlib/complex/float64/ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Multiplies two double-precision complex floating-point numbers. -* -* @private -* @param {Complex128} z1 - complex number -* @param {Complex128} z2 - complex number -* @returns {Complex128} result -* -* @example -* var Complex128 = require( '@stdlib/complex/float64/ctor' ); -* var real = require( '@stdlib/complex/float64/real' ); -* var imag = require( '@stdlib/complex/float64/imag' ); -* -* var z1 = new Complex128( 5.0, 3.0 ); -* // returns -* -* var z2 = new Complex128( -2.0, 1.0 ); -* // returns -* -* var out = cmul( z1, z2 ); -* // returns -* -* var re = real( out ); -* // returns -13.0 -* -* var im = imag( out ); -* // returns -1.0 -*/ -function cmul( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex128( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cmul; diff --git a/base/ops/cmul/manifest.json b/base/ops/cmul/manifest.json deleted file mode 100644 index 48efffba2..000000000 --- a/base/ops/cmul/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math/base/napi/binary", - "@stdlib/complex/float64/ctor", - "@stdlib/complex/float64/reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex/float64/ctor", - "@stdlib/complex/float64/reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex/float64/ctor", - "@stdlib/complex/float64/reim" - ] - } - ] -} diff --git a/base/ops/cmul/package.json b/base/ops/cmul/package.json deleted file mode 100644 index 99f202b6d..000000000 --- a/base/ops/cmul/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/math/base/ops/cmul", - "version": "0.0.0", - "description": "Multiply two double-precision complex floating-point numbers.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": true, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdmath", - "mathematics", - "math", - "cmul", - "mul", - "mult", - "multiply", - "multiplication", - "arithmetic", - "complex", - "cmplx", - "number" - ] -} diff --git a/base/ops/cmul/src/Makefile b/base/ops/cmul/src/Makefile deleted file mode 100644 index f79b87238..000000000 --- a/base/ops/cmul/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/base/ops/cmul/src/addon.c b/base/ops/cmul/src/addon.c deleted file mode 100644 index 9563d788d..000000000 --- a/base/ops/cmul/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -#include "stdlib/math/base/ops/cmul.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_ZZ_Z( stdlib_base_cmul ) diff --git a/base/ops/cmul/src/main.c b/base/ops/cmul/src/main.c deleted file mode 100644 index ca57f64ff..000000000 --- a/base/ops/cmul/src/main.c +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -#include "stdlib/math/base/ops/cmul.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/reim.h" - -/** -* Multiplies two double-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* #include "stdlib/complex/float64/real.h" -* #include "stdlib/complex/float64/imag.h" -* -* stdlib_complex128_t z1 = stdlib_complex128( 5.0, 3.0 ); -* stdlib_complex128_t z2 = stdlib_complex128( -2.0, 1.0 ); -* -* stdlib_complex128_t out = stdlib_base_cmul( z1, z2 ); -* -* double re = stdlib_complex128_real( out ); -* // returns -13.0 -* -* double im = stdlib_complex128_imag( out ); -* // returns -1.0 -*/ -stdlib_complex128_t stdlib_base_cmul( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) { - double re1; - double re2; - double im1; - double im2; - double re; - double im; - - stdlib_complex128_reim( z1, &re1, &im1 ); - stdlib_complex128_reim( z2, &re2, &im2 ); - - re = (re1*re2) - (im1*im2); - im = (re1*im2) + (im1*re2); - - return stdlib_complex128( re, im ); -} diff --git a/base/ops/cmul/test/test.js b/base/ops/cmul/test/test.js deleted file mode 100644 index d3507c2c9..000000000 --- a/base/ops/cmul/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 isnan = require( './../../../../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 cmul = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof cmul, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function multiplies two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = cmul( z1, z2 ); - - t.strictEqual( real( v ), -13.0, 'returns expected value' ); - t.strictEqual( imag( v ), -1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/base/ops/cmul/test/test.native.js b/base/ops/cmul/test/test.native.js deleted file mode 100644 index 2bf0858eb..000000000 --- a/base/ops/cmul/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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 resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnan = require( './../../../../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 tryRequire = require( '@stdlib/utils/try-require' ); - - -// VARIABLES // - -var cmul = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cmul instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof cmul, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function multiplies two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = cmul( z1, z2 ); - - t.strictEqual( real( v ), -13.0, 'returns expected value' ); - t.strictEqual( imag( v ), -1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( -2.0, 1.0 ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, 3.0 ); - z2 = new Complex128( NaN, 1.0 ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, 1.0 ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, 3.0 ); - z2 = new Complex128( -2.0, NaN ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( 5.0, NaN ); - z2 = new Complex128( -2.0, NaN ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - z1 = new Complex128( NaN, NaN ); - z2 = new Complex128( NaN, NaN ); - - v = cmul( z1, z2 ); - t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/base/ops/cmulf/README.md b/base/ops/cmulf/README.md deleted file mode 100644 index b7e416cf3..000000000 --- a/base/ops/cmulf/README.md +++ /dev/null @@ -1,240 +0,0 @@ - - -# cmulf - -> Multiply two single-precision complex floating-point numbers. - -
- -
- - - -
- -## Usage - -```javascript -var cmulf = require( '@stdlib/math/base/ops/cmulf' ); -``` - -#### cmulf( z1, z2 ) - -Multiples two single-precision complex floating-point numbers. - -```javascript -var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); - -var z1 = new Complex64( 5.0, 3.0 ); -var z2 = new Complex64( -2.0, 1.0 ); - -var v = cmulf( z1, z2 ); -// returns - -var re = realf( v ); -// returns -13.0 - -var im = imagf( v ); -// returns -1.0 -``` - -
- - - -
- -## Examples - - - -```javascript -var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; -var cmulf = require( '@stdlib/math/base/ops/cmulf' ); - -var rand; -var z1; -var z2; -var z3; -var i; - -rand = discreteUniform( -50, 50 ); -for ( i = 0; i < 100; i++ ) { - z1 = new Complex64( rand(), rand() ); - z2 = new Complex64( rand(), rand() ); - z3 = cmulf( z1, z2 ); - console.log( '(%s) * (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} -``` - -
- - - - - -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/math/base/ops/cmulf.h" -``` - -#### stdlib_base_cmulf( z1, z2 ) - -Multiplies two single-precision complex floating-point numbers. - -```c -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float32/real.h" -#include "stdlib/complex/float32/imag.h" - -stdlib_complex64_t z1 = stdlib_complex64( 5.0f, 3.0f ); -stdlib_complex64_t z2 = stdlib_complex64( -2.0f, 1.0f ); - -stdlib_complex64_t out = stdlib_base_cmulf( z1, z2 ); - -float re = stdlib_complex64_real( out ); -// returns -13.0f - -float im = stdlib_complex64_imag( out ); -// returns -1.0f -``` - -The function accepts the following arguments: - -- **z1**: `[in] stdlib_complex64_t` input value. -- **z2**: `[in] stdlib_complex64_t` input value. - -```c -stdlib_complex64_t stdlib_base_cmulf( const stdlib_complex64_t z1, const stdlib_complex64_t z2 ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/math/base/ops/cmulf.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float32/reim.h" -#include - -int main( void ) { - const stdlib_complex64_t x[] = { - stdlib_complex64( 3.14f, 1.5f ), - stdlib_complex64( -3.14f, 1.5f ), - stdlib_complex64( 0.0f, -0.0f ), - stdlib_complex64( 0.0f/0.0f, 0.0f/0.0f ) - }; - - stdlib_complex64_t v; - stdlib_complex64_t y; - float re; - float im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex64_reim( v, &re, &im ); - printf( "z = %f + %fi\n", re, im ); - - y = stdlib_base_cmulf( v, v ); - stdlib_complex64_reim( y, &re, &im ); - printf( "cmulf(z, z) = %f + %fi\n", re, im ); - } -} -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/base/ops/cmulf/benchmark/benchmark.js b/base/ops/cmulf/benchmark/benchmark.js deleted file mode 100644 index 7f2ab4c3b..000000000 --- a/base/ops/cmulf/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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/base/uniform' ); -var isnanf = require( './../../../../base/assert/is-nanf' ); -var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var real = require( '@stdlib/complex/float32/real' ); -var imag = require( '@stdlib/complex/float32/imag' ); -var pkg = require( './../package.json' ).name; -var cmulf = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex64( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex64( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cmulf( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnanf( real( out ) ) || isnanf( imag( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/ops/cmulf/benchmark/benchmark.native.js b/base/ops/cmulf/benchmark/benchmark.native.js deleted file mode 100644 index 66e810e54..000000000 --- a/base/ops/cmulf/benchmark/benchmark.native.js +++ /dev/null @@ -1,69 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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 resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/base/uniform' ); -var isnanf = require( './../../../../base/assert/is-nanf' ); -var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); -var tryRequire = require( '@stdlib/utils/try-require' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cmulf = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cmulf instanceof Error ) -}; - - -// MAIN // - -bench( pkg+'::native', opts, function benchmark( b ) { - var values; - var out; - var z; - var i; - - values = [ - new Complex64( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), - new Complex64( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = values[ i%values.length ]; - out = cmulf( z, z ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( isnanf( realf( out ) ) || isnanf( imagf( out ) ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/ops/cmulf/benchmark/c/Makefile b/base/ops/cmulf/benchmark/c/Makefile deleted file mode 100644 index d7adc1ad0..000000000 --- a/base/ops/cmulf/benchmark/c/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles C source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/base/ops/cmulf/benchmark/c/benchmark.c b/base/ops/cmulf/benchmark/c/benchmark.c deleted file mode 100644 index a41f02138..000000000 --- a/base/ops/cmulf/benchmark/c/benchmark.c +++ /dev/null @@ -1,148 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/** -* Benchmark `cmulf`. -*/ -#include -#include -#include -#include -#include - -#define NAME "cmulf" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -void print_version() { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -double tic() { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1]. -* -* @return random number -*/ -float rand_float() { - int r = rand(); - return (float)r / ( (float)RAND_MAX + 1.0f ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -double benchmark() { - double elapsed; - float re; - float im; - double t; - int i; - - float complex z1; - float complex z2; - float complex z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0f*rand_float() ) - 500.0f; - im = ( 1000.0f*rand_float() ) - 500.0f; - z1 = re + im*I; - - re = ( 1000.0f*rand_float() ) - 500.0f; - im = ( 1000.0f*rand_float() ) - 500.0f; - z2 = re + im*I; - - re = ( crealf(z1)*crealf(z2) ) - ( cimagf(z1)*cimagf(z2) ); - im = ( crealf(z1)*cimagf(z2) ) + ( cimagf(z1)*crealf(z2) ); - z3 = re + im*I; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( z3 != z3 ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/base/ops/cmulf/benchmark/c/native/Makefile b/base/ops/cmulf/benchmark/c/native/Makefile deleted file mode 100644 index 7f6bbc4c2..000000000 --- a/base/ops/cmulf/benchmark/c/native/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := benchmark.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/base/ops/cmulf/benchmark/c/native/benchmark.c b/base/ops/cmulf/benchmark/c/native/benchmark.c deleted file mode 100644 index 517ffcc91..000000000 --- a/base/ops/cmulf/benchmark/c/native/benchmark.c +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -/** -* Benchmark `cmulf`. -*/ -#include "stdlib/math/base/ops/cmulf.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float32/reim.h" -#include -#include -#include -#include -#include - -#define NAME "cmulf" -#define ITERATIONS 1000000 -#define REPEATS 3 - -/** -* Prints the TAP version. -*/ -void print_version() { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param elapsed elapsed time in seconds -*/ -void print_results( double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -double tic() { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1]. -* -* @return random number -*/ -float rand_float() { - int r = rand(); - return (float)r / ( (float)RAND_MAX + 1.0f ); -} - -/** -* Runs a benchmark. -* -* @return elapsed time in seconds -*/ -double benchmark() { - double elapsed; - float re; - float im; - double t; - int i; - - stdlib_complex64_t z1; - stdlib_complex64_t z2; - stdlib_complex64_t z3; - - t = tic(); - for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0f*rand_float() ) - 500.0f; - im = ( 1000.0f*rand_float() ) - 500.0f; - z1 = stdlib_complex64( re, im ); - - re = ( 1000.0f*rand_float() ) - 500.0f; - im = ( 1000.0f*rand_float() ) - 500.0f; - z2 = stdlib_complex64( re, im ); - - z3 = stdlib_base_cmulf( z1, z2 ); - stdlib_complex64_reim( z3, &re, &im ); - if ( re != re ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( im != im ) { - printf( "should not return NaN\n" ); - } - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int i; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - for ( i = 0; i < REPEATS; i++ ) { - printf( "# c::native::%s\n", NAME ); - elapsed = benchmark(); - print_results( elapsed ); - printf( "ok %d benchmark finished\n", i+1 ); - } - print_summary( REPEATS, REPEATS ); -} diff --git a/base/ops/cmulf/benchmark/julia/REQUIRE b/base/ops/cmulf/benchmark/julia/REQUIRE deleted file mode 100644 index 98645e192..000000000 --- a/base/ops/cmulf/benchmark/julia/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 1.5 -BenchmarkTools 0.5.0 diff --git a/base/ops/cmulf/benchmark/julia/benchmark.jl b/base/ops/cmulf/benchmark/julia/benchmark.jl deleted file mode 100644 index 08be26ea9..000000000 --- a/base/ops/cmulf/benchmark/julia/benchmark.jl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env julia -# -# @license Apache-2.0 -# -# Copyright (c) 2021 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. - -import BenchmarkTools -using Printf - -# Benchmark variables: -name = "cmulf"; -repeats = 3; - -""" - print_version() - -Prints the TAP version. - -# Examples - -``` julia -julia> print_version() -``` -""" -function print_version() - @printf( "TAP version 13\n" ); -end - -""" - print_summary( total, passing ) - -Print the benchmark summary. - -# Arguments - -* `total`: total number of tests -* `passing`: number of passing tests - -# Examples - -``` julia -julia> print_summary( 3, 3 ) -``` -""" -function print_summary( total, passing ) - @printf( "#\n" ); - @printf( "1..%d\n", total ); # TAP plan - @printf( "# total %d\n", total ); - @printf( "# pass %d\n", passing ); - @printf( "#\n" ); - @printf( "# ok\n" ); -end - -""" - print_results( iterations, elapsed ) - -Print benchmark results. - -# Arguments - -* `iterations`: number of iterations -* `elapsed`: elapsed time (in seconds) - -# Examples - -``` julia -julia> print_results( 1000000, 0.131009101868 ) -``` -""" -function print_results( iterations, elapsed ) - rate = iterations / elapsed - - @printf( " ---\n" ); - @printf( " iterations: %d\n", iterations ); - @printf( " elapsed: %0.9f\n", elapsed ); - @printf( " rate: %0.9f\n", rate ); - @printf( " ...\n" ); -end - -""" - benchmark() - -Run a benchmark. - -# Notes - -* Benchmark results are returned as a two-element array: [ iterations, elapsed ]. -* The number of iterations is not the true number of iterations. Instead, an 'iteration' is defined as a 'sample', which is a computed estimate for a single evaluation. -* The elapsed time is in seconds. - -# Examples - -``` julia -julia> out = benchmark(); -``` -""" -function benchmark() - t = BenchmarkTools.@benchmark ComplexF32( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) * ComplexF32( (rand()*1000.0)-500.0, (rand()*1000.0)-500.0 ) samples=1e6 - - # Compute the total "elapsed" time and convert from nanoseconds to seconds: - s = sum( t.times ) / 1.0e9; - - # Determine the number of "iterations": - iter = length( t.times ); - - # Return the results: - [ iter, s ]; -end - -""" - main() - -Run benchmarks. - -# Examples - -``` julia -julia> main(); -``` -""" -function main() - print_version(); - for i in 1:repeats - @printf( "# julia::%s\n", name ); - results = benchmark(); - print_results( results[ 1 ], results[ 2 ] ); - @printf( "ok %d benchmark finished\n", i ); - end - print_summary( repeats, repeats ); -end - -main(); diff --git a/base/ops/cmulf/binding.gyp b/base/ops/cmulf/binding.gyp deleted file mode 100644 index 1058b57ba..000000000 --- a/base/ops/cmulf/binding.gyp +++ /dev/null @@ -1,170 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. - -# A `.gyp` file for building a Node.js native add-on. -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # List of files to include in this file: - 'includes': [ - './include.gypi', - ], - - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Target name should match the add-on export name: - 'addon_target_name%': 'addon', - - # Set variables based on the host OS: - 'conditions': [ - [ - 'OS=="win"', - { - # Define the object file suffix: - 'obj': 'obj', - }, - { - # Define the object file suffix: - 'obj': 'o', - } - ], # end condition (OS=="win") - ], # end conditions - }, # end variables - - # Define compile targets: - 'targets': [ - - # Target to generate an add-on: - { - # The target name should match the add-on export name: - 'target_name': '<(addon_target_name)', - - # Define dependencies: - 'dependencies': [], - - # Define directories which contain relevant include headers: - 'include_dirs': [ - # Local include directory: - '<@(include_dirs)', - ], - - # List of source files: - 'sources': [ - '<@(src_files)', - ], - - # Settings which should be applied when a target's object files are used as linker input: - 'link_settings': { - # Define libraries: - 'libraries': [ - '<@(libraries)', - ], - - # Define library directories: - 'library_dirs': [ - '<@(library_dirs)', - ], - }, - - # C/C++ compiler flags: - 'cflags': [ - # Enable commonly used warning options: - '-Wall', - - # Aggressive optimization: - '-O3', - ], - - # C specific compiler flags: - 'cflags_c': [ - # Specify the C standard to which a program is expected to conform: - '-std=c99', - ], - - # C++ specific compiler flags: - 'cflags_cpp': [ - # Specify the C++ standard to which a program is expected to conform: - '-std=c++11', - ], - - # Linker flags: - 'ldflags': [], - - # Apply conditions based on the host OS: - 'conditions': [ - [ - 'OS=="mac"', - { - # Linker flags: - 'ldflags': [ - '-undefined dynamic_lookup', - '-Wl,-no-pie', - '-Wl,-search_paths_first', - ], - }, - ], # end condition (OS=="mac") - [ - 'OS!="win"', - { - # C/C++ flags: - 'cflags': [ - # Generate platform-independent code: - '-fPIC', - ], - }, - ], # end condition (OS!="win") - ], # end conditions - }, # end target <(addon_target_name) - - # Target to copy a generated add-on to a standard location: - { - 'target_name': 'copy_addon', - - # Declare that the output of this target is not linked: - 'type': 'none', - - # Define dependencies: - 'dependencies': [ - # Require that the add-on be generated before building this target: - '<(addon_target_name)', - ], - - # Define a list of actions: - 'actions': [ - { - 'action_name': 'copy_addon', - 'message': 'Copying addon...', - - # Explicitly list the inputs in the command-line invocation below: - 'inputs': [], - - # Declare the expected outputs: - 'outputs': [ - '<(addon_output_dir)/<(addon_target_name).node', - ], - - # Define the command-line invocation: - 'action': [ - 'cp', - '<(PRODUCT_DIR)/<(addon_target_name).node', - '<(addon_output_dir)/<(addon_target_name).node', - ], - }, - ], # end actions - }, # end target copy_addon - ], # end targets -} diff --git a/base/ops/cmulf/docs/repl.txt b/base/ops/cmulf/docs/repl.txt deleted file mode 100644 index a8ee0375e..000000000 --- a/base/ops/cmulf/docs/repl.txt +++ /dev/null @@ -1,33 +0,0 @@ - -{{alias}}( z1, z2 ) - Multiplies two single-precision complex floating-point numbers. - - Parameters - ---------- - z1: Complex64 - Complex number. - - z2: Complex64 - Complex number. - - Returns - ------- - out: Complex64 - Result. - - Examples - -------- - > var z1 = new {{alias:@stdlib/complex/float32/ctor}}( 5.0, 3.0 ) - - > var z2 = new {{alias:@stdlib/complex/float32/ctor}}( -2.0, 1.0 ) - - > var out = {{alias}}( z1, z2 ) - - > var re = {{alias:@stdlib/complex/float32/real}}( out ) - -13.0 - > var im = {{alias:@stdlib/complex/float32/imag}}( out ) - -1.0 - - See Also - -------- - diff --git a/base/ops/cmulf/docs/types/index.d.ts b/base/ops/cmulf/docs/types/index.d.ts deleted file mode 100644 index d49456cb6..000000000 --- a/base/ops/cmulf/docs/types/index.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 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 - -/// - -import { Complex64 } from '@stdlib/types/complex'; - -/** -* Multiplies two single-precision complex floating-point numbers. -* -* @param z1 - complex number -* @param z2 - complex number -* @returns result -* -* @example -* var Complex64 = require( '@stdlib/complex/float32/ctor' ); -* var realf = require( '@stdlib/complex/float32/real' ); -* var imagf = require( '@stdlib/complex/float32/imag' ); -* -* var z1 = new Complex64( 5.0, 3.0 ); -* // returns -* -* var z2 = new Complex64( -2.0, 1.0 ); -* // returns -* -* var out = cmulf( z1, z2 ); -* // returns -* -* var re = realf( out ); -* // returns -13.0 -* -* var im = imagf( out ); -* // returns -1.0 -*/ -declare function cmulf( z1: Complex64, z2: Complex64 ): Complex64; - - -// EXPORTS // - -export = cmulf; diff --git a/base/ops/cmulf/docs/types/test.ts b/base/ops/cmulf/docs/types/test.ts deleted file mode 100644 index 8727e82f8..000000000 --- a/base/ops/cmulf/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 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. -*/ - -import Complex64 = require( '@stdlib/complex/float32/ctor' ); -import cmulf = require( './index' ); - - -// TESTS // - -// The function returns a complex number... -{ - const z = new Complex64( 1.0, 1.0 ); - - cmulf( z, z ); // $ExpectType Complex64 -} - -// The compiler throws an error if the function is provided a first argument which is not a complex number... -{ - const z = new Complex64( 1.0, 1.0 ); - - cmulf( true, z ); // $ExpectError - cmulf( false, z ); // $ExpectError - cmulf( null, z ); // $ExpectError - cmulf( undefined, z ); // $ExpectError - cmulf( '5', z ); // $ExpectError - cmulf( [], z ); // $ExpectError - cmulf( {}, z ); // $ExpectError - cmulf( ( x: number ): number => x, z ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a complex number... -{ - const z = new Complex64( 1.0, 1.0 ); - - cmulf( z, true ); // $ExpectError - cmulf( z, false ); // $ExpectError - cmulf( z, null ); // $ExpectError - cmulf( z, undefined ); // $ExpectError - cmulf( z, '5' ); // $ExpectError - cmulf( z, [] ); // $ExpectError - cmulf( z, {} ); // $ExpectError - cmulf( z, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const z = new Complex64( 1.0, 1.0 ); - - cmulf(); // $ExpectError - cmulf( z ); // $ExpectError - cmulf( z, z, z ); // $ExpectError -} diff --git a/base/ops/cmulf/examples/c/Makefile b/base/ops/cmulf/examples/c/Makefile deleted file mode 100644 index 70c91f4e1..000000000 --- a/base/ops/cmulf/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - -# Define the program used for compiling C source files: -ifdef C_COMPILER - CC := $(C_COMPILER) -else - CC := gcc -endif - -# Define the command-line options when compiling C files: -CFLAGS ?= \ - -std=c99 \ - -O3 \ - -Wall \ - -pedantic - -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option -ifeq ($(OS), WINNT) - fPIC ?= -else - fPIC ?= -fPIC -endif - -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): -INCLUDE ?= - -# List of source files: -SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): -LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): -LIBPATH ?= - -# List of C targets: -c_targets := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/base/ops/cmulf/examples/c/example.c b/base/ops/cmulf/examples/c/example.c deleted file mode 100644 index c05e5e62f..000000000 --- a/base/ops/cmulf/examples/c/example.c +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -#include "stdlib/math/base/ops/cmulf.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float32/reim.h" -#include - -int main( void ) { - const stdlib_complex64_t x[] = { - stdlib_complex64( 3.14f, 1.5f ), - stdlib_complex64( -3.14f, 1.5f ), - stdlib_complex64( 0.0f, -0.0f ), - stdlib_complex64( 0.0f/0.0f, 0.0f/0.0f ) - }; - - stdlib_complex64_t v; - stdlib_complex64_t y; - float re; - float im; - int i; - for ( i = 0; i < 4; i++ ) { - v = x[ i ]; - stdlib_complex64_reim( v, &re, &im ); - printf( "z = %f + %fi\n", re, im ); - - y = stdlib_base_cmulf( v, v ); - stdlib_complex64_reim( y, &re, &im ); - printf( "cmulf(z, z) = %f + %fi\n", re, im ); - } -} diff --git a/base/ops/cmulf/examples/index.js b/base/ops/cmulf/examples/index.js deleted file mode 100644 index 0e6a1e2f1..000000000 --- a/base/ops/cmulf/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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'; - -var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; -var cmulf = require( './../lib' ); - -var rand; -var z1; -var z2; -var z3; -var i; - -rand = discreteUniform( -50, 50 ); -for ( i = 0; i < 100; i++ ) { - z1 = new Complex64( rand(), rand() ); - z2 = new Complex64( rand(), rand() ); - z3 = cmulf( z1, z2 ); - console.log( '(%s) * (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); -} diff --git a/base/ops/cmulf/include.gypi b/base/ops/cmulf/include.gypi deleted file mode 100644 index 3b437d524..000000000 --- a/base/ops/cmulf/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. - -# A GYP include file for building a Node.js native add-on. -# -# Main documentation: -# -# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md -# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md -{ - # Define variables to be used throughout the configuration for all targets: - 'variables': { - # Source directory: - 'src_dir': './src', - - # Include directories: - 'include_dirs': [ - ' -* -* var z2 = new Complex64( -2.0, 1.0 ); -* // returns -* -* var out = cmulf( z1, z2 ); -* // returns -* -* var re = realf( out ); -* // returns -13.0 -* -* var im = imagf( out ); -* // returns -1.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/ops/cmulf/lib/main.js b/base/ops/cmulf/lib/main.js deleted file mode 100644 index 5c9803c48..000000000 --- a/base/ops/cmulf/lib/main.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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 float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); -var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); - - -// MAIN // - -/** -* Multiplies two single-precision complex floating-point numbers. -* -* @param {Complex64} z1 - complex number -* @param {Complex64} z2 - complex number -* @returns {Complex64} result -* -* @example -* var Complex64 = require( '@stdlib/complex/float32/ctor' ); -* var realf = require( '@stdlib/complex/float32/real' ); -* var imagf = require( '@stdlib/complex/float32/imag' ); -* -* var z1 = new Complex64( 5.0, 3.0 ); -* // returns -* -* var z2 = new Complex64( -2.0, 1.0 ); -* // returns -* -* var out = cmulf( z1, z2 ); -* // returns -* -* var re = realf( out ); -* // returns -13.0 -* -* var im = imagf( out ); -* // returns -1.0 -*/ -function cmulf( z1, z2 ) { - var re1 = realf( z1 ); - var re2 = realf( z2 ); - var im1 = imagf( z1 ); - var im2 = imagf( z2 ); - var re = float64ToFloat32(re1*re2) - float64ToFloat32(im1*im2); - var im = float64ToFloat32(re1*im2) + float64ToFloat32(im1*re2); - return new Complex64( float64ToFloat32( re ), float64ToFloat32( im ) ); -} - - -// EXPORTS // - -module.exports = cmulf; diff --git a/base/ops/cmulf/lib/native.js b/base/ops/cmulf/lib/native.js deleted file mode 100644 index 7f473b756..000000000 --- a/base/ops/cmulf/lib/native.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 Complex64 = require( '@stdlib/complex/float32/ctor' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Multiplies two single-precision complex floating-point numbers. -* -* @private -* @param {Complex64} z1 - complex number -* @param {Complex64} z2 - complex number -* @returns {Complex64} result -* -* @example -* var Complex64 = require( '@stdlib/complex/float32/ctor' ); -* var realf = require( '@stdlib/complex/float32/real' ); -* var imagf = require( '@stdlib/complex/float32/imag' ); -* -* var z1 = new Complex64( 5.0, 3.0 ); -* // returns -* -* var z2 = new Complex64( -2.0, 1.0 ); -* // returns -* -* var out = cmulf( z1, z2 ); -* // returns -* -* var re = realf( out ); -* // returns -13.0 -* -* var im = imagf( out ); -* // returns -1.0 -*/ -function cmulf( z1, z2 ) { - var v = addon( z1, z2 ); - return new Complex64( v.re, v.im ); -} - - -// EXPORTS // - -module.exports = cmulf; diff --git a/base/ops/cmulf/manifest.json b/base/ops/cmulf/manifest.json deleted file mode 100644 index c55113261..000000000 --- a/base/ops/cmulf/manifest.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/math/base/napi/binary", - "@stdlib/complex/float32/ctor", - "@stdlib/complex/float32/reim" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex/float32/ctor", - "@stdlib/complex/float32/reim" - ] - }, - { - "task": "examples", - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex/float32/ctor", - "@stdlib/complex/float32/reim" - ] - } - ] -} diff --git a/base/ops/cmulf/package.json b/base/ops/cmulf/package.json deleted file mode 100644 index 8e35a381d..000000000 --- a/base/ops/cmulf/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/math/base/ops/cmulf", - "version": "0.0.0", - "description": "Multiply two single-precision complex floating-point numbers.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "gypfile": true, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdmath", - "mathematics", - "math", - "cmulf", - "mul", - "mult", - "multiply", - "multiplication", - "arithmetic", - "complex", - "cmplx", - "number" - ] -} diff --git a/base/ops/cmulf/src/Makefile b/base/ops/cmulf/src/Makefile deleted file mode 100644 index f79b87238..000000000 --- a/base/ops/cmulf/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# VARIABLES # - -ifndef VERBOSE - QUIET := @ -else - QUIET := -endif - -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - - -# RULES # - -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: clean-addon - -.PHONY: clean diff --git a/base/ops/cmulf/src/addon.c b/base/ops/cmulf/src/addon.c deleted file mode 100644 index 89955be90..000000000 --- a/base/ops/cmulf/src/addon.c +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -#include "stdlib/math/base/ops/cmulf.h" -#include "stdlib/math/base/napi/binary.h" - -// cppcheck-suppress shadowFunction -STDLIB_MATH_BASE_NAPI_MODULE_CC_C( stdlib_base_cmulf ) diff --git a/base/ops/cmulf/src/main.c b/base/ops/cmulf/src/main.c deleted file mode 100644 index 0a79f398a..000000000 --- a/base/ops/cmulf/src/main.c +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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. -*/ - -#include "stdlib/math/base/ops/cmulf.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float32/reim.h" - -/** -* Multiplies two single-precision complex floating-point numbers. -* -* @param z1 input value -* @param z2 input value -* @return result -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float32/real.h" -* #include "stdlib/complex/float32/imag.h" -* -* stdlib_complex64_t z1 = stdlib_complex64( 5.0f, 3.0f ); -* stdlib_complex64_t z2 = stdlib_complex64( -2.0f, 1.0f ); -* -* stdlib_complex64_t out = stdlib_base_cmulf( z1, z2 ); -* -* float re = stdlib_complex64_real( out ); -* // returns -13.0f -* -* float im = stdlib_complex64_imag( out ); -* // returns -1.0f -*/ -stdlib_complex64_t stdlib_base_cmulf( const stdlib_complex64_t z1, const stdlib_complex64_t z2 ) { - float re1; - float re2; - float im1; - float im2; - float re; - float im; - - stdlib_complex64_reim( z1, &re1, &im1 ); - stdlib_complex64_reim( z2, &re2, &im2 ); - - re = (re1*re2) - (im1*im2); - im = (re1*im2) + (im1*re2); - - return stdlib_complex64( re, im ); -} diff --git a/base/ops/cmulf/test/test.js b/base/ops/cmulf/test/test.js deleted file mode 100644 index 21a4b3ceb..000000000 --- a/base/ops/cmulf/test/test.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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 isnanf = require( './../../../../base/assert/is-nanf' ); -var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); -var cmulf = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof cmulf, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function multiples two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( -2.0, 1.0 ); - - v = cmulf( z1, z2 ); - - t.strictEqual( realf( v ), -13.0, 'returns expected value' ); - t.strictEqual( imagf( v ), -1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex64( NaN, 3.0 ); - z2 = new Complex64( -2.0, 1.0 ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( NaN, 1.0 ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( NaN, 3.0 ); - z2 = new Complex64( NaN, 1.0 ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, NaN ); - z2 = new Complex64( -2.0, 1.0 ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( -2.0, NaN ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, NaN ); - z2 = new Complex64( -2.0, NaN ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( NaN, NaN ); - z2 = new Complex64( NaN, NaN ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/base/ops/cmulf/test/test.native.js b/base/ops/cmulf/test/test.native.js deleted file mode 100644 index 19d13de20..000000000 --- a/base/ops/cmulf/test/test.native.js +++ /dev/null @@ -1,119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 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 resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isnanf = require( './../../../../base/assert/is-nanf' ); -var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); -var tryRequire = require( '@stdlib/utils/try-require' ); - - -// VARIABLES // - -var cmulf = tryRequire( resolve( __dirname, './../lib/native.js' ) ); -var opts = { - 'skip': ( cmulf instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof cmulf, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function multiples two complex numbers', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( -2.0, 1.0 ); - - v = cmulf( z1, z2 ); - - t.strictEqual( realf( v ), -13.0, 'returns expected value' ); - t.strictEqual( imagf( v ), -1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', opts, function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex64( NaN, 3.0 ); - z2 = new Complex64( -2.0, 1.0 ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( NaN, 1.0 ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( NaN, 3.0 ); - z2 = new Complex64( NaN, 1.0 ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, NaN ); - z2 = new Complex64( -2.0, 1.0 ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( -2.0, NaN ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, NaN ); - z2 = new Complex64( -2.0, NaN ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( NaN, NaN ); - z2 = new Complex64( NaN, NaN ); - - v = cmulf( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/base/ops/csub/README.md b/base/ops/csub/README.md index ebeea2e30..1f6101738 100644 --- a/base/ops/csub/README.md +++ b/base/ops/csub/README.md @@ -215,7 +215,7 @@ int main( void ) { - [`@stdlib/complex/float64/base/add`][@stdlib/complex/float64/base/add]: add two double-precision complex floating-point numbers. - [`@stdlib/math/base/ops/cdiv`][@stdlib/math/base/ops/cdiv]: divide two complex numbers. -- [`@stdlib/math/base/ops/cmul`][@stdlib/math/base/ops/cmul]: multiply two double-precision complex floating-point numbers. +- [`@stdlib/complex/float64/base/mul`][@stdlib/complex/float64/base/mul]: multiply two double-precision complex floating-point numbers. @@ -231,7 +231,7 @@ int main( void ) { [@stdlib/math/base/ops/cdiv]: https://github.com/stdlib-js/math/tree/main/base/ops/cdiv -[@stdlib/math/base/ops/cmul]: https://github.com/stdlib-js/math/tree/main/base/ops/cmul +[@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/complex-float64-base-mul diff --git a/base/ops/csubf/README.md b/base/ops/csubf/README.md index ae038b73c..77dbca854 100644 --- a/base/ops/csubf/README.md +++ b/base/ops/csubf/README.md @@ -213,7 +213,7 @@ int main( void ) { ## See Also - [`@stdlib/complex/float32/base/add`][@stdlib/complex/float32/base/add]: add two single-precision complex floating-point numbers. -- [`@stdlib/math/base/ops/cmulf`][@stdlib/math/base/ops/cmulf]: multiply two single-precision complex floating-point numbers. +- [`@stdlib/complex/float32/base/mul`][@stdlib/complex/float32/base/mul]: multiply two single-precision complex floating-point numbers. - [`@stdlib/math/base/ops/csub`][@stdlib/math/base/ops/csub]: subtract two double-precision complex floating-point numbers. @@ -228,7 +228,7 @@ int main( void ) { [@stdlib/complex/float32/base/add]: https://github.com/stdlib-js/complex-float32-base-add -[@stdlib/math/base/ops/cmulf]: https://github.com/stdlib-js/math/tree/main/base/ops/cmulf +[@stdlib/complex/float32/base/mul]: https://github.com/stdlib-js/complex-float32-base-mul [@stdlib/math/base/ops/csub]: https://github.com/stdlib-js/math/tree/main/base/ops/csub diff --git a/base/ops/docs/types/index.d.ts b/base/ops/docs/types/index.d.ts index ef66ffea8..ecd493429 100644 --- a/base/ops/docs/types/index.d.ts +++ b/base/ops/docs/types/index.d.ts @@ -28,8 +28,8 @@ import addf = require( './../../../../base/ops/addf' ); import cadd = require( '@stdlib/complex/float64/base/add' ); import caddf = require( '@stdlib/complex/float32/base/add' ); import cdiv = require( './../../../../base/ops/cdiv' ); -import cmul = require( './../../../../base/ops/cmul' ); -import cmulf = require( './../../../../base/ops/cmulf' ); +import cmul = require( '@stdlib/complex/float64/base/mul' ); +import cmulf = require( '@stdlib/complex/float32/base/mul' ); import cneg = require( './../../../../base/ops/cneg' ); import cnegf = require( './../../../../base/ops/cnegf' ); import csub = require( './../../../../base/ops/csub' ); diff --git a/base/ops/lib/index.js b/base/ops/lib/index.js index dc7bf2906..e51ec6f0e 100644 --- a/base/ops/lib/index.js +++ b/base/ops/lib/index.js @@ -45,6 +45,15 @@ var ns = {}; */ setReadOnly( ns, 'caddf', require( '@stdlib/complex/float32/base/add' ) ); +/** +* @name cmulf +* @memberof ns +* @readonly +* @type {Function} +* @see {@link module:@stdlib/complex/float32/base/mul} +*/ +setReadOnly( ns, 'cmulf', require( '@stdlib/complex/float32/base/mul' ) ); + /** * @name cadd * @memberof ns @@ -54,6 +63,15 @@ setReadOnly( ns, 'caddf', require( '@stdlib/complex/float32/base/add' ) ); */ setReadOnly( ns, 'cadd', require( '@stdlib/complex/float64/base/add' ) ); +/** +* @name cmul +* @memberof ns +* @readonly +* @type {Function} +* @see {@link module:@stdlib/complex/float64/base/mul} +*/ +setReadOnly( ns, 'cmul', require( '@stdlib/complex/float64/base/mul' ) ); + /** * @name add * @memberof ns @@ -108,24 +126,6 @@ setReadOnly( ns, 'addf', require( './../../../base/ops/addf' ) ); */ setReadOnly( ns, 'cdiv', require( './../../../base/ops/cdiv' ) ); -/** -* @name cmul -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/math/base/ops/cmul} -*/ -setReadOnly( ns, 'cmul', require( './../../../base/ops/cmul' ) ); - -/** -* @name cmulf -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/math/base/ops/cmulf} -*/ -setReadOnly( ns, 'cmulf', require( './../../../base/ops/cmulf' ) ); - /** * @name cneg * @memberof ns diff --git a/strided/ops/mul/lib/data.js b/strided/ops/mul/lib/data.js index d0582501c..8ee01bf9c 100644 --- a/strided/ops/mul/lib/data.js +++ b/strided/ops/mul/lib/data.js @@ -21,8 +21,8 @@ // MODULES // var mul = require( './../../../../base/ops/mul' ); -var cmul = require( './../../../../base/ops/cmul' ); -var cmulf = require( './../../../../base/ops/cmulf' ); +var cmul = require( '@stdlib/complex/float64/base/mul' ); +var cmulf = require( '@stdlib/complex/float32/base/mul' ); var callbacks = require( '@stdlib/strided/base/binary-signature-callbacks' ); var types = require( './types.js' ); diff --git a/strided/ops/mul/manifest.json b/strided/ops/mul/manifest.json index d2bc81ea6..721ebcf30 100644 --- a/strided/ops/mul/manifest.json +++ b/strided/ops/mul/manifest.json @@ -33,8 +33,8 @@ "dependencies": [ "@stdlib/math/base/ops/mul", "@stdlib/math/base/ops/mulf", - "@stdlib/math/base/ops/cmul", - "@stdlib/math/base/ops/cmulf", + "@stdlib/complex/float64/base/mul", + "@stdlib/complex/float32/base/mul", "@stdlib/strided/base/function-object", "@stdlib/strided/base/binary", "@stdlib/strided/dtypes", diff --git a/strided/ops/mul/src/addon.c b/strided/ops/mul/src/addon.c index fc1f7a04a..54ed835eb 100644 --- a/strided/ops/mul/src/addon.c +++ b/strided/ops/mul/src/addon.c @@ -20,8 +20,8 @@ #include "stdlib/math/base/ops/mul.h" #include "stdlib/math/base/ops/mulf.h" -#include "stdlib/math/base/ops/cmul.h" -#include "stdlib/math/base/ops/cmulf.h" +#include "stdlib/complex/float64/base/mul.h" +#include "stdlib/complex/float32/base/mul.h" #include "stdlib/strided/dtypes.h" #include "stdlib/strided/base/function_object.h" #include "stdlib/strided/base/binary.h" @@ -639,266 +639,266 @@ static int32_t types[] = { // Define a list of strided array function "data" (in this case, callbacks): static void *data[] = { - (void *)stdlib_base_cmulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex64_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mul, (void *)stdlib_base_mulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)mulk, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)muli, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)mulk, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)muli, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)mulk, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)muli, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex64_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)mulk, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)muli, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)muls, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)mulk, (void *)muli, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)mulk, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)muli, - (void *)stdlib_base_cmulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex64_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)mult, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)muli, (void *)mulu, (void *)mulu, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)mult, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)muli, (void *)mulu, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)mulu, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)mulu, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)mulu, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex64_mul, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mulf, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mul, (void *)stdlib_base_mul, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)mulk, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)muli, (void *)muli, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)mulk, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)muli, (void *)mult, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)muli, (void *)mulu, (void *)mulu, - (void *)stdlib_base_cmul, + (void *)stdlib_base_complex128_mul, (void *)stdlib_base_mul, (void *)mulb, - (void *)stdlib_base_cmul, - (void *)stdlib_base_cmulf, + (void *)stdlib_base_complex128_mul, + (void *)stdlib_base_complex64_mul, (void *)stdlib_base_mulf, (void *)stdlib_base_mul, (void *)mulk,