Giter Club home page Giter Club logo

go.matrix's Introduction

go.matrix's People

Contributors

skelterjohn avatar timtadh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go.matrix's Issues

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

ParseMatlab does not handle floating point values

The following generates an error.

_, err := matrix.ParseMatlab("[1 2; 3 4.4]")

The error states: strconv.ParseFloat: parsing ".": invalid syntax. When I substitute the value 4.4 with an 4 it works as expected. I would expect that floating point values would be allowed.

Some documentation?

Could please add some documentation to this library? With examples of use?

New Repo owner?

Hi John, this is an important repo for golang as it is the most complete native go matrix library. Others use cgo. I would be willing to take on this repo and give it some TLC. Thoughts? Feel free to check out my very active github profile.

Add float32 functionality.

Using go.matrix for OpenGL calls for example isn't possible without converting each underlying matrix to a float32 slice. It would be nice to see functionality added that allows the user to use this type.

MakeDenseMatrix generates garbage

MakeDenseMatrix makes a new slice for A.elements, then loses it to the garbage collector by assigning the parameter elements. The intent isn't documented and seems ambiguous from the code. Maybe the make should be deleted, or maybe data should be copied from the parameter.

Missing LICENSE file

The .go files say

// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

but there is no LICENSE file in the github repo. Could you add the LICENSE file?

matrix norms/determinant

I believe that the OneNorm and InfinityNorm functions are implemented incorrectly.

The OneNorm should be the sum of absolute values of the elements of the matrix.

The InfinityNorm should be the maximum absolute value of the elements of the matrix.

Also, it would be helpful to have a function that provides the log determinant, since the determinant will blow up for moderate or large matrix sizes.

Enable matrix-operation chaining by having matrix-operations panic instead of returning the extra error

I don't know if there's something clever I'm missing about ignoring errors when trying to chain matrix operations - but having the ability to do this:

Y := Z.MinusDense( H.TimesDense(X) )

Instead of this:

HX, err := H.TimesDense(X)
if err != nil {
    return nil, error
}
Y, err = Z.MinusDense(HX)
if err != nil {
    return nil, error
}

Would be terrific. I don't know if maybe having a different import for go.matrix that allowed for the matrix operations to be chained like this would make sense. I was gonna branch this and simply replace all return *DenseMatrix, error with panic(err) but seeing as this seems to be the most prominent matrix package for Go, I thought I would ask for your thoughts before going in that direction.

super-slow execution, is that expected?

I have been benchmarking this library against the regular C libraries, and the regular libs are about 100x faster than go.matrix. Has anyone looked at where this discrepancy is coming from? Anyone using this, or another Go linear algebra lib, for machine learning or other compute intensive applications?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.