You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: refactor API and add C API to math/base/special/cexp
BREAKING CHANGE: remove support for `out` argument
To migrate, users should provide a `Complex128` object, rather than an output array and real and imaginary components.
PR-URL: #972
Co-authored-by: Athan Reines <kgryte@gmail.com>
Reviewed-by: Athan Reines <kgryte@gmail.com>
Private-ref: stdlib-js/todo#1454
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/math/base/special/cexp/README.md
+137-31
Original file line number
Diff line number
Diff line change
@@ -20,9 +20,9 @@ limitations under the License.
20
20
21
21
# exp
22
22
23
-
> Compute the [exponential][exponential-function] function of a complex number.
23
+
> Evaluate the [exponential][exponential-function] function for a double-precision complex floating-point number.
24
24
25
-
<sectionclass="intro">
25
+
<sectionclass="intro">
26
26
27
27
The [exponential][exponential-function] function of a complex number is defined as
28
28
@@ -51,30 +51,32 @@ The [exponential][exponential-function] function of a complex number is defined
51
51
var cexp =require( '@stdlib/math/base/special/cexp' );
52
52
```
53
53
54
-
#### cexp( \[out,] re, im )
54
+
#### cexp( z )
55
55
56
-
Evaluates the [exponential][exponential-function] function with a `complex` argument comprised of a **real** component `re` and an **imaginary** component `im`.
56
+
Evaluates the [exponential][exponential-function] function for a double-precision complex floating-point number.
57
57
58
58
```javascript
59
-
var v =cexp( 0.0, 0.0 );
60
-
// returns [ 1.0, 0.0 ]
59
+
var Complex128 =require( '@stdlib/complex/float64' );
60
+
var real =require( '@stdlib/complex/real' );
61
+
var imag =require( '@stdlib/complex/imag' );
61
62
62
-
v =cexp( 0.0, 1.0 );
63
-
// returns [ ~0.540, ~0.841 ]
64
-
```
63
+
var v =cexp( newComplex128( 0.0, 0.0 ) );
64
+
// returns <Complex128>
65
65
66
-
By default, the function returns real and imaginary components as a two-element `array`. To avoid unnecessary memory allocation, the function supports providing an output (destination) object.
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
126
+
127
+
<sectionclass="intro">
128
+
129
+
</section>
130
+
131
+
<!-- /.intro -->
132
+
133
+
<!-- C usage documentation. -->
134
+
135
+
<sectionclass="usage">
136
+
137
+
### Usage
138
+
139
+
```c
140
+
#include"stdlib/math/base/special/cexp.h"
141
+
```
142
+
143
+
#### stdlib_base_cexp( z )
144
+
145
+
Evaluates the [exponential][exponential-function] function for a double-precision complex floating-point number.
146
+
147
+
```c
148
+
#include"stdlib/complex/float64.h"
149
+
#include"stdlib/complex/real.h"
150
+
#include"stdlib/complex/imag.h"
151
+
152
+
stdlib_complex128_t z = stdlib_complex128( 0.0, 0.0 );
153
+
stdlib_complex128_t out = stdlib_base_cexp( z );
154
+
155
+
double re = stdlib_real( out );
156
+
// returns 1.0
157
+
158
+
double im = stdlib_imag( out );
159
+
// returns 0.0
160
+
```
161
+
162
+
The function accepts the following arguments:
163
+
164
+
-**z**: `[in] stdlib_complex128_t` input value.
165
+
166
+
```c
167
+
stdlib_complex128_tstdlib_base_cexp( const stdlib_complex128_t z );
168
+
```
169
+
170
+
</section>
171
+
172
+
<!-- /.usage -->
173
+
174
+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
0 commit comments