Send Feedback
Skip to content

inv

Matrix inverse

inv x     inv[x]

Returns the inverse of non-singular float matrix x.

q)a:3 3#2 4 8 3 5 6 0 7 1f
q)inv a
-0.4512195  0.6341463  -0.195122
-0.03658537 0.02439024 0.1463415
0.2560976   -0.1707317 -0.02439024
q)a mmu inv a
1 2.220446e-16 -2.775558e-17
0 1            5.551115e-17
0 0            1
q)1=a mmu inv a
100b
010b
001b

lsq solves a normal equations matrix via Cholesky decomposition – solving systems is more robust than matrix inversion and multiplication.

Since V3.6 2017.09.26 inv uses LU decomposition. Previously it used Cholesky decomposition as well.


lsq

Mathematics

LU decomposition, Cholesky decomposition