Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Adddgetri #53

Merged
merged 1 commit into from
Sep 14, 2015
Merged

Adddgetri #53

merged 1 commit into from
Sep 14, 2015

Conversation

btracey
Copy link
Member

@btracey btracey commented Sep 13, 2015

No description provided.

@btracey
Copy link
Member Author

btracey commented Sep 13, 2015

This needs #52 .

The cgo lapack implementation is wrong. The function documents that it returns the matrix inverse, but the cgo implementation returns a permutation of the inverse.

// Dgetri is a blocked inversion, but the block size is limited
// by the temporary space available. If lwork == -1, instead of performing Dgetri,
// the optimal work length will be stored into work[0].
func (impl Implementation) Dgetri(n int, a []float64, lda int, ipiv []int, work []float64, lwork int) bool {
Copy link
Member

Choose a reason for hiding this comment

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

The return is not described.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

Choose a reason for hiding this comment

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

"ok" here too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@btracey
Copy link
Member Author

btracey commented Sep 13, 2015

Note that the cgo error is now logged (with comment).

@kortschak
Copy link
Member

Here we go again:

$ go test github.com/gonum/lapack/cgo -cpu 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 -run Dgetri
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x7f66fb5a3e2c]

runtime stack:
runtime.throw(0x66f060, 0x2a)
    /home/daniel/Development/go/src/runtime/panic.go:527 +0x90
runtime.sigpanic()
    /home/daniel/Development/go/src/runtime/sigpanic_unix.go:12 +0x5a

goroutine 5 [syscall, locked to thread]:
runtime.cgocall(0x4280c0, 0xc820043b18, 0xc800000000)
    /home/daniel/Development/go/src/runtime/cgocall.go:120 +0x11b fp=0xc820043ad0 sp=0xc820043aa0
github.com/gonum/lapack/cgo/clapack._Cfunc_LAPACKE_dgetri(0x500000065, 0xc820067040, 0x5, 0xc820010420, 0xc800000000)
    github.com/gonum/lapack/cgo/clapack/_obj/_cgo_gotypes.go:6049 +0x39 fp=0xc820043b18 sp=0xc820043ad0
github.com/gonum/lapack/cgo/clapack.Dgetri(0x5, 0xc820067040, 0x19, 0x19, 0x5, 0xc820010420, 0x5, 0x5, 0x5)
    /home/daniel/Development/src/github.com/gonum/lapack/cgo/clapack/clapack.go:1192 +0x59 fp=0xc820043b48 sp=0xc820043b18
github.com/gonum/lapack/cgo.Implementation.Dgetri(0x5, 0xc820067040, 0x19, 0x19, 0x5, 0xc82000a540, 0x5, 0x5, 0xc82000a570, 0x5, ...)
    /home/daniel/Development/src/github.com/gonum/lapack/cgo/lapack.go:427 +0x27f fp=0xc820043bc0 sp=0xc820043b48
github.com/gonum/lapack/cgo.(*Implementation).Dgetri(0x966150, 0x5, 0xc820067040, 0x19, 0x19, 0x5, 0xc82000a540, 0x5, 0x5, 0xc82000a570, ...)
    <autogenerated>:13 +0x12a fp=0xc820043c30 sp=0xc820043bc0
github.com/gonum/lapack/testlapack.DgetriTest(0xc8200a2000, 0x7f66f2a6f798, 0x966150)
    /home/daniel/Development/src/github.com/gonum/lapack/testlapack/dgetri.go:57 +0x620 fp=0xc820043f28 sp=0xc820043c30
github.com/gonum/lapack/cgo.TestDgetri(0xc8200a2000)
    /home/daniel/Development/src/github.com/gonum/lapack/cgo/lapack_test.go:61 +0x76 fp=0xc820043f68 sp=0xc820043f28
testing.tRunner(0xc8200a2000, 0x930ea8)
    /home/daniel/Development/go/src/testing/testing.go:456 +0x98 fp=0xc820043fa0 sp=0xc820043f68
runtime.goexit()
    /home/daniel/Development/go/src/runtime/asm_amd64.s:1696 +0x1 fp=0xc820043fa8 sp=0xc820043fa0
created by testing.RunTests
    /home/daniel/Development/go/src/testing/testing.go:561 +0x86d

goroutine 1 [chan receive]:
testing.RunTests(0x686be8, 0x930da0, 0x11, 0x11, 0x611c01)
    /home/daniel/Development/go/src/testing/testing.go:562 +0x8ad
testing.(*M).Run(0xc820053ef8, 0x43a9e8)
    /home/daniel/Development/go/src/testing/testing.go:494 +0x70
main.main()
    github.com/gonum/lapack/cgo/_test/_testmain.go:86 +0x116

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /home/daniel/Development/go/src/runtime/asm_amd64.s:1696 +0x1
FAIL    github.com/gonum/lapack/cgo 0.008s

This is abolished by commenting out the call the LAPACK_dgetri, so the prep is incorrect for that routine. I think we need Indiana Jones for this.

This one was ours.

}
ipiv32 := make([]int32, len(ipiv))
for i, v := range ipiv {
ipiv32[i] = int32(v)
Copy link
Member

Choose a reason for hiding this comment

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

ipiv32[i] = int32(v) + 1

@btracey
Copy link
Member Author

btracey commented Sep 13, 2015

Ah shoot.

@kortschak
Copy link
Member

LGTM after minor change. Any idea why travis fails this? The usual?

btracey added a commit that referenced this pull request Sep 14, 2015
@btracey btracey merged commit 4024e4e into master Sep 14, 2015
@btracey btracey deleted the Adddgetri branch September 14, 2015 02:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants