Quantcast
Viewing all articles
Browse latest Browse all 971

New Post: Example of using foldRows/foldCoumns for matrix

Note that FoldColumns folds over the columns themselves (each of them, individually), not over the column vectors. We should probably add the later as well.

Compute column sums with FoldColumns:
var m = Matrix<double>.Build.Random(4,4);
var columnSums = m.FoldColumns((sum, x) => sum+x, 0.0, Zeros.AllowSkip);
var rowSums = m.FoldRows((sum, x) => sum+x, 0.0, Zeros.AllowSkip);
Thanks,
Christoph

Viewing all articles
Browse latest Browse all 971

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>