@digitaldefiance/node-accelerate 1.0.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1277 -166
- package/accelerate.cc +1346 -0
- package/examples/advanced-functions.js +0 -0
- package/examples/data-processing.js +123 -0
- package/examples/machine-learning.js +158 -0
- package/examples/mathematical-functions.js +101 -0
- package/examples/matrix-multiply.js +50 -0
- package/examples/ml-pipeline.js +317 -0
- package/examples/signal-processing-advanced.js +98 -0
- package/examples/signal-processing.js +70 -0
- package/examples/statistical-operations.js +44 -0
- package/examples/trigonometric-functions.js +52 -0
- package/examples/vector-operations.js +73 -0
- package/index.d.ts +720 -0
- package/index.js +636 -0
- package/package.json +13 -3
package/index.d.ts
CHANGED
|
@@ -279,6 +279,657 @@ export function euclidean(a: Float64Array, b: Float64Array): number;
|
|
|
279
279
|
*/
|
|
280
280
|
export function rms(a: Float64Array): number;
|
|
281
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Variance of vector elements
|
|
284
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
285
|
+
*
|
|
286
|
+
* @param a - Input vector as Float64Array
|
|
287
|
+
* @returns The variance
|
|
288
|
+
*/
|
|
289
|
+
export function variance(a: Float64Array): number;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Standard deviation of vector elements
|
|
293
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
294
|
+
*
|
|
295
|
+
* @param a - Input vector as Float64Array
|
|
296
|
+
* @returns The standard deviation
|
|
297
|
+
*/
|
|
298
|
+
export function stddev(a: Float64Array): number;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Find both minimum and maximum values in a vector
|
|
302
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
303
|
+
*
|
|
304
|
+
* @param vec - Input vector as Float64Array
|
|
305
|
+
* @returns Object with min and max values
|
|
306
|
+
*/
|
|
307
|
+
export function minmax(vec: Float64Array): { min: number; max: number };
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Element-wise sine: b = sin(a)
|
|
311
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
312
|
+
*
|
|
313
|
+
* @param a - Input vector as Float64Array
|
|
314
|
+
* @param b - Output vector as Float64Array
|
|
315
|
+
* @returns The output vector b
|
|
316
|
+
*/
|
|
317
|
+
export function vsin(a: Float64Array, b: Float64Array): Float64Array;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Element-wise cosine: b = cos(a)
|
|
321
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
322
|
+
*
|
|
323
|
+
* @param a - Input vector as Float64Array
|
|
324
|
+
* @param b - Output vector as Float64Array
|
|
325
|
+
* @returns The output vector b
|
|
326
|
+
*/
|
|
327
|
+
export function vcos(a: Float64Array, b: Float64Array): Float64Array;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Element-wise tangent: b = tan(a)
|
|
331
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
332
|
+
*
|
|
333
|
+
* @param a - Input vector as Float64Array
|
|
334
|
+
* @param b - Output vector as Float64Array
|
|
335
|
+
* @returns The output vector b
|
|
336
|
+
*/
|
|
337
|
+
export function vtan(a: Float64Array, b: Float64Array): Float64Array;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Element-wise exponential: b = exp(a)
|
|
341
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
342
|
+
*
|
|
343
|
+
* @param a - Input vector as Float64Array
|
|
344
|
+
* @param b - Output vector as Float64Array
|
|
345
|
+
* @returns The output vector b
|
|
346
|
+
*/
|
|
347
|
+
export function vexp(a: Float64Array, b: Float64Array): Float64Array;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Element-wise natural logarithm: b = log(a)
|
|
351
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
352
|
+
*
|
|
353
|
+
* @param a - Input vector as Float64Array
|
|
354
|
+
* @param b - Output vector as Float64Array
|
|
355
|
+
* @returns The output vector b
|
|
356
|
+
*/
|
|
357
|
+
export function vlog(a: Float64Array, b: Float64Array): Float64Array;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Element-wise base-10 logarithm: b = log10(a)
|
|
361
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
362
|
+
*
|
|
363
|
+
* @param a - Input vector as Float64Array
|
|
364
|
+
* @param b - Output vector as Float64Array
|
|
365
|
+
* @returns The output vector b
|
|
366
|
+
*/
|
|
367
|
+
export function vlog10(a: Float64Array, b: Float64Array): Float64Array;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Element-wise power: c = a^b
|
|
371
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
372
|
+
*
|
|
373
|
+
* @param a - Base vector as Float64Array
|
|
374
|
+
* @param b - Exponent vector as Float64Array
|
|
375
|
+
* @param c - Output vector as Float64Array
|
|
376
|
+
* @returns The output vector c
|
|
377
|
+
*/
|
|
378
|
+
export function vpow(
|
|
379
|
+
a: Float64Array,
|
|
380
|
+
b: Float64Array,
|
|
381
|
+
c: Float64Array
|
|
382
|
+
): Float64Array;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Clip vector values to range [min, max]
|
|
386
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
387
|
+
*
|
|
388
|
+
* @param a - Input vector as Float64Array
|
|
389
|
+
* @param b - Output vector as Float64Array
|
|
390
|
+
* @param min - Minimum value
|
|
391
|
+
* @param max - Maximum value
|
|
392
|
+
* @returns The output vector b
|
|
393
|
+
*/
|
|
394
|
+
export function vclip(
|
|
395
|
+
a: Float64Array,
|
|
396
|
+
b: Float64Array,
|
|
397
|
+
min: number,
|
|
398
|
+
max: number
|
|
399
|
+
): Float64Array;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Threshold vector: b[i] = a[i] if a[i] > threshold, else 0
|
|
403
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
404
|
+
*
|
|
405
|
+
* @param a - Input vector as Float64Array
|
|
406
|
+
* @param b - Output vector as Float64Array
|
|
407
|
+
* @param threshold - Threshold value
|
|
408
|
+
* @returns The output vector b
|
|
409
|
+
*/
|
|
410
|
+
export function vthreshold(
|
|
411
|
+
a: Float64Array,
|
|
412
|
+
b: Float64Array,
|
|
413
|
+
threshold: number
|
|
414
|
+
): Float64Array;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* 1D Convolution
|
|
418
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
419
|
+
*
|
|
420
|
+
* @param signal - Input signal as Float64Array
|
|
421
|
+
* @param kernel - Convolution kernel as Float64Array
|
|
422
|
+
* @param result - Output as Float64Array (length = signal.length - kernel.length + 1)
|
|
423
|
+
* @returns The output result
|
|
424
|
+
*/
|
|
425
|
+
export function conv(
|
|
426
|
+
signal: Float64Array,
|
|
427
|
+
kernel: Float64Array,
|
|
428
|
+
result: Float64Array
|
|
429
|
+
): Float64Array;
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Cross-correlation of two signals
|
|
433
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
434
|
+
*
|
|
435
|
+
* @param a - First signal as Float64Array
|
|
436
|
+
* @param b - Second signal as Float64Array
|
|
437
|
+
* @param result - Output as Float64Array (length = a.length + b.length - 1)
|
|
438
|
+
* @returns The output result
|
|
439
|
+
*/
|
|
440
|
+
export function xcorr(
|
|
441
|
+
a: Float64Array,
|
|
442
|
+
b: Float64Array,
|
|
443
|
+
result: Float64Array
|
|
444
|
+
): Float64Array;
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Generate Hamming window
|
|
448
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
449
|
+
*
|
|
450
|
+
* @param length - Window length
|
|
451
|
+
* @returns Window coefficients as Float64Array
|
|
452
|
+
*/
|
|
453
|
+
export function hamming(length: number): Float64Array;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Generate Hanning window
|
|
457
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
458
|
+
*
|
|
459
|
+
* @param length - Window length
|
|
460
|
+
* @returns Window coefficients as Float64Array
|
|
461
|
+
*/
|
|
462
|
+
export function hanning(length: number): Float64Array;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Generate Blackman window
|
|
466
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
467
|
+
*
|
|
468
|
+
* @param length - Window length
|
|
469
|
+
* @returns Window coefficients as Float64Array
|
|
470
|
+
*/
|
|
471
|
+
export function blackman(length: number): Float64Array;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Matrix transpose: B = A^T
|
|
475
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
476
|
+
*
|
|
477
|
+
* @param A - Input matrix (rows × cols) as Float64Array in row-major order
|
|
478
|
+
* @param B - Output matrix (cols × rows) as Float64Array in row-major order
|
|
479
|
+
* @param rows - Number of rows in A
|
|
480
|
+
* @param cols - Number of columns in A
|
|
481
|
+
* @returns The output matrix B
|
|
482
|
+
*/
|
|
483
|
+
export function transpose(
|
|
484
|
+
A: Float64Array,
|
|
485
|
+
B: Float64Array,
|
|
486
|
+
rows: number,
|
|
487
|
+
cols: number
|
|
488
|
+
): Float64Array;
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Inverse Fast Fourier Transform (IFFT)
|
|
492
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
493
|
+
*
|
|
494
|
+
* @param real - Real part of frequency domain as Float64Array
|
|
495
|
+
* @param imag - Imaginary part of frequency domain as Float64Array
|
|
496
|
+
* @returns Time domain signal as Float64Array
|
|
497
|
+
*/
|
|
498
|
+
export function ifft(real: Float64Array, imag: Float64Array): Float64Array;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Linear interpolation
|
|
502
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
503
|
+
*
|
|
504
|
+
* @param x - X coordinates of data points as Float64Array
|
|
505
|
+
* @param y - Y coordinates of data points as Float64Array
|
|
506
|
+
* @param xi - X coordinates to interpolate at as Float64Array
|
|
507
|
+
* @param yi - Output interpolated Y values as Float64Array
|
|
508
|
+
* @returns The output yi
|
|
509
|
+
*/
|
|
510
|
+
export function interp1d(
|
|
511
|
+
x: Float64Array,
|
|
512
|
+
y: Float64Array,
|
|
513
|
+
xi: Float64Array,
|
|
514
|
+
yi: Float64Array
|
|
515
|
+
): Float64Array;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Reverse vector order: b = reverse(a)
|
|
519
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
520
|
+
*
|
|
521
|
+
* @param a - Input vector as Float64Array
|
|
522
|
+
* @param b - Output vector as Float64Array
|
|
523
|
+
* @returns The output vector b
|
|
524
|
+
*/
|
|
525
|
+
export function vreverse(a: Float64Array, b: Float64Array): Float64Array;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Negate vector: b = -a
|
|
529
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
530
|
+
*
|
|
531
|
+
* @param a - Input vector as Float64Array
|
|
532
|
+
* @param b - Output vector as Float64Array
|
|
533
|
+
* @returns The output vector b
|
|
534
|
+
*/
|
|
535
|
+
export function vneg(a: Float64Array, b: Float64Array): Float64Array;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Sum of squares: sum(a[i]^2)
|
|
539
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
540
|
+
*
|
|
541
|
+
* @param a - Input vector as Float64Array
|
|
542
|
+
* @returns The sum of squares
|
|
543
|
+
*/
|
|
544
|
+
export function sumOfSquares(a: Float64Array): number;
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Mean magnitude: mean(|a[i]|)
|
|
548
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
549
|
+
*
|
|
550
|
+
* @param a - Input vector as Float64Array
|
|
551
|
+
* @returns The mean magnitude
|
|
552
|
+
*/
|
|
553
|
+
export function meanMagnitude(a: Float64Array): number;
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Mean square: mean(a[i]^2)
|
|
557
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
558
|
+
*
|
|
559
|
+
* @param a - Input vector as Float64Array
|
|
560
|
+
* @returns The mean square
|
|
561
|
+
*/
|
|
562
|
+
export function meanSquare(a: Float64Array): number;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Element-wise vector subtraction: out[i] = a[i] - b[i]
|
|
566
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
567
|
+
*
|
|
568
|
+
* @param a - First vector as Float64Array
|
|
569
|
+
* @param b - Second vector as Float64Array (must be same length as a)
|
|
570
|
+
* @param out - Output vector as Float64Array (must be same length as a)
|
|
571
|
+
* @returns The output vector
|
|
572
|
+
*/
|
|
573
|
+
export function vsub(
|
|
574
|
+
a: Float64Array,
|
|
575
|
+
b: Float64Array,
|
|
576
|
+
out: Float64Array
|
|
577
|
+
): Float64Array;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Element-wise vector division: out[i] = a[i] / b[i]
|
|
581
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
582
|
+
*
|
|
583
|
+
* @param a - First vector as Float64Array
|
|
584
|
+
* @param b - Second vector as Float64Array (must be same length as a)
|
|
585
|
+
* @param out - Output vector as Float64Array (must be same length as a)
|
|
586
|
+
* @returns The output vector
|
|
587
|
+
*/
|
|
588
|
+
export function vdiv(
|
|
589
|
+
a: Float64Array,
|
|
590
|
+
b: Float64Array,
|
|
591
|
+
out: Float64Array
|
|
592
|
+
): Float64Array;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Copy vector: y = x
|
|
596
|
+
* Uses Apple's BLAS for hardware-accelerated computation
|
|
597
|
+
*
|
|
598
|
+
* @param x - Input vector as Float64Array
|
|
599
|
+
* @param y - Output vector as Float64Array
|
|
600
|
+
* @returns The output vector y
|
|
601
|
+
*/
|
|
602
|
+
export function copy(x: Float64Array, y: Float64Array): Float64Array;
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Swap two vectors: x <-> y
|
|
606
|
+
* Uses Apple's BLAS for hardware-accelerated computation
|
|
607
|
+
*
|
|
608
|
+
* @param x - First vector as Float64Array
|
|
609
|
+
* @param y - Second vector as Float64Array
|
|
610
|
+
* @returns The first vector x
|
|
611
|
+
*/
|
|
612
|
+
export function swap(x: Float64Array, y: Float64Array): Float64Array;
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* L2 norm (Euclidean length): ||x||
|
|
616
|
+
* Uses Apple's BLAS for hardware-accelerated computation
|
|
617
|
+
*
|
|
618
|
+
* @param x - Input vector as Float64Array
|
|
619
|
+
* @returns The L2 norm
|
|
620
|
+
*/
|
|
621
|
+
export function norm(x: Float64Array): number;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Sum of absolute values: sum(|x[i]|)
|
|
625
|
+
* Uses Apple's BLAS for hardware-accelerated computation
|
|
626
|
+
*
|
|
627
|
+
* @param x - Input vector as Float64Array
|
|
628
|
+
* @returns The sum of absolute values
|
|
629
|
+
*/
|
|
630
|
+
export function abssum(x: Float64Array): number;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Index of maximum absolute value
|
|
634
|
+
* Uses Apple's BLAS for hardware-accelerated computation
|
|
635
|
+
*
|
|
636
|
+
* @param x - Input vector as Float64Array
|
|
637
|
+
* @returns The index of the maximum absolute value
|
|
638
|
+
*/
|
|
639
|
+
export function maxAbsIndex(x: Float64Array): number;
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Givens rotation: apply rotation to vectors x and y
|
|
643
|
+
* Uses Apple's BLAS for hardware-accelerated computation
|
|
644
|
+
*
|
|
645
|
+
* @param x - First vector as Float64Array
|
|
646
|
+
* @param y - Second vector as Float64Array
|
|
647
|
+
* @param c - Cosine of rotation angle
|
|
648
|
+
* @param s - Sine of rotation angle
|
|
649
|
+
* @returns The first vector x
|
|
650
|
+
*/
|
|
651
|
+
export function rot(
|
|
652
|
+
x: Float64Array,
|
|
653
|
+
y: Float64Array,
|
|
654
|
+
c: number,
|
|
655
|
+
s: number
|
|
656
|
+
): Float64Array;
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Fill vector with scalar value
|
|
660
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
661
|
+
*
|
|
662
|
+
* @param scalar - Value to fill with
|
|
663
|
+
* @param vec - Output vector as Float64Array
|
|
664
|
+
* @returns The output vector
|
|
665
|
+
*/
|
|
666
|
+
export function vfill(scalar: number, vec: Float64Array): Float64Array;
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Generate linear ramp: vec[i] = start + i * step
|
|
670
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
671
|
+
*
|
|
672
|
+
* @param start - Starting value
|
|
673
|
+
* @param step - Step size
|
|
674
|
+
* @param vec - Output vector as Float64Array
|
|
675
|
+
* @returns The output vector
|
|
676
|
+
*/
|
|
677
|
+
export function vramp(
|
|
678
|
+
start: number,
|
|
679
|
+
step: number,
|
|
680
|
+
vec: Float64Array
|
|
681
|
+
): Float64Array;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Add scalar to vector: c[i] = a[i] + scalar
|
|
685
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
686
|
+
*
|
|
687
|
+
* @param a - Input vector as Float64Array
|
|
688
|
+
* @param scalar - Scalar value to add
|
|
689
|
+
* @param c - Output vector as Float64Array
|
|
690
|
+
* @returns The output vector c
|
|
691
|
+
*/
|
|
692
|
+
export function vaddScalar(
|
|
693
|
+
a: Float64Array,
|
|
694
|
+
scalar: number,
|
|
695
|
+
c: Float64Array
|
|
696
|
+
): Float64Array;
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Multiply-add: d[i] = (a[i] * b[i]) + c[i]
|
|
700
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
701
|
+
*
|
|
702
|
+
* @param a - First vector as Float64Array
|
|
703
|
+
* @param b - Second vector as Float64Array
|
|
704
|
+
* @param c - Third vector as Float64Array
|
|
705
|
+
* @param d - Output vector as Float64Array
|
|
706
|
+
* @returns The output vector d
|
|
707
|
+
*/
|
|
708
|
+
export function vma(
|
|
709
|
+
a: Float64Array,
|
|
710
|
+
b: Float64Array,
|
|
711
|
+
c: Float64Array,
|
|
712
|
+
d: Float64Array
|
|
713
|
+
): Float64Array;
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Multiply-scalar-add: d[i] = (a[i] * b) + c[i]
|
|
717
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
718
|
+
*
|
|
719
|
+
* @param a - Input vector as Float64Array
|
|
720
|
+
* @param b - Scalar multiplier
|
|
721
|
+
* @param c - Vector to add as Float64Array
|
|
722
|
+
* @param d - Output vector as Float64Array
|
|
723
|
+
* @returns The output vector d
|
|
724
|
+
*/
|
|
725
|
+
export function vmsa(
|
|
726
|
+
a: Float64Array,
|
|
727
|
+
b: number,
|
|
728
|
+
c: Float64Array,
|
|
729
|
+
d: Float64Array
|
|
730
|
+
): Float64Array;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Linear interpolation: c[i] = a[i] + t * (b[i] - a[i])
|
|
734
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
735
|
+
*
|
|
736
|
+
* @param a - Start vector as Float64Array
|
|
737
|
+
* @param b - End vector as Float64Array
|
|
738
|
+
* @param t - Interpolation parameter (0 to 1)
|
|
739
|
+
* @param c - Output vector as Float64Array
|
|
740
|
+
* @returns The output vector c
|
|
741
|
+
*/
|
|
742
|
+
export function vlerp(
|
|
743
|
+
a: Float64Array,
|
|
744
|
+
b: Float64Array,
|
|
745
|
+
t: number,
|
|
746
|
+
c: Float64Array
|
|
747
|
+
): Float64Array;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Clear vector (set all elements to zero)
|
|
751
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
752
|
+
*
|
|
753
|
+
* @param vec - Vector to clear as Float64Array
|
|
754
|
+
* @returns The cleared vector
|
|
755
|
+
*/
|
|
756
|
+
export function vclear(vec: Float64Array): Float64Array;
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Limit/saturate values to range [low, high]
|
|
760
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
761
|
+
*
|
|
762
|
+
* @param a - Input vector as Float64Array
|
|
763
|
+
* @param low - Lower bound
|
|
764
|
+
* @param high - Upper bound
|
|
765
|
+
* @param c - Output vector as Float64Array
|
|
766
|
+
* @returns The output vector c
|
|
767
|
+
*/
|
|
768
|
+
export function vlimit(
|
|
769
|
+
a: Float64Array,
|
|
770
|
+
low: number,
|
|
771
|
+
high: number,
|
|
772
|
+
c: Float64Array
|
|
773
|
+
): Float64Array;
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Maximum magnitude (absolute value)
|
|
777
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
778
|
+
*
|
|
779
|
+
* @param vec - Input vector as Float64Array
|
|
780
|
+
* @returns The maximum magnitude
|
|
781
|
+
*/
|
|
782
|
+
export function maxMagnitude(vec: Float64Array): number;
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Minimum magnitude (absolute value)
|
|
786
|
+
* Uses Apple's vDSP for hardware-accelerated computation
|
|
787
|
+
*
|
|
788
|
+
* @param vec - Input vector as Float64Array
|
|
789
|
+
* @returns The minimum magnitude
|
|
790
|
+
*/
|
|
791
|
+
export function minMagnitude(vec: Float64Array): number;
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Element-wise inverse sine: b[i] = asin(a[i])
|
|
795
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
796
|
+
*
|
|
797
|
+
* @param a - Input vector as Float64Array
|
|
798
|
+
* @param b - Output vector as Float64Array
|
|
799
|
+
* @returns The output vector b
|
|
800
|
+
*/
|
|
801
|
+
export function vasin(a: Float64Array, b: Float64Array): Float64Array;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Element-wise inverse cosine: b[i] = acos(a[i])
|
|
805
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
806
|
+
*
|
|
807
|
+
* @param a - Input vector as Float64Array
|
|
808
|
+
* @param b - Output vector as Float64Array
|
|
809
|
+
* @returns The output vector b
|
|
810
|
+
*/
|
|
811
|
+
export function vacos(a: Float64Array, b: Float64Array): Float64Array;
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Element-wise inverse tangent: b[i] = atan(a[i])
|
|
815
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
816
|
+
*
|
|
817
|
+
* @param a - Input vector as Float64Array
|
|
818
|
+
* @param b - Output vector as Float64Array
|
|
819
|
+
* @returns The output vector b
|
|
820
|
+
*/
|
|
821
|
+
export function vatan(a: Float64Array, b: Float64Array): Float64Array;
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Two-argument arctangent: out[i] = atan2(y[i], x[i])
|
|
825
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
826
|
+
*
|
|
827
|
+
* @param y - Y coordinates as Float64Array
|
|
828
|
+
* @param x - X coordinates as Float64Array
|
|
829
|
+
* @param out - Output vector as Float64Array
|
|
830
|
+
* @returns The output vector
|
|
831
|
+
*/
|
|
832
|
+
export function vatan2(
|
|
833
|
+
y: Float64Array,
|
|
834
|
+
x: Float64Array,
|
|
835
|
+
out: Float64Array
|
|
836
|
+
): Float64Array;
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Element-wise hyperbolic sine: b[i] = sinh(a[i])
|
|
840
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
841
|
+
*
|
|
842
|
+
* @param a - Input vector as Float64Array
|
|
843
|
+
* @param b - Output vector as Float64Array
|
|
844
|
+
* @returns The output vector b
|
|
845
|
+
*/
|
|
846
|
+
export function vsinh(a: Float64Array, b: Float64Array): Float64Array;
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Element-wise hyperbolic cosine: b[i] = cosh(a[i])
|
|
850
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
851
|
+
*
|
|
852
|
+
* @param a - Input vector as Float64Array
|
|
853
|
+
* @param b - Output vector as Float64Array
|
|
854
|
+
* @returns The output vector b
|
|
855
|
+
*/
|
|
856
|
+
export function vcosh(a: Float64Array, b: Float64Array): Float64Array;
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* Element-wise hyperbolic tangent: b[i] = tanh(a[i])
|
|
860
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
861
|
+
*
|
|
862
|
+
* @param a - Input vector as Float64Array
|
|
863
|
+
* @param b - Output vector as Float64Array
|
|
864
|
+
* @returns The output vector b
|
|
865
|
+
*/
|
|
866
|
+
export function vtanh(a: Float64Array, b: Float64Array): Float64Array;
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Element-wise reciprocal: b[i] = 1 / a[i]
|
|
870
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
871
|
+
*
|
|
872
|
+
* @param a - Input vector as Float64Array
|
|
873
|
+
* @param b - Output vector as Float64Array
|
|
874
|
+
* @returns The output vector b
|
|
875
|
+
*/
|
|
876
|
+
export function vreciprocal(a: Float64Array, b: Float64Array): Float64Array;
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Element-wise inverse square root: b[i] = 1 / sqrt(a[i])
|
|
880
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
881
|
+
*
|
|
882
|
+
* @param a - Input vector as Float64Array
|
|
883
|
+
* @param b - Output vector as Float64Array
|
|
884
|
+
* @returns The output vector b
|
|
885
|
+
*/
|
|
886
|
+
export function vrsqrt(a: Float64Array, b: Float64Array): Float64Array;
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Element-wise ceiling: b[i] = ceil(a[i])
|
|
890
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
891
|
+
*
|
|
892
|
+
* @param a - Input vector as Float64Array
|
|
893
|
+
* @param b - Output vector as Float64Array
|
|
894
|
+
* @returns The output vector b
|
|
895
|
+
*/
|
|
896
|
+
export function vceil(a: Float64Array, b: Float64Array): Float64Array;
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* Element-wise floor: b[i] = floor(a[i])
|
|
900
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
901
|
+
*
|
|
902
|
+
* @param a - Input vector as Float64Array
|
|
903
|
+
* @param b - Output vector as Float64Array
|
|
904
|
+
* @returns The output vector b
|
|
905
|
+
*/
|
|
906
|
+
export function vfloor(a: Float64Array, b: Float64Array): Float64Array;
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Element-wise truncate (round toward zero): b[i] = trunc(a[i])
|
|
910
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
911
|
+
*
|
|
912
|
+
* @param a - Input vector as Float64Array
|
|
913
|
+
* @param b - Output vector as Float64Array
|
|
914
|
+
* @returns The output vector b
|
|
915
|
+
*/
|
|
916
|
+
export function vtrunc(a: Float64Array, b: Float64Array): Float64Array;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Copy sign: c[i] = |a[i]| * sign(b[i])
|
|
920
|
+
* Uses Apple's vForce for hardware-accelerated computation
|
|
921
|
+
*
|
|
922
|
+
* @param a - Magnitude vector as Float64Array
|
|
923
|
+
* @param b - Sign vector as Float64Array
|
|
924
|
+
* @param c - Output vector as Float64Array
|
|
925
|
+
* @returns The output vector c
|
|
926
|
+
*/
|
|
927
|
+
export function vcopysign(
|
|
928
|
+
a: Float64Array,
|
|
929
|
+
b: Float64Array,
|
|
930
|
+
c: Float64Array
|
|
931
|
+
): Float64Array;
|
|
932
|
+
|
|
282
933
|
/**
|
|
283
934
|
* All exported functions
|
|
284
935
|
*/
|
|
@@ -286,9 +937,16 @@ declare const accelerate: {
|
|
|
286
937
|
// Matrix operations
|
|
287
938
|
matmul: typeof matmul;
|
|
288
939
|
matvec: typeof matvec;
|
|
940
|
+
transpose: typeof transpose;
|
|
289
941
|
|
|
290
942
|
// BLAS operations
|
|
291
943
|
axpy: typeof axpy;
|
|
944
|
+
copy: typeof copy;
|
|
945
|
+
swap: typeof swap;
|
|
946
|
+
norm: typeof norm;
|
|
947
|
+
abssum: typeof abssum;
|
|
948
|
+
maxAbsIndex: typeof maxAbsIndex;
|
|
949
|
+
rot: typeof rot;
|
|
292
950
|
|
|
293
951
|
// Vector arithmetic
|
|
294
952
|
dot: typeof dot;
|
|
@@ -298,23 +956,85 @@ declare const accelerate: {
|
|
|
298
956
|
vsub: typeof vsub;
|
|
299
957
|
vmul: typeof vmul;
|
|
300
958
|
vdiv: typeof vdiv;
|
|
959
|
+
vscale: typeof vscale;
|
|
960
|
+
vneg: typeof vneg;
|
|
961
|
+
vaddScalar: typeof vaddScalar;
|
|
962
|
+
vma: typeof vma;
|
|
963
|
+
vmsa: typeof vmsa;
|
|
301
964
|
|
|
302
965
|
// Vector functions
|
|
303
966
|
vabs: typeof vabs;
|
|
304
967
|
vsquare: typeof vsquare;
|
|
305
968
|
vsqrt: typeof vsqrt;
|
|
306
969
|
normalize: typeof normalize;
|
|
970
|
+
vreverse: typeof vreverse;
|
|
971
|
+
vfill: typeof vfill;
|
|
972
|
+
vramp: typeof vramp;
|
|
973
|
+
vlerp: typeof vlerp;
|
|
974
|
+
vclear: typeof vclear;
|
|
975
|
+
vlimit: typeof vlimit;
|
|
976
|
+
|
|
977
|
+
// Trigonometric
|
|
978
|
+
vsin: typeof vsin;
|
|
979
|
+
vcos: typeof vcos;
|
|
980
|
+
vtan: typeof vtan;
|
|
981
|
+
vasin: typeof vasin;
|
|
982
|
+
vacos: typeof vacos;
|
|
983
|
+
vatan: typeof vatan;
|
|
984
|
+
vatan2: typeof vatan2;
|
|
985
|
+
|
|
986
|
+
// Hyperbolic
|
|
987
|
+
vsinh: typeof vsinh;
|
|
988
|
+
vcosh: typeof vcosh;
|
|
989
|
+
vtanh: typeof vtanh;
|
|
990
|
+
|
|
991
|
+
// Exponential/Logarithmic
|
|
992
|
+
vexp: typeof vexp;
|
|
993
|
+
vlog: typeof vlog;
|
|
994
|
+
vlog10: typeof vlog10;
|
|
995
|
+
vpow: typeof vpow;
|
|
996
|
+
vreciprocal: typeof vreciprocal;
|
|
997
|
+
vrsqrt: typeof vrsqrt;
|
|
998
|
+
|
|
999
|
+
// Rounding
|
|
1000
|
+
vceil: typeof vceil;
|
|
1001
|
+
vfloor: typeof vfloor;
|
|
1002
|
+
vtrunc: typeof vtrunc;
|
|
1003
|
+
vcopysign: typeof vcopysign;
|
|
1004
|
+
|
|
1005
|
+
// Clipping/Thresholding
|
|
1006
|
+
vclip: typeof vclip;
|
|
1007
|
+
vthreshold: typeof vthreshold;
|
|
307
1008
|
|
|
308
1009
|
// Reductions
|
|
309
1010
|
max: typeof max;
|
|
310
1011
|
min: typeof min;
|
|
1012
|
+
minmax: typeof minmax;
|
|
311
1013
|
rms: typeof rms;
|
|
1014
|
+
variance: typeof variance;
|
|
1015
|
+
stddev: typeof stddev;
|
|
1016
|
+
sumOfSquares: typeof sumOfSquares;
|
|
1017
|
+
meanMagnitude: typeof meanMagnitude;
|
|
1018
|
+
meanSquare: typeof meanSquare;
|
|
1019
|
+
maxMagnitude: typeof maxMagnitude;
|
|
1020
|
+
minMagnitude: typeof minMagnitude;
|
|
312
1021
|
|
|
313
1022
|
// Distance metrics
|
|
314
1023
|
euclidean: typeof euclidean;
|
|
315
1024
|
|
|
316
1025
|
// Signal processing
|
|
317
1026
|
fft: typeof fft;
|
|
1027
|
+
ifft: typeof ifft;
|
|
1028
|
+
conv: typeof conv;
|
|
1029
|
+
xcorr: typeof xcorr;
|
|
1030
|
+
|
|
1031
|
+
// Window functions
|
|
1032
|
+
hamming: typeof hamming;
|
|
1033
|
+
hanning: typeof hanning;
|
|
1034
|
+
blackman: typeof blackman;
|
|
1035
|
+
|
|
1036
|
+
// Interpolation
|
|
1037
|
+
interp1d: typeof interp1d;
|
|
318
1038
|
};
|
|
319
1039
|
|
|
320
1040
|
export default accelerate;
|