c# numerical library user guide - rogue wavedocs.roguewave.com/imsl/net/6.5/imslcs.pdf · imsl c#...

2005
VERSION 6.5 User Guide C# Numerical Library ®

Upload: truongliem

Post on 02-Jul-2018

251 views

Category:

Documents


0 download

TRANSCRIPT

  • V E R S I O N 6 . 5

    User GuideC# Numerical Library

  • IMSL C# Numerical Library V.6.5 User's Guide

    Trusted for Almost Four Decades

  • CORPORATE HEADQUARTERS Rogue Wave Software 5500 Flatiron Parkway Suite 200 Boulder, CO 80301 USA

    IMSL Libraries Contact Information USA Toll Free: 800.222.4675 T: 713.784.3131 F: 713.781.9260 Email: [email protected] Web site: www.vni.com

    Worldwide Offices USA UK France Germany Japan For contact information, please visit www.vni.com/contact/worldwideoffices.php

    IMPORTANT NOTICE

    .

  • Contents

    1 Linear Systems 1

    Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    ComplexMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    SparseMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

    SparseMatrix.SparseArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    ComplexSparseMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    ComplexSparseMatrix.SparseArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    LU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

    ComplexLU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    SuperLU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

    SuperLU.ColumnOrdering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

    SuperLU.PerformanceParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

    SuperLU.Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    ComplexSuperLU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

    ComplexSuperLU.ColumnOrdering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

    ComplexSuperLU.PerformanceParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

    ComplexSuperLU.Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

    Cholesky . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    SparseCholesky . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

    SparseCholesky.NumericFactorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    SparseCholesky.NumericFactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    SparseCholesky.SymbolicFactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    Contents Contents i

  • ComplexSparseCholesky . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    ComplexSparseCholesky.NumericFactorization . . . . . . . . . . . . . . . . . . . . . . . . . 94

    ComplexSparseCholesky.NumericFactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    ComplexSparseCholesky.SymbolicFactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    QR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    SVD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

    GenMinRes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

    GenMinRes.ImplementationMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

    GenMinRes.ResidualMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

    GenMinRes.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

    GenMinRes.IPreconditioner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

    GenMinRes.IVectorProducts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

    GenMinRes.INorm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

    ConjugateGradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

    ConjugateGradient.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

    ConjugateGradient.IPreconditioner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

    2 Eigensystem Analysis 131

    Eigen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

    SymEigen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

    3 Interpolation and Approximation 141

    Spline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

    CsAkima . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

    CsTCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

    CsInterpolate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

    CsInterpolate.Condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

    CsPeriodic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

    CsShape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

    CsSmooth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

    CsSmoothC2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

    CsTCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

    ii Contents IMSL C# Numerical Library

  • BSpline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

    BsInterpolate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

    BsLeastSquares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    Spline2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

    Spline2DInterpolate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

    Spline2DLeastSquares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

    RadialBasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

    RadialBasis.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

    RadialBasis.Gaussian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

    RadialBasis.HardyMultiquadric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

    4 Quadrature 211

    Quadrature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212

    Quadrature.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

    HyperRectangleQuadrature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220

    HyperRectangleQuadrature.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

    5 Differential Equations 225

    ODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

    ODE.ExamineStepOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

    ODE.ErrorNormOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

    OdeRungeKutta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232

    OdeRungeKutta.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234

    OdeAdamsGear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

    OdeAdamsGear.IntegrationType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

    OdeAdamsGear.SolveOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

    OdeAdamsGear.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241

    OdeAdamsGear.IJacobian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

    FeynmanKac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

    FeynmanKac.PDEStepControlMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297

    FeynmanKac.IPdeCoefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298

    FeynmanKac.IBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

    Contents Contents iii

  • FeynmanKac.IInitialData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

    FeynmanKac.IForcingTerm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

    6 Transforms 305

    FFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306

    ComplexFFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310

    7 Nonlinear Equations 315

    ZeroPolynomial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316

    ZerosFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

    ZerosFunction.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

    ZeroSystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

    ZeroSystem.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332

    ZeroSystem.IJacobian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333

    8 Optimization 335

    MinUncon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338

    MinUncon.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343

    MinUncon.IDerivative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344

    MinUnconMultiVar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344

    MinUnconMultiVar.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352

    MinUnconMultiVar.IGradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352

    NonlinLeastSquares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353

    NonlinLeastSquares.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

    NonlinLeastSquares.IJacobian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

    DenseLP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363

    MPSReader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371

    MPSReader.Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383

    MPSReader.Row . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384

    QuadraticProgramming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385

    MinConGenLin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391

    MinConGenLin.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399

    iv Contents IMSL C# Numerical Library

  • MinConGenLin.IGradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399

    BoundedLeastSquares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400

    BoundedLeastSquares.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408

    BoundedLeastSquares.IJacobian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409

    BoundedVariableLeastSquares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409

    NonNegativeLeastSquares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413

    MinConNLP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417

    MinConNLP.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429

    MinConNLP.IGradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430

    NumericalDerivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431

    NumericalDerivatives.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449

    NumericalDerivatives.IJacobian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450

    NumericalDerivatives.DifferencingMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451

    9 Special Functions 453

    Sfun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453

    Bessel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469

    10 Miscellaneous 475

    Complex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475

    Physical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500

    EpsilonAlgorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513

    11 Printing Functions 517

    PrintMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517

    PrintMatrixFormat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522

    PrintMatrixFormat.ParsePosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526

    PrintMatrix.MatrixType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527

    PrintMatrixFormat.FormatType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528

    PrintMatrixFormat.ColumnLabelType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530

    PrintMatrixFormat.RowLabelType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531

    12 Basic Statistics 533

    Contents Contents v

  • Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534

    Covariances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545

    Covariances.MatrixType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551

    PartialCovariances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552

    NormOneSample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559

    NormTwoSample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565

    Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576

    Ranks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584

    Ranks.Tie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592

    EmpiricalQuantiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593

    TableOneWay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596

    TableTwoWay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601

    TableMultiWay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608

    TableMultiWay.TableBalanced . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614

    TableMultiWay.TableUnbalanced . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615

    13 Regression 617

    RegressorsForGLM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625

    RegressorsForGLM.DummyType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633

    LinearRegression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634

    LinearRegression.CaseStatistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643

    LinearRegression.CoefficientTTestsValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647

    NonlinearRegression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648

    NonlinearRegression.IDerivative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662

    NonlinearRegression.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663

    SelectionRegression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 664

    SelectionRegression.Criterion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675

    SelectionRegression.SummaryStatistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676

    StepwiseRegression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677

    StepwiseRegression.CoefficientTTestsValue . . . . . . . . . . . . . . . . . . . . . . . . . . . 687

    StepwiseRegression.Direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688

    UserBasisRegression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689

    vi Contents IMSL C# Numerical Library

  • IRegressionBasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694

    14 Analysis of Variance 695

    ANCOVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695

    ANOVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708

    ANOVA.ComputeOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718

    ANOVAFactorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719

    ANOVAFactorial.ErrorCalculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729

    MultipleComparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730

    15 Categorical and Discrete Data Analysis 733

    ContingencyTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733

    CategoricalGenLinModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747

    CategoricalGenLinModel.DistributionParameterModel . . . . . . . . . . . . . . . . . . . . . 770

    16 Nonparametric Statistics 773

    SignTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773

    WilcoxonRankSum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777

    17 Tests of Goodness of Fit 783

    ChiSquaredTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783

    NormalityTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788

    KolmogorovOneSample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793

    KolmogorovTwoSample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796

    18 Time Series and Forecasting 801

    AutoCorrelation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804

    AutoCorrelation.StdErr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813

    CrossCorrelation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813

    CrossCorrelation.StdErr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826

    MultiCrossCorrelation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826

    LackOfFit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838

    ARAutoUnivariate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841

    Contents Contents vii

  • ARAutoUnivariate.ParamEstimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 862

    ARSeasonalFit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 862

    ARSeasonalFit.CenterMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873

    ARMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 874

    ARMA.ParamEstimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 895

    ARMAEstimateMissing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 896

    ARMAEstimateMissing.MissingValueEstimation . . . . . . . . . . . . . . . . . . . . . . . . 905

    ARMAMaxLikelihood . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 906

    ARMAOutlierIdentification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 919

    AutoARIMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 940

    AutoARIMA.InformationCriterion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 964

    Difference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965

    GARCH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 970

    KalmanFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 976

    19 Multivariate Analysis 991

    ClusterKMeans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993

    Dissimilarities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1002

    Dissimilarities.Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1007

    Dissimilarities.Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1009

    ClusterHierarchical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1009

    ClusterHierarchical.Linkage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1018

    ClusterHierarchical.Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1019

    FactorAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1020

    FactorAnalysis.MatrixType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1037

    FactorAnalysis.Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1037

    DiscriminantAnalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1038

    DiscriminantAnalysis.Discrimination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1060

    DiscriminantAnalysis.CovarianceMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1061

    DiscriminantAnalysis.Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1061

    DiscriminantAnalysis.PriorProbabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1062

    viii Contents IMSL C# Numerical Library

  • 20 Survival and Reliability Analysis 1063

    KaplanMeierECDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1063

    KaplanMeierEstimates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1067

    ProportionalHazards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1075

    ProportionalHazards.TieHandling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1092

    LifeTables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1092

    21 Probability Distribution Functions and Inverses 1099

    Cdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1101

    InvCdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1137

    Pdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1149

    ICdfFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1165

    InverseCdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1165

    IDistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1167

    IProbabilityDistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1168

    NormalDistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1170

    GammaDistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1172

    LogNormalDistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1175

    PoissonDistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1177

    22 Random Number Generation 1181

    Random . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1182

    Random.BaseGenerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1206

    MersenneTwister . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1207

    MersenneTwister64 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1211

    FaureSequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1216

    IRandomSequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1221

    23 Finance 1223

    Finance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1224

    Finance.Period . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1254

    Bond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1254

    Contents Contents ix

  • Bond.Frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1288

    DayCountBasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1289

    IBasisPart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1291

    24 Chart2D 1293

    AbstractChartNode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1294

    ChartNode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1310

    Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1332

    Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1338

    ChartTitle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1339

    Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1340

    Legend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1341

    Annotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1342

    Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1346

    AxisXY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1348

    Axis1D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1353

    AxisLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1358

    AxisLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1359

    AxisTitle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1360

    AxisUnit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1360

    MajorTick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1361

    MinorTick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1362

    Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1362

    TransformDate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1363

    AxisR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1365

    AxisRLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1367

    AxisRLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1368

    AxisRMajorTick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1369

    AxisTheta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1370

    GridPolar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1372

    Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1372

    ChartFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1383

    x Contents IMSL C# Numerical Library

  • ChartSpline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1384

    Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1385

    ToolTip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1388

    FillPaint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1390

    Draw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1393

    FrameChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1401

    PanelChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1403

    DrawPick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1405

    PickEventArgs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1411

    PickEventHandler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1413

    WebChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1413

    DrawMap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1414

    BoxPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1420

    BoxPlot.Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1428

    Contour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1431

    Contour.Legend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1444

    ContourLevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1445

    ErrorBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1446

    HighLowClose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1451

    Candlestick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1458

    CandlestickItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1460

    SplineData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1461

    Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1464

    BarItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1473

    BarSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1477

    Pie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1479

    PieSlice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1483

    Dendrogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1484

    Polar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1495

    Heatmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1497

    Heatmap.Legend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1509

    Contents Contents xi

  • Treemap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1510

    Colormap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1517

    Colormap Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1518

    25 Quality Control and Improvement Charts 1521

    ShewhartControlChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1521

    ControlLimit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1527

    XbarR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1529

    RChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1536

    XbarS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1539

    SChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1546

    XmR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1550

    NpChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1553

    PChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1556

    CChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1560

    UChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1563

    EWMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1566

    CuSum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1569

    CuSumStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1572

    ParetoChart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1578

    26 Data Mining 1585

    NaiveBayesClassifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1587

    27 Neural Nets 1613

    FeedForwardNetwork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1639

    Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1654

    InputLayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1655

    HiddenLayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1656

    OutputLayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1657

    Node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1659

    InputNode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1660

    xii Contents IMSL C# Numerical Library

  • Perceptron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1661

    OutputPerceptron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1662

    IActivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1663

    Activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1664

    Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1665

    ITrainer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1666

    QuasiNewtonTrainer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1668

    QuasiNewtonTrainer.IError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1674

    LeastSquaresTrainer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1675

    EpochTrainer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1680

    BinaryClassification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1683

    MultiClassification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1727

    ScaleFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1742

    ScaleFilter.ScalingMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1751

    UnsupervisedNominalFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1752

    UnsupervisedOrdinalFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1756

    UnsupervisedOrdinalFilter.TransformMethod . . . . . . . . . . . . . . . . . . . . . . . . . . 1761

    TimeSeriesFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1762

    TimeSeriesClassFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1764

    Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1786

    28 Error Handling 1795

    Warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1795

    WarningObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1797

    IMSLException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1798

    Logger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1799

    29 Exceptions 1803

    IMSLUnexpectedErrorException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1806

    AllConstraintsNotSatisfiedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1806

    BadInitialGuessException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1807

    BoundaryInconsistentException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1808

    Contents Contents xiii

  • BoundsInconsistentException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1810

    ConstraintEvaluationException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1811

    ConstraintsInconsistentException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1812

    ConstraintsNotSatisfiedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1814

    CorrectorConvergenceException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1815

    CyclingOccurringException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1816

    DidNotConvergeException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1817

    EqualityConstraintsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1819

    ErrorTestException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1820

    FalseConvergenceException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1822

    IllConditionedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1823

    InconsistentSystemException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1824

    InitialConstraintsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1825

    InvalidMPSFileException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1827

    IterationMatrixSingularException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1828

    LimitingAccuracyException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1829

    LinearlyDependentGradientsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1830

    MaxIterationsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1831

    MaxNumberStepsAllowedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1833

    MaxFcnEvalsExceededException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1834

    MultipleSolutionsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1835

    NoAcceptablePivotException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1836

    NoAcceptableStepsizeException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1837

    NoConvergenceException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1839

    NoLPSolutionException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1840

    NoProgressException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1841

    NotDefiniteAMatrixException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1842

    NotDefiniteJacobiPreconditionerException . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1843

    NotDefinitePreconditionMatrixException . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1845

    NotSPDException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1846

    NumericDifficultyException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1847

    xiv Contents IMSL C# Numerical Library

  • ObjectiveEvaluationException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1848

    PenaltyFunctionPointInfeasibleException . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1849

    ProblemInfeasibleException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1850

    ProblemUnboundedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1851

    ProblemVacuousException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1852

    QPInfeasibleException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1854

    QPProblemUnboundedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1855

    SingularException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1856

    SingularMatrixException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1857

    SingularPreconditionMatrixException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1858

    SolutionNotFoundException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1859

    SomeConstraintsDiscardedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1860

    TcurrentTstopInconsistentException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1862

    TEqualsToutException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1863

    TerminationCriteriaNotSatisfiedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1865

    TimeIntervalTooSmallException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1866

    ToleranceTooSmallException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1868

    TooManyIterationsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1869

    TooManyStepsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1871

    TooMuchTimeException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1872

    UnboundedBelowException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1873

    VarBoundsInconsistentException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1875

    WorkingSetSingularException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1876

    AllDeletedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1877

    AllMissingException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1878

    AltSeriesAccuracyLossException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1879

    BadVarianceException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1880

    ClassificationVariableException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1882

    ClassificationVariableLimitException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1883

    ClassificationVariableValueException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1884

    ClusterNoPointsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1886

    Contents Contents xv

  • ConstrInconsistentException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1887

    CovarianceSingularException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1888

    CovarianceSingular1Exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1889

    CovarianceSingular2Exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1890

    CyclingIsOccurringException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1890

    DeleteObservationsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1892

    DidNotConvergeException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1893

    DiffObsDeletedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1894

    EigenvalueException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1896

    EmptyGroupException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1897

    EqConstrInconsistentException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1898

    IllConditionedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1899

    IncreaseErrRelException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1900

    InitialMAException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1902

    InvalidMatrixException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1903

    InvalidPartialCorrelationException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1903

    MatrixSingularException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1904

    MoreObsDelThanEnteredException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1905

    NegativeFreqException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1906

    NegativeWeightException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1908

    NewInitialGuessException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1909

    NoAcceptableModelFoundException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1910

    NoConvergenceException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1911

    NoDegreesOfFreedomException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1913

    NoProgressException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1914

    NoVariationInputException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1915

    NoVectorXException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1916

    NonInvertibleException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1917

    NonPosVarianceException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1918

    NonPosVarianceXYException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1920

    NonPositiveEigenvalueException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1921

    xvi Contents IMSL C# Numerical Library

  • NonStationaryException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1922

    NoPositiveVarianceException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1923

    NotCDFException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1925

    NotPositiveDefiniteException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1927

    NotPositiveSemiDefiniteException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1928

    NotSemiDefiniteException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1929

    NoVariablesEnteredException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1930

    NoVariablesException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1931

    NoVariationInputException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1932

    NoVectorXException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1934

    PooledCovarianceSingularException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1935

    RankException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1936

    RankDeficientException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1937

    ScaleFactorZeroException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1938

    SingularException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1940

    SingularTriangularMatrixException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1941

    SumOfWeightsNegException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1942

    TooManyCallsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1944

    TooManyFunctionEvaluationsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1945

    TooManyIterationsException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1946

    TooManyIterationsReTryException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1948

    TooManyJacobianEvalException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1949

    TooManyObsDeletedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1950

    VarsDeterminedException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1951

    ZeroNormException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1952

    30 References 1955

    Index i

    Contents Contents xvii

  • Chapter 1: Linear Systems

    Types

    class Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6class ComplexMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11class SparseMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16class SparseMatrix.SparseArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27class ComplexSparseMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28class ComplexSparseMatrix.SparseArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37class LU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39class ComplexLU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44class SuperLU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49enumeration SuperLU.ColumnOrdering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60enumeration SuperLU.PerformanceParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61enumeration SuperLU.Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62class ComplexSuperLU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63enumeration ComplexSuperLU.ColumnOrdering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74enumeration ComplexSuperLU.PerformanceParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75enumeration ComplexSuperLU.Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76class Cholesky . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77class SparseCholesky . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81enumeration SparseCholesky.NumericFactorization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87class SparseCholesky.NumericFactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88class SparseCholesky.SymbolicFactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88class ComplexSparseCholesky . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88enumeration ComplexSparseCholesky.NumericFactorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94class ComplexSparseCholesky.NumericFactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95class ComplexSparseCholesky.SymbolicFactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95class QR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95class SVD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99class GenMinRes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104enumeration GenMinRes.ImplementationMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118enumeration GenMinRes.ResidualMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119interface GenMinRes.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

    1

  • interface GenMinRes.IPreconditioner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120interface GenMinRes.IVectorProducts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120interface GenMinRes.INorm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121class ConjugateGradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122interface ConjugateGradient.IFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129interface ConjugateGradient.IPreconditioner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

    Usage NotesSolving Systems of Linear EquationsA square system of linear equations has the form Ax = b, where A is a user-specifiedn x n matrix, b is a given right-hand side n vector, and x is the solution n vector. Each entry of A and bmust be specified by the user. The entire vector x is returned as output.

    When A is invertible, a unique solution to Ax = b exists. The most commonly used direct method forsolving Ax = b factors the matrix A into a product of triangular matrices and solves the resultingtriangular systems of linear equations. Functions that use direct methods for solving systems of linearequations all compute the solution to Ax = b.

    Matrix FactorizationsIn some applications, it is desirable to just factor the n x n matrix A into a product of two triangularmatrices. This can be done by a constructor of a class for solving the system of linear equations Ax = b.The constructor of class LU computes the LU factorization of A.

    Besides the basic matrix factorizations, such as LU and LLT , additional matrix factorizations also areprovided. For a real matrix A, its QR factorization can be computed using the class QR. The class forcomputing the singular value decomposition (SVD) of a matrix is discussed in a later section.

    Matrix InversionsThe inverse of an n x n nonsingular matrix can be obtained by using the method Inverse in the classesfor solving systems of linear equations. The inverse of a matrix need not be computed if the purpose is tosolve one or more systems of linear equations. Even with multiple right-hand sides, solving a system oflinear equations by computing the inverse and performing matrix multiplication is usually moreexpensive than the method discussed in the next section.

    Multiple Right-Hand SidesConsider the case where a system of linear equations has more than one right-hand side vector. It is mosteconomical to find the solution vectors by first factoring the coefficient matrix A into products oftriangular matrices. Then, the resulting triangular systems of linear equations are solved for eachright-hand side. When A is a real general matrix, access to the LU factorization of A is computed by aconstructor of LU. The solution xk for the k-th right-hand side vector, bk is then found by two triangularsolves, Lyk = bk and Uxk = yk. The method Solve in class LU is used to solve each right-hand side.These arguments are found in other functions for solving systems of linear equations.

    2 IMSL C# Numerical Library

  • Least-Squares Solutions and QR FactorizationsLeast-squares solutions are usually computed for an over-determined system of linear equationsAmxnx = b, where m > n. A least-squares solution x minimizes the Euclidean length of the residualvector r = Axb. The class QR computes a unique least-squares solution for x when A has full columnrank. If A is rank-deficient, then the base solution for some variables is computed. These variablesconsist of the resulting columns after the interchanges. The QR decomposition, with columninterchanges or pivoting, is computed such that AP = QR. Here, Q is orthogonal, R is upper-trapezoidalwith its diagonal elements nonincreasing in magnitude, and P is the permutation matrix determined bythe pivoting. The base solution xB is obtained by solving R(PT )x = QT b for the base variables. Fordetails, see class QR. The QR factorization of a matrix A such that AP = QR with P specified by the usercan be computed using keywords.

    Singular Value Decompositions and Generalized InversesThe SVD of an m x n matrix A is a matrix decomposition A = USVT . With q = min(m,n), the factorsUmxq and Vnxq are orthogonal matrices, and Sqxq is a nonnegative diagonal matrix with nonincreasingdiagonal terms. The class SVD computes the singular values of A by default. Part or all of the U and Vmatrices, an estimate of the rank of A, and the generalized inverse of A, also can be obtained.

    Ill-Conditioning and SingularityAn m x n matrix A, is mathematically singular if there is an x 6= 0 such that Ax = 0. In this case, thesystem of linear equations Ax = b does not have a unique solution. On the other hand, a matrix A isnumerically singular if it is close to a mathematically singular matrix. Such problems are calledill-conditioned. If the numerical results with an ill-conditioned problem are unacceptable, users canobtain an approximate solution to the system using the SVD of A: If q = min(m,n) and

    A = qi=1si,iuivTi

    then the approximate solution is given by the following:

    xk = ki=1ti,i(bT ui

    )vi

    The scalars ti,i are defined below.

    ti,i ={

    s1i,i if si,i tol > 00 otherwise

    The user specifies the value of tol. This value determines how close the given matrix is to a singularmatrix. Further restrictions may apply to the number of terms in the sum, k q. For example, there maybe a value of k q such that the scalars

    bT ui , i > k are smaller than the average uncertainty in theright-hand side b. This means that these scalars can be replaced by zero; and hence, b is replaced by avector that is within the stated uncertainty of the problem.

    Sparse Matrix Storage ModesAll classes that work with sparse matrices (e.g. classes SparseCholesky, SuperLU,ComplexSparseCholesky and ComplexSuperLU) require a matrix input format that only storesinformation about the nonzero entries of these matrices. IMSL C# Numerical Library supports two suchformats: The sparse coordinate storage (SCS) format and the Sparse Array format. The SCS formatstores the value of each matrix entry together with that entrys row and column index. The Sparse Array

    Linear Systems 3

  • format stores the sparse matrix in two arrays of arrays. One array contains the references to the nonzerovalue arrays for each row of the matrix, the other contains the references to the associated column indexarrays. As an example, consider the following sparse 66 matrix:

    A =

    10 0 0 0 0 00 10 3 1 0 00 0 15 0 0 02 0 0 10 1 01 0 0 5 1 31 2 0 0 0 6

    This matrix has 15 nonzero elements, and the sparse coordinate representation would be

    row 0 1 1 1 2 3 3 3 4 4 4 4 5 5 5col 0 1 2 3 2 0 3 4 0 3 4 5 0 1 5val 10 10 -3 -1 15 -2 10 -1 -1 -5 1 -3 -1 -2 6

    Since this representation does not rely on the order of the matrix elements, an equivalent form would be

    row 5 4 3 0 5 1 2 1 4 3 1 4 3 5 4col 0 0 0 0 1 1 2 2 3 3 3 4 4 5 5val -1 -1 -2 10 -2 10 15 -3 -5 10 -1 1 -1 6 -3

    In Sparse Array format, matrix A can be represented by the following two arrays, index and values:

    index:row 0: 0row 1: 1, 2, 3row 2: 2row 3: 0, 3, 4row 4: 0, 3, 4, 5row 5: 0, 1, 5

    values:row 0: 10row 1: 10, -3, -1row 2: 15row 3: -2, 10, -1row 4: -1, -5, 1, -3row 5: -1, -2, 6

    In contrast to the SCS format, the row order is fixed here, but the entries within each row do not rely onany order.

    In IMSL C# Numerical Library, sparse matrices are instances of classesSparseMatrix/ComplexSparseMatrix. Use of the SCS and Sparse Array input format is reflected bydifferent constructors. The following code fragment shows how a user can construct a SparseMatrixfor the matrix A above in SCS format:

    // Generate an empty 6 by 6 SparseMatrix objectint nRows = nColumns = 6;

    4 IMSL C# Numerical Library

  • SparseMatrix a = new SparseMatrix(nRows, nColumns);// Fill object a with the entries of matrix A,// A given in SCS formata.Set(0, 0, 10.0); a.Set(1, 1, 10.0); a.Set(1, 2, -3.0);a.Set(1, 3, -1.0); a.Set(2, 2, 15.0); a.Set(3, 0, -2.0);a.Set(3, 3, 10.0); a.Set(3, 4, -1.0); a.Set(4, 0, -1.0);a.Set(4, 3, -5.0); a.Set(4, 4, 1.0); a.Set(4, 5, -3.0);a.Set(5, 0, -1.0); a.Set(5, 1, -2.0); a.Set(5, 5, 6.0);

    Similarly, the following code fragment shows how to construct a SparseMatrix in Sparse Array format:

    // Generate matrix A in Sparse Array formatint nRows = nColumns = 6;int[][] aIndex = { {0},

    {1, 2, 3},{2},{0, 3, 4},{0, 3, 4, 5},{0, 1, 5}};

    int[][] aValues = { {10.0},{10.0, -3.0, -1.0},{15.0},{-2.0, 10.0, -1.0},{-1.0, -5.0, 1.0, -3.0},{-1.0, -2.0, 6.0}};

    // Create SparseMatrix object based on A in Sparse Array formatSparseMatrix a = new SparseMatrix(nRows, nColumns, aIndex, aValues);

    All IMSL C# Numerical Library algorithms working on sparse matrices use SparseMatrix orComplexSparseMatrix as an input argument type. A square nn matrix is called symmetric ifAT = A, where AT denotes the tranpose of A. It is called Hermitian if AH = A. Here, AH AT denotesthe conjugate transpose of A. For these types of matrices, all matrix information is stored in the lowertriangular part of the matrix. Therefore, for all IMSL C# Numerical Library sparse matrix classesworking on symmetric or Hermitian matrices it is sufficient to store only the lower triangle of the matrixin the SparseMatrix or ComplexSparseMatrix input object.

    The complex 44 matrix

    H =

    4 1 i 0 0

    1+ i 4 1 i 00 1+ i 4 1 i0 0 1+ i 4

    is Hermitian positive definite. Typically, matrices of this type areinput to methods of class ComplexSparseCholesky.

    The following code fragment shows how the lower triangular part of H can be constructed as aComplexSparseMatrix type in SCS input format:

    // Generate an empty 4 by 4 ComplexSparseMatrix objectint nRows = nColumns = 4;ComplexSparseMatrix h = new ComplexSparseMatrix(nRows, nColumns);// Store lower triangular part of H in object h

    Linear Systems 5

  • h.Set(0, 0, new Complex(4.0,0.0));h.Set(1, 0, new Complex(1.0, 1.0)); h.Set(1, 1, new Complex(4.0,0.0));h.Set(2, 1, new Complex(1.0,1.0)); h.Set(2, 2, new Complex(4.0, 0.0));h.Set(3, 2, new Complex(1.0, 1.0)); h.Set(3, 3, new Complex(4.0, 0.0));

    Matrix Class

    public class Imsl.Math.Matrix

    Matrix manipulation functions.

    Methods

    Addstatic public double[,] Add(double[,] a, double[,] b)

    Description

    Add two rectangular matrixs, a + b.

    Parameters

    a A double rectangular matrix.

    b A double rectangular matrix.

    Returns

    A double rectangular matrix representing the matrix sum of the two arguments.

    Exception

    System.ArgumentException is thrown when the matrices are not the same size

    CheckSquareMatrixstatic public void CheckSquareMatrix(double[,] a)

    Description

    Check that the matrix is square.

    Parameter

    a A double matrix.

    Exception

    System.ArgumentException is thrown when the matrix is not square

    FrobeniusNormstatic public double FrobeniusNorm(double[,] a)

    6 Matrix IMSL C# Numerical Library

  • Description

    Return the frobenius norm of a matrix.

    Parameter

    a A double rectangular matrix.

    Returns

    A double scalar value equal to the frobenius norm of the matrix.

    InfinityNormstatic public double InfinityNorm(double[,] a)

    Description

    Return the infinity norm of a matrix.

    Parameter

    a A double rectangular matrix.

    Returns

    A double scalar value equal to the maximum of the row sums of the absolute values of the matrixelements.

    InverseLowerTriangularstatic public double[,] InverseLowerTriangular(double[,] a)

    Description

    Returns the inverse of the lower triangular matrix a.

    Parameter

    a A double square lower triangular matrix.

    Returns

    A double matrix containing the inverse of a.

    InverseUpperTriangularstatic public double[,] InverseUpperTriangular(double[,] a)

    Description

    Returns the inverse of the upper triangular matrix a.

    Parameter

    a A double square upper triangular matrix.

    Returns

    A double matrix containing the inverse of a.

    Multiplystatic public double[] Multiply(double[] x, double[,] a)

    Linear Systems Matrix 7

  • Description

    Return the product of the row matrix x and the rectangular matrix a.

    Parameters

    x A double row matrix.

    a A double rectangular matrix.

    Returns

    A double vector representing the product of the arguments, x*a.

    Exception

    System.ArgumentException is thrown when the number of elements in the input row matrix isnot equal to the number of rows of the matrix

    Multiplystatic public double[] Multiply(double[] x, double[,] a, int processors)

    Description

    Return the product of the row matrix x and the rectangular matrix a.

    Parameters

    x A double row matrix.

    a A double rectangular matrix.

    processors An int which specifies the number of processors to use. If processors is lessthan 1, then processors = 1 is used.

    Returns

    A double vector representing the product of the arguments, x*a.

    Exception

    System.ArgumentException is thrown when the number of elements in the input row matrix isnot equal to the number of rows of the matrix

    Multiplystatic public double[] Multiply(double[,] a, double[] x)

    Description

    Multiply the rectangular matrix a and the column matrix x.

    Parameters

    a A double rectangular matrix.

    x A double column matrix.

    Returns

    A double vector representing the product of the arguments, a * x.

    8 Matrix IMSL C# Numerical Library

  • Exception

    System.ArgumentException is thrown when the number of columns in the input matrix is notequal to the number of elements in the input column vector

    Multiplystatic public double[,] Multiply(double[,] a, double[,] b, int processors)

    Description

    Multiply two rectangular arrays, a * b, using multiple processors.

    Parameters

    a A double rectangular array.

    b A double rectangular array.

    processors An int which specifies the number of processors to use. If processors is lessthan 1, then processors = 1 is used.

    Returns

    The double matrix product of a times b

    Multiplystatic public double[,] Multiply(double[,] a, double[,] b)

    Description

    Multiply two rectangular matrices, a * b.

    Parameters

    a A double rectangular matrix.

    b A double rectangular matrix.

    Returns

    The double matrix product of a * b.

    Exception

    System.ArgumentException is thrown when the number of columns in a is not equal to thenumber of rows in b

    OneNormstatic public double OneNorm(double[,] a)

    Description

    Return the matrix one norm.

    Parameter

    a A double rectangular matrix.

    Linear Systems Matrix 9

  • Returns

    A double value equal to the maximum of the column sums of the absolute values of the matrix elements.

    Subtractstatic public double[,] Subtract(double[,] a, double[,] b)

    Description

    Subtract two rectangular matrixs, a - b.

    Parameters

    a A double rectangular matrix.

    b A double rectangular matrix.

    Returns

    A double rectangular matrix representing the matrix difference of the two arguments.

    Exception

    System.ArgumentException is thrown when the matrices are not the same size

    Transposestatic public double[,] Transpose(double[,] a)

    Description

    Return the transpose of a matrix.

    Parameter

    a A double matrix.

    Returns

    A double matrix which is the transpose of the argument.

    Example: Matrix and PrintMatrixThe 1 norm of a matrix is found using a method from the Matrix class. The matrix is printed using thePrintMatrix class.

    using System;using Imsl.Math;

    public class MatrixEx1{

    public static void Main(String[] args){

    double nrm1;double[,] a = {

    {0.0, 1.0, 2.0, 3.0},{4.0, 5.0, 6.0, 7.0},{8.0, 9.0, 8.0, 1.0},{6.0, 3.0, 4.0, 3.0}

    10 Matrix IMSL C# Numerical Library

  • };

    // Get the 1 norm of matrix anrm1 = Matrix.OneNorm(a);

    // Construct a PrintMatrix object with a titlePrintMatrix p = new PrintMatrix("A Simple Matrix");

    // Print the matrix and its 1 normp.Print(a);Console.Out.WriteLine("The 1 norm of the matrix is " + nrm1);

    }}

    OutputA Simple Matrix

    0 1 2 30 0 1 2 31 4 5 6 72 8 9 8 13 6 3 4 3

    The 1 norm of the matrix is 20

    ComplexMatrix Class

    public class Imsl.Math.ComplexMatrix

    Complex matrix manipulation functions.

    Methods

    Addstatic public Imsl.Math.Complex[,] Add(Imsl.Math.Complex[,] a,Imsl.Math.Complex[,] b)

    Description

    Add two rectangular Complex arrays, a + b.

    Parameters

    a A Complex rectangular array.

    b A Complex rectangular array.

    Linear Systems ComplexMatrix 11

  • Returns

    The Complex matrix sum of the two arguments.

    Exception

    System.ArgumentException is thrown when the matrices are not the same size.

    CheckSquareMatrixstatic public void CheckSquareMatrix(Imsl.Math.Complex[,] a)

    Description

    Check that the Complex matrix is square.

    Parameter

    a A Complex matrix.

    Exception

    System.ArgumentException is thrown when the matrix is not square.

    FrobeniusNormstatic public double FrobeniusNorm(Imsl.Math.Complex[,] a)

    Description

    Return the frobenius norm of a Complex matrix.

    Parameter

    a A Complex rectangular matrix.

    Returns

    A double value equal to the frobenius norm of the matrix.

    InfinityNormstatic public double InfinityNorm(Imsl.Math.Complex[,] a)

    Description

    Return the infinity norm of a Complex matrix.

    Parameter

    a A Complex rectangular matrix.

    Returns

    A double value equal to the maximum of the row sums of the absolute values of the array elements.

    Multiplystatic public Imsl.Math.Complex[] Multiply(Imsl.Math.Complex[] x,Imsl.Math.Complex[,] a)

    Description

    Returns the product of the row vector x and the rectangular array a, both Complex.

    12 ComplexMatrix IMSL C# Numerical Library

  • Parameters

    x A Complex row vector.

    a A Complex rectangular matrix.

    Returns

    A Complex vector containing the product of the arguments, x * a.

    Exception

    System.ArgumentException is thrown when the number of elements in the input vector is notequal to the number of rows of the matrix.

    Multiplystatic public Imsl.Math.Complex[] Multiply(Imsl.Math.Complex[] x,Imsl.Math.Complex[,] a, int processors)

    Description

    Returns the product of the row vector x and the rectangular array a, both Complex.

    Parameters

    x A Complex row vector.

    a A Complex rectangular matrix.

    processors An int which specifies the number of processors to use. If processors is lessthan 1, then processors = 1 is used.

    Returns

    A Complex vector containing the product of the arguments, x * a.

    Exception

    System.ArgumentException is thrown when the number of elements in the input vector is notequal to the number of rows of the matrix.

    Multiplystatic public Imsl.Math.Complex[] Multiply(Imsl.Math.Complex[,] a,Imsl.Math.Complex[] x)

    Description

    Multiply the rectangular array a and the column vector x, both Complex.

    Parameters

    a A Complex rectangular matrix.

    x A Complex vector.

    Returns

    A Complex vector containing the product of the arguments, a * x.

    Linear Systems ComplexMatrix 13

  • Exception

    System.ArgumentException is thrown when the number of columns in the input matrix is notequal to the number of elements in the input vector.

    Multiplystatic public Imsl.Math.Complex[,] Multiply(Imsl.Math.Complex[,] a,Imsl.Math.Complex[,] b)

    Description

    Multiply two Complex rectangular arrays, a * b.

    Parameters

    a A Complex rectangular array.

    b A Complex rectangular array.

    Returns

    The Complex matrix product of a times b.

    Exception

    System.ArgumentException is thrown when the number of columns in a is not equal to thenumber of rows in b.

    Multiplystatic public Imsl.Math.Complex[,] Multiply(Imsl.Math.Complex[,] a,Imsl.Math.Complex[,] b, int processors)

    Description

    Multiply two Complex rectangular arrays, a * b, using multiple processors.

    Parameters

    a A Complex rectangular array.

    b A Complex rectangular array.

    processors An int which specifies the number of processors to use. If processors is lessthan 1, then processors = 1 is used.

    Returns

    The Complex matrix product of a times b

    OneNormstatic public double OneNorm(Imsl.Math.Complex[,] a)

    Description

    Return the Complex matrix one norm.

    Parameter

    a A Complex rectangular array.

    14 ComplexMatrix IMSL C# Numerical Library

  • Returns

    A double value equal to the maximum of the column sums of the absolute values of the array elements.

    Subtractstatic public Imsl.Math.Complex[,] Subtract(Imsl.Math.Complex[,] a,Imsl.Math.Complex[,] b)

    Description

    Subtract two Complex rectangular arrays, a - b.

    Parameters

    a A Complex rectangular array.

    b A Complex rectangular array.

    Returns

    The Complex matrix difference of the two arguments.

    Exception

    System.ArgumentException is thrown when the matrices are not the same size.

    Transposestatic public Imsl.Math.Complex[,] Transpose(Imsl.Math.Complex[,] a)

    Description

    Return the transpose of a Complex matrix.

    Parameter

    a A Complex matrix.

    Returns

    The Complex matrix transpose of the argument.

    Example: Print a Complex MatrixA Complex matrix and its transpose is printed.

    using System;using Imsl.Math;

    public class ComplexMatrixEx1{

    public static void Main(String[] args){

    Complex[,] a = {{new Complex(1, 3), new Complex(3, 5), new Complex(7, 9)},{new Complex(8, 7), new Complex(9, 5), new Complex(1, 9)},{new Complex(2, 9), new Complex(6, 9), new Complex(7, 3)},{new Complex(5, 4), new Complex(8, 4), new Complex(5, 9)}

    };

    Linear Systems ComplexMatrix 15

  • // Print the matrixnew PrintMatrix("Matrix A").Print(a);

    // Print the transpose of the matrixnew PrintMatrix("Transpose(A)").Print(ComplexMatrix.Transpose(a));

    }}

    OutputMatrix A

    0 1 20 1+3i 3+5i 7+9i1 8+7i 9+5i 1+9i2 2+9i 6+9i 7+3i3 5+4i 8+4i 5+9i

    Transpose(A)0 1 2 3

    0 1+3i 8+7i 2+9i 5+4i1 3+5i 9+5i 6+9i 8+4i2 7+9i 1+9i 7+3i 5+9i

    SparseMatrix Class

    public class Imsl.Math.SparseMatrix

    A general real sparse matrix intended to be efficiently and easily updated.

    A SparseMatrix can be constructed from a set of arrays, or it can be abstractly created as an emptyarray and then incrementally built into final form. It is usually easier to create an empty SparseMatrixof a set size and then use the Set method to set the elements of the array. When setting the elements ofthe sparse array, their positions should be thought of as their positions in the dense array. Elements canbe set in any order, but only the elements actually set are stored.

    This class includes methods to update the sparse matrix. There are also methods to multiply a sparsematrix and a vector or to multiply two sparse matrices. To solve a sparse linear system useSparseCholesky or SuperLU.

    See Also

    Imsl.Math.SparseCholesky (p. 81), Imsl.Math.SuperLU (p. 49)

    16 SparseMatrix IMSL C# Numerical Library

  • Properties

    NumberOfColumnspublic int NumberOfColumns {get; }

    Description

    The number of columns in the matrix.

    Property Value

    An int containing the number of columns in the matrix.

    NumberOfNonZerospublic long NumberOfNonZeros {get; }

    Description

    The number of nonzeros in the matrix.

    Property Value

    A long containing the number of nonzeros in the matrix.

    NumberOfRowspublic int NumberOfRows {get; }

    Description

    The number of rows in the matrix.

    Property Value

    An int containing the number of rows in the matrix.

    Constructors

    SparseMatrixpublic SparseMatrix(int nRows, int nColumns)

    Description

    Creates a new instance of SparseMatrix. Initially this is the zero matrix.

    Parameters

    nRows An int specifying the number of rows in the sparse matrix.

    nColumns An int specifying the number of columns in the sparse matrix.

    SparseMatrixpublic SparseMatrix(Imsl.Math.SparseMatrix A)

    Linear Systems SparseMatrix 17

  • Description

    Creates a new instance of SparseMatrix which is a copy of another SparseMatrix object.

    Parameter

    A A SparseMatrix object containing the matrix to be copied.

    SparseMatrixpublic SparseMatrix(Imsl.Math.SparseMatrix.SparseArray sparseArray)

    Description

    Constructs a sparse matrix from a SparseArray.

    Parameter

    sparseArray A SparseArray used to initialize the sparse matrix. The fieldNumberOfNonZeros in SparseArray (p. 27) is not used for initialization, so it does not have tobe set.

    SparseMatrixpublic SparseMatrix(int nRows, int nColumns, int[][] index, double[][] values)

    Description

    Constructs a sparse matrix from SparseArray data.

    Parameters

    nRows An int specifying the number of rows in the sparse matrix.

    nColumns An int specifying the number of columns in the sparse matrix.

    index An int jagged array containing the column indices of all nonzero elements correspondingto the compressed representation of the sparse matrix in values. The size of index must beidentical to the size of values. The i-th row contains the column indices of all nonzero elements ofrow i of the sparse matrix. The j-th element of row i is the column index of the value located at thesame position in values.

    values A double jagged array containing the compressed representation of a real sparse matrixof size nRows by nColumns. The number of rows in values must be nRows. The i-th row containsall nonzero elements of row i of the full sparse matrix.

    Methods

    Addstatic public Imsl.Math.SparseMatrix Add(double alpha, double beta,Imsl.Math.SparseMatrix A, Imsl.Math.SparseMatrix B)

    Description

    Performs element-wise addition of two real sparse matrices A, B of type SparseMatrix, C A+B.

    18 SparseMatrix IMSL C# Numerical Library

  • Parameters

    alpha A double scalar value applied to SparseMatrix A.

    beta A double scalar value applied to SparseMatrix B.

    A A SparseMatrix matrix.

    B A SparseMatrix matrix.

    Returns

    A SparseMatrix matrix representing the computed sum.

    Exception

    System.ArgumentException is thrown when the matrices are not of the same size.

    CheckSquareMatrixpublic void CheckSquareMatrix()

    Description

    Check that the matrix is square.

    Exception

    System.ArgumentException is thrown if the matrix is not square.

    FrobeniusNormpublic double FrobeniusNorm()

    Description

    Returns the Frobenius norm of the matrix.

    Returns

    A double scalar equal to the Frobenius norm of the matrix.

    Getpublic double Get(int iRow, int jColumn)

    Description

    Returns the value of an element in the matrix.

    Parameters

    iRow An int specifying the row index of the element.

    jColumn An int specifying the column index of the element.

    Returns

    A double containing the value of the iRow-th and jColumn-th element. If the element was never set, itsvalue is zero.

    InfinityNormpublic double InfinityNorm()

    Linear Systems SparseMatrix 19

  • Description

    Returns the infinity norm of the matrix.

    Returns

    A double scalar equal to the maximum of the row sums of the absolute values of the array elements ofthe sparse matrix.

    Multiplypublic double[] Multiply(double[] x)

    Description

    Multiply the matrix by a vector.

    Parameter

    x A double column array.

    Returns

    A double vector representing the product of the constructed matrix and x, Ax.

    Exception

    System.ArgumentException is thrown when the number of columns of the matrix representedby this object is not equal to the number of elements in the input column vector.

    Multiplystatic public double[] Multiply(Imsl.Math.SparseMatrix A, double[] x)

    Description

    Multiply sparse matrix A and column array x, Ax.

    Parameters

    A A SparseMatrix matrix.

    x A double column array.

    Returns

    A double vector representing the product of the arguments, Ax.

    Exception

    System.ArgumentException is thrown when the number of columns in the input matrix is notequal to the number of elements in the input column vector.

    Multiplystatic public double[] Multiply(double[] x, Imsl.Math.SparseMatrix A)

    Description

    Multiply row array x and sparse matrix A, xT A.

    20 SparseMatrix IMSL C# Numerical Library

  • Parameters

    x A double row array.

    A A SparseMatrix matrix.

    Returns

    A double vector representing the product of the arguments, xT A.

    Exception

    System.ArgumentException is thrown when the number of elements in the input vector is notequal to the number of rows of the matrix.

    Multiplystatic public Imsl.Math.SparseMatrix Multiply(Imsl.Math.SparseMatrix A,Imsl.Math.SparseMatrix B)

    Description

    Multiply two sparse matrices, C AB.Parameters

    A A SparseMatrix sparse matrix.

    B A SparseMatrix sparse matrix.

    Returns

    The SparseMatrix product AB of A and B.

    Exception

    System.ArgumentException is thrown when the number of columns of matrix A is not equal tothe number of rows of matrix B.

    MultiplySymmetricstatic public double[] MultiplySymmetric(Imsl.Math.SparseMatrix A, double[] x)

    Description

    Multiply sparse symmetric matrix A and column vector x.

    Parameters

    A A SparseMatrix sparse symmetric matrix, where only the lower triangular part of the matrixis to be used.

    x A double vector.

    Returns

    A double vector representing the product of the arguments, Ax.

    Exception

    System.ArgumentException is thrown when the input matrix is not square or the number ofcolumns in the input matrix is not equal to the number of elements in the input column vector.

    OneNormpublic double OneNorm()

    Linear Systems SparseMatrix 21

  • Description

    Returns the matrix one norm of the sparse matrix.

    Returns

    A double scalar containing the maximum of the column sums of the absolute values of the arrayelements.

    PlusEqualspublic double PlusEquals(int iRow, int jColumn, double x)

    Description

    Adds a value to an element in the matrix.

    Parameters

    iRow An int specifying the row index o