go.matrix
go.matrix copied to clipboard
Possible Crash in QR
When writing a tool to generate polynormials I have encountered a bug where the libary would crash in QR
and take the whole program with it.
You can find the code I used: https://github.com/playgenhub/DataPlay/blob/master/tools/generatepolys/gen.go#L13
Here is the stack trace:
panic: runtime error: slice bounds out of range
goroutine 1 [running]:
github.com/skelterjohn/go%2ematrix.(*DenseMatrix).QR(0xc0801f6ae0, 0x1, 0xc0801f6bd0,0xc0801f6c30)
C:/Users/Ben Cox/src/github.com/skelterjohn/go.matrix/dense_decomp.go:177 +0x12bb
main.GetPolyResults(0xc0802bdf60, 0x2, 0x2, 0xc0802bdf70, 0x2, ...)
C:/Users/Ben Cox/Documents/datacon/tools/generatepolys/gen.go:35 +0x306
main.DoPoly(0xc0801a0140, 0x3f, 0xc0800d79c0, 0x12, 0xc0800af8c0, ...)
C:/Users/Ben Cox/Documents/datacon/tools/generatepolys/gen.go:116 +0x4dc
main.main()
C:/Users/Ben Cox/Documents/datacon/tools/generatepolys/gen.go:100 +0xb54
I put a trap into the library to capture the state before it crashed:
func (A *DenseMatrix) QR(debug bool) (Q, R *DenseMatrix) {
if debug {
b, _ := json.Marshal(A.elements)
fmt.Println(string(b))
}
And I got this back when the application would crash
[
1,
21669,
469545561,
1,
1447,
2093809
]
if it is any help the dataset that was shoved into it was:
transaction_number,ap_amount____
149149,27589.1
149166,30032
161184,1797250
161691,27066.7
169567,25706.4
161186,1134340
161756,90027
161188,132034
161190,693800
161180,222737
161665,26729
206584,30528
161696,29500.2
193463,92318
178295,304469
161192,2182670
184579,78657.1
161718,30097.2