forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray3.fsi
More file actions
482 lines (457 loc) · 18.1 KB
/
Copy patharray3.fsi
File metadata and controls
482 lines (457 loc) · 18.1 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace Microsoft.FSharp.Collections
open System
open Microsoft.FSharp.Collections
open Microsoft.FSharp.Core
open Microsoft.FSharp.Core.Operators
/// <summary>Contains operations for working with rank 3 arrays.</summary>
///
/// <remarks>
/// See also <a href="https://learn.microsoft.com/dotnet/fsharp/language-reference/arrays">F# Language Guide - Arrays</a>.
/// </remarks>
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
[<RequireQualifiedAccess>]
module Array3D =
/// <summary>Creates an array whose elements are all initially the given value.</summary>
/// <param name="length1">The length of the first dimension.</param>
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
/// <param name="initial">The value of the array elements.</param>
///
/// <returns>The created array.</returns>
///
/// <example id="create-1">
/// <code lang="fsharp">
/// Array3D.create 2 2 3 1
/// </code>
/// Evaluates to a 2x3 array with contents <c>[[[1; 1; 1]; [1; 1; 1]]; [[1; 1; 1]; [1; 1; 1]]]</c>
/// </example>
///
[<CompiledName("Create")>]
val create: length1: int -> length2: int -> length3: int -> initial: 'T -> 'T[,,]
/// <summary>Creates an array given the dimensions and a generator function to compute the elements.</summary>
///
/// <param name="length1">The length of the first dimension.</param>
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
/// <param name="initializer">The function to create an initial value at each index into the array.</param>
///
/// <returns>The created array.</returns>
///
/// <example id="init-1">
/// <code lang="fsharp">
/// Array3D.init 2 2 3 (fun i j k -> 100*i + 10*j + k)
/// </code>
/// Evaluates to a 2x2x3 array with contents <c>[[[0; 1; 2]; [10; 11; 12]]; [[100; 101; 102]; [110; 111; 112]]]</c>
/// </example>
[<CompiledName("Initialize")>]
val init: length1: int -> length2: int -> length3: int -> initializer: (int -> int -> int -> 'T) -> 'T[,,]
/// <summary>Fetches an element from a 3D array. You can also use the syntax 'array.[index1,index2,index3]'</summary>
///
/// <param name="array">The input array.</param>
/// <param name="index1">The index along the first dimension.</param>
/// <param name="index2">The index along the second dimension.</param>
/// <param name="index3">The index along the third dimension.</param>
///
/// <returns>The value at the given index.</returns>
///
/// <remarks>
/// Indexer syntax is generally preferred, e.g.
/// <code lang="fsharp">
/// let array = Array3D.init 2 3 3 (fun i j k -> 100*i + 10*j + k)
///
/// array[0,2,1]
/// </code>
/// Evaluates to <c>11</c>.
/// </remarks>
///
/// <example id="set-1">
/// <code lang="fsharp">
/// let array = Array3D.init 2 3 3 (fun i j k -> 100*i + 10*j + k)
///
/// Array3D.get array 0 2 1
/// </code>
/// Evaluates to <c>21</c>.
/// </example>
[<CompiledName("Get")>]
val get: array: 'T[,,] -> index1: int -> index2: int -> index3: int -> 'T
/// <summary>Applies the given function to each element of the array.</summary>
///
/// <param name="action">The function to apply to each element of the array.</param>
/// <param name="array">The input array.</param>
///
/// <example id="iter-1">
/// <code lang="fsharp">
/// let inputs = Array3D.init 2 2 3 (fun i j k -> 100*i + 10*j + k)
///
/// inputs |> Array3D.iter (fun v -> printfn $"value = {v}")
/// </code>
/// Evaluates to <c>unit</c> and prints
/// <code>
/// value = 0
/// value = 1
/// value = 2
/// value = 10
/// value = 11
/// value = 12
/// value = 100
/// value = 101
/// value = 102
/// value = 110
/// value = 111
/// value = 112
/// </code>
/// in the console.
/// </example>
[<CompiledName("Iterate")>]
val iter: action: ('T -> unit) -> array: 'T[,,] -> unit
/// <summary>Applies the given function to each element of the array. The integer indices passed to the
/// function indicates the index of element.</summary>
///
/// <param name="action">The function to apply to each element of the array.</param>
/// <param name="array">The input array.</param>
///
/// <example id="iter-1">
/// <code lang="fsharp">
/// let inputs = Array3D.init 2 2 3 (fun i j k -> 100*i + 10*j + k)
///
/// inputs |> Array3D.iteri (fun i j k v -> printfn $"value at ({i},{j},{k}) = {v}")
/// </code>
/// Evaluates to <c>unit</c> and prints
/// <code>
/// value at (0,0,0) = 0
/// value at (0,0,1) = 1
/// value at (0,0,2) = 2
/// value at (0,1,0) = 10
/// value at (0,1,1) = 11
/// value at (0,1,2) = 12
/// value at (1,0,0) = 100
/// value at (1,0,1) = 101
/// value at (1,0,2) = 102
/// value at (1,1,0) = 110
/// value at (1,1,1) = 111
/// value at (1,1,2) = 112
/// </code>
/// in the console.
/// </example>
[<CompiledName("IterateIndexed")>]
val iteri: action: (int -> int -> int -> 'T -> unit) -> array: 'T[,,] -> unit
/// <summary>Returns the length of an array in the first dimension </summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the first dimension.</returns>
///
/// <example id="length1-1">
/// <code>
/// let array = Array3D.init 2 3 4 (fun i j k -> 100*i + 10*j + k)
///
/// array |> Array3D.length1
/// </code>
/// Evaluates to <c>2</c>.
/// </example>
[<CompiledName("Length1")>]
val length1: array: 'T[,,] -> int
/// <summary>Returns the length of an array in the second dimension.</summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the second dimension.</returns>
///
/// <example id="length2-1">
/// <code>
/// let array = Array3D.init 2 3 4 (fun i j k -> 100*i + 10*j + k)
///
/// array |> Array3D.length2
/// </code>
/// Evaluates to <c>3</c>.
/// </example>
[<CompiledName("Length2")>]
val length2: array: 'T[,,] -> int
/// <summary>Returns the length of an array in the third dimension.</summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the third dimension.</returns>
///
/// <example id="length3-1">
/// <code>
/// let array = Array3D.init 2 3 4 (fun i j k -> 100*i + 10*j + k)
///
/// array |> Array3D.length3
/// </code>
/// Evaluates to <c>4</c>.
/// </example>
[<CompiledName("Length3")>]
val length3: array: 'T[,,] -> int
/// <summary>Builds a new array whose elements are the results of applying the given function
/// to each of the elements of the array.</summary>
///
/// <remarks>For non-zero-based arrays the basing on an input array will be propagated to the output
/// array.</remarks>
/// <param name="mapping">The function to transform each element of the array.</param>
/// <param name="array">The input array.</param>
///
/// <returns>The array created from the transformed elements.</returns>
///
/// <example id="map-1">
/// <code lang="fsharp">
/// let inputs = Array3D.init 2 3 3 (fun i j k -> 100*i + 10*j + k)
///
/// inputs |> Array3D.map (fun v -> 2 * v)
/// </code>
/// Evaluates to a 2x3x3 array with contents <c> <c>[[[0; 2; 4]; [20; 22; 24]]; [[200; 202; 204]; [220; 222; 224]]]</c></c>
/// </example>
[<CompiledName("Map")>]
val map: mapping: ('T -> 'U) -> array: 'T[,,] -> 'U[,,]
/// <summary>Builds a new array whose elements are the results of applying the given function
/// to each of the elements of the array. The integer indices passed to the
/// function indicates the element being transformed.</summary>
///
/// <remarks>For non-zero-based arrays the basing on an input array will be propagated to the output
/// array.</remarks>
/// <param name="mapping">The function to transform the elements at each index in the array.</param>
/// <param name="array">The input array.</param>
///
/// <returns>The array created from the transformed elements.</returns>
///
/// <example id="mapi-1">
/// <code lang="fsharp">
/// let inputs = Array3D.zeroCreate 2 3 3
///
/// inputs |> Array3D.mapi (fun i j k v -> 100*i + 10*j + k)
/// </code>
/// Evaluates to a 2x3x3 array with contents <c>[[[0; 2; 4]; [20; 22; 24]]; [[200; 202; 204]; [220; 222; 224]]]</c>
/// </example>
[<CompiledName("MapIndexed")>]
val mapi: mapping: (int -> int -> int -> 'T -> 'U) -> array: 'T[,,] -> 'U[,,]
/// <summary>Sets the value of an element in an array. You can also
/// use the syntax 'array.[index1,index2,index3] <- value'.</summary>
///
/// <param name="array">The input array.</param>
/// <param name="index1">The index along the first dimension.</param>
/// <param name="index2">The index along the second dimension.</param>
/// <param name="index3">The index along the third dimension.</param>
/// <param name="value">The value to set at the given index.</param>
///
/// <remarks>
/// Indexer syntax is generally preferred, e.g.
/// <code lang="fsharp">
/// let array = Array3D.zeroCreate 2 3 3
///
/// array[0,2,1] < 4.0
/// </code>
/// Evaluates to <c>11</c>.
/// </remarks>
///
/// <example id="set-1">
/// <code lang="fsharp">
/// let array = Array3D.zeroCreate 2 3 3
///
/// Array3D.set array 0 2 1 4.0
/// </code>
/// After evaluation <c>array</c> is a 2x3x3 array with contents <c>[[[0.0; 0.0; 0.0]; [0.0; 4.0; 0.0]]; [[0.0; 0.0; 0.0]; [0.0; 0.0; 0.0]]]</c>
/// </example>
[<CompiledName("Set")>]
val set: array: 'T[,,] -> index1: int -> index2: int -> index3: int -> value: 'T -> unit
/// <summary>Creates an array where the entries are initially the "default" value.</summary>
///
/// <param name="length1">The length of the first dimension.</param>
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
///
/// <returns>The created array.</returns>
///
/// <example id="zerocreate-1">
/// <code lang="fsharp">
/// let array : float[,,] = Array3D.zeroCreate 2 3 3
/// </code>
/// After evaluation <c>array</c> is a 2x3x3 array with contents all zero.
/// </example>
[<CompiledName("ZeroCreate")>]
val zeroCreate: length1: int -> length2: int -> length3: int -> 'T[,,]
/// <summary>Contains operations for working with rank 4 arrays. </summary>
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
[<RequireQualifiedAccess>]
module Array4D =
/// <summary>Creates an array whose elements are all initially the given value</summary>
///
/// <param name="length1">The length of the first dimension.</param>
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
/// <param name="length4">The length of the fourth dimension.</param>
/// <param name="initial">The initial value for each element of the array.</param>
///
/// <returns>The created array.</returns>
///
/// <example id="create-1">
/// <code lang="fsharp">
/// Array4D.create 2 2 2 2 1
/// </code>
/// Evaluates to a 2x2x2x2 array with all entries <c>1</c>
/// </example>
///
[<CompiledName("Create")>]
val create: length1: int -> length2: int -> length3: int -> length4: int -> initial: 'T -> 'T[,,,]
/// <summary>Creates an array given the dimensions and a generator function to compute the elements.</summary>
///
/// <param name="length1">The length of the first dimension.</param>
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
/// <param name="length4">The length of the fourth dimension.</param>
/// <param name="initializer">The function to create an initial value at each index in the array.</param>
///
/// <returns>The created array.</returns>
///
/// <example id="init-1">
/// <code lang="fsharp">
/// Array4D.init 2 2 2 2 (fun i j k l -> i*1000+j*100+k*10+l)
/// </code>
/// Evaluates to a 2x2x2x2 array with contents <c>[[[[0; 1]; [10; 11]]; [[100; 101]; [110; 111]]];[[[1000; 1]; [1010; 1011]]; [[1100; 1101]; [1110; 1111]]]]</c>
/// </example>
///
[<CompiledName("Initialize")>]
val init:
length1: int ->
length2: int ->
length3: int ->
length4: int ->
initializer: (int -> int -> int -> int -> 'T) ->
'T[,,,]
/// <summary>Returns the length of an array in the first dimension </summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the first dimension.</returns>
///
/// <example id="length1-1">
/// <code>
/// let array = Array4D.init 2 3 4 5 (fun i j k -> 100*i + 10*j + k)
///
/// array |> Array4D.length1
/// </code>
/// Evaluates to <c>2</c>.
/// </example>
[<CompiledName("Length1")>]
val length1: array: 'T[,,,] -> int
/// <summary>Returns the length of an array in the second dimension.</summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the second dimension.</returns>
///
/// <example id="length2-1">
/// <code>
/// let array = Array4D.init 2 3 4 5 (fun i j k -> 100*i + 10*j + k)
///
/// array |> Array4D.length2
/// </code>
/// Evaluates to <c>3</c>.
/// </example>
[<CompiledName("Length2")>]
val length2: array: 'T[,,,] -> int
/// <summary>Returns the length of an array in the third dimension.</summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the third dimension.</returns>
///
/// <example id="length3-1">
/// <code>
/// let array = Array4D.init 2 3 4 5 (fun i j k -> 100*i + 10*j + k)
///
/// array |> Array4D.length3
/// </code>
/// Evaluates to <c>4</c>.
/// </example>
[<CompiledName("Length3")>]
val length3: array: 'T[,,,] -> int
/// <summary>Returns the length of an array in the fourth dimension.</summary>
///
/// <param name="array">The input array.</param>
///
/// <returns>The length of the array in the fourth dimension.</returns>
///
/// <example id="length4-1">
/// <code>
/// let array = Array4D.init 2 3 4 5 (fun i j k -> 100*i + 10*j + k)
///
/// array |> Array4D.length4
/// </code>
/// Evaluates to <c>5</c>.
/// </example>
[<CompiledName("Length4")>]
val length4: array: 'T[,,,] -> int
/// <summary>Creates an array where the entries are initially the "default" value.</summary>
///
/// <param name="length1">The length of the first dimension.</param>
/// <param name="length2">The length of the second dimension.</param>
/// <param name="length3">The length of the third dimension.</param>
/// <param name="length4">The length of the fourth dimension.</param>
///
/// <returns>The created array.</returns>
///
/// <example id="zerocreate-1">
/// <code lang="fsharp">
/// let array : float[,,,] = Array4D.zeroCreate 2 3 3 5
/// </code>
/// After evaluation <c>array</c> is a 2x3x3x5 array with contents all zero.
/// </example>
[<CompiledName("ZeroCreate")>]
val zeroCreate: length1: int -> length2: int -> length3: int -> length4: int -> 'T[,,,]
/// <summary>Fetches an element from a 4D array. You can also use the syntax 'array.[index1,index2,index3,index4]'</summary>
///
/// <param name="array">The input array.</param>
/// <param name="index1">The index along the first dimension.</param>
/// <param name="index2">The index along the second dimension.</param>
/// <param name="index3">The index along the third dimension.</param>
/// <param name="index4">The index along the fourth dimension.</param>
///
/// <returns>The value at the given index.</returns>
///
/// <remarks>
/// Indexer syntax is generally preferred, e.g.
/// <code lang="fsharp">
/// let array: float[,,,] = Array4D.zeroCreate 2 3 4 5
///
/// array[0,2,1,3]
/// </code>
/// </remarks>
///
/// <example id="get-1">
/// <code lang="fsharp">
/// let array = Array4D.zeroCreate 2 3 4 5
///
/// Array4D.get array 0 2 1 3
/// </code>
/// </example>
[<CompiledName("Get")>]
val get: array: 'T[,,,] -> index1: int -> index2: int -> index3: int -> index4: int -> 'T
/// <summary>Sets the value of an element in an array. You can also
/// use the syntax 'array.[index1,index2,index3,index4] <- value'.</summary>
///
/// <param name="array">The input array.</param>
/// <param name="index1">The index along the first dimension.</param>
/// <param name="index2">The index along the second dimension.</param>
/// <param name="index3">The index along the third dimension.</param>
/// <param name="index4">The index along the fourth dimension.</param>
/// <param name="value">The value to set.</param>
///
/// <remarks>
/// Indexer syntax is generally preferred, e.g.
/// <code lang="fsharp">
/// let array: float[,,,] = Array4D.zeroCreate 2 3 4 5
///
/// array[0,2,1,3] <- 5.0
/// </code>
/// </remarks>
///
/// <example id="get-1">
/// <code lang="fsharp">
/// let array = Array4D.zeroCreate 2 3 4 5
///
/// Array4D.2et array 0 2 1 3 5.0
/// </code>
/// </example>
[<CompiledName("Set")>]
val set: array: 'T[,,,] -> index1: int -> index2: int -> index3: int -> index4: int -> value: 'T -> unit