Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mean/sum/min/max/std on axis #54

Open
JoostvDoorn opened this issue Sep 6, 2018 · 3 comments · May be fixed by #149
Open

mean/sum/min/max/std on axis #54

JoostvDoorn opened this issue Sep 6, 2018 · 3 comments · May be fixed by #149

Comments

@JoostvDoorn
Copy link

JoostvDoorn commented Sep 6, 2018

It would be very helpful if numjs supported mean/sum/min/max etc. over a specific axis like numpy.

a = nj.random([2,3]);
nj.mean(a, axis=1)
@nicolaspanel
Copy link
Owner

I agree it would be nice
I have no bandwidth right now but PR are always welcome ;)

@christianbender
Copy link

@nicolaspanel Can I work on this?

@christianbender
Copy link

christianbender commented Mar 5, 2019

@nicolaspanel @JoostvDoorn
I build a function meanaxis(arr, axis = 0) for square matrices like [[1, 2], [3, 4]]. Inclusive tests.

/**
 * Calculates the arithmetic mean over a specific axis
 * axis := 0 means x-axis (columns)
 * axis := 1 means y-axis (rows)
 * @param {NdArray} arr 
 * @param {Integer} axis (0 or 1)
 */
function meanaxis(arr, axis = 0)

I changed the function for calculating simple vectors like [1, 2, 3].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants