NMath Code Examples

CenterSpace.NMath.Core Namespace


Vector ExamplesDescriptionSource
VectorExample Example showing some of the basic functionality of the vector classes. C#  VB.NET  F#
VectorArithmeticExample Example showing the element-wise operators overloaded for vector/vector and vector/scalar operations. C#  VB.NET  
VectorRangeExample Example showing how to use the indexing class Range with the vector classes. C#  VB.NET  
VectorSliceExample Example showing how to use the indexing class Slice with the vector classes. C#  VB.NET  


Matrix ExamplesDescriptionSource
MatrixExample Example showing some of the basic functionality of the matrix classes. C#  VB.NET  
MatrixArithmeticExample Example showing the element-wise operators overloaded for matrix/matrix and matrix/scalar operations. C#  VB.NET  
MatrixRangeExample Example showing how to use the indexing class Range with the matrix classes. C#  VB.NET  
MatrixSliceExample Example showing how to use the indexing class Slice with the matrix classes. C#  VB.NET  


Functions of Vectors and MatricesDescriptionSource
NMathFunctionsExample Example showing some of the functionality of the NMathFunctions class. C#  VB.NET  
ApplyTransformExample Example showing how to use the matrix and vector Apply() and Tranform() methods. C#  VB.NET  


Factorization ExamplesDescriptionSource
LUFactorizationExample Example showing how to use the LU factorization classes to solve linear systems, and to compute matrix inverses, condition numbers, and determinants. C#  VB.NET  


Least Squares ExamplesDescriptionSource
LeastSquaresExample Example showing how to use the least squares classes to solve linear least squares problems. C#  VB.NET  


Random Number ExamplesDescriptionSource
RandomNumberExample Example showing how to generate random number from a normal distribution, using the class RandGenNormal, and place them in a Histogram. C#  VB.NET  
AdvancedRNGExample Example showing how to create a random number generator for a particular probability distribution using a specified uniform deviate method. C#  VB.NET  
MonteCarloRNGExample Example showing how to calculate an approximation for Pi using a Monte Carlo method and the uniform random number generator class RandGenUniform. C#  VB.NET  
VectorizedRNGExample Example showing how to generate random numbers from a stream. C#  VB.NET  
QuasiRandomExample Example showing how to generate a sequence of quasirandom points. C#  VB.NET  
IndependentStreamsExample Example showing how to create streams of independent random numbers. C#  VB.NET  


FFT, Convolution, and Correlation ExamplesDescriptionSource
FFTExample Examples showing how to use the basic FFT classes. C#  VB.NET  
FFT1DExample Example showing how to use the 1D FFT classes. C#  VB.NET  
FFT2DExample Example showing how to use the 2D FFT classes. C#  VB.NET  
ConvolutionExample Example showing how to use the convolution classes. C#  VB.NET  
CorrelationExample Example showing how to use the correlation classes. C#  VB.NET  F#


Signal Processing ExamplesDescriptionSource
MovingWindowFilterExample Example showing how to filter data using a moving average filter. C#  VB.NET  
SavitzkyGolayFilteringExample Example showing how to use the Savitzky-Golay filtering class. C#  VB.NET  


Calculus ExamplesDescriptionSource
OneVariableFunctionExample Example showing how to create and manipulate functions of one variable. C#  VB.NET  
PolynomialExample Example showing how to create and manipulate Polynomial objects. C#  VB.NET  
DifferentiationExample Example showing how to create differentiator objects for greater control over how numerical differentiation is performed. C#  VB.NET  
IntegrationExample Example showing how to create integrator objects for greater control over how numerical integration is performed. C#  VB.NET  


Misc. ExamplesDescriptionSource
CurrencyExample Example showing how to read and write vectors of currencies. C#  VB.NET  
MissingValuesExample Example showing how to perform statistical operations on matrices containing missing data. C#  VB.NET  
DatabaseExample Example showing how to use ADO.NET data structures with matrices. C#  VB.NET  
BinarySerializationExample Example showing how to serialize and deserialize an NMath Core object in binary format. C#  VB.NET  
SoapSerializationExample Example showing how to serialize and deserialize an NMath Core object in SOAP format. C#  VB.NET  



CenterSpace.NMath.Matrix Namespace


Structured Sparse Matrix ExamplesDescriptionSource
TriangularMatrixExample Example demonstrating the features of the triangular matrix classes. C#  VB.NET  
SymmetricMatrixExample Example demonstrating the features of the symmetric matrix classes. C#  VB.NET  
HermitianMatrixExample Example demonstrating the features of the Hermitian matrix classes. C#  VB.NET  
BandMatrixExample Example demonstrating the features of the banded matrix classes. C#  VB.NET  
HermitianBandMatrixExample Example demonstrating the features of the banded Hermitian matrix classes. C#  VB.NET  
SymmetricBandMatrixExample Example demonstrating the features of the banded symmetric matrix classes. C#  VB.NET  
TridiagonalMatrixExample Example demonstrating the features of the tridiagonal matrix classes. C#  VB.NET  


Structured Sparse Matrix Factorization ExamplesDescriptionSource
SymFactExample Example demonstrating the features of the factorization classes for symmetric matrices. C#  VB.NET  
BandFactExample Example demonstrating the features of the factorization classes for banded matrices. C#  VB.NET  
TriDiagFactExample Example demonstrating the features of the factorization classes for tridiagonal matrices. C#  VB.NET  
HermPDTriDiagFactExample Example demonstrating the features of the factorization classes for Hermitian positive definite tridiagonal matrices. C#  VB.NET  


General Sparse Vector and Matrix ExamplesDescriptionSource
SparseVectorExample Example demonstrating the features of the general sparse vector classes. C#  VB.NET  
SparseMatrixExample Example demonstrating the features of the general sparse matrix classes. C#  VB.NET  
SparseFactorizationExample Example showing how to solve a symmetric sparse linear system. C#  VB.NET  


Decomposition ExamplesDescriptionSource
QRDecompExample Example demonstrating the features of the QR decomposition classes. C#  VB.NET  
SVDecompExample Example demonstrating the features of the singular value decomposition classes. C#  VB.NET  
EigDecompExample Example demonstrating the features of the eigenvalue decomposition classes. C#  VB.NET  F#


Least Squares ExamplesDescriptionSource
LeastSquaresExample Example demonstrating the features of the classes for solving orindary least squares problems. C#  VB.NET  
WeightedLeastSquaresExample Example demonstrating the features of the classes for solving weighted least squares problems. C#  VB.NET  
IterativelyReweightedLeastSqExample Example demonstrating the features of the classes for solving iteratively reweighted least squares problems. C#  VB.NET  



CenterSpace.NMath.Analysis Namespace


Linear Programming ExamplesDescriptionSource
LinearProgrammingExample Example showing how to solve a linear programming (LP) problem. C#  VB.NET  F#
PrimalDualSimplexExample Example showing how to solve the Klee Minty cube linear programming problem using both primal and dual simplex methods. C#  VB.NET  


Minimization ExamplesDescriptionSource
OneVariableMinimizationExample Example showing how to find a minimum of a univariate function. C#  VB.NET  
MultiVariableMinimizationExample Example showing how to find a minimum of a multivariate function. C#  VB.NET  
TrustRegionMinimizationExample Example showing how to minimize a function using the Trust Region method. C#  VB.NET  


Simulated Annealing ExamplesDescriptionSource
SimulatedAnnealingExample Example showing how to find the minimum of a function using simulated annealing. C#  VB.NET  


Nonlinear Programming ExamplesDescriptionSource
NonlinearProgrammingExample Example showing how to solve a NonLinear Programming (NLP) problem. C#  VB.NET  
SimpleNonlinearProgrammingExample Example showing how to solve a NonLinear Programming (NLP) problem with linear constraints and variable bounds. C#  VB.NET  
QuadraticProgrammingExample Example showing how to solve a Quadratic Programming (QP) problem. C#  VB.NET  
InteriorPointQPExample Example showing how to use the interior point quadratic programming solver to solve a quadratic programming problem. C#  VB.NET  
StochasticHillClimbingExample Example showing how to use the stochastic hill climbing solver to solve a nonlinear programming problem. C#  VB.NET  
ConstrainedLeastSquaresExample Example showing how to solve the constrained least squares problem. C#  VB.NET  


Curve Fitting ExamplesDescriptionSource
PolynomialLeastSquaresExample Example showing how to fit a polynomial through a set of points. C#  VB.NET  
OneVariableCurveFittingExample Example showing how to fit a generalized one variable function to a set of points. C#  VB.NET  
MultiVariableCurveFittingExample Example showing how to fit a generalized multivariable function to a set of points. C#  VB.NET  F#


Differential Equation ExamplesDescriptionSource
RungeKuttaSolverExample Example showing how to solve first order initial value differential equations. C#  VB.NET  


Misc ExamplesDescriptionSource
RootFindingExample Example showing how to find a root of a univariate function. C#  VB.NET  
TwoVariableIntegrationExample Example showing how to integrate over two variables. C#  VB.NET  



GPU Examples


NMath Premium ExamplesDescriptionSource
BasicGPUExample Example showing how to automatically route computations to the GPU. C#  VB.NET  
FlowControlExample Example showing how to force routing of computations to CPU or GPU. C#  VB.NET  
TaskControlExample Example showing how route individual threads to a given compute device. C#  VB.NET