5.3.4

7 Matrices and Linear Algebra

Jens Axel Søgaard <jensaxel@soegaard.net>


Neil Toronto <ntoronto@racket-lang.org>

Performance Warning: Matrix values are arrays, as exported by math/array. The same performance warning applies: operations are currently 25-50 times slower in untyped Racket than in Typed Racket, due to the overhead of checking higher-order contracts. We are working on it.

For now, if you need speed, use the typed/racket language.

 (require math/matrix)

Like all of math, math/matrix is a work in progress. Most of the basic algorithms are implemented, but some are still in planning. Possibly the most useful unimplemented algorithms are
  • LUP decomposition (currently, LU decomposition is implemented, in matrix-lu)

  • matrix-solve for triangular matrices

  • Singular value decomposition (SVD)

  • Eigendecomposition

  • Decomposition-based solvers

  • Pseudoinverse and least-squares solving

All of these are planned for the next Racket release, as well as fast flonum-specific matrix operations and LAPACK integration.

    7.1 Introduction

      7.1.1 Function Types

      7.1.2 Failure Arguments

      7.1.3 Broadcasting

      7.1.4 Strictness

    7.2 Types, Predicates and Accessors

    7.3 Construction

    7.4 Conversion

    7.5 Entrywise Operations and Arithmetic

    7.6 Polymorphic Operations

    7.7 Basic Operations

    7.8 Inner Product Space Operations

    7.9 Solving Systems of Equations

    7.10 Row-Based Algorithms

    7.11 Orthogonal Algorithms

    7.12 Operator Norms and Comparing Matrices