diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2019-04-26 14:56:40 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2019-04-26 14:56:40 +0200 |
commit | ecd1dba4a8f11e7e5265c98675fc2fa780a4c6e5 (patch) | |
tree | f5969509aad4ff9eed187df0f88a27b76f25421e /vespajlib/src | |
parent | e92b8dd81cfc469d42f858785919964baf8afb0e (diff) |
Add float accessor
Diffstat (limited to 'vespajlib/src')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/tensor/IndexedTensor.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/IndexedTensor.java b/vespajlib/src/main/java/com/yahoo/tensor/IndexedTensor.java index f6af1cf0ed2..d43e9ee74a3 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/IndexedTensor.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/IndexedTensor.java @@ -97,6 +97,16 @@ public abstract class IndexedTensor implements Tensor { return get((int)toValueIndex(indexes, dimensionSizes)); } + /** + * Returns the value at the given indexes as a float + * + * @param indexes the indexes into the dimensions of this. Must be one number per dimension of this + * @throws IndexOutOfBoundsException if any of the indexes are out of bound or a wrong number of indexes are given + */ + public float getFloat(long ... indexes) { + return getFloat((int)toValueIndex(indexes, dimensionSizes)); + } + /** Returns the value at this address, or NaN if there is no value at this address */ @Override public double get(TensorAddress address) { |