org.tensorics.core.reduction.ToFunctions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tensorics-core Show documentation
Show all versions of tensorics-core Show documentation
Tensorics is a java framework which uses a tensor as a central object. A tensor represents a set of values placed in an N-dimensional space. Wherever you are tempted to use maps of maps, a tensor might be a good choice ;-) Tensorics provides methods to create, transform and performing calculations with those tensors.
/**
* Copyright (c) 2016 European Organisation for Nuclear Research (CERN), All Rights Reserved.
*/
package org.tensorics.core.reduction;
import java.util.Map;
import org.tensorics.core.function.DiscreteFunction;
import org.tensorics.core.function.MapBackedDiscreteFunction;
import org.tensorics.core.tensor.Position;
/**
* A reduction strategy which reduces all elements of dimension by transforming them into a {@link DiscreteFunction}
* s from to
*
* @author kfuchsbe, caguiler
* @param the type of the values along the X-axis, the type of coordinate (aka 'the dimension') do be reduced
* @param the type of the tensor elements and also the type of the values along the Y-axis
*/
public final class ToFunctions implements ReductionStrategy> {
@Override
public DiscreteFunction reduce(Map inputValues, Position position) {
return MapBackedDiscreteFunction.fromMap(inputValues);
}
@Override
public Position context(Position originalContext) {
return originalContext;
}
}