29
29
import org .tensorics .core .lang .Tensorics ;
30
30
import org .tensorics .core .math .ExplicitField ;
31
31
import org .tensorics .core .math .operations .BinaryOperation ;
32
+ import org .tensorics .core .tensor .ImmutableScalar ;
32
33
import org .tensorics .core .tensor .Tensor ;
33
34
import org .tensorics .core .tensor .operations .ElementBinaryOperation ;
34
35
import org .tensorics .core .tree .domain .Expression ;
@@ -72,11 +73,21 @@ public Expression<Tensor<V>> plus(Expression<Tensor<V>> right) {
72
73
return evaluate (right , field .addition ());
73
74
}
74
75
76
+ @ Override
77
+ public Expression <Tensor <V >> plusV (V right ) {
78
+ return plus (ResolvedExpression .of (ImmutableScalar .of (right )));
79
+ }
80
+
75
81
@ Override
76
82
public Expression <Tensor <V >> minus (Expression <Tensor <V >> right ) {
77
83
return evaluate (right , field .subtraction ());
78
84
}
79
85
86
+ @ Override
87
+ public Expression <Tensor <V >> minusV (V right ) {
88
+ return minus (ResolvedExpression .of (ImmutableScalar .of (right )));
89
+ }
90
+
80
91
@ Override
81
92
public Expression <Tensor <V >> elementDividedByV (V value ) {
82
93
Tensor <V > right = Tensorics .scalarOf (value );
@@ -90,40 +101,14 @@ public Expression<Tensor<V>> elementTimes(Expression<Tensor<V>> right) {
90
101
91
102
@ Override
92
103
public Expression <Tensor <V >> elementTimesV (V value ) {
93
- Tensor <V > right = Tensorics .scalarOf (value );
94
- return elementTimes (ResolvedExpression .of (right ));
104
+ return elementTimes (ResolvedExpression .of (ImmutableScalar .of (value )));
95
105
}
96
106
97
107
@ Override
98
108
public Expression <Tensor <V >> elementDividedBy (Expression <Tensor <V >> right ) {
99
109
return evaluate (right , field .division ());
100
110
}
101
111
102
- // /**
103
- // * Calls multiplication operation with question for outupt's {@link
104
- // ShapingStrategy}
105
- // *
106
- // * @param right second tensoric to use
107
- // * @return Possibility to choose {@link ShapingStrategy}s
108
- // */
109
- // public Expression<Tensor<V>> elementTimes(Expression<Tensor<V>> right) {
110
- //
111
- // }
112
-
113
- // public Expression<Tensor<V>> elementDividedBy(Expression<Tensor<V>>
114
- // right) {
115
- //
116
- // }
117
- // /**
118
- // * Calls multiplication for single value operation.
119
- // *
120
- // * @param value to be multiplied in first Tensoric
121
- // * @return multiplied tensoric result.
122
- // */
123
- // public Expression<Tensor<V>> elementTimes(V value) {
124
- //
125
- // }
126
-
127
112
private Expression <Tensor <V >> evaluate (Expression <Tensor <V >> right , BinaryOperation <V > operation ) {
128
113
return new BinaryOperationExpression <>(new ElementBinaryOperation <V >(operation , optionRegistry ), left , right );
129
114
}
0 commit comments