Skip to content

Commit f8ff8d3

Browse files
committed
added linear algebra ns. This will eventually replace the apache-mx ns in the Apache-math library. Also cleaned up the intervals, matrix, and tensor ns.
1 parent d4c5f54 commit f8ff8d3

File tree

9 files changed

+2641
-312
lines changed

9 files changed

+2641
-312
lines changed

README.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
L# provisdom.math
1+
# provisdom.math
22

33
A comprehensive Clojure mathematics library providing numerical computing primitives with robust handling of edge cases, IEEE 754 compliance, and spec-driven development.
44

@@ -38,10 +38,30 @@ Specialized 1D tensor operations:
3838
### Matrix (`provisdom.math.matrix`)
3939
Comprehensive matrix operations:
4040
- Matrix creation (identity, diagonal, Toeplitz, random)
41-
- Specialized types (symmetric, triangular, sparse)
41+
- Specialized types (symmetric, triangular, sparse, positive-definite)
4242
- Matrix multiplication, transpose, Kronecker product
4343
- Slicing, filtering, and partitioning
44+
- Row/column manipulation (insert, remove, update)
4445
- Serialization/deserialization of triangular matrices
46+
- Matrix trace, outer product, and element-wise operations
47+
- Matrix rounding utilities
48+
49+
### Linear Algebra (`provisdom.math.linear-algebra`)
50+
Matrix decompositions and linear system solving:
51+
- LU decomposition with partial pivoting
52+
- Cholesky decomposition for positive-definite matrices
53+
- QR decomposition using Householder reflections
54+
- Eigendecomposition for symmetric matrices
55+
- Singular Value Decomposition (SVD)
56+
- Linear system solving (exact and least squares)
57+
- Matrix inverse and Moore-Penrose pseudoinverse
58+
- Determinant, condition number, and matrix rank
59+
- Minors, cofactors, and adjugate matrices
60+
- Matrix power (including negative powers via inverse)
61+
- Matrix exponential (e^M) using Padé approximation
62+
- Induced matrix norms (1-norm, infinity-norm, spectral norm)
63+
- Positive definite/semi-definite utilities
64+
- Correlation/covariance matrix conversions
4565

4666
### Special Functions (`provisdom.math.special-functions`)
4767
Advanced mathematical functions:
@@ -87,10 +107,14 @@ Numerical integration:
87107
- Parallel processing support
88108

89109
### Intervals (`provisdom.math.intervals`)
90-
Interval arithmetic:
91-
- Simple intervals `[a, b]`
92-
- Complex bounds with open/closed endpoints
93-
- Interval operations (intersection, containment)
110+
Interval arithmetic and bounds manipulation:
111+
- **Intervals**: Simple `[lower, upper]` vectors with inclusive endpoints
112+
- **Bounds**: Maps with `::lower`, `::upper`, `::open-lower?`, `::open-upper?` keys for flexible endpoint handling
113+
- Interval operations: `in-interval?`, `bound-by-interval`, `interval-width`, `interval-midpoint`
114+
- Bounds operations: `intersection`, `union`, `encompassing-bounds`, `overlaps?`, `contains-bounds?`
115+
- Bounds utilities: `bound-by-bounds`, `bounds-width`, `bounds-midpoint`
116+
- Predefined bounds: `bounds-prob` [0,1], `bounds-open-prob` (0,1), `bounds+` (0,∞], `bounds-finite` (-∞,+∞)
117+
- Specialized bounds for optimization constraints and positive-definite matrices
94118

95119
### Arrays (`provisdom.math.arrays`)
96120
Java primitive array operations for performance-critical code.
@@ -104,6 +128,7 @@ Number formatting utilities.
104128
(require '[provisdom.math.core :as m])
105129
(require '[provisdom.math.random :as random])
106130
(require '[provisdom.math.matrix :as mx])
131+
(require '[provisdom.math.linear-algebra :as la])
107132
(require '[provisdom.math.special-functions :as special-fns])
108133

109134
;; Core math
@@ -119,6 +144,12 @@ Number formatting utilities.
119144
(mx/mx* [[1 2] [3 4]] [[5 6] [7 8]]) ;=> [[19 22] [43 50]]
120145
(mx/transpose [[1 2] [3 4]]) ;=> [[1 3] [2 4]]
121146

147+
;; Linear algebra
148+
(la/determinant [[1 2] [3 4]]) ;=> -2.0
149+
(la/inverse [[4 7] [2 6]]) ;=> [[0.6 -0.7] [-0.2 0.4]]
150+
(la/solve [[2 1] [1 3]] [4 5]) ;=> [1.4 1.2]
151+
(la/matrix-power [[1 2] [3 4]] 3) ;=> [[37 54] [81 118]]
152+
122153
;; Special functions
123154
(special-fns/gamma 5) ;=> 24.0 (4!)
124155
(special-fns/erf 1.0) ;=> 0.8427007929497149

0 commit comments

Comments
 (0)