Comments (4)
Thanks for opening this issue. I'm not sure I can give a good answer to this one - the current implementation is definitely intentional.
I'll try to explain the reasoning:
In the current implementation sum_rows
should be read as add all of the rows together. So in your example the matrix has 2 rows, each containing 3 elements. Adding these together should result in a single row with 3 elements. I believe your implementation would make more sense if read as sum along the rows.
I know that this disagrees with numpy for example - though they do explicitly state in the documentation that the sum is along the axis. I think at the very least this confusion should be eliminated in the rulinalg documentation. Or perhaps we should just adopt the along the axis convention.
I'll leave this issue open as I decide how best to handle this...
from rulinalg.
Actually it seems I wasn't remembering numpy's implementation correctly:
>>> import numpy as np
>>> a = np.array([[1,2,3],[4,5,6]])
>>> a.shape
(2,3)
>>> a.sum(0) # sum the rows
array([5, 7, 9])
>>> a.sum(1) # sum the cols
array([ 6, 15])
It seems that we do agree currently?
from rulinalg.
Yes, currently the results match those of numpy.
I didn't look at the numpy implementation at first so I didn't notice that the is sum calculated over the axis instead of along the axis.
Thank you for clarifying!
from rulinalg.
Of course!
In that case I'll close this issue and add a new one for improving the documentation a little. Thanks again for bringing this to my attention.
from rulinalg.
Related Issues (20)
- (feature?) More flexible inner products HOT 2
- Make `Matrix::from_fn` row-major
- Using assert_*_equal macros in all tests HOT 1
- SVD goes in an infinite loop for certain matrices HOT 2
- Matrix debug info is incorrect on docs homepage? HOT 2
- Computation of numerically stable matrix operations HOT 3
- Add serde support HOT 1
- Eigenvalues goes into infinite loop for certain matrices HOT 8
- Document that Cholesky only uses the lower triangular part HOT 1
- Variance and mean could be calculated in a better way HOT 1
- Adapt matrix factorizations from nalgebra? HOT 5
- SVD algorithm will segfault if matrix has 0 rows or 0 columns
- 'Matrix row counts not equal.' should give matrix dimensions
- Multidimensional tensors
- Hosted documentation out-of-date
- I want to help HOT 4
- Right-multiplication by permutation matrix is inconsistent with representation
- Matrix Operations on Complex Numbers
- API soundness issue in `raw_slice` and `raw_slice_mut` HOT 1
- [Question] Will sparse matrices be supported?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rulinalg.