Skip to content

Commit

Permalink
fix: add self review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
steff456 committed Jul 11, 2023
1 parent abfae48 commit f87b410
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 29 deletions.
16 changes: 4 additions & 12 deletions lib/node_modules/@stdlib/math/base/special/cinv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ limitations under the License.
-->

# inv
# cinv

> Compute the inverse of a complex number.
> Compute the inverse of a double-precision complex floating-point number.
<section class="intro">

Expand Down Expand Up @@ -78,23 +78,15 @@ var im = imag( v );

```javascript
var Complex128 = require( '@stdlib/complex/float64' );
var randu = require( '@stdlib/random/base/randu' );
var round = require( '@stdlib/math/base/special/round' );
var real = require( '@stdlib/complex/real' );
var imag = require( '@stdlib/complex/imag' );
var uniform = require( '@stdlib/random/base/uniform' );
var cinv = require( '@stdlib/math/base/special/cinv' );

var re;
var im;
var z1;
var z2;
var i;

for ( i = 0; i < 100; i++ ) {
re = round( randu()*100.0 ) - 50.0;
im = round( randu()*100.0 ) - 50.0;
z1 = new Complex128( re, im );

z1 = new Complex128( uniform( -50.0, 50.0 ), uniform( -50.0, 50.0 ) );
z2 = cinv( z1 );

console.log( '1.0 / (%s) = %s', z1.toString(), z2.toString() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import cinv = require( './index' );

// TESTS //

// The function returns an array of numbers...
// The function returns a double-precision floating-point complex number.
{
cinv( new Complex128( 1.0, 2.0 ) ); // $ExpectType Complex128
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#/
# @license Apache-2.0
#
# Copyright (c) 2021 The Stdlib Authors.
# Copyright (c) 2023 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,15 @@
'use strict';

var Complex128 = require( '@stdlib/complex/float64' );
var randu = require( '@stdlib/random/base/randu' );
var round = require( '@stdlib/math/base/special/round' );
var uniform = require( '@stdlib/random/base/uniform' );
var cinv = require( './../lib' );

var re;
var im;
var z1;
var z2;
var i;

for ( i = 0; i < 100; i++ ) {
re = round( randu()*100.0 ) - 50.0;
im = round( randu()*100.0 ) - 50.0;
z1 = new Complex128( re, im );

z1 = new Complex128( uniform( -50.0, 50.0 ), uniform( -50.0, 50.0 ) );
z2 = cinv( z1 );

console.log( '1.0 / (%s) = %s', z1.toString(), z2.toString() );
Expand Down
12 changes: 9 additions & 3 deletions lib/node_modules/@stdlib/math/base/special/cinv/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
"@stdlib/math/base/napi/unary",
"@stdlib/complex/float64",
"@stdlib/complex/reim",
"@stdlib/math/base/special/abs"
"@stdlib/math/base/special/abs",
"@stdlib/constants/float64/max",
"@stdlib/constants/float64/eps"
]
},
{
Expand All @@ -55,7 +57,9 @@
"dependencies": [
"@stdlib/complex/float64",
"@stdlib/complex/reim",
"@stdlib/math/base/special/abs"
"@stdlib/math/base/special/abs",
"@stdlib/constants/float64/max",
"@stdlib/constants/float64/eps"
]
},
{
Expand All @@ -71,7 +75,9 @@
"dependencies": [
"@stdlib/complex/float64",
"@stdlib/complex/reim",
"@stdlib/math/base/special/abs"
"@stdlib/math/base/special/abs",
"@stdlib/constants/float64/max",
"@stdlib/constants/float64/eps"
]
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#/
# @license Apache-2.0
#
# Copyright (c) 2021 The Stdlib Authors.
# Copyright (c) 2023 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.
Expand Down
9 changes: 6 additions & 3 deletions lib/node_modules/@stdlib/math/base/special/cinv/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include "stdlib/math/base/special/cinv.h"
#include "stdlib/math/base/special/abs.h"
#include "stdlib/constants/float64/max.h"
#include "stdlib/constants/float64/eps.h"
#include "stdlib/complex/float64.h"
#include "stdlib/complex/reim.h"
#include <math.h>
Expand All @@ -26,9 +28,10 @@

// VARIABLES //

const double LARGE_THRESHOLD = DBL_MAX * 0.5;
const double SMALL_THRESHOLD = DBL_MIN * ( 2.0 / DBL_EPSILON );
const double RECIP_EPS_SQR = 2.0 / ( DBL_EPSILON * DBL_EPSILON );
const double LARGE_THRESHOLD = STDLIB_CONSTANT_FLOAT64_MAX * 0.5;
// TODO: add min stdlib function once implemented
const double SMALL_THRESHOLD = DBL_MIN * ( 2.0 / STDLIB_CONSTANT_FLOAT64_EPS );
const double RECIP_EPS_SQR = 2.0 / ( STDLIB_CONSTANT_FLOAT64_EPS * STDLIB_CONSTANT_FLOAT64_EPS );


// MAIN //
Expand Down

0 comments on commit f87b410

Please sign in to comment.