-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.d.ts
151 lines (135 loc) · 3.39 KB
/
mod.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
* @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.
*/
// TypeScript Version: 4.1
/* eslint-disable max-lines */
import base = require( './../../base' );
import complex = require( './../../cmplx' );
import ctors = require( './../../ctors' );
import dtype = require( './../../dtype' );
import dtypes = require( './../../dtypes' );
import float32 = require( './../../float32' );
import float64 = require( './../../float64' );
import promotionRules = require( './../../promotion-rules' );
import reviveComplex = require( './../../reviver' );
/**
* Interface describing the `complex` namespace.
*/
interface Namespace {
/**
* Base (i.e., lower-level) complex number functions.
*/
base: typeof base;
/**
* Creates a complex number.
*
* @param real - real component
* @param imag - imaginary component
* @param dtype - data type (default: 'float64')
* @returns complex number
*
* @example
* var z = ns.complex( 5.0, 3.0, 'float64' );
* // returns <Complex128>
*/
complex: typeof complex;
/**
* Returns a complex number constructor.
*
* @param dtype - data type
* @returns constructor or null
*
* @example
* var ctor = ns.ctors( 'complex128' );
* // returns <Function>
*
* @example
* var ctor = ns.ctors( 'float' );
* // returns null
*/
ctors: typeof ctors;
/**
* Returns the data type of a complex number.
*
* ## Notes
*
* - If provided an argument having an unknown or unsupported type, the function returns `null`.
*
* @param value - input value
* @returns data type
*
* @example
* var Complex64 = require( './../../float32/ctor' );
*
* var dt = ns.dtype( new Complex64( 1.0, 2.0 ) );
* // returns 'complex64'
*
* var dt = ns.dtype( 'beep' );
* // returns null
*/
dtype: typeof dtype;
/**
* Returns a list of complex number data types.
*
* @returns list of complex number data types
*
* @example
* var list = ns.dtypes();
* // e.g., returns [ 'complex64', 'complex128' ]
*/
dtypes: typeof dtypes;
/**
* Single-precision complex number functions.
*/
float32: typeof float32;
/**
* Double-precision complex number functions.
*/
float64: typeof float64;
/**
* Returns a type promotion table displaying complex number data types with the smallest size and closest "kind" to which data types can be safely cast.
*
* @returns promotion rule table
*
* @example
* var table = ns.promotionRules();
* // returns {...}
*/
promotionRules: typeof promotionRules;
/**
* Revives a JSON-serialized complex number.
*
* @param key - key
* @param value - value
* @returns value or complex number
*
* @example
* var parseJSON = require( '@stdlib/utils/parse-json' );
*
* var str = '{"type":"Complex128","re":5,"im":3}';
*
* var z = parseJSON( str, ns.reviveComplex );
* // returns <Complex128>
*/
reviveComplex: typeof reviveComplex;
}
/**
* Complex numbers.
*/
declare var ns: Namespace;
// EXPORTS //
export = ns;