Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lufact for sparse matrix pivot option error #18246

Merged
merged 6 commits into from
Aug 29, 2016
Merged

lufact for sparse matrix pivot option error #18246

merged 6 commits into from
Aug 29, 2016

Conversation

garrettthomaskth
Copy link
Contributor

base/sparse/umfpack.jl includes the following method definition for lufact

lufact(A::SparseMatrixCSC, pivot::Type{Val{false}}) = lufact(A)

which should be

lufact(A::SparseMatrixCSC, pivot::Type{Val{true}}) = lufact(A)

because in lufact pivoting is on by default.

The error is shown in the following example

A = speye(4)
A[1:2,1:2] = [-.01 -200; 200 .001]
F = lufact(A,Val{false})
F[:p]

which returns

julia> F[:q]
4-element Array{Int64,1}:
 3
 4
 1
 2

However it should return

julia> F[:q]
4-element Array{Int64,1}:
1
2
3
4

because pivoting was turned off.

base/sparse/umfpack.jl includes the following method definition for lufact

`lufact(A::SparseMatrixCSC, pivot::Type{Val{false}}) = lufact(A)`

This should likely be

`lufact(A::SparseMatrixCSC, pivot::Type{Val{true}}) = lufact(A)`

because in lufact pivoting is on by default.

The error is shown in the following example

```
A = speye(4)
A[1:2,1:2] = [-.01 -200; 200 .001]
F = lufact(A,Val{false})
F[:p]
```
which returns
```
julia> F[:q]
4-element Array{Int64,1}:
 3
 4
 1
 2
```
However it should return
```
julia> F[:q]
4-element Array{Int64,1}:
1
2
3
4
```
because pivoting was turned off.
lufact for sparse matrix pivot option error
@kshyatt kshyatt added domain:linear algebra Linear algebra domain:arrays:sparse Sparse arrays kind:bugfix This change fixes an existing bug needs tests Unit tests are required for this change labels Aug 25, 2016
@andreasnoack
Copy link
Member

Thanks. That method is indeed wrong. I'm wondering why we have it. @jiahao Do you remember why you added it?

@jiahao
Copy link
Member

jiahao commented Aug 26, 2016

I don't recall...

Ref: #18244

@garrettthomaskth Could you help us add the nice test case you show as a test in test/sparse/umfpack.jl?

#18246,18244-lufact sparse pivot
let
A = speye(4)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 space indent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops. okay added the 4 space indent

@tkelman tkelman removed the needs tests Unit tests are required for this change label Aug 26, 2016
oops my bad
@andreasnoack
Copy link
Member

@garrettthomaskth Could you try just to remove the method and see what happens? Since we don't support turning off pivoting I don't think this method is necessary.

@andreasnoack andreasnoack merged commit 68d3d32 into JuliaLang:master Aug 29, 2016
@andreasnoack
Copy link
Member

Great. Thanks.

@tkelman
Copy link
Contributor

tkelman commented Aug 31, 2016

why should deleting a method be backported?

@andreasnoack
Copy link
Member

andreasnoack commented Aug 31, 2016

The method was wrong. It pretended to disable pivoting but didn't.

mfasi pushed a commit to mfasi/julia that referenced this pull request Sep 5, 2016
* lufact for sparse matrix pivot option error

base/sparse/umfpack.jl includes the following method definition for lufact

`lufact(A::SparseMatrixCSC, pivot::Type{Val{false}}) = lufact(A)`

This should likely be

`lufact(A::SparseMatrixCSC, pivot::Type{Val{true}}) = lufact(A)`

because in lufact pivoting is on by default.

The error is shown in the following example

```
A = speye(4)
A[1:2,1:2] = [-.01 -200; 200 .001]
F = lufact(A,Val{false})
F[:p]
```
which returns
```
julia> F[:q]
4-element Array{Int64,1}:
 3
 4
 1
 2
```
However it should return
```
julia> F[:q]
4-element Array{Int64,1}:
1
2
3
4
```
because pivoting was turned off.

* Added test for JuliaLang#18246 and JuliaLang#18244

* 4 space indent

oops my bad

* remove unnecessary lufact method

* update test for removed lufact method definition
@tkelman tkelman added this to the 0.5.x milestone Sep 7, 2016
tkelman pushed a commit that referenced this pull request Feb 22, 2017
* lufact for sparse matrix pivot option error

base/sparse/umfpack.jl includes the following method definition for lufact

`lufact(A::SparseMatrixCSC, pivot::Type{Val{false}}) = lufact(A)`

This should likely be

`lufact(A::SparseMatrixCSC, pivot::Type{Val{true}}) = lufact(A)`

because in lufact pivoting is on by default.

The error is shown in the following example

```
A = speye(4)
A[1:2,1:2] = [-.01 -200; 200 .001]
F = lufact(A,Val{false})
F[:p]
```
which returns
```
julia> F[:q]
4-element Array{Int64,1}:
 3
 4
 1
 2
```
However it should return
```
julia> F[:q]
4-element Array{Int64,1}:
1
2
3
4
```
because pivoting was turned off.

* Added test for #18246 and #18244

* 4 space indent

oops my bad

* remove unnecessary lufact method

* update test for removed lufact method definition

(cherry picked from commit 68d3d32)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:arrays:sparse Sparse arrays domain:linear algebra Linear algebra kind:bugfix This change fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants