Socket
Socket
Sign inDemoInstall

@stdlib/math-base-ops-cmulf

Package Overview
Dependencies
70
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

include.gypi

4

docs/repl.txt

@@ -26,5 +26,5 @@

<Complex64>
> var re = {{alias:@stdlib/complex/real}}( out )
> var re = {{alias:@stdlib/complex/realf}}( out )
-13.0
> var im = {{alias:@stdlib/complex/imag}}( out )
> var im = {{alias:@stdlib/complex/imagf}}( out )
-1.0

@@ -31,0 +31,0 @@

@@ -34,4 +34,4 @@ /*

* var Complex64 = require( `@stdlib/complex/float32` );
* var real = require( `@stdlib/complex/real` );
* var imag = require( `@stdlib/complex/imag` );
* var realf = require( `@stdlib/complex/realf` );
* var imagf = require( `@stdlib/complex/imagf` );
*

@@ -47,6 +47,6 @@ * var z1 = new Complex64( 5.0, 3.0 );

*
* var re = real( out );
* var re = realf( out );
* // returns -13.0
*
* var im = imag( out );
* var im = imagf( out );
* // returns -1.0

@@ -53,0 +53,0 @@ */

@@ -28,4 +28,4 @@ /**

* var Complex64 = require( '@stdlib/complex-float32' );
* var real = require( '@stdlib/complex-real' );
* var imag = require( '@stdlib/complex-imag' );
* var realf = require( '@stdlib/complex-realf' );
* var imagf = require( '@stdlib/complex-imagf' );
* var cmulf = require( '@stdlib/math-base-ops-cmulf' );

@@ -42,6 +42,6 @@ *

*
* var re = real( out );
* var re = realf( out );
* // returns -13.0
*
* var im = imag( out );
* var im = imagf( out );
* // returns -1.0

@@ -48,0 +48,0 @@ */

@@ -24,4 +24,5 @@ /**

var float64ToFloat32 = require( '@stdlib/number-float64-base-to-float32' );
var real = require( '@stdlib/complex-real' );
var imag = require( '@stdlib/complex-imag' );
var Complex64 = require( '@stdlib/complex-float32' );
var realf = require( '@stdlib/complex-realf' );
var imagf = require( '@stdlib/complex-imagf' );

@@ -40,4 +41,4 @@

* var Complex64 = require( '@stdlib/complex-float32' );
* var real = require( '@stdlib/complex-real' );
* var imag = require( '@stdlib/complex-imag' );
* var realf = require( '@stdlib/complex-realf' );
* var imagf = require( '@stdlib/complex-imagf' );
*

@@ -53,16 +54,16 @@ * var z1 = new Complex64( 5.0, 3.0 );

*
* var re = real( out );
* var re = realf( out );
* // returns -13.0
*
* var im = imag( out );
* var im = imagf( out );
* // returns -1.0
*/
function cmulf( z1, z2 ) {
var re1 = real( z1 );
var re2 = real( z2 );
var im1 = imag( z1 );
var im2 = imag( 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 z1.constructor( float64ToFloat32( re ), float64ToFloat32( im ) );
return new Complex64( float64ToFloat32( re ), float64ToFloat32( im ) );
}

@@ -69,0 +70,0 @@

{
"options": {},
"options": {
"task": "build"
},
"fields": [

@@ -26,14 +28,49 @@ {

"confs": [
{
"src": [
"./src/main.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": []
}
]
{
"task": "build",
"src": [
"./src/main.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/math-base-napi-binary",
"@stdlib/complex-float32",
"@stdlib/complex-reimf"
]
},
{
"task": "benchmark",
"src": [
"./src/main.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/complex-float32",
"@stdlib/complex-reimf"
]
},
{
"task": "examples"
"src": [
"./src/main.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/complex-float32",
"@stdlib/complex-reimf"
]
}
]
}
{
"name": "@stdlib/math-base-ops-cmulf",
"version": "0.0.1",
"version": "0.0.2",
"description": "Multiply two single-precision complex floating-point numbers.",

@@ -17,2 +17,3 @@ "license": "Apache-2.0",

"main": "./lib",
"gypfile": false,
"directories": {

@@ -22,3 +23,5 @@ "benchmark": "./benchmark",

"example": "./examples",
"include": "./include",
"lib": "./lib",
"src": "./src",
"test": "./test"

@@ -42,14 +45,16 @@ },

"dependencies": {
"@stdlib/complex-imag": "^0.0.x",
"@stdlib/complex-real": "^0.0.x",
"@stdlib/complex-float32": "^0.0.x",
"@stdlib/complex-imagf": "^0.0.x",
"@stdlib/complex-realf": "^0.0.x",
"@stdlib/number-float64-base-to-float32": "^0.0.x",
"@stdlib/types": "^0.0.x",
"@stdlib/utils-library-manifest": "^0.0.x"
"@stdlib/types": "^0.0.x"
},
"devDependencies": {
"@stdlib/bench": "^0.0.x",
"@stdlib/complex-float32": "^0.0.x",
"@stdlib/complex-imag": "^0.0.x",
"@stdlib/complex-real": "^0.0.x",
"@stdlib/math-base-assert-is-nanf": "^0.0.x",
"@stdlib/random-base-discrete-uniform": "^0.0.x",
"@stdlib/random-base-uniform": "^0.0.x",
"@stdlib/utils-try-require": "^0.0.x",
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",

@@ -56,0 +61,0 @@ "istanbul": "^0.4.1",

@@ -57,4 +57,4 @@ <!--

var Complex64 = require( '@stdlib/complex-float32' );
var real = require( '@stdlib/complex-real' );
var imag = require( '@stdlib/complex-imag' );
var realf = require( '@stdlib/complex-realf' );
var imagf = require( '@stdlib/complex-imagf' );

@@ -67,6 +67,6 @@ var z1 = new Complex64( 5.0, 3.0 );

var re = real( v );
var re = realf( v );
// returns -13.0
var im = imag( v );
var im = imagf( v );
// returns -1.0

@@ -140,9 +140,16 @@ ```

```c
#include <complex.h>
#include "stdlib/complex/float32.h"
#include "stdlib/complex/realf.h"
#include "stdlib/complex/imagf.h"
float complex z1 = 5.0f + 3.0f*I;
float complex z2 = -2.0f + 1.0f*I;
stdlib_complex64_t z1 = stdlib_complex64( 5.0f, 3.0f );
stdlib_complex64_t z2 = stdlib_complex64( -2.0f, 1.0f );
float complex out = stdlib_base_cmulf( z1, z2 );
// returns -13.0f-1.0f*I
stdlib_complex64_t out = stdlib_base_cmulf( z1, z2 );
float re = stdlib_realf( out );
// returns -13.0f
float im = stdlib_imagf( out );
// returns -1.0f
```

@@ -152,7 +159,7 @@

- **z1**: `[in] float complex` input value.
- **z2**: `[in] float complex` input value.
- **z1**: `[in] stdlib_complex64_t` input value.
- **z2**: `[in] stdlib_complex64_t` input value.
```c
float complex stdlib_base_cmulf( const float complex z1, const float complex z2 );
stdlib_complex64_t stdlib_base_cmulf( const stdlib_complex64_t z1, const stdlib_complex64_t z2 );
```

@@ -180,15 +187,27 @@

#include "stdlib/math/base/ops/cmulf.h"
#include "stdlib/complex/float32.h"
#include "stdlib/complex/reimf.h"
#include <stdio.h>
#include <complex.h>
int main() {
float complex x[] = { 3.14f+1.5f*I, -3.14f-1.5f*I, 0.0f+0.0f*I, 0.0f/0.0f+0.0f/0.0f*I };
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 )
};
float complex v;
float complex y;
stdlib_complex64_t v;
stdlib_complex64_t y;
float re;
float im;
int i;
for ( i = 0; i < 4; i++ ) {
v = x[ i ];
stdlib_reimf( v, &re, &im );
printf( "z = %f + %fi\n", re, im );
y = stdlib_base_cmulf( v, v );
printf( "z = %f + %fi\ncmulf(z, z) = %f + %fi\n", crealf( v ), cimagf( v ), crealf( y ), cimagf( y ) );
stdlib_reimf( y, &re, &im );
printf( "cmulf(z, z) = %f + %fi\n", re, im );
}

@@ -253,4 +272,4 @@ }

[test-image]: https://github.com/stdlib-js/math-base-ops-cmulf/actions/workflows/test.yml/badge.svg
[test-url]: https://github.com/stdlib-js/math-base-ops-cmulf/actions/workflows/test.yml
[test-image]: https://github.com/stdlib-js/math-base-ops-cmulf/actions/workflows/test.yml/badge.svg?branch=v0.0.2
[test-url]: https://github.com/stdlib-js/math-base-ops-cmulf/actions/workflows/test.yml?query=branch:v0.0.2

@@ -267,2 +286,9 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-ops-cmulf/main.svg

[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
[chat-url]: https://gitter.im/stdlib-js/stdlib/
[stdlib]: https://github.com/stdlib-js/stdlib
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
[umd]: https://github.com/umdjs/umd

@@ -274,10 +300,4 @@ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules

[esm-url]: https://github.com/stdlib-js/math-base-ops-cmulf/tree/esm
[branches-url]: https://github.com/stdlib-js/math-base-ops-cmulf/blob/main/branches.md
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
[chat-url]: https://gitter.im/stdlib-js/stdlib/
[stdlib]: https://github.com/stdlib-js/stdlib
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/math-base-ops-cmulf/main/LICENSE

@@ -284,0 +304,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc