JuliaSmoothOptimizers / JuliaSmoothOptimizers/AMD.jl

symamd is not comparable with OCTAVE/MATLAB

Open
#60 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
23
Forks
12
Avg merge
5h 4m
Merged PRs (30d)
5

Description

I have been trying to convert some code from MATLAB to Julia. But I observe that symamd operation is not very comparable to MATLAB's.
I am pasting the whole code snippet for comparison:

**Julia Code**
```julia
H = 2; #Height of the container
L = 5; #Length of the container

nx = 10;
ny = 7;

dx = L/(nx-1); #Width of space step(x)
dy = H/(ny-1); #Width of space step(y)
dt = 0.01

e = ones(nx-2);
i = ones(ny-2);

Tx = spdiagm(-1 => e[1:end-1], 0 => -2*e, 1 => e[1:end-1]);
Ty = spdiagm(-1 => i[1:end-1], 0 => -2*i, 1 => i[1:end-1]);

Tx[1,1] = -1;
Tx[end,end]=-1;

Tt = kron(Ty/dy^2, sparse(I, nx-2, nx-2)) + kron(sparse(I, ny-2, ny-2), Tx/dx^2);
N = (nx-2)*(ny-2)
Tt = sparse(I, N, N) - dt*Tt/Pe;
pt = symamd(Tt);
```
Output in Julia:
```Julia
pt = [1, 8, 33, 40, 39, 32, 34, 25, 16, 7, 9, 2, 4, 36, 37, 5, 10, 15, 26, 31, 19, 21, 24, 23, 30, 14, 22, 29, 38, 13, 6, 28, 12, 20, 27, 35, 18, 17, 11, 3]
```

Output in OCTAVE:

```OCTAVE
debug> pt
pt =

Columns 1 through 11:

1 9 2 10 33 34 25 26 19 4 5

Columns 12 through 22:

36 37 21 8 16 7 15 40 39 32 31

Columns 23 through 33:

24 23 30 14 22 29 38 13 6 28 12

Columns 34 through 40:

20 27 35 18 17 11 3
```

Any help/suggestion/insight is greatly appreciated,
Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.