This project has moved and is read-only. For the latest updates, please go here.

What do the DenseMatrix FoldRows/FoldColumns functions do?

Jun 2, 2014 at 2:17 AM
I've been looking through the densematrix operations available in the documentation.
I am not familiar with this operation, what does it do?
What is it for?
Jun 2, 2014 at 9:06 PM
Similar to Map, Fold is one of the fundamental higher order functions in functional programming, see https://en.wikipedia.org/wiki/Fold_%28higher-order_function%29

With these fold functions you can fold some function over all columns (or over all rows). This is useful to implement simple algorithms (which are missing in the library) over all columns or rows, e.g. to compute column sums or some row statistics. You could also write a loop to achieve the same thing, but accessing matrix cells by index is very inefficient especially for sparse matrices.
Jun 2, 2014 at 9:43 PM
Edited Jun 2, 2014 at 9:44 PM
Do you think that using folds would improve this?
Can this be made faster?