The goal of this project is to progressively write a comprehensive mathematical library for Jai, similar to the Gnu Scientific Library or Java Apache Math.
The focus lies in providing the functionality first, performance second.
Feel free to add functionality and performance upgrades.
- Add
Quaternion64
(maybe evenOctonion64
) - I'm going through [2] now to improve the algorithms since that book is actually considering special properties of matrices early on and also writes out EVERY algorithm used.
There are more thoughts written down in the document outlining some of my thoughts.
Complex and reals scalars, vectors, matrices interoperate automatically (in most cases). Many functions specialize during compile-time on the real or complex variant (e.g. all the elementary functions).
-
Utils
calculation(Code)
; will create and release a Pool of memory for all the allocations in the Code block.
-
Complex numbers
+
,-
,*
,/
,str
; for pretty printing
-
Elementary (
z
∈ ℂ)sign(r)
factorial(z)
binomial(from, choose)
conjugate(z)
abs_sq(z)
abs(z)
arg(z)
exp(z)
log(z)
pow(z)
sqrt(z)
phase(magnitude ∈ ℂ, angle ∈ ℂ)
sin
,cos
,tan
,cot
,sec
,csc
on ℂasin
,acos
,atan
,acot
,asec
,acsc
on ℂsinh
,cosh
,tanh
,coth
,sech
,csch
on ℂasinh
,acosh
,atanh
,acoth
,asech
,acsch
on ℂ
-
polynomials
solve_quadratic
-> ℂsolve_quadratic_real
-> ℝpolynom(x, ..a)
= a[0] x^n + a[1] x^{n-1} + ... + a[n] x^0, with a,x ∈ ℝ,ℂsynthetic_division
repeated_synthetic_division
-
vector:
VectorType
; real or complex vector withVectorType
is a generic interface/trate that is implemented by any concrete vector struct, e.g.DenseVector($Type, $Dimensions)
.str
; for pretty printing- operators
[]
,==
,+
,-
,*
,/
- in-place functions add, sub, neg, mul, div
- multiple initialization functions (ones, basis, varargs, etc.)
conjugate
outer_product
reflect
norm(vec, n)
with n ∈ ℝ, specialisationsnorm_2
,norm_1
,norm_inf
cross
, for 3-dim vectorsangle
permute
swap
-
matrix:
MatrixType
; real or complexMatrixType
is a generic interface/trate that is implemented by any concrete matrix struct, e.g.DenseMatrix($Type, $Columns, $Rows)
.pstr
,str
for pretty printing- operators
[]
,[][]
,==
,+
,-
,*
,/
row
,column
- in-place functions
add
,sub
,neg
,mul
,div
- multiple initialization functions (1, ones, hadamard, varargs, etc.)
reflector
submatrix
transpose
conjugate
conjugate_transpose
=dagger
tensor
norm_1
,norm_inf
,norm_frobenius
permute_rows
,permute_columns
,permute
swap_columns
,swap_rows
-
checks
is_diagonal_unit(M)
is_(left, right)\_triangular(M)
is_right_quasi_triangular(M)
is_unitary(M)
is_(left, right)_trapezoidal(M)
-
linear algebra
solve_linear_2x2
=sl2
solve_linear_(left, right)_triangular
=sl(l, r)ta
solve_linear_right_quasi_triangular
=slrqta
solve_linear_orthogonal_projection
=solve_linear_unitary
=slop
solve_linear_successive_orthogonal_projection
=slsop
solve_linear_(left, right)_trapezoidal
=sl(l, r)tz
for vectors and matricesdecompose_LR
gaussian_factorization_(no, full, row)_pivot
solve_linear_gaussian_factorization_(no, full, row)_pivot
=slgf_(n, f, r)p
=solve_LR(n, f, r)p
inverse(M)
; M quadratic matrix ∈ ℂdeterminant
=det
; ∈ ℂ
- linear algebra
- LAPACK Scaling for Gaussian factorization (Algorithm 3.9.1 [1])
- Iterative Improvement for Gaussian factorization (Algorithm 3.9.2 [1])
Give sources for algorithms written so that we can take a look and help debugging.
Write (at least some) tests contained in each file.
[1] Scientific Computing, Vol I: Linear and nonlinear equations, Texts in computational science and engineering 18, Springer
[2] Matrix Computations, 4th Edition; Gene H. Golub & Charles F. Van Loan; Johns Hopkins University Press, Baltimore; 2013