In [16]:
using NMfE
In [17]:
A=[10. 1. -5.;-20. 3. 20.;5. 3. 5.]
Out[17]:
In [18]:
b=[1., 2., 6.]
Out[18]:
In [19]:
(lower, upper) = lufac(A)
# NMfE lufac(A) - lower
lower
Out[19]:
In [20]:
# NMfE lufac(A) - upper
upper
Out[20]:
In [21]:
# Check if we get A back
lower * upper
Out[21]:
In [22]:
subfor!(lower, b)
# Updated RHS
b
Out[22]:
In [23]:
subbac!(upper, b)
# Solution vector:
b
Out[23]:
In [24]:
d = copy(b)
# Restore b
b=[1., 2., 6.];
In [25]:
c = A\b
Out[25]:
In [26]:
round(A * c, 14) == b
Out[26]:
In [27]:
round(c, 14) == d
Out[27]:
In [28]:
# Julia lufact(A)
f = lufact(A);
In [29]:
f[:L]
Out[29]:
In [30]:
f[:U]
Out[30]: