Giter VIP home page Giter VIP logo

Comments (8)

atimin avatar atimin commented on August 26, 2024

It will be fixed but I suspect that you have some misconceptions about a list matrix.

  1. A list matrix has default value (by default it equals zero). You will get this value always when you access to non-existent element of the matrix. After creation a list matrix is empty, but we see it as filed by zero. When you assign to a cell default value you actually remove it. In this way, your code (if it works) does nothing.

  2. If you want to fill your matrix fully or bigger part. To be better use a dense matrix.

Thanks for report, if @MohawkJohn will not be against I can fix up this bug.

from nmatrix.

jpmckinney avatar jpmckinney commented on August 26, 2024

For (2) most of the values I'm setting are 0. I'm using a sparse matrix as a vector space model.

For (1), I don't understand, "your code (if it works) does nothing". For example, this works fine:

matrix = NMatrix.new(:list, [2, 2], :float64)
matrix.pretty_print

Prints:

0.0  0.0
0.0  0.0

Then:

matrix[0, 0] = 1
matrix.pretty_print

Gives:

1.0  0.0
0.0  0.0

My code is doing the same thing as above, except inside loops.

from nmatrix.

atimin avatar atimin commented on August 26, 2024

(1) Sorry. I have understood what you fill a matrix by zero values. And from (2) I agree that your choice of type matrix is right.

Well.. we will fix it as soon as it possible. Thank you very mach for report again.

from nmatrix.

jpmckinney avatar jpmckinney commented on August 26, 2024

Forgot to mention: this is with 0.0.1 release. I will test with HEAD as soon as I can install it.

from nmatrix.

atimin avatar atimin commented on August 26, 2024

It's very important because 0.0.2 is very differ from 0.0.1 inwardly. Actually 0.0.2 is result of deep refactoring and a big part had been rewritten in C++.

I will check up it for 0.0.2.

from nmatrix.

atimin avatar atimin commented on August 26, 2024

For 0.0.2 this code works right:

    m = NMatrix.new(:list, [3, 3], :float64)
    [1.0,2.0,3.0].each_with_index do |x,i|
      [1.0,2.0,3.0].each_with_index do |y,j|
        m[i, j] = x+y
      end
    end
    m.pretty_print

Pleas try it again when you will have installed 0.0.2 version.

from nmatrix.

translunar avatar translunar commented on August 26, 2024

Is this working for you now, @jpmckinney? Thanks, Aleksey, for working on this.

from nmatrix.

jpmckinney avatar jpmckinney commented on August 26, 2024

My code works with :list now, thanks! And I'm able to cast it to :yale after building it.

from nmatrix.

Related Issues (20)

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.