Home - vorcyc/Vorcyc.Mathematics GitHub Wiki

Vorcyc.Mathematics

A high performance math library.

VMath logo 0.10.24

๐Ÿ“’Full navigation

Vorcycยฎ Mathematics is a .NET-oriented math library designed to leverage the latest .NET features and deliver high-performance, accurate mathematical functions and operations. It is written in C# and can be used in any .NET application.

Main goals:

  1. Leverage the latest .NET features for best performance, for example:
    • SIMD-accelerated serial CPU computation, parallel computation, and generic math.
    • Use Span<T> instead of arrays for parameters; use Memory<T> for fields.
    • Use managed pointers and memory pools to improve performance.
  2. Fill gaps in built-in .NET math where common functions are missing.
  3. Provide additional mathematical algorithms and operations.

Targets .NET 10.0 and above.
This package targets a minimum of .NET 10.


Features

  • SIMD-accelerated serial CPU computation
  • Parallel computation (ComputingContext)
  • Generic math

GPU / CUDA policy: The main package does not include GPU acceleration; ILGPU and experimental CudaFFT have been removed. Computation runs on the CPU by default (ComputingContext). See the dedicated note for rationale, alternatives, and future extension principles.
๐Ÿ“˜GPU policy

Dependencies

  • System.Numerics.Tensors: version 10.0.9

Core module: Provides basic math operations, common functions, and extension methods, covering array operations, base conversion, bit math, combinatorics, constants, number mapping, pinnable arrays, random number generation, trigonometry, and various math functions.
๐Ÿ“˜Manual


ComputingContext: Lightweight CPU execution policy (scalar / SIMD / parallel / auto), supporting context parameters and ComputingScope; integrated into FFT, statistics, matrix/vector ops, curve fitting, batch DL, parallel MFCC, Mel audio frontends, and Trainer.Fit* training entry points. Includes numerical equivalence tests (see the manual section "Verification and tests").
๐Ÿ“˜Manual


Deep learning module: 0.9 provides a differentiable training stack: BatchTensor (NHWC), BatchSequential / Sequential model containers, 20+ batch layers (convolution, depthwise, LayerNorm, Dropout, residual/SE, etc.), Trainer.FitBatchSequential / FitCnnMlp, IBatchLoss, Adam/SGD optimizers, and ModelSerializer v3 (architecture metadata + weights). The legacy static Layers class remains.
๐Ÿ“˜Manual


Linear algebra module: :blue_book:Manual


Also includes SVM, KNN regression, clustering (DBSCAN, GMM, KMeans, etc.), dimensionality reduction (PCA with out-of-sample Transform from 0.10.18, t-SNE, LDA), blind source separation (ICA / FastICA), Isolation Forest anomaly detection with JSON snapshots (0.10.11), GPR predictive std / variance (0.10.10), CurveFitting SIMD large-N StackOverflow fix (0.10.16), classic fitter CancellationToken (0.10.17), extended model JSON persistence, and various distance metrics. Runnable examples: Examples/MachineLearning_example/.
๐Ÿ“˜Manual


Signal processing module: Rich signal processing across audio effects, feature extraction, filtering (IirFilter<T> / FirFilter<T> / ZiFilter<T> / FDA-in-T from 0.10.18; empty zpk ZpToTf([]) โ†’ [1] from 0.10.20), Fourier transforms (Fft<T> / RealFft<T> from 0.10.18), convolution (Convolver<T> / Operation.Convolve<T> from 0.10.19), common operations, signal definition and manipulation, transforms (mode decomposition stays in T from 0.10.18), and window functions. From 0.9, Signal / SignalSegment are the primary time-domain APIs (float sample rate, zero-copy slicing, ReadOnlySpan hot paths); DiscreteSignal remains but is obsolete. See Signal definition and related operations.
๐Ÿ“˜Manual


Numerics module: Types for numerical computation including integers, floating-point numbers, complex numbers, rationals, fractions, and more. High-precision numeric operations with conversion between numeric types.
๐Ÿ“˜Manual


Statistics module: Statistical analysis of numeric data across multiple data structures and numeric types. Includes extreme value search, sum, mean, variance, and methods to find max/min values and their indices. Uses hardware acceleration where possible.
๐Ÿ“˜Manual


Calculus module: Comprehensive tools including limits, integration, derivatives, Taylor series, Fourier series, Runge-Kutta ODE solvers, and Newton-Raphson root finding.
๐Ÿ“˜Manual


Extension packages

FFTW extension (separate NuGet package: Vorcyc.Mathematics.Extensions.FFTW, 0.10.24; no FFTW API change): .NET wrapper over the native FFTW library for high-performance discrete Fourier transforms. Supports single- and double-precision 1D / 2D / 3D / N-D complex-to-complex (C2C), real-to-complex (R2C), complex-to-real (C2R), and real-to-real (R2R) transforms. Also includes FFT-based Hilbert transform, envelope computation, and extension methods to convert experimental signal types to the frequency domain.
๐Ÿ“˜Manual


Examples

The Examples/ directory contains standalone runnable projects that demonstrate real-world use of the main library (not published on NuGet). Currently includes: Audio_example (NAudio WAV I/O, MFCC analysis, training and inference); Core_example (matrix multiply, Span statistics, VectorSpan, ComputingContext scope); MachineLearning_example (classification/regression pipelines); Colorization_example (image colorization, Emgu.CV); SignalProcessing_example (Signal, FFT, MFCC, filtering, and effects); DeepLearning_example (training, serialization, curve fitting); Calculus_example (integration, ODEs, root finding, series).
๐Ÿ“˜Manual


โš ๏ธ **GitHub.com Fallback** โš ๏ธ