-
-
Notifications
You must be signed in to change notification settings - Fork 400
/
index.d.ts
160 lines (148 loc) · 6.8 KB
/
index.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
152
153
154
155
156
157
158
159
160
/*
* @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: 2.0
/// <reference types="@stdlib/types"/>
import { ArrayLike } from '@stdlib/types/array';
import { ndarray, DataType, Mode, Order, Shape, Strides } from '@stdlib/types/ndarray';
import { Buffer } from 'buffer';
/**
* Interface defining function options.
*/
interface Options {
/**
* Specifies how to handle a linear index which exceeds array dimensions (default: 'throw').
*/
mode?: Mode;
/**
* Specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: ['throw']).
*/
submode?: Array<Mode>;
/**
* Boolean indicating whether an array should be read-only (default: false).
*/
readonly?: boolean;
}
/**
* Interface defining a ndarray constructor which is both "newable" and "callable".
*/
interface Constructor {
/**
* ndarray constructor.
*
* @param dtype - data type
* @param buffer - data buffer
* @param shape - array shape
* @param strides - array strides
* @param offset - index offset
* @param order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)
* @param options - function options
* @param options.mode - specifies how to handle indices which exceed array dimensions (default: 'throw')
* @param options.submode - specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: ['throw'])
* @param options.readonly - specifies whether an array should be read-only (default: false)
* @throws `buffer` argument `get` and `set` properties must be functions
* @throws `shape` argument must be an array-like object containing nonnegative integers
* @throws `shape` argument length must equal the number of dimensions
* @throws `strides` argument must be an array-like object containing integers
* @throws `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`)
* @throws for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0`
* @throws `offset` argument must be a nonnegative integer
* @throws `buffer` argument must be compatible with specified meta data
* @throws must provide valid options
* @throws too many dimensions
* @returns ndarray instance
*
* @example
* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var out = new ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
*/
new( dtype: DataType, buffer: ArrayLike<any> | Buffer, shape: Shape, strides: Strides, offset: number, order: Order, options?: Options ): ndarray; // tslint-disable-line max-line-length
/**
* ndarray constructor.
*
* @param dtype - data type
* @param buffer - data buffer
* @param shape - array shape
* @param strides - array strides
* @param offset - index offset
* @param order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)
* @param options - function options
* @param options.mode - specifies how to handle indices which exceed array dimensions (default: 'throw')
* @param options.submode - specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: ['throw'])
* @param options.readonly - specifies whether an array should be read-only (default: false)
* @throws `buffer` argument `get` and `set` properties must be functions
* @throws `shape` argument must be an array-like object containing nonnegative integers
* @throws `shape` argument length must equal the number of dimensions
* @throws `strides` argument must be an array-like object containing integers
* @throws `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`)
* @throws for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0`
* @throws `offset` argument must be a nonnegative integer
* @throws `buffer` argument must be compatible with specified meta data
* @throws must provide valid options
* @throws too many dimensions
* @returns ndarray instance
*
* @example
* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
*/
( dtype: DataType, buffer: ArrayLike<any> | Buffer, shape: Shape, strides: Strides, offset: number, order: Order, options?: Options ): ndarray; // tslint-disable-line max-line-length
}
/**
* ndarray constructor.
*
* @param dtype - data type
* @param buffer - data buffer
* @param shape - array shape
* @param strides - array strides
* @param offset - index offset
* @param order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)
* @param options - function options
* @param options.mode - specifies how to handle indices which exceed array dimensions (default: 'throw')
* @param options.submode - specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: ['throw'])
* @param options.readonly - specifies whether an array should be read-only (default: false)
* @throws `buffer` argument `get` and `set` properties must be functions
* @throws `shape` argument must be an array-like object containing nonnegative integers
* @throws `shape` argument length must equal the number of dimensions
* @throws `strides` argument must be an array-like object containing integers
* @throws `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`)
* @throws for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0`
* @throws `offset` argument must be a nonnegative integer
* @throws `buffer` argument must be compatible with specified meta data
* @throws must provide valid options
* @throws too many dimensions
* @returns ndarray instance
*
* @example
* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
* var shape = [ 3, 2 ];
* var strides = [ 2, 1 ];
* var offset = 0;
*
* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
*/
declare var ctor: Constructor;
// EXPORTS //
export = ctor;