Coder Social home page Coder Social logo

ndarray-ops's People

Contributors

dy avatar mikolalysenko avatar randompast avatar serg06 avatar shama 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ndarray-ops's Issues

Support for 0d ndarrays

This doesn't seem to work with 0d ndarrays:

var a = ndarray(new Float32Array(128*128))
ops.addseq(a.pick(0), 2)

Throws "SyntaxError: Unexpected token |="

It looks like cwise-compiler (maybe this is a bug which should be filed there instead) is assembling some code which includes a var statement with no argument (i.e. "var \n a |= 0").

Problems with ops.equals

I have been encountering various problems with ops.equals when running tests for my own ndarray modules.

Different lengths seem to play a role. I wrote the following test and it fails:

var x2 = ndarray(new Float32Array([0]));
var y2 = ndarray(new Float32Array([0, 1]));
t.assert(!ops.equals(x2, y2))

Maybe this is outside the intended use case and you only intended that ndarrays with the same length and same underlying buffer format get compared. Nevertheless, having more robust falsiness behavior would make it easier to instrument and test modules.

I think there are other things. I will update this issue as I find them. I will also try to fix them.

UPDATE:
I am just going to implement my own equals method, since that would be faster/easier for me.

names of "sup" and "inf"?

Could you explain the reason that the min/max element functions are named "inf" and "sup". I only stumbled over them after writing my own with ndarray-cwise. Maybe minvalue, maxvalue or something more obvious?

Thanks,

john

Is this repo abandonned?

It seems like there is little or no work coming in for this repo, yet I grabbed it along with several others mentioned here: http://scijs.net/packages/ as it seemed pretty essential to some of the experimental things I am doing with ndarray.

I have been chasing my tail for a few hours trying to figure an out an odd bug that comes back to ndarray-ops::assign. Now, I am wondering if it is worth the effort to try to correct the issue (PR), or if this particular repo is essentially abandoned in favor of just using cwise.

cwise on the other hand looks to have been updated 19 minutes ago, at the time of following this issue, so that's great.

Either way thanks for the work so far.

Advice needed for nullargmin/nullargmax

Following the discussion on scijs/ndarray#22 I tried implementing this, mostly by copy pasting the existing argmin/max:

https://github.com/Reading-eScience-Centre/leaflet-coverage/blob/master/test/util/ndarray-ops-null.spec.js

For reference:

function nullargminmax (op) {
  let minus = op === 'max' ? '-' : ''
  let comp = op === 'max' ? '>' : '<'

  // adapted from ndarray-ops argmin/argmax
  return compile({
    args:["index","array","shape"],
    pre:{
    body:"{this_v=" + minus + "Infinity;this_i=_inline_0_arg2_.slice(0)}",
    args:[
      {name:"_inline_0_arg0_",lvalue:false,rvalue:false,count:0},
      {name:"_inline_0_arg1_",lvalue:false,rvalue:false,count:0},
      {name:"_inline_0_arg2_",lvalue:false,rvalue:true,count:1}
      ],
    thisVars:["this_i","this_v"],
    localVars:[]},
    body:{
    body:"{if(_inline_1_arg1_ !== null && _inline_1_arg1_ " + comp + "this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",
    args:[
      {name:"_inline_1_arg0_",lvalue:false,rvalue:true,count:2},
      {name:"_inline_1_arg1_",lvalue:false,rvalue:true,count:2}],
    thisVars:["this_i","this_v"],
    localVars:["_inline_1_k"]},
    post:{
    body:"{return this_i}",
    args:[],
    thisVars:["this_i"],
    localVars:[]}
  })
}
var nullargmin = nullargminmax('min')
var nullargmax = nullargminmax('max')

It works. However, I have a problem when the array contains only nulls. Then for some reason I get an array [2] as an answer where the number is the length of the array, e.g. for ndarray([null,null]). Does this make any sense? I'm a bit lost understanding this low-level code.

[idea] batch ops

I believe there is a slight perf improvement available by combining loops in the case of performing multiple operations in series. Although, I'm not sure how difficult this would be, or whether or not it should be implemented here or directly upon cwise.

What do you think?

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.