2525import java .util .Map ;
2626import java .util .Map .Entry ;
2727import java .util .Set ;
28+ import java .util .function .BiFunction ;
2829import java .util .function .Function ;
2930import java .util .function .Supplier ;
3031import java .util .stream .Stream ;
@@ -194,6 +195,14 @@ public static <V, TB extends Tensorbacked<V>> TB empty(Class<TB> tensorbackedCla
194195 return Tensorbackeds .empty (tensorbackedClass );
195196 }
196197
198+ public static <V > Tensor <V > empty (Iterable <Class <?>> dimensions ) {
199+ return ImmutableTensor .<V > builder (dimensions ).build ();
200+ }
201+
202+ public static <V > Tensor <V > empty (Class <?> ... dimensions ) {
203+ return ImmutableTensor .<V > builder (dimensions ).build ();
204+ }
205+
197206 /**
198207 * @see Tensorbackeds#validitiesOf(Tensorbacked)
199208 */
@@ -237,6 +246,13 @@ public static <S> Tensor<QuantifiedValue<S>> quantityTensorOf(Tensor<S> tensor,
237246 return QuantityTensors .quantityTensorOf (tensor , unit );
238247 }
239248
249+ /**
250+ * @see QuantityTensors#quantityTensorOf(Tensor, javax.measure.unit.Unit)
251+ */
252+ public static <S > Tensor <QuantifiedValue <S >> quantityTensorOf (Tensor <S > tensor , javax .measure .unit .Unit <?> unit ) {
253+ return QuantityTensors .quantityTensorOf (tensor , JScienceUnit .of (unit ));
254+ }
255+
240256 /**
241257 * @see QuantityTensors#unitOf(Tensor)
242258 */
@@ -309,18 +325,38 @@ public static <S> Tensor<S> sameValues(Shape shape, S value) {
309325 return TensorInternals .sameValues (shape , value );
310326 }
311327
328+ /**
329+ * @deprecated use {@link #tensor(Shape, Supplier)}
330+ */
331+ @ Deprecated
312332 public static <S > Tensor <S > createFrom (Shape shape , Supplier <S > supplier ) {
333+ return tensor (shape , supplier );
334+ }
335+
336+ public static <S > Tensor <S > tensor (Shape shape , Supplier <S > supplier ) {
313337 return TensorInternals .createFrom (shape , supplier );
314338 }
315339
340+ /**
341+ * @deprecated use {@link #tensor(Shape, Function)}
342+ */
343+ @ Deprecated
316344 public static <S > Tensor <S > createFrom (Shape shape , Function <Position , S > function ) {
345+ return tensor (shape , function );
346+ }
347+
348+ public static <S > Tensor <S > tensor (Shape shape , Function <Position , S > function ) {
317349 return TensorInternals .createFrom (shape , function );
318350 }
319351
320352 public static <S > OngoingCompletion <S > complete (Tensor <S > tensor ) {
321353 return TensorStructurals .complete (tensor );
322354 }
323355
356+ /**
357+ * @deprecated use {@link #map(Tensor, BiFunction)} instead
358+ */
359+ @ Deprecated
324360 public static <S , T > Tensor <T > transformEntries (Tensor <S > tensor , Function <Entry <Position , S >, T > function ) {
325361 return TensorStructurals .transformEntries (tensor , function );
326362 }
@@ -329,6 +365,10 @@ public static <S, T> Tensor<T> map(Tensor<S> tensor, Function<S, T> function) {
329365 return TensorStructurals .transformScalars (tensor , function );
330366 }
331367
368+ public static <S , T > Tensor <T > map (Tensor <S > tensor , BiFunction <Position , S , T > function ) {
369+ return TensorStructurals .transformScalars (tensor , function );
370+ }
371+
332372 public static final Scalar <QuantifiedValue <Double >> zeroDimensionalOf (double value ,
333373 javax .measure .unit .Unit <?> unit ) {
334374 QuantifiedValue <Double > quantity = quantityOf (value , unit );
0 commit comments