Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "complex/base/wrap-function/docs/types/index.d"

Index

Type aliases

Binary

Binary: (x: ComplexLike, y: ComplexLike) => any

Binary function accepting complex numbers.

param

input value

param

input value

returns

result

Type declaration

Constructor

Constructor: {}

Complex number constructor.

param

real component

param

imaginary component

returns

complex number

Type declaration

Nary

Nary: (x: ComplexLike, y: ComplexLike, z: ComplexLike, w: ComplexLike, v: ComplexLike, ...args: Array<ComplexLike>) => any

An n-ary function accepting complex numbers.

param

input value

param

input value

param

input value

param

input value

param

input value

param

subsequent input values

returns

result

Type declaration

Nullary

Nullary: () => any

Nullary function.

returns

result

Type declaration

    • (): any
    • Returns any

Quaternary

Quaternary: (x: ComplexLike, y: ComplexLike, z: ComplexLike, w: ComplexLike) => any

Quaternary function accepting complex numbers.

param

input value

param

input value

param

input value

param

input value

returns

result

Type declaration

Quinary

Quinary: (x: ComplexLike, y: ComplexLike, z: ComplexLike, w: ComplexLike, v: ComplexLike) => any

Quinary function accepting complex numbers.

param

input value

param

input value

param

input value

param

input value

param

input value

returns

result

Type declaration

RealOrComplex

RealOrComplex: number | ComplexLike

Real or complex number.

Ternary

Ternary: (x: ComplexLike, y: ComplexLike, z: ComplexLike) => any

Ternary function accepting complex numbers.

param

input value

param

input value

param

input value

returns

result

Type declaration

Unary

Unary: (x: ComplexLike) => any

Unary function accepting complex numbers.

param

input value

returns

result

Type declaration

WrappedBinary

WrappedBinary: (x: RealOrComplex, y: RealOrComplex) => any

Binary function accepting both real and complex numbers.

param

input value

param

input value

returns

result

Type declaration

WrappedNary

WrappedNary: (x: RealOrComplex, y: RealOrComplex, z: RealOrComplex, w: RealOrComplex, v: RealOrComplex, ...args: Array<RealOrComplex>) => any

An n-ary function accepting both real and complex numbers.

param

input value

param

input value

param

input value

param

input value

param

input value

param

subsequent input values

returns

result

Type declaration

WrappedQuaternary

WrappedQuaternary: (x: RealOrComplex, y: RealOrComplex, z: RealOrComplex, w: RealOrComplex) => any

Quaternary function accepting both real and complex numbers.

param

input value

param

input value

param

input value

param

input value

returns

result

Type declaration

WrappedQuinary

WrappedQuinary: (x: RealOrComplex, y: RealOrComplex, z: RealOrComplex, w: RealOrComplex, v: RealOrComplex) => any

Quinary function accepting both real and complex numbers.

param

input value

param

input value

param

input value

param

input value

param

input value

returns

result

Type declaration

WrappedTernary

WrappedTernary: (x: RealOrComplex, y: RealOrComplex, z: RealOrComplex) => any

Ternary function accepting both real and complex numbers.

param

input value

param

input value

param

input value

returns

result

Type declaration

WrappedUnary

WrappedUnary: (x: RealOrComplex) => any

Unary function accepting both real and complex numbers.

param

input value

returns

result

Type declaration

Functions

Export assignment wrap

  • Wraps a nullary function accepting complex number arguments to support providing both real and complex numbers.

    throws

    second argument must be a nonnegative integer

    Parameters

    • fcn: Nullary

      nullary function to wrap

    • nargs: 0

      number of arguments

    • ctor: Constructor

      complex number constructor

    Returns Nullary

    wrapped function

    Example

    var Complex64 = require( `@stdlib/complex/float32` );
    var realf = require( `@stdlib/complex/realf` );
    var imagf = require( `@stdlib/complex/imagf` );
    var randu = require( `@stdlib/random/base/randu` );
    
    function randComplex() {
        return new Complex64( randu(), randu() );
    }
    
    var f = wrap( randComplex, 0, Complex64 );
    
    // ...
    
    var z = f();
    // returns <Complex64>
    
    var re = realf( z );
    // returns <number>
    
    var im = imagf( z );
    // returns <number>
  • Wraps a unary function accepting complex number arguments to support providing both real and complex numbers.

    Notes

    • The returned function assumes that the wrapped function accepts only complex number input arguments (i.e., every argument must be a complex number).
    • The returned function assumes that, if an input argument is non-numeric (i.e., not of type number), then the input argument is a complex number. The returned function does not verify that non-numeric input arguments are, in fact, complex number objects. The returned function passes non-numeric input arguments to the wrapped function without modification.
    throws

    second argument must be a nonnegative integer

    Parameters

    • fcn: Unary

      function to wrap

    • nargs: 1

      number of arguments

    • ctor: Constructor

      complex number constructor

    Returns WrappedUnary

    wrapped function

    Example

    var Complex64 = require( `@stdlib/complex/float32` );
    var cidentityf = require( `@stdlib/math/base/special/cidentityf` );
    var realf = require( `@stdlib/complex/realf` );
    var imagf = require( `@stdlib/complex/imagf` );
    
    var f = wrap( cidentityf, 1, Complex64 );
    
    // ...
    
    var z = f( 3.0 );
    // returns <Complex64>
    
    var re = realf( z );
    // returns 3.0
    
    var im = imagf( z );
    // returns 0.0
  • Wraps a binary function accepting complex number arguments to support providing both real and complex numbers.

    Notes

    • The returned function assumes that the wrapped function accepts only complex number input arguments (i.e., every argument must be a complex number).
    • The returned function assumes that, if an input argument is non-numeric (i.e., not of type number), then the input argument is a complex number. The returned function does not verify that non-numeric input arguments are, in fact, complex number objects. The returned function passes non-numeric input arguments to the wrapped function without modification.
    throws

    second argument must be a nonnegative integer

    Parameters

    • fcn: Binary

      function to wrap

    • nargs: 2

      number of arguments

    • ctor: Constructor

      complex number constructor

    Returns WrappedBinary

    wrapped function

    Example

    var Complex64 = require( `@stdlib/complex/float32` );
    var cadd = require( `@stdlib/math/base/ops/cadd` );
    var realf = require( `@stdlib/complex/realf` );
    var imagf = require( `@stdlib/complex/imagf` );
    
    var f = wrap( cadd, 2, Complex64 );
    
    // ...
    
    var z = f( 3.0, 4.0 );
    // returns <Complex64>
    
    var re = realf( z );
    // returns 7.0
    
    var im = imagf( z );
    // returns 0.0
  • Wraps a ternary function accepting complex number arguments to support providing both real and complex numbers.

    Notes

    • The returned function assumes that the wrapped function accepts only complex number input arguments (i.e., every argument must be a complex number).
    • The returned function assumes that, if an input argument is non-numeric (i.e., not of type number), then the input argument is a complex number. The returned function does not verify that non-numeric input arguments are, in fact, complex number objects. The returned function passes non-numeric input arguments to the wrapped function without modification.
    throws

    second argument must be a nonnegative integer

    Parameters

    • fcn: Ternary

      function to wrap

    • nargs: 3

      number of arguments

    • ctor: Constructor

      complex number constructor

    Returns WrappedTernary

    wrapped function

    Example

    var Complex64 = require( `@stdlib/complex/float32` );
    var realf = require( `@stdlib/complex/realf` );
    var imagf = require( `@stdlib/complex/imagf` );
    
    function add( x, y, z ) {
        var re = realf( x ) + realf( y ) + realf( z );
        var im = imagf( x ) + imagf( y ) + imagf( z );
        return new Complex64( re, im );
    }
    
    var f = wrap( add, 3, Complex64 );
    
    // ...
    
    var z = f( 3.0, 4.0, 5.0 );
    // returns <Complex64>
    
    var re = realf( z );
    // returns 12.0
    
    var im = imagf( z );
    // returns 0.0
  • Wraps a quaternary function accepting complex number arguments to support providing both real and complex numbers.

    Notes

    • The returned function assumes that the wrapped function accepts only complex number input arguments (i.e., every argument must be a complex number).
    • The returned function assumes that, if an input argument is non-numeric (i.e., not of type number), then the input argument is a complex number. The returned function does not verify that non-numeric input arguments are, in fact, complex number objects. The returned function passes non-numeric input arguments to the wrapped function without modification.
    throws

    second argument must be a nonnegative integer

    Parameters

    • fcn: Quaternary

      function to wrap

    • nargs: 4

      number of arguments

    • ctor: Constructor

      complex number constructor

    Returns WrappedQuaternary

    wrapped function

    Example

    var Complex64 = require( `@stdlib/complex/float32` );
    var realf = require( `@stdlib/complex/realf` );
    var imagf = require( `@stdlib/complex/imagf` );
    
    function add( x, y, z, w ) {
        var re = realf( x ) + realf( y ) + realf( z ) + realf( w );
        var im = imagf( x ) + imagf( y ) + imagf( z ) + imagf( w );
        return new Complex64( re, im );
    }
    
    var f = wrap( add, 4, Complex64 );
    
    // ...
    
    var z = f( 3.0, 4.0, 5.0, 6.0 );
    // returns <Complex64>
    
    var re = realf( z );
    // returns 18.0
    
    var im = imagf( z );
    // returns 0.0
  • Wraps a quinary function accepting complex number arguments to support providing both real and complex numbers.

    Notes

    • The returned function assumes that the wrapped function accepts only complex number input arguments (i.e., every argument must be a complex number).
    • The returned function assumes that, if an input argument is non-numeric (i.e., not of type number), then the input argument is a complex number. The returned function does not verify that non-numeric input arguments are, in fact, complex number objects. The returned function passes non-numeric input arguments to the wrapped function without modification.
    throws

    second argument must be a nonnegative integer

    Parameters

    • fcn: Quinary

      function to wrap

    • nargs: 5

      number of arguments

    • ctor: Constructor

      complex number constructor

    Returns WrappedQuinary

    wrapped function

    Example

    var Complex64 = require( `@stdlib/complex/float32` );
    var realf = require( `@stdlib/complex/realf` );
    var imagf = require( `@stdlib/complex/imagf` );
    
    function add( x, y, z, w, v ) {
        var re = realf( x ) + realf( y ) + realf( z ) + realf( w ) + realf( v );
        var im = imagf( x ) + imagf( y ) + imagf( z ) + imagf( w ) + imagf( v );
        return new Complex64( re, im );
    }
    
    var f = wrap( add, 5, Complex64 );
    
    // ...
    
    var z = f( 3.0, 4.0, 5.0, 6.0, 7.0 );
    // returns <Complex64>
    
    var re = realf( z );
    // returns 25.0
    
    var im = imagf( z );
    // returns 0.0
  • Wraps an n-ary function accepting complex number arguments to support providing both real and complex numbers.

    Notes

    • The returned function assumes that the wrapped function accepts only complex number input arguments (i.e., every argument must be a complex number).
    • The returned function assumes that, if an input argument is non-numeric (i.e., not of type number), then the input argument is a complex number. The returned function does not verify that non-numeric input arguments are, in fact, complex number objects. The returned function passes non-numeric input arguments to the wrapped function without modification.
    throws

    second argument must be a nonnegative integer

    Parameters

    • fcn: Nary

      function to wrap

    • nargs: number

      number of arguments

    • ctor: Constructor

      complex number constructor

    Returns WrappedNary

    wrapped function

    Example

    var Complex64 = require( `@stdlib/complex/float32` );
    var realf = require( `@stdlib/complex/realf` );
    var imagf = require( `@stdlib/complex/imagf` );
    
    function add( x, y, z, w, v, t ) {
        var re = realf( x ) + realf( y ) + realf( z ) + realf( w ) + realf( v ) + realf( t );
        var im = imagf( x ) + imagf( y ) + imagf( z ) + imagf( w ) + imagf( v ) + imagf( t );
        return new Complex64( re, im );
    }
    
    var f = wrap( add, 6, Complex64 );
    
    // ...
    
    var z = f( 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 );
    // returns <Complex64>
    
    var re = realf( z );
    // returns 33.0
    
    var im = imagf( z );
    // returns 0.0