numeric icon indicating copy to clipboard operation
numeric copied to clipboard

Broadcasting and new functions

Open orangeduck opened this issue 10 years ago • 1 comments

Hi,

Here are the updates I've worked on to support broadcasting. As well as broadcasting I worked on allowing mapreduce functions to work over a specified axis. Also I have added a large number of new functions to the library covering a bunch of domains. My inspiration has been Numpy, so most of the new functions semantics are meant to match those of Numpy. If this isn't the case you can consider it a bug.

Now is the time for name changes if you can think of better names for any of my new functions please go ahead and re-name them. I've also not yet updated the version number.

I should mention so that you can get an idea of my use-case is that the reason I've contributed lots of these updates is because I'm working on a Javascript machine learning library using numeric and porting lots of code from Numpy.

Sorry that some of the commits are so messy. I made lots of changes which I later changed to something else or removed completely so the easiest file to examine might be numeric.js in the latest commit. I should have kept a change log but unfortunately I didn't. So here is a change log now. Hopefully I've not forgotten anything.

  • Updated pointwise mathematical functions to support broadcasting. Semantics match that of Numpy.
  • Updated mapreduce functions to take an optional axis to reduce over.
  • Changed interface to numeric.pointwise to support broadcasting. New interface is explained in documentation.
  • Changed interface to numeric.mapreduce to support folding over an axis. Main requirement now is that numeric functions are used, not JS operators. New method of using is also explained in documentation.
  • Added numeric.inf, numeric.sup to documentation. Added numeric.arginf and numeric.argsup.
  • Added numeric.mean
  • Added numeric.variance
  • Added numeric.std
  • Added numeric.empty, numeric.ones, numeric.zeros for Array creation.
  • Added numeric.range, numeric.logspace for Array creation.
  • Added numeric.flatten, numeric.reshape, numeric.flip, numeric.fliplr, numeric.flipup, numeric.rot90, numeric.roll, numeric.wrap, numeric.concat, numeric.stack, numeric.hstack, numeric.vstack, numeric.dstack for shape manipulation.
  • Added numeric.slice and numeric.sliceeq for accessing arrays using slice objects
  • Added numeric.mask and numeric.maskeq for accessing arrays using Boolean arrays
  • Added numeric.index and numeric.indexeq for accessing arrays using Integer arrays
  • Added numeric.clip and numeric.saturate functions to clip values to given range
  • Added numeric.when function to act like pointwise ternary operator z = b ? x : y
  • Added numeric.bool function to cast a JS value to a boolean value y = !!x
  • Added numeric.inner and numeric.outer
  • Added numeric.kron
  • Added numeric.setDiag
  • Added numeric.pi and numeric.e
  • Fixed bug in CSV reading/writing
  • Reorganized documentation reference card into sections
  • Updated documentation to explain the new functions and semantics.

orangeduck avatar Oct 21 '14 10:10 orangeduck

Wow, that looks fantastic @sloisel just looking into some analysis libraries in the javascript world and some of the functionality here looks great for me to consider this. Are there any blocking issues for this to get merged?

Globegitter avatar Nov 11 '14 22:11 Globegitter