Debugging the TriPMatrices package

Generic matrices


In [171]:
cd("../src")
include("TriPMatrices.jl")


WARNING: replacing module TriPMatrices
Out[171]:
TriPMatrices

In [172]:
n = 6
D = [linspace(1,n,n);] + 5.0
Dl = [linspace(1,n,n);] + 1.0
Du = [linspace(1,n,n);] + 2.0

M = TriPMatrices.TridiagonalP(Dl, D, Du)


Out[172]:
6x6 TriPMatrices.TridiagonalP{Float64}:
 6.0  3.0  0.0  0.0   0.0   2.0
 3.0  7.0  4.0  0.0   0.0   0.0
 0.0  4.0  8.0  5.0   0.0   0.0
 0.0  0.0  5.0  9.0   6.0   0.0
 0.0  0.0  0.0  6.0  10.0   7.0
 8.0  0.0  0.0  0.0   7.0  11.0

In [173]:
Mf = full(M)


Out[173]:
6x6 Array{Float64,2}:
 6.0  3.0  0.0  0.0   0.0   2.0
 3.0  7.0  4.0  0.0   0.0   0.0
 0.0  4.0  8.0  5.0   0.0   0.0
 0.0  0.0  5.0  9.0   6.0   0.0
 0.0  0.0  0.0  6.0  10.0   7.0
 8.0  0.0  0.0  0.0   7.0  11.0

In [174]:
maxabs(inv(Mf) - inv(M))


Out[174]:
3.3306690738754696e-16

Symmetric matrices


In [175]:
{S = TriPMatrices.SymTridiagonalP(D, Du)}


WARNING: deprecated syntax "{a,b, ...}" at In[175]:1.
Use "Any[a,b, ...]" instead.
Out[175]:
1-element Array{Any,1}:
 6x6 TriPMatrices.SymTridiagonalP{Float64}:
 6.0  3.0  0.0  0.0   0.0   8.0
 3.0  7.0  4.0  0.0   0.0   0.0
 0.0  4.0  8.0  5.0   0.0   0.0
 0.0  0.0  5.0  9.0   6.0   0.0
 0.0  0.0  0.0  6.0  10.0   7.0
 8.0  0.0  0.0  0.0   7.0  11.0

In [176]:
iS = TriPMatrices.cholfact!(copy(S))


Out[176]:
TriPMatrices.Lixo{Float64,TriPMatrices.SymTridiagonalP{T}}(6x6 TriPMatrices.SymTridiagonalP{Float64}:
 6.0  0.5       0.0       0.0       0.0       8.0
 0.5  5.5       0.727273  0.0       0.0       0.0
 0.0  0.727273  5.09091   0.982143  0.0       0.0
 0.0  0.0       0.982143  4.08929   1.46725   0.0
 0.0  0.0       0.0       1.46725   1.19651   7.0
 8.0  0.0       0.0       0.0       7.0      11.0,'U')

In [ ]:


In [ ]: