Search in sources :

Example 36 with IdentityValueMapper

use of org.apache.ignite.ml.math.IdentityValueMapper in project ignite by apache.

the class CacheVectorTest method testCopy.

/**
 */
public void testCopy() {
    IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
    IdentityValueMapper valMapper = new IdentityValueMapper();
    CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
    try {
        cacheVector.copy();
        TestCase.fail("Unsupported case");
    } catch (UnsupportedOperationException ignored) {
    }
}
Also used : IdentityValueMapper(org.apache.ignite.ml.math.IdentityValueMapper) UnsupportedOperationException(org.apache.ignite.ml.math.exceptions.UnsupportedOperationException)

Example 37 with IdentityValueMapper

use of org.apache.ignite.ml.math.IdentityValueMapper in project ignite by apache.

the class CacheVectorTest method testMapBiFunc.

/**
 */
public void testMapBiFunc() {
    IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
    IdentityValueMapper valMapper = new IdentityValueMapper();
    CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
    initVector(cacheVector);
    cacheVector.map(Functions.PLUS, 1d);
    for (int i = 0; i < size; i++) assertEquals("Unexpected value.", cacheVector.get(i), 1d, 0d);
}
Also used : IdentityValueMapper(org.apache.ignite.ml.math.IdentityValueMapper)

Aggregations

IdentityValueMapper (org.apache.ignite.ml.math.IdentityValueMapper)37 UnsupportedOperationException (org.apache.ignite.ml.math.exceptions.UnsupportedOperationException)8 Vector (org.apache.ignite.ml.math.Vector)5 Ignite (org.apache.ignite.Ignite)2 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)2 ValueMapper (org.apache.ignite.ml.math.distributed.ValueMapper)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 ExternalizeTest (org.apache.ignite.ml.math.ExternalizeTest)1 MatrixKeyMapper (org.apache.ignite.ml.math.distributed.MatrixKeyMapper)1 VectorKeyMapper (org.apache.ignite.ml.math.distributed.VectorKeyMapper)1 CacheMatrix (org.apache.ignite.ml.math.impls.matrix.CacheMatrix)1 CacheVector (org.apache.ignite.ml.math.impls.vector.CacheVector)1