Code Monkey home page Code Monkey logo

Comments (3)

versilov avatar versilov commented on May 12, 2024

Hello!

Definitely a bug, fixed.

Now it passes special values (like NaN and Inf) as symbols :nan, :inf, :neg_inf to all apply functions. So, you can round numbers like this:

iex> Matrex.apply(m, fn x when is_float(x) -> Float.round(x)
...> o -> o                                                 
...> end)  

or

iex(2)> Matrex.apply(m, fn x when x in [:nan, :inf, :neg_inf] -> -1
...(2)> x -> Float.round(x)
...(2)> end)

Please, give a try.

from matrex.

goodhamgupta avatar goodhamgupta commented on May 12, 2024

Hi!

Yup, it seems to be working great! Thanks for the quick fix @versilov!

As a side note, do you have a list of tasks/features that you plan on implementing in the array branch? If you have any beginner level issues, I would be more than happy to help! 😄

from matrex.

versilov avatar versilov commented on May 12, 2024

Thank you for using this library, @goodhamgupta! You already help to debug it.

The main task, that I am stuck at right now in the array branch is displaying of multi-dimensional matrices. It does not require deep knowledge of the language, rather good algorithmic skills (which I lack).

  # Our goal:
  # Matrex[2×2×3×2×2]:int32
  # ┌┌┌           ┐┌           ┐┌           ┐┐┐
  # │││11111 11112││11211 11212││11311 11312│││
  # │││11121 11122││11221 11222││11321 11322│││
  # ││└           ┘└           ┘└           ┘││
  # ││┌           ┐┌           ┐┌           ┐││
  # │││12111 12112││12211 12212││12311 12312│││
  # │││12121 12122││12221 12222││12321 12322│││
  # │└└           ┘└           ┘└           ┘┘│
  # │┌┌           ┐┌           ┐┌           ┐┐│
  # │││21111 21112││21211 21212││21311 21312│││
  # │││21121 21122││21221 21222││21321 21322│││
  # ││└           ┘└           ┘└           ┘││
  # ││┌           ┐┌           ┐┌           ┐││
  # │││22111 22112││22211 22212││22311 22312│││
  # │││22121 22122││22221 22222││22321 22322│││
  # └└└           ┘└           ┘└           ┘┘┘

For now it's half-done, looks like this:

iex(3)> Matrex.random({2, 2, 3, 2, 2}, :int16)
#Matrex[2×2×3×2×2]:int16
   831   6347 ││  4338   1181 ││ 12238   3884 │││
│││  1846   3181 ││  4359  12171 ││   305   8627 │││
└        ┘
│┌┌              ┐
│││  1555   1125 ││  1560   7162 ││  4894   6021 │││
│││ 13590   3041 ││ 15878   2861 ││ 15376  15071 │││
└        ┘
│┌┌              ┐
│││ 10665   7267 ││ 11838  13686 ││  3619  15967 │││
│││ 13945  13892 ││ 14153  12669 ││ 15818   7957 │││
└        ┘
│┌┌              ┐
│││   734   3795 ││  7647   4052 ││  5177   2394 │││
│││  3746  12972 ││  5217   9171 ││ 12212   6705 │││
└        ┘
│┌┌              ┐
│││

from matrex.

Related Issues (16)

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.