In the initial implementation of foldMap/map for sparse we considered only nonzero elements. This is problem because it conflicts with behaviour of other matrix implementation. For example, if we try to run map (+1) over sparse identity matrix, we'll get not matrix with 2's on diagonal and other elements equal to one, but matrix with 2s on diagonal and 0s in other positions. Also if we try fold (by fold(f) i mean foldMap(f, identity)) sparse identity matrix with min, we'll get 1 instead of 0. I've started fixing this behaviour in IGNITE-5102. Basic idea for fixing map is to map default element along with nondefault elements (we'll now have not necessary zero as default element). For fold the idea is in performing folding n times with default element (n is count of default element) after folding on nondefault elements. Actually this approach requires accumulator function to be commutative, but it seems that it does not conflict with javadoc for foldMap (it does not specify any order of folding explicitly, so there is no order guaranteed and therefore for operation to be well defined, accumulator should be commutative). Any objections for this?
-- View this message in context: http://apache-ignite-developers.2346864.n4.nabble.com/Ignite-ML-next-steps-IGNITE-5029-tp17096p17411.html Sent from the Apache Ignite Developers mailing list archive at Nabble.com.