http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/SingularValueDecomposition.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/SingularValueDecomposition.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/SingularValueDecomposition.java
deleted file mode 100644
index 68aeb6d..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/SingularValueDecomposition.java
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.decompositions;
-
-import org.apache.ignite.ml.math.Algebra;
-import org.apache.ignite.ml.math.Destroyable;
-import org.apache.ignite.ml.math.Matrix;
-
-import static org.apache.ignite.ml.math.util.MatrixUtil.like;
-
-/**
- * Compute a singular value decomposition (SVD) of {@code (l x k)} matrix 
{@code m}.
- * <p>This decomposition can be thought
- * as an extension of {@link EigenDecomposition} to rectangular matrices. The 
factorization we get is following:</p>
- * <p>{@code m = u * s * v^{*}}, where</p>
- * <ul><li>{@code u} is a real or complex unitary matrix.</li>
- * <li>{@code s} is a rectangular diagonal matrix with non-negative real 
numbers on diagonal
- * (these numbers are singular values of {@code m}).</li>
- * <li>{@code v} is a real or complex unitary matrix.</li></ul>
- * <p>If {@code m} is real then {@code u} and {@code v} are also real.</p>
- * <p>See also: <a 
href="https://en.wikipedia.org/wiki/Singular_value_decomposition";>Wikipedia 
article on SVD</a>.</p>
- * <p>Note: complex case is currently not supported.</p>
- */
-public class SingularValueDecomposition implements Destroyable {
-    // U and V.
-    /** */
-    private final double[][] u;
-    /** */
-    private final double[][] v;
-
-    /** Singular values. */
-    private final double[] s;
-
-    /** Row dimension. */
-    private final int m;
-    /** Column dimension. */
-    private final int n;
-
-    /** */
-    private Matrix arg;
-
-    /** */
-    private boolean transpositionNeeded;
-
-    /**
-     * Singular value decomposition object.
-     *
-     * @param arg A rectangular matrix.
-     */
-    public SingularValueDecomposition(Matrix arg) {
-        assert arg != null;
-
-        this.arg = arg;
-
-        if (arg.rowSize() < arg.columnSize())
-            transpositionNeeded = true;
-
-        double[][] a;
-
-        if (transpositionNeeded) {
-            // Use the transpose matrix.
-            m = arg.columnSize();
-            n = arg.rowSize();
-
-            a = new double[m][n];
-
-            for (int i = 0; i < m; i++)
-                for (int j = 0; j < n; j++)
-                    a[i][j] = arg.get(j, i);
-        }
-        else {
-            m = arg.rowSize();
-            n = arg.columnSize();
-
-            a = new double[m][n];
-
-            for (int i = 0; i < m; i++)
-                for (int j = 0; j < n; j++)
-                    a[i][j] = arg.get(i, j);
-        }
-
-        int nu = Math.min(m, n);
-
-        s = new double[Math.min(m + 1, n)];
-        u = new double[m][nu];
-        v = new double[n][n];
-
-        double[] e = new double[n];
-        double[] work = new double[m];
-
-        int nct = Math.min(m - 1, n);
-        int nrt = Math.max(0, Math.min(n - 2, m));
-
-        for (int k = 0; k < Math.max(nct, nrt); k++) {
-            if (k < nct) {
-                // Compute the transformation for the k-th column and
-                // place the k-th diagonal in s[k]. Compute 2-norm of k-th
-                // column without under/overflow.
-                s[k] = 0;
-
-                for (int i = k; i < m; i++)
-                    s[k] = Algebra.hypot(s[k], a[i][k]);
-
-                if (s[k] != 0.0) {
-                    if (a[k][k] < 0.0)
-                        s[k] = -s[k];
-
-                    for (int i = k; i < m; i++)
-                        a[i][k] /= s[k];
-
-                    a[k][k] += 1.0;
-                }
-
-                s[k] = -s[k];
-            }
-
-            for (int j = k + 1; j < n; j++) {
-                if (k < nct && s[k] != 0.0) {
-                    // Apply the transformation.
-                    double t = 0;
-
-                    for (int i = k; i < m; i++)
-                        t += a[i][k] * a[i][j];
-
-                    t = -t / a[k][k];
-
-                    for (int i = k; i < m; i++)
-                        a[i][j] += t * a[i][k];
-                }
-
-                // Place the k-th row of A into e for the
-                // subsequent calculation of the row transformation.
-                e[j] = a[k][j];
-            }
-
-            if (k < nct)
-                // Place the transformation in U for subsequent back
-                // multiplication.
-                for (int i = k; i < m; i++)
-                    u[i][k] = a[i][k];
-
-            if (k < nrt) {
-                // Compute the k-th row transformation and place the
-                // k-th super-diagonal in e[k].
-                // Compute 2-norm without under/overflow.
-                e[k] = 0;
-
-                for (int i = k + 1; i < n; i++)
-                    e[k] = Algebra.hypot(e[k], e[i]);
-
-                if (e[k] != 0.0) {
-                    if (e[k + 1] < 0.0)
-                        e[k] = -e[k];
-
-                    for (int i = k + 1; i < n; i++)
-                        e[i] /= e[k];
-
-                    e[k + 1] += 1.0;
-                }
-
-                e[k] = -e[k];
-
-                if (k + 1 < m && e[k] != 0.0) {
-                    // Apply the transformation.
-                    for (int i = k + 1; i < m; i++)
-                        work[i] = 0.0;
-
-                    for (int j = k + 1; j < n; j++)
-                        for (int i = k + 1; i < m; i++)
-                            work[i] += e[j] * a[i][j];
-
-                    for (int j = k + 1; j < n; j++) {
-                        double t = -e[j] / e[k + 1];
-
-                        for (int i = k + 1; i < m; i++)
-                            a[i][j] += t * work[i];
-                    }
-                }
-
-                // Place the transformation in V for subsequent
-                // back multiplication.
-                for (int i = k + 1; i < n; i++)
-                    v[i][k] = e[i];
-            }
-        }
-
-        // Set up the final bi-diagonal matrix or order p.
-        int p = Math.min(n, m + 1);
-
-        if (nct < n)
-            s[nct] = a[nct][nct];
-
-        if (m < p)
-            s[p - 1] = 0.0;
-
-        if (nrt + 1 < p)
-            e[nrt] = a[nrt][p - 1];
-
-        e[p - 1] = 0.0;
-
-        // Generate U.
-        for (int j = nct; j < nu; j++) {
-            for (int i = 0; i < m; i++)
-                u[i][j] = 0.0;
-
-            u[j][j] = 1.0;
-        }
-
-        for (int k = nct - 1; k >= 0; k--) {
-            if (s[k] != 0.0) {
-                for (int j = k + 1; j < nu; j++) {
-                    double t = 0;
-
-                    for (int i = k; i < m; i++)
-                        t += u[i][k] * u[i][j];
-
-                    t = -t / u[k][k];
-
-                    for (int i = k; i < m; i++)
-                        u[i][j] += t * u[i][k];
-                }
-
-                for (int i = k; i < m; i++)
-                    u[i][k] = -u[i][k];
-
-                u[k][k] = 1.0 + u[k][k];
-
-                for (int i = 0; i < k - 1; i++)
-                    u[i][k] = 0.0;
-            }
-            else {
-                for (int i = 0; i < m; i++)
-                    u[i][k] = 0.0;
-
-                u[k][k] = 1.0;
-            }
-        }
-
-        // Generate V.
-        for (int k = n - 1; k >= 0; k--) {
-            if (k < nrt && e[k] != 0.0) {
-                for (int j = k + 1; j < nu; j++) {
-                    double t = 0;
-
-                    for (int i = k + 1; i < n; i++)
-                        t += v[i][k] * v[i][j];
-
-                    t = -t / v[k + 1][k];
-
-                    for (int i = k + 1; i < n; i++)
-                        v[i][j] += t * v[i][k];
-                }
-            }
-
-            for (int i = 0; i < n; i++)
-                v[i][k] = 0.0;
-
-            v[k][k] = 1.0;
-        }
-
-        // Main iteration loop for the singular values.
-        int pp = p - 1;
-        int iter = 0;
-
-        double eps = Math.pow(2.0, -52.0);
-        double tiny = Math.pow(2.0, -966.0);
-
-        while (p > 0) {
-            int k;
-
-            for (k = p - 2; k >= -1; k--) {
-                if (k == -1)
-                    break;
-
-                if (Math.abs(e[k]) <= tiny + eps * (Math.abs(s[k]) + 
Math.abs(s[k + 1]))) {
-                    e[k] = 0.0;
-
-                    break;
-                }
-            }
-
-            int kase;
-
-            if (k == p - 2)
-                kase = 4;
-            else {
-                int ks;
-
-                for (ks = p - 1; ks >= k; ks--) {
-                    if (ks == k)
-                        break;
-
-                    double t =
-                        (ks != p ? Math.abs(e[ks]) : 0.) +
-                            (ks != k + 1 ? Math.abs(e[ks - 1]) : 0.);
-
-                    if (Math.abs(s[ks]) <= tiny + eps * t) {
-                        s[ks] = 0.0;
-
-                        break;
-                    }
-                }
-
-                if (ks == k)
-                    kase = 3;
-                else if (ks == p - 1)
-                    kase = 1;
-                else {
-                    kase = 2;
-
-                    k = ks;
-                }
-            }
-
-            k++;
-
-            // Perform the task indicated by kase.
-            switch (kase) {
-                // Deflate negligible s(p).
-                case 1: {
-                    double f = e[p - 2];
-
-                    e[p - 2] = 0.0;
-
-                    for (int j = p - 2; j >= k; j--) {
-                        double t = Algebra.hypot(s[j], f);
-                        double cs = s[j] / t;
-                        double sn = f / t;
-
-                        s[j] = t;
-
-                        if (j != k) {
-                            f = -sn * e[j - 1];
-                            e[j - 1] = cs * e[j - 1];
-                        }
-
-                        for (int i = 0; i < n; i++) {
-                            t = cs * v[i][j] + sn * v[i][p - 1];
-
-                            v[i][p - 1] = -sn * v[i][j] + cs * v[i][p - 1];
-                            v[i][j] = t;
-                        }
-                    }
-                }
-
-                break;
-
-                // Split at negligible s(k).
-                case 2: {
-                    double f = e[k - 1];
-                    e[k - 1] = 0.0;
-
-                    for (int j = k; j < p; j++) {
-                        double t = Algebra.hypot(s[j], f);
-                        double cs = s[j] / t;
-                        double sn = f / t;
-
-                        s[j] = t;
-                        f = -sn * e[j];
-                        e[j] = cs * e[j];
-
-                        for (int i = 0; i < m; i++) {
-                            t = cs * u[i][j] + sn * u[i][k - 1];
-
-                            u[i][k - 1] = -sn * u[i][j] + cs * u[i][k - 1];
-                            u[i][j] = t;
-                        }
-                    }
-                }
-
-                break;
-
-                // Perform one qr step.
-                case 3: {
-                    // Calculate the shift.
-                    double scale = Math.max(Math.max(Math.max(Math.max(
-                        Math.abs(s[p - 1]), Math.abs(s[p - 2])), Math.abs(e[p 
- 2])),
-                        Math.abs(s[k])), Math.abs(e[k]));
-
-                    double sp = s[p - 1] / scale;
-                    double spm1 = s[p - 2] / scale;
-                    double epm1 = e[p - 2] / scale;
-                    double sk = s[k] / scale;
-                    double ek = e[k] / scale;
-                    double b = ((spm1 + sp) * (spm1 - sp) + epm1 * epm1) / 2.0;
-                    double c = sp * epm1 * sp * epm1;
-                    double shift = 0.0;
-
-                    if (b != 0.0 || c != 0.0) {
-                        shift = Math.sqrt(b * b + c);
-
-                        if (b < 0.0)
-                            shift = -shift;
-
-                        shift = c / (b + shift);
-                    }
-
-                    double f = (sk + sp) * (sk - sp) + shift;
-                    double g = sk * ek;
-
-                    // Chase zeros.
-                    for (int j = k; j < p - 1; j++) {
-                        double t = Algebra.hypot(f, g);
-                        double cs = f / t;
-                        double sn = g / t;
-
-                        if (j != k)
-                            e[j - 1] = t;
-
-                        f = cs * s[j] + sn * e[j];
-                        e[j] = cs * e[j] - sn * s[j];
-                        g = sn * s[j + 1];
-                        s[j + 1] = cs * s[j + 1];
-
-                        for (int i = 0; i < n; i++) {
-                            t = cs * v[i][j] + sn * v[i][j + 1];
-
-                            v[i][j + 1] = -sn * v[i][j] + cs * v[i][j + 1];
-                            v[i][j] = t;
-                        }
-
-                        t = Algebra.hypot(f, g);
-                        cs = f / t;
-                        sn = g / t;
-                        s[j] = t;
-                        f = cs * e[j] + sn * s[j + 1];
-                        s[j + 1] = -sn * e[j] + cs * s[j + 1];
-                        g = sn * e[j + 1];
-                        e[j + 1] = cs * e[j + 1];
-
-                        if (j < m - 1)
-                            for (int i = 0; i < m; i++) {
-                                t = cs * u[i][j] + sn * u[i][j + 1];
-
-                                u[i][j + 1] = -sn * u[i][j] + cs * u[i][j + 1];
-                                u[i][j] = t;
-                            }
-                    }
-
-                    e[p - 2] = f;
-                    iter = iter + 1;
-                }
-
-                break;
-
-                // Convergence.
-                case 4: {
-                    // Make the singular values positive.
-                    if (s[k] <= 0.0) {
-                        s[k] = s[k] < 0.0 ? -s[k] : 0.0;
-
-                        for (int i = 0; i <= pp; i++)
-                            v[i][k] = -v[i][k];
-                    }
-
-                    // Order the singular values.
-                    while (k < pp) {
-                        if (s[k] >= s[k + 1])
-                            break;
-
-                        double t = s[k];
-
-                        s[k] = s[k + 1];
-                        s[k + 1] = t;
-
-                        if (k < n - 1)
-                            for (int i = 0; i < n; i++) {
-                                t = v[i][k + 1];
-
-                                v[i][k + 1] = v[i][k];
-                                v[i][k] = t;
-                            }
-
-                        if (k < m - 1)
-                            for (int i = 0; i < m; i++) {
-                                t = u[i][k + 1];
-
-                                u[i][k + 1] = u[i][k];
-                                u[i][k] = t;
-                            }
-
-                        k++;
-                    }
-
-                    iter = 0;
-                    p--;
-                }
-
-                break;
-
-                default:
-                    throw new IllegalStateException();
-            }
-        }
-    }
-
-    /**
-     * Gets the two norm condition number, which is {@code max(S) / min(S)} .
-     */
-    public double cond() {
-        return s[0] / s[Math.min(m, n) - 1];
-    }
-
-    /**
-     * @return the diagonal matrix of singular values.
-     */
-    public Matrix getS() {
-        double[][] s = new double[n][n];
-
-        for (int i = 0; i < n; i++) {
-            for (int j = 0; j < n; j++)
-                s[i][j] = 0.0;
-
-            s[i][i] = this.s[i];
-        }
-
-        return like(arg, n, n).assign(s);
-    }
-
-    /**
-     * Gets the diagonal of {@code S}, which is a one-dimensional array of
-     * singular values.
-     *
-     * @return diagonal of {@code S}.
-     */
-    public double[] getSingularValues() {
-        return s;
-    }
-
-    /**
-     * Gets the left singular vectors {@code U}.
-     *
-     * @return {@code U}
-     */
-    public Matrix getU() {
-        if (transpositionNeeded)
-            return like(arg, v.length, v.length).assign(v);
-        else {
-            int numCols = Math.min(m + 1, n);
-
-            Matrix r = like(arg, m, numCols);
-
-            for (int i = 0; i < m; i++)
-                for (int j = 0; j < numCols; j++)
-                    r.set(i, j, u[i][j]);
-
-            return r;
-        }
-    }
-
-    /**
-     * Gets the right singular vectors {@code V}.
-     *
-     * @return {@code V}
-     */
-    public Matrix getV() {
-        if (transpositionNeeded) {
-            int numCols = Math.min(m + 1, n);
-
-            Matrix r = like(arg, m, numCols);
-
-            for (int i = 0; i < m; i++)
-                for (int j = 0; j < numCols; j++)
-                    r.set(i, j, u[i][j]);
-
-            return r;
-        }
-        else
-            return like(arg, v.length, v.length).assign(v);
-    }
-
-    /**
-     * Gets the two norm, which is {@code max(S)}.
-     */
-    public double norm2() {
-        return s[0];
-    }
-
-    /**
-     * Gets effective numerical matrix rank.
-     */
-    public int rank() {
-        double eps = Math.pow(2.0, -52.0);
-        double tol = Math.max(m, n) * s[0] * eps;
-        int r = 0;
-
-        for (double value : s)
-            if (value > tol)
-                r++;
-
-        return r;
-    }
-
-    /**
-     * Gets [n × n] covariance matrix.
-     *
-     * @param minSingularVal Value below which singular values are ignored.
-     */
-    Matrix getCovariance(double minSingularVal) {
-        Matrix j = like(arg, s.length, s.length);
-        Matrix vMat = like(arg, v.length, v.length).assign(v);
-
-        for (int i = 0; i < s.length; i++)
-            j.set(i, i, s[i] >= minSingularVal ? 1 / (s[i] * s[i]) : 0.0);
-
-        return vMat.times(j).times(vMat.transpose());
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/package-info.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/package-info.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/package-info.java
deleted file mode 100644
index d317ccd..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * <!-- Package description. -->
- * Contains matrix decompositions for distributed code algebra.
- */
-package org.apache.ignite.ml.math.decompositions;

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/CacheUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/CacheUtils.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/CacheUtils.java
deleted file mode 100644
index 3256f8a..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/CacheUtils.java
+++ /dev/null
@@ -1,734 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.BinaryOperator;
-import java.util.stream.Stream;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.affinity.Affinity;
-import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.cluster.ClusterGroup;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
-import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteCallable;
-import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.lang.IgniteRunnable;
-import org.apache.ignite.ml.math.KeyMapper;
-import org.apache.ignite.ml.math.distributed.keys.DataStructureCacheKey;
-import org.apache.ignite.ml.math.distributed.keys.RowColMatrixKey;
-import org.apache.ignite.ml.math.distributed.keys.impl.MatrixBlockKey;
-import org.apache.ignite.ml.math.distributed.keys.impl.VectorBlockKey;
-import org.apache.ignite.ml.math.exceptions.UnsupportedOperationException;
-import org.apache.ignite.ml.math.functions.IgniteBiFunction;
-import org.apache.ignite.ml.math.functions.IgniteBinaryOperator;
-import org.apache.ignite.ml.math.functions.IgniteConsumer;
-import org.apache.ignite.ml.math.functions.IgniteDoubleFunction;
-import org.apache.ignite.ml.math.functions.IgniteFunction;
-import org.apache.ignite.ml.math.functions.IgniteSupplier;
-import org.apache.ignite.ml.math.functions.IgniteTriFunction;
-import org.apache.ignite.ml.math.impls.matrix.MatrixBlockEntry;
-import org.apache.ignite.ml.math.impls.vector.VectorBlockEntry;
-
-/**
- * Distribution-related misc. support.
- *
- * TODO: IGNITE-5102, fix sparse key filters.
- */
-public class CacheUtils {
-    /**
-     * Cache entry support.
-     *
-     * @param <K>
-     * @param <V>
-     */
-    public static class CacheEntry<K, V> {
-        /** */
-        private Cache.Entry<K, V> entry;
-        /** */
-        private IgniteCache<K, V> cache;
-
-        /**
-         * @param entry Original cache entry.
-         * @param cache Cache instance.
-         */
-        CacheEntry(Cache.Entry<K, V> entry, IgniteCache<K, V> cache) {
-            this.entry = entry;
-            this.cache = cache;
-        }
-
-        /**
-         *
-         */
-        public Cache.Entry<K, V> entry() {
-            return entry;
-        }
-
-        /**
-         *
-         */
-        public IgniteCache<K, V> cache() {
-            return cache;
-        }
-    }
-
-    /**
-     * Gets local Ignite instance.
-     */
-    public static Ignite ignite() {
-        return Ignition.localIgnite();
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param k Key into the cache.
-     * @param <K> Key type.
-     * @return Cluster group for given key.
-     */
-    protected static <K> ClusterGroup getClusterGroupForGivenKey(String 
cacheName, K k) {
-        return 
ignite().cluster().forNode(ignite().affinity(cacheName).mapKeyToNode(k));
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param keyMapper {@link KeyMapper} to validate cache key.
-     * @param valMapper {@link ValueMapper} to obtain double value for given 
cache key.
-     * @param <K> Cache key object type.
-     * @param <V> Cache value object type.
-     * @return Sum of the values obtained for valid keys.
-     */
-    public static <K, V> double sum(String cacheName, KeyMapper<K> keyMapper, 
ValueMapper<V> valMapper) {
-        Collection<Double> subSums = fold(cacheName, (CacheEntry<K, V> ce, 
Double acc) -> {
-            if (keyMapper.isValid(ce.entry().getKey())) {
-                double v = valMapper.toDouble(ce.entry().getValue());
-
-                return acc == null ? v : acc + v;
-            }
-            else
-                return acc;
-        });
-
-        return sum(subSums);
-    }
-
-    /**
-     * @param matrixUuid Matrix UUID.
-     * @return Sum obtained using sparse logic.
-     */
-    @SuppressWarnings("unchecked")
-    public static <K, V> double sparseSum(UUID matrixUuid, String cacheName) {
-        A.notNull(matrixUuid, "matrixUuid");
-        A.notNull(cacheName, "cacheName");
-
-        Collection<Double> subSums = fold(cacheName, (CacheEntry<K, V> ce, 
Double acc) -> {
-            V v = ce.entry().getValue();
-
-            double sum;
-
-            if (v instanceof Map) {
-                Map<Integer, Double> map = (Map<Integer, Double>)v;
-
-                sum = sum(map.values());
-            }
-            else if (v instanceof MatrixBlockEntry) {
-                MatrixBlockEntry be = (MatrixBlockEntry)v;
-
-                sum = be.sum();
-            }
-            else
-                throw new UnsupportedOperationException();
-
-            return acc == null ? sum : acc + sum;
-        }, sparseKeyFilter(matrixUuid));
-
-        return sum(subSums);
-    }
-
-    /**
-     * @param c {@link Collection} of double values to sum.
-     * @return Sum of the values.
-     */
-    private static double sum(Collection<Double> c) {
-        // Fix for IGNITE-6762, some collections could store null values.
-        return 
c.stream().filter(Objects::nonNull).mapToDouble(Double::doubleValue).sum();
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param keyMapper {@link KeyMapper} to validate cache key.
-     * @param valMapper {@link ValueMapper} to obtain double value for given 
cache key.
-     * @param <K> Cache key object type.
-     * @param <V> Cache value object type.
-     * @return Minimum value for valid keys.
-     */
-    public static <K, V> double min(String cacheName, KeyMapper<K> keyMapper, 
ValueMapper<V> valMapper) {
-        Collection<Double> mins = fold(cacheName, (CacheEntry<K, V> ce, Double 
acc) -> {
-            if (keyMapper.isValid(ce.entry().getKey())) {
-                double v = valMapper.toDouble(ce.entry().getValue());
-
-                if (acc == null)
-                    return v;
-                else
-                    return Math.min(acc, v);
-            }
-            else
-                return acc;
-        });
-
-        return Collections.min(mins);
-    }
-
-    /**
-     * @param matrixUuid Matrix UUID.
-     * @return Minimum value obtained using sparse logic.
-     */
-    @SuppressWarnings("unchecked")
-    public static <K, V> double sparseMin(UUID matrixUuid, String cacheName) {
-        A.notNull(matrixUuid, "matrixUuid");
-        A.notNull(cacheName, "cacheName");
-
-        Collection<Double> mins = fold(cacheName, (CacheEntry<K, V> ce, Double 
acc) -> {
-            V v = ce.entry().getValue();
-
-            double min;
-
-            if (v instanceof Map) {
-                Map<Integer, Double> map = (Map<Integer, Double>)v;
-
-                min = Collections.min(map.values());
-            }
-            else if (v instanceof MatrixBlockEntry) {
-                MatrixBlockEntry be = (MatrixBlockEntry)v;
-
-                min = be.minValue();
-            }
-            else
-                throw new UnsupportedOperationException();
-
-            if (acc == null)
-                return min;
-            else
-                return Math.min(acc, min);
-
-        }, sparseKeyFilter(matrixUuid));
-
-        return Collections.min(mins);
-    }
-
-    /**
-     * @param matrixUuid Matrix UUID.
-     * @return Maximum value obtained using sparse logic.
-     */
-    @SuppressWarnings("unchecked")
-    public static <K, V> double sparseMax(UUID matrixUuid, String cacheName) {
-        A.notNull(matrixUuid, "matrixUuid");
-        A.notNull(cacheName, "cacheName");
-
-        Collection<Double> maxes = fold(cacheName, (CacheEntry<K, V> ce, 
Double acc) -> {
-            V v = ce.entry().getValue();
-
-            double max;
-
-            if (v instanceof Map) {
-                Map<Integer, Double> map = (Map<Integer, Double>)v;
-
-                max = Collections.max(map.values());
-            }
-            else if (v instanceof MatrixBlockEntry) {
-                MatrixBlockEntry be = (MatrixBlockEntry)v;
-
-                max = be.maxValue();
-            }
-            else
-                throw new UnsupportedOperationException();
-
-            if (acc == null)
-                return max;
-            else
-                return Math.max(acc, max);
-
-        }, sparseKeyFilter(matrixUuid));
-
-        return Collections.max(maxes);
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param keyMapper {@link KeyMapper} to validate cache key.
-     * @param valMapper {@link ValueMapper} to obtain double value for given 
cache key.
-     * @param <K> Cache key object type.
-     * @param <V> Cache value object type.
-     * @return Maximum value for valid keys.
-     */
-    public static <K, V> double max(String cacheName, KeyMapper<K> keyMapper, 
ValueMapper<V> valMapper) {
-        Collection<Double> maxes = fold(cacheName, (CacheEntry<K, V> ce, 
Double acc) -> {
-            if (keyMapper.isValid(ce.entry().getKey())) {
-                double v = valMapper.toDouble(ce.entry().getValue());
-
-                if (acc == null)
-                    return v;
-                else
-                    return Math.max(acc, v);
-            }
-            else
-                return acc;
-        });
-
-        return Collections.max(maxes);
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param keyMapper {@link KeyMapper} to validate cache key.
-     * @param valMapper {@link ValueMapper} to obtain double value for given 
cache key.
-     * @param mapper Mapping {@link IgniteFunction}.
-     * @param <K> Cache key object type.
-     * @param <V> Cache value object type.
-     */
-    public static <K, V> void map(String cacheName, KeyMapper<K> keyMapper, 
ValueMapper<V> valMapper,
-        IgniteFunction<Double, Double> mapper) {
-        foreach(cacheName, (CacheEntry<K, V> ce) -> {
-            K k = ce.entry().getKey();
-
-            if (keyMapper.isValid(k))
-                // Actual assignment.
-                ce.cache().put(k, 
valMapper.fromDouble(mapper.apply(valMapper.toDouble(ce.entry().getValue()))));
-        });
-    }
-
-    /**
-     * @param matrixUuid Matrix UUID.
-     * @param mapper Mapping {@link IgniteFunction}.
-     */
-    @SuppressWarnings("unchecked")
-    public static <K, V> void sparseMap(UUID matrixUuid, 
IgniteDoubleFunction<Double> mapper, String cacheName) {
-        A.notNull(matrixUuid, "matrixUuid");
-        A.notNull(cacheName, "cacheName");
-        A.notNull(mapper, "mapper");
-
-        foreach(cacheName, (CacheEntry<K, V> ce) -> {
-            K k = ce.entry().getKey();
-
-            V v = ce.entry().getValue();
-
-            if (v instanceof Map) {
-                Map<Integer, Double> map = (Map<Integer, Double>)v;
-
-                for (Map.Entry<Integer, Double> e : (map.entrySet()))
-                    e.setValue(mapper.apply(e.getValue()));
-
-            }
-            else if (v instanceof MatrixBlockEntry) {
-                MatrixBlockEntry be = (MatrixBlockEntry)v;
-
-                be.map(mapper);
-            }
-            else
-                throw new UnsupportedOperationException();
-
-            ce.cache().put(k, v);
-        }, sparseKeyFilter(matrixUuid));
-    }
-
-    /**
-     * Filter for distributed matrix keys.
-     *
-     * @param matrixUuid Matrix uuid.
-     */
-    private static <K> IgnitePredicate<K> sparseKeyFilter(UUID matrixUuid) {
-        return key -> {
-            if (key instanceof DataStructureCacheKey)
-                return 
((DataStructureCacheKey)key).dataStructureId().equals(matrixUuid);
-            else if (key instanceof IgniteBiTuple)
-                return ((IgniteBiTuple<Integer, 
UUID>)key).get2().equals(matrixUuid);
-            else if (key instanceof MatrixBlockKey)
-                return 
((MatrixBlockKey)key).dataStructureId().equals(matrixUuid);
-            else if (key instanceof RowColMatrixKey)
-                return 
((RowColMatrixKey)key).dataStructureId().equals(matrixUuid);
-            else if (key instanceof VectorBlockKey)
-                return 
((VectorBlockKey)key).dataStructureId().equals(matrixUuid);
-            else
-                throw new UnsupportedOperationException();
-        };
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param fun An operation that accepts a cache entry and processes it.
-     * @param <K> Cache key object type.
-     * @param <V> Cache value object type.
-     */
-    private static <K, V> void foreach(String cacheName, 
IgniteConsumer<CacheEntry<K, V>> fun) {
-        foreach(cacheName, fun, null);
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param fun An operation that accepts a cache entry and processes it.
-     * @param keyFilter Cache keys filter.
-     * @param <K> Cache key object type.
-     * @param <V> Cache value object type.
-     */
-    protected static <K, V> void foreach(String cacheName, 
IgniteConsumer<CacheEntry<K, V>> fun,
-        IgnitePredicate<K> keyFilter) {
-        bcast(cacheName, () -> {
-            Ignite ignite = Ignition.localIgnite();
-            IgniteCache<K, V> cache = ignite.getOrCreateCache(cacheName);
-
-            int partsCnt = ignite.affinity(cacheName).partitions();
-
-            // Use affinity in filter for scan query. Otherwise we accept 
consumer in each node which is wrong.
-            Affinity affinity = ignite.affinity(cacheName);
-            ClusterNode locNode = ignite.cluster().localNode();
-
-            // Iterate over all partitions. Some of them will be stored on 
that local node.
-            for (int part = 0; part < partsCnt; part++) {
-                int p = part;
-
-                // Iterate over given partition.
-                // Query returns an empty cursor if this partition is not 
stored on this node.
-                for (Cache.Entry<K, V> entry : cache.query(new ScanQuery<K, 
V>(part,
-                    (k, v) -> affinity.mapPartitionToNode(p) == locNode && 
(keyFilter == null || keyFilter.apply(k)))))
-                    fun.accept(new CacheEntry<>(entry, cache));
-            }
-        });
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param fun An operation that accepts a cache entry and processes it.
-     * @param ignite Ignite.
-     * @param keysGen Keys generator.
-     * @param <K> Cache key object type.
-     * @param <V> Cache value object type.
-     */
-    public static <K, V> void update(String cacheName, Ignite ignite,
-        IgniteBiFunction<Ignite, Cache.Entry<K, V>, Stream<Cache.Entry<K, V>>> 
fun, IgniteSupplier<Set<K>> keysGen) {
-        bcast(cacheName, ignite, () -> {
-            Ignite ig = Ignition.localIgnite();
-            IgniteCache<K, V> cache = ig.getOrCreateCache(cacheName);
-
-            Affinity<K> affinity = ig.affinity(cacheName);
-            ClusterNode locNode = ig.cluster().localNode();
-
-            Collection<K> ks = 
affinity.mapKeysToNodes(keysGen.get()).get(locNode);
-
-            if (ks == null)
-                return;
-
-            Map<K, V> m = new ConcurrentHashMap<>();
-
-            ks.parallelStream().forEach(k -> {
-                V v = cache.localPeek(k);
-                if (v != null)
-                    (fun.apply(ignite, new CacheEntryImpl<>(k, 
v))).forEach(ent -> m.put(ent.getKey(), ent.getValue()));
-            });
-
-            cache.putAll(m);
-        });
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param fun An operation that accepts a cache entry and processes it.
-     * @param ignite Ignite.
-     * @param keysGen Keys generator.
-     * @param <K> Cache key object type.
-     * @param <V> Cache value object type.
-     */
-    public static <K, V> void update(String cacheName, Ignite ignite, 
IgniteConsumer<Cache.Entry<K, V>> fun,
-        IgniteSupplier<Set<K>> keysGen) {
-        bcast(cacheName, ignite, () -> {
-            Ignite ig = Ignition.localIgnite();
-            IgniteCache<K, V> cache = ig.getOrCreateCache(cacheName);
-
-            Affinity<K> affinity = ig.affinity(cacheName);
-            ClusterNode locNode = ig.cluster().localNode();
-
-            Collection<K> ks = 
affinity.mapKeysToNodes(keysGen.get()).get(locNode);
-
-            if (ks == null)
-                return;
-
-            Map<K, V> m = new ConcurrentHashMap<>();
-
-            for (K k : ks) {
-                V v = cache.localPeek(k);
-                fun.accept(new CacheEntryImpl<>(k, v));
-                m.put(k, v);
-            }
-
-            cache.putAll(m);
-        });
-    }
-
-    /**
-     * <b>Currently fold supports only commutative operations.<b/>
-     *
-     * @param cacheName Cache name.
-     * @param folder Fold function operating over cache entries.
-     * @param <K> Cache key object type.
-     * @param <V> Cache value object type.
-     * @param <A> Fold result type.
-     * @return Fold operation result.
-     */
-    public static <K, V, A> Collection<A> fold(String cacheName, 
IgniteBiFunction<CacheEntry<K, V>, A, A> folder) {
-        return fold(cacheName, folder, null);
-    }
-
-    /**
-     * <b>Currently fold supports only commutative operations.<b/>
-     *
-     * @param cacheName Cache name.
-     * @param folder Fold function operating over cache entries.
-     * @param <K> Cache key object type.
-     * @param <V> Cache value object type.
-     * @param <A> Fold result type.
-     * @return Fold operation result.
-     */
-    public static <K, V, A> Collection<A> fold(String cacheName, 
IgniteBiFunction<CacheEntry<K, V>, A, A> folder,
-        IgnitePredicate<K> keyFilter) {
-        return bcast(cacheName, () -> {
-            Ignite ignite = Ignition.localIgnite();
-            IgniteCache<K, V> cache = ignite.getOrCreateCache(cacheName);
-
-            int partsCnt = ignite.affinity(cacheName).partitions();
-
-            // Use affinity in filter for ScanQuery. Otherwise we accept 
consumer in each node which is wrong.
-            Affinity affinity = ignite.affinity(cacheName);
-            ClusterNode locNode = ignite.cluster().localNode();
-
-            A a = null;
-
-            // Iterate over all partitions. Some of them will be stored on 
that local node.
-            for (int part = 0; part < partsCnt; part++) {
-                int p = part;
-
-                // Iterate over given partition.
-                // Query returns an empty cursor if this partition is not 
stored on this node.
-                for (Cache.Entry<K, V> entry : cache.query(new ScanQuery<K, 
V>(part,
-                    (k, v) -> affinity.mapPartitionToNode(p) == locNode && 
(keyFilter == null || keyFilter.apply(k)))))
-                    a = folder.apply(new CacheEntry<>(entry, cache), a);
-            }
-
-            return a;
-        });
-    }
-
-    /**
-     * Distributed version of fold operation.
-     *
-     * @param cacheName Cache name.
-     * @param folder Folder.
-     * @param keyFilter Key filter.
-     * @param accumulator Accumulator.
-     * @param zeroValSupp Zero value supplier.
-     */
-    public static <K, V, A> A distributedFold(String cacheName, 
IgniteBiFunction<Cache.Entry<K, V>, A, A> folder,
-        IgnitePredicate<K> keyFilter, BinaryOperator<A> accumulator, 
IgniteSupplier<A> zeroValSupp) {
-        return sparseFold(cacheName, folder, keyFilter, accumulator, 
zeroValSupp, null, null, 0,
-            false);
-    }
-
-    /**
-     * Sparse version of fold. This method also applicable to sparse zeroes.
-     *
-     * @param cacheName Cache name.
-     * @param folder Folder.
-     * @param keyFilter Key filter.
-     * @param accumulator Accumulator.
-     * @param zeroValSupp Zero value supplier.
-     * @param defVal Default value.
-     * @param defKey Default key.
-     * @param defValCnt Def value count.
-     * @param isNilpotent Is nilpotent.
-     */
-    private static <K, V, A> A sparseFold(String cacheName, 
IgniteBiFunction<Cache.Entry<K, V>, A, A> folder,
-        IgnitePredicate<K> keyFilter, BinaryOperator<A> accumulator, 
IgniteSupplier<A> zeroValSupp, V defVal, K defKey,
-        long defValCnt, boolean isNilpotent) {
-
-        A defRes = zeroValSupp.get();
-
-        if (!isNilpotent)
-            for (int i = 0; i < defValCnt; i++)
-                defRes = folder.apply(new CacheEntryImpl<>(defKey, defVal), 
defRes);
-
-        Collection<A> totalRes = bcast(cacheName, () -> {
-            Ignite ignite = Ignition.localIgnite();
-            IgniteCache<K, V> cache = ignite.getOrCreateCache(cacheName);
-
-            int partsCnt = ignite.affinity(cacheName).partitions();
-
-            // Use affinity in filter for ScanQuery. Otherwise we accept 
consumer in each node which is wrong.
-            Affinity affinity = ignite.affinity(cacheName);
-            ClusterNode locNode = ignite.cluster().localNode();
-
-            A a = zeroValSupp.get();
-
-            // Iterate over all partitions. Some of them will be stored on 
that local node.
-            for (int part = 0; part < partsCnt; part++) {
-                int p = part;
-
-                // Iterate over given partition.
-                // Query returns an empty cursor if this partition is not 
stored on this node.
-                for (Cache.Entry<K, V> entry : cache.query(new ScanQuery<K, 
V>(part,
-                    (k, v) -> affinity.mapPartitionToNode(p) == locNode && 
(keyFilter == null || keyFilter.apply(k)))))
-                    a = folder.apply(entry, a);
-            }
-
-            return a;
-        });
-        return totalRes.stream().reduce(defRes, accumulator);
-    }
-
-    /**
-     * Distributed version of fold operation. This method also applicable to 
sparse zeroes.
-     *
-     * @param cacheName Cache name.
-     * @param ignite ignite
-     * @param acc Accumulator
-     * @param supp supplier
-     * @param entriesGen entries generator
-     * @param comb combiner
-     * @param zeroValSupp Zero value supplier.
-     * @return aggregated result
-     */
-    public static <K, V, A, W> A reduce(String cacheName, Ignite ignite,
-        IgniteTriFunction<W, Cache.Entry<K, V>, A, A> acc,
-        IgniteSupplier<W> supp,
-        IgniteSupplier<Iterable<Cache.Entry<K, V>>> entriesGen, 
IgniteBinaryOperator<A> comb,
-        IgniteSupplier<A> zeroValSupp) {
-
-        A defRes = zeroValSupp.get();
-
-        Collection<A> totalRes = bcast(cacheName, ignite, () -> {
-            // Use affinity in filter for ScanQuery. Otherwise we accept 
consumer in each node which is wrong.
-            A a = zeroValSupp.get();
-
-            W w = supp.get();
-
-            for (Cache.Entry<K, V> kvEntry : entriesGen.get())
-                a = acc.apply(w, kvEntry, a);
-
-            return a;
-        });
-
-        return totalRes.stream().reduce(defRes, comb);
-    }
-
-    /**
-     * Distributed version of fold operation.
-     *
-     * @param cacheName Cache name.
-     * @param acc Accumulator
-     * @param supp supplier
-     * @param entriesGen entries generator
-     * @param comb combiner
-     * @param zeroValSupp Zero value supplier
-     * @return aggregated result
-     */
-    public static <K, V, A, W> A reduce(String cacheName,
-        IgniteTriFunction<W, Cache.Entry<K, V>, A, A> acc,
-        IgniteSupplier<W> supp,
-        IgniteSupplier<Iterable<Cache.Entry<K, V>>> entriesGen,
-        IgniteBinaryOperator<A> comb,
-        IgniteSupplier<A> zeroValSupp) {
-        return reduce(cacheName, Ignition.localIgnite(), acc, supp, 
entriesGen, comb, zeroValSupp);
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param run {@link Runnable} to broadcast to cache nodes for given cache 
name.
-     */
-    public static void bcast(String cacheName, Ignite ignite, IgniteRunnable 
run) {
-        
ignite.compute(ignite.cluster().forDataNodes(cacheName)).broadcast(run);
-    }
-
-    /**
-     * Broadcast runnable to data nodes of given cache.
-     *
-     * @param cacheName Cache name.
-     * @param run Runnable.
-     */
-    public static void bcast(String cacheName, IgniteRunnable run) {
-        bcast(cacheName, ignite(), run);
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param call {@link IgniteCallable} to broadcast to cache nodes for 
given cache name.
-     * @param <A> Type returned by the callable.
-     */
-    public static <A> Collection<A> bcast(String cacheName, IgniteCallable<A> 
call) {
-        return bcast(cacheName, ignite(), call);
-    }
-
-    /**
-     * Broadcast callable to data nodes of given cache.
-     *
-     * @param cacheName Cache name.
-     * @param ignite Ignite instance.
-     * @param call Callable to broadcast.
-     * @param <A> Type of callable result.
-     * @return Results of callable from each node.
-     */
-    public static <A> Collection<A> bcast(String cacheName, Ignite ignite, 
IgniteCallable<A> call) {
-        return 
ignite.compute(ignite.cluster().forDataNodes(cacheName)).broadcast(call);
-    }
-
-    /**
-     * @param vectorUuid Matrix UUID.
-     * @param mapper Mapping {@link IgniteFunction}.
-     */
-    @SuppressWarnings("unchecked")
-    public static <K, V> void sparseMapForVector(UUID vectorUuid, 
IgniteDoubleFunction<V> mapper, String cacheName) {
-        A.notNull(vectorUuid, "vectorUuid");
-        A.notNull(cacheName, "cacheName");
-        A.notNull(mapper, "mapper");
-
-        foreach(cacheName, (CacheEntry<K, V> ce) -> {
-            K k = ce.entry().getKey();
-
-            V v = ce.entry().getValue();
-
-            if (v instanceof VectorBlockEntry) {
-                VectorBlockEntry entry = (VectorBlockEntry)v;
-
-                for (int i = 0; i < entry.size(); i++)
-                    entry.set(i, (Double)mapper.apply(entry.get(i)));
-
-                ce.cache().put(k, (V)entry);
-            }
-            else {
-                V mappingRes = mapper.apply((Double)v);
-                ce.cache().put(k, mappingRes);
-            }
-        }, sparseKeyFilter(vectorUuid));
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/DistributedStorage.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/DistributedStorage.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/DistributedStorage.java
deleted file mode 100644
index 7b58d1d..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/DistributedStorage.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed;
-
-import java.util.Set;
-
-/**
- * Extension for any distributed storage.
- */
-public interface DistributedStorage<K> {
-    /**
-     * Build a keyset for this storage.
-     */
-    public Set<K> getAllKeys();
-
-    /**
-     * @return The name of cache used in this storage.
-     */
-    public String cacheName();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/MatrixKeyMapper.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/MatrixKeyMapper.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/MatrixKeyMapper.java
deleted file mode 100644
index 2a93328..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/MatrixKeyMapper.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed;
-
-import org.apache.ignite.ml.math.KeyMapper;
-import org.apache.ignite.ml.math.Matrix;
-
-/**
- * Maps {@link Matrix} row and column index to cache key.
- */
-public interface MatrixKeyMapper<K> extends KeyMapper<K> {
-    /**
-     * @param x Matrix row index.
-     * @param y Matrix column index.
-     * @return Cache key for given row and column.
-     */
-    public K apply(int x, int y);
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/ValueMapper.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/ValueMapper.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/ValueMapper.java
deleted file mode 100644
index c94cfb6..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/ValueMapper.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed;
-
-import java.io.Serializable;
-
-/**
- * Utility mapper that can be used to map arbitrary values types to and from 
double.
- */
-public interface ValueMapper<V> extends Serializable {
-    /**
-     * @param v Value to map from double.
-     * @return Mapped value.
-     */
-    public V fromDouble(double v);
-
-    /**
-     * @param v Value to map to double.
-     * @return Mapped value.
-     */
-    public double toDouble(V v);
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/VectorKeyMapper.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/VectorKeyMapper.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/VectorKeyMapper.java
deleted file mode 100644
index de08d7b..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/VectorKeyMapper.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed;
-
-import org.apache.ignite.ml.math.KeyMapper;
-import org.apache.ignite.ml.math.Vector;
-
-/**
- * Maps {@link Vector} element index to cache key.
- */
-public interface VectorKeyMapper<K> extends KeyMapper<K> {
-    /**
-     * @param i Vector element index.
-     * @return Cache key for given element index.
-     */
-    public K apply(int i);
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/DataStructureCacheKey.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/DataStructureCacheKey.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/DataStructureCacheKey.java
deleted file mode 100644
index d99ea48..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/DataStructureCacheKey.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed.keys;
-
-import java.util.UUID;
-
-/**
- * Base matrix cache key.
- */
-public interface DataStructureCacheKey {
-    /**
-     * @return matrix id.
-     */
-    public UUID dataStructureId();
-
-    /**
-     * @return affinity key.
-     */
-    public Object affinityKey();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/MatrixBlockKey.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/MatrixBlockKey.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/MatrixBlockKey.java
deleted file mode 100644
index 9c76568..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/MatrixBlockKey.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed.keys;
-
-import org.apache.ignite.internal.util.lang.IgnitePair;
-import org.apache.ignite.ml.math.impls.matrix.SparseBlockDistributedMatrix;
-
-/**
- * Cache key for blocks in {@link SparseBlockDistributedMatrix}.
- *
- * TODO: check if using {@link IgnitePair} will be better for block id.
- */
-public interface MatrixBlockKey extends DataStructureCacheKey {
-    /**
-     * @return block row id.
-     */
-    public long blockRowId();
-
-    /**
-     * @return block col id.
-     */
-    public long blockColId();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/RowColMatrixKey.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/RowColMatrixKey.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/RowColMatrixKey.java
deleted file mode 100644
index 05d8027..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/RowColMatrixKey.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed.keys;
-
-import org.apache.ignite.ml.math.impls.matrix.SparseDistributedMatrix;
-
-/**
- * Cache key for {@link SparseDistributedMatrix}.
- */
-public interface RowColMatrixKey extends DataStructureCacheKey {
-    /**
-     * Return index value(blockId, Row/Col index, etc.)
-     */
-    public int index();
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/VectorBlockKey.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/VectorBlockKey.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/VectorBlockKey.java
deleted file mode 100644
index 32af965..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/VectorBlockKey.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed.keys;
-
-import org.apache.ignite.internal.util.lang.IgnitePair;
-import org.apache.ignite.ml.math.impls.vector.SparseBlockDistributedVector;
-
-/**
- * Cache key for blocks in {@link SparseBlockDistributedVector}.
- *
- * TODO: check if using {@link IgnitePair} will be better for block id.
- */
-public interface VectorBlockKey extends DataStructureCacheKey {
-    /**
-     * @return block id.
-     */
-    public long blockId();
-
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/MatrixBlockKey.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/MatrixBlockKey.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/MatrixBlockKey.java
deleted file mode 100644
index 6e09499..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/MatrixBlockKey.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed.keys.impl;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.UUID;
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.ml.math.impls.matrix.MatrixBlockEntry;
-import org.apache.ignite.ml.math.impls.matrix.SparseBlockDistributedMatrix;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Key implementation for {@link MatrixBlockEntry} using for {@link 
SparseBlockDistributedMatrix}.
- */
-public class MatrixBlockKey implements 
org.apache.ignite.ml.math.distributed.keys.MatrixBlockKey,
-    Externalizable, Binarylizable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Block row ID */
-    private long blockIdRow;
-
-    /** Block col ID */
-    private long blockIdCol;
-
-    /** Matrix ID */
-    private UUID matrixUuid;
-
-    /** Block affinity key. */
-    private UUID affinityKey;
-
-    /**
-     * Empty constructor required for {@link Externalizable}.
-     */
-    public MatrixBlockKey() {
-        // No-op.
-    }
-
-    /**
-     * Construct matrix block key.
-     *
-     * @param matrixUuid Matrix uuid.
-     * @param affinityKey Affinity key.
-     */
-    public MatrixBlockKey(long rowId, long colId, UUID matrixUuid, @Nullable 
UUID affinityKey) {
-        assert rowId >= 0;
-        assert colId >= 0;
-        assert matrixUuid != null;
-
-        this.blockIdRow = rowId;
-        this.blockIdCol = colId;
-        this.matrixUuid = matrixUuid;
-        this.affinityKey = affinityKey;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long blockRowId() {
-        return blockIdRow;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long blockColId() {
-        return blockIdCol;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID dataStructureId() {
-        return matrixUuid;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID affinityKey() {
-        return affinityKey;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(matrixUuid);
-        out.writeObject(affinityKey);
-        out.writeLong(blockIdRow);
-        out.writeLong(blockIdCol);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        matrixUuid = (UUID)in.readObject();
-        affinityKey = (UUID)in.readObject();
-        blockIdRow = in.readLong();
-        blockIdCol = in.readLong();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeBinary(BinaryWriter writer) throws 
BinaryObjectException {
-        BinaryRawWriter out = writer.rawWriter();
-
-        out.writeUuid(matrixUuid);
-        out.writeUuid(affinityKey);
-        out.writeLong(blockIdRow);
-        out.writeLong(blockIdCol);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readBinary(BinaryReader reader) throws 
BinaryObjectException {
-        BinaryRawReader in = reader.rawReader();
-
-        matrixUuid = in.readUuid();
-        affinityKey = in.readUuid();
-        blockIdRow = in.readLong();
-        blockIdCol = in.readLong();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = 37;
-
-        res += res * 37 + blockIdCol;
-        res += res * 37 + blockIdRow;
-        res += res * 37 + matrixUuid.hashCode();
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object obj) {
-        if (obj == this)
-            return true;
-
-        if (obj == null || obj.getClass() != getClass())
-            return false;
-
-        MatrixBlockKey that = (MatrixBlockKey)obj;
-
-        return blockIdRow == that.blockIdRow && blockIdCol == that.blockIdCol 
&& matrixUuid.equals(that.matrixUuid)
-            && F.eq(affinityKey, that.affinityKey);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(MatrixBlockKey.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/SparseMatrixKey.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/SparseMatrixKey.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/SparseMatrixKey.java
deleted file mode 100644
index 3669d19..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/SparseMatrixKey.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed.keys.impl;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.UUID;
-import org.apache.ignite.cache.affinity.AffinityKeyMapped;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.ml.math.distributed.keys.RowColMatrixKey;
-import org.apache.ignite.ml.math.impls.matrix.SparseDistributedMatrix;
-
-
-/**
- * Key implementation for {@link SparseDistributedMatrix}.
- */
-public class SparseMatrixKey implements RowColMatrixKey, Externalizable {
-    /** */
-    private int idx;
-
-    /** */
-    private UUID matrixId;
-
-    /** */
-    @AffinityKeyMapped
-    private Object affinityKey;
-
-    /**
-     * Default constructor (required by Externalizable).
-     */
-    public SparseMatrixKey() {
-
-    }
-
-    /**
-     * Build Key.
-     */
-    public SparseMatrixKey(int idx, UUID matrixId, Object affinityKey) {
-        assert idx >= 0 : "Index must be positive.";
-        assert matrixId != null : "Matrix id can`t be null.";
-
-        this.idx = idx;
-        this.matrixId = matrixId;
-        this.affinityKey = affinityKey;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int index() {
-        return idx;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID dataStructureId() {
-        return matrixId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Object affinityKey() {
-        return affinityKey;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(matrixId);
-        out.writeObject(affinityKey);
-        out.writeInt(idx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        matrixId = (UUID)in.readObject();
-        affinityKey = in.readObject();
-        idx = in.readInt();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = idx;
-        res = 31 * res + (matrixId != null ? matrixId.hashCode() : 0);
-        res = 31 * res + (affinityKey != null ? affinityKey.hashCode() : 0);
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object obj) {
-        if (obj == this)
-            return true;
-
-        if (obj == null || obj.getClass() != getClass())
-            return false;
-
-        SparseMatrixKey that = (SparseMatrixKey)obj;
-
-        return idx == that.idx && matrixId.equals(that.matrixId) && 
F.eq(affinityKey, that.affinityKey);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(SparseMatrixKey.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/VectorBlockKey.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/VectorBlockKey.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/VectorBlockKey.java
deleted file mode 100644
index 718897f..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/VectorBlockKey.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.ml.math.distributed.keys.impl;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.UUID;
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.ml.math.impls.vector.SparseBlockDistributedVector;
-import org.apache.ignite.ml.math.impls.vector.VectorBlockEntry;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Key implementation for {@link VectorBlockEntry} using for {@link 
SparseBlockDistributedVector}.
- */
-public class VectorBlockKey implements 
org.apache.ignite.ml.math.distributed.keys.VectorBlockKey, Externalizable, 
Binarylizable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Block row ID */
-    private long blockId;
-
-    /** Vector ID */
-    private UUID vectorUuid;
-
-    /** Block affinity key. */
-    private UUID affinityKey;
-
-    /**
-     * Empty constructor required for {@link Externalizable}.
-     */
-    public VectorBlockKey() {
-        // No-op.
-    }
-
-    /**
-     * Construct vector block key.
-     *
-     * @param vectorUuid Vector uuid.
-     * @param affinityKey Affinity key.
-     */
-    public VectorBlockKey(long blockId, UUID vectorUuid, @Nullable UUID 
affinityKey) {
-        assert blockId >= 0;
-        assert vectorUuid != null;
-
-        this.blockId = blockId;
-        this.vectorUuid = vectorUuid;
-        this.affinityKey = affinityKey;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long blockId() {
-        return blockId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID dataStructureId() {
-        return vectorUuid;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID affinityKey() {
-        return affinityKey;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(vectorUuid);
-        out.writeObject(affinityKey);
-        out.writeLong(blockId);
-
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        vectorUuid = (UUID)in.readObject();
-        affinityKey = (UUID)in.readObject();
-        blockId = in.readLong();
-
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeBinary(BinaryWriter writer) throws 
BinaryObjectException {
-        BinaryRawWriter out = writer.rawWriter();
-
-        out.writeUuid(vectorUuid);
-        out.writeUuid(affinityKey);
-        out.writeLong(blockId);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readBinary(BinaryReader reader) throws 
BinaryObjectException {
-        BinaryRawReader in = reader.rawReader();
-
-        vectorUuid = in.readUuid();
-        affinityKey = in.readUuid();
-        blockId = in.readLong();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = 37;
-
-        res += res * 37 + blockId;
-        res += res * 37 + vectorUuid.hashCode();
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object obj) {
-        if (obj == this)
-            return true;
-
-        if (obj == null || obj.getClass() != getClass())
-            return false;
-
-        VectorBlockKey that = (VectorBlockKey)obj;
-
-        return blockId == that.blockId && vectorUuid.equals(that.vectorUuid)
-            && F.eq(affinityKey, that.affinityKey);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(VectorBlockKey.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/package-info.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/package-info.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/package-info.java
deleted file mode 100644
index 3a68ee2..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/impl/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- *  * <!-- Package description. -->
- * Contains matrix cache key implementations.
- */
-package org.apache.ignite.ml.math.distributed.keys.impl;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/package-info.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/package-info.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/package-info.java
deleted file mode 100644
index 8954c6e..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/keys/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- *  * <!-- Package description. -->
- * Contains matrix cache keys.
- */
-package org.apache.ignite.ml.math.distributed.keys;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/package-info.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/package-info.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/package-info.java
deleted file mode 100644
index ad7399b..0000000
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/distributed/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * <!-- Package description. -->
- * Contains classes for distribution support.
- */
-package org.apache.ignite.ml.math.distributed;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/9dccb3db/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
----------------------------------------------------------------------
diff --git 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
index 5b6c988..06fb7a2 100644
--- 
a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
+++ 
b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
@@ -31,7 +31,6 @@ import org.apache.ignite.ml.math.Blas;
 import org.apache.ignite.ml.math.Matrix;
 import org.apache.ignite.ml.math.MatrixStorage;
 import org.apache.ignite.ml.math.Vector;
-import org.apache.ignite.ml.math.decompositions.LUDecomposition;
 import org.apache.ignite.ml.math.exceptions.CardinalityException;
 import org.apache.ignite.ml.math.exceptions.ColumnIndexException;
 import org.apache.ignite.ml.math.exceptions.RowIndexException;
@@ -581,29 +580,6 @@ public abstract class AbstractMatrix implements Matrix {
         return sto.rowSize();
     }
 
-    /** {@inheritDoc} */
-    @Override public double determinant() {
-        //TODO: IGNITE-5799, This decomposition should be cached
-        LUDecomposition dec = new LUDecomposition(this);
-        double res = dec.determinant();
-        dec.destroy();
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Matrix inverse() {
-        if (rowSize() != columnSize())
-            throw new CardinalityException(rowSize(), columnSize());
-
-        //TODO: IGNITE-5799, This decomposition should be cached
-        LUDecomposition dec = new LUDecomposition(this);
-
-        Matrix res = dec.solve(likeIdentity());
-        dec.destroy();
-
-        return res;
-    }
-
     /** */
     protected Matrix likeIdentity() {
         int n = rowSize();

Reply via email to