summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2017-12-19 23:02:04 +0100
committerJon Bratseth <bratseth@yahoo-inc.com>2017-12-19 23:02:04 +0100
commit35d59981840614bf4b877714ee88e273816c46d2 (patch)
treefba37b2e8bc9fcee46821821ab2886d371fcd696 /vespajlib/src/main/java/com/yahoo/tensor/Tensor.java
parent067eb48b7d2fc062a74392b1c16f5538b5031d5b (diff)
Use longs for dimensions lengths in all API's
This is to be able to support tensor dimensions with more than 2B elements in the future without API change.
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/tensor/Tensor.java')
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/Tensor.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java b/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java
index 1b60e01cf7e..0c948f1fbee 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/Tensor.java
@@ -59,7 +59,7 @@ public interface Tensor {
default boolean isEmpty() { return size() == 0; }
/** Returns the number of cells in this */
- int size();
+ long size();
/** Returns the value of a cell, or NaN if this cell does not exist/have no value */
double get(TensorAddress address);
@@ -124,7 +124,7 @@ public interface Tensor {
return new Rename(new ConstantTensor(this), fromDimensions, toDimensions).evaluate();
}
- static Tensor generate(TensorType type, Function<List<Integer>, Double> valueSupplier) {
+ static Tensor generate(TensorType type, Function<List<Long>, Double> valueSupplier) {
return new Generate(type, valueSupplier).evaluate();
}
@@ -333,7 +333,7 @@ public interface Tensor {
* This is for optimizations mapping between tensors where this is possible without creating a
* TensorAddress.
*/
- int getDirectIndex() { return -1; }
+ long getDirectIndex() { return -1; }
@Override
public Double getValue() { return value; }
@@ -396,7 +396,7 @@ public interface Tensor {
Builder cell(TensorAddress address, double value);
/** Add a cell */
- Builder cell(double value, int ... labels);
+ Builder cell(double value, long ... labels);
/**
* Add a cell
@@ -425,7 +425,7 @@ public interface Tensor {
return this;
}
- public CellBuilder label(String dimension, int label) {
+ public CellBuilder label(String dimension, long label) {
return label(dimension, String.valueOf(label));
}