1 package org.djunits.value.vfloat.matrix;
2
3 import org.djunits.unit.AbsoluteLinearUnit;
4 import org.djunits.unit.Unit;
5 import org.djunits.value.MathFunctionsAbs;
6 import org.djunits.value.MathFunctionsRel;
7 import org.djunits.value.StorageType;
8 import org.djunits.value.ValueException;
9 import org.djunits.value.vfloat.FloatMathFunctions;
10 import org.djunits.value.vfloat.scalar.FloatScalar;
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 public abstract class MutableFloatMatrix
26 {
27
28
29
30
31
32 public static class Abs<AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>> extends
33 AbstractMutableFloatMatrixAbs<AU, RU, FloatMatrix.Abs<AU, RU>, FloatMatrix.Rel<RU>, MutableFloatMatrix.Abs<AU, RU>,
34 FloatScalar.Abs<AU, RU>>
35 implements MathFunctionsAbs<MutableFloatMatrix.Abs<AU, RU>>, FloatMathFunctions<MutableFloatMatrix.Abs<AU, RU>>
36 {
37
38 private static final long serialVersionUID = 20151003L;
39
40
41
42
43
44
45
46
47 public Abs(final float[][] values, final AU unit, final StorageType storageType) throws ValueException
48 {
49 super(values, unit, storageType);
50 }
51
52
53
54
55
56
57
58 public Abs(final FloatScalar.Abs<AU, RU>[][] values, final StorageType storageType) throws ValueException
59 {
60 super(values, storageType);
61 }
62
63
64
65
66
67
68 Abs(final FloatMatrixData data, final AU unit)
69 {
70 super(data, unit);
71 }
72
73
74 @Override
75 @SuppressWarnings("designforextension")
76 public MutableFloatMatrix.Abs<AU, RU> toDense()
77 {
78 return this.data.isDense() ? this : instantiateMutableType(this.data.toDense(), getUnit());
79 }
80
81
82 @Override
83 @SuppressWarnings("designforextension")
84 public MutableFloatMatrix.Abs<AU, RU> toSparse()
85 {
86 return this.data.isSparse() ? this : instantiateMutableType(this.data.toSparse(), getUnit());
87 }
88
89
90 @Override
91 protected final FloatMatrix.Abs<AU, RU> instantiateTypeAbs(final FloatMatrixData dmd, final AU unit)
92 {
93 return new FloatMatrix.Abs<AU, RU>(dmd, unit);
94 }
95
96
97 @Override
98 protected final FloatMatrix.Rel<RU> instantiateTypeRel(final FloatMatrixData dmd, final RU unit)
99 {
100 return new FloatMatrix.Rel<RU>(dmd, unit);
101 }
102
103
104 @Override
105 protected final MutableFloatMatrix.Abs<AU, RU> instantiateMutableType(final FloatMatrixData dmd, final AU unit)
106 {
107 return new MutableFloatMatrix.Abs<AU, RU>(dmd, unit);
108 }
109
110
111 @Override
112 protected final FloatScalar.Abs<AU, RU> instantiateScalar(final float value, final AU unit)
113 {
114 return new FloatScalar.Abs<AU, RU>(value, unit);
115 }
116 }
117
118
119
120
121
122 public static class Rel<U extends Unit<U>>
123 extends AbstractMutableFloatMatrixRel<U, FloatMatrix.Rel<U>, MutableFloatMatrix.Rel<U>, FloatScalar.Rel<U>>
124 implements MathFunctionsRel<MutableFloatMatrix.Rel<U>>, FloatMathFunctions<MutableFloatMatrix.Rel<U>>
125 {
126
127 private static final long serialVersionUID = 20151003L;
128
129
130
131
132
133
134
135
136 public Rel(final float[][] values, final U unit, final StorageType storageType) throws ValueException
137 {
138 super(values, unit, storageType);
139 }
140
141
142
143
144
145
146
147 public Rel(final FloatScalar.Rel<U>[][] values, final StorageType storageType) throws ValueException
148 {
149 super(values, storageType);
150 }
151
152
153
154
155
156
157 Rel(final FloatMatrixData data, final U unit)
158 {
159 super(data, unit);
160 }
161
162
163 @Override
164 @SuppressWarnings("designforextension")
165 public MutableFloatMatrix.Rel<U> toDense()
166 {
167 return this.data.isDense() ? this : new MutableFloatMatrix.Rel<U>(this.data.toDense(), getUnit());
168 }
169
170
171 @Override
172 @SuppressWarnings("designforextension")
173 public MutableFloatMatrix.Rel<U> toSparse()
174 {
175 return this.data.isSparse() ? this : new MutableFloatMatrix.Rel<U>(this.data.toSparse(), getUnit());
176 }
177
178
179 @Override
180 protected final FloatMatrix.Rel<U> instantiateType(final FloatMatrixData dmd, final U unit)
181 {
182 return new FloatMatrix.Rel<U>(dmd, unit);
183 }
184
185
186 @Override
187 protected final MutableFloatMatrix.Rel<U> instantiateMutableType(final FloatMatrixData dmd, final U unit)
188 {
189 return new MutableFloatMatrix.Rel<U>(dmd, unit);
190 }
191
192
193 @Override
194 protected final FloatScalar.Rel<U> instantiateScalar(final float value, final U unit)
195 {
196 return new FloatScalar.Rel<U>(value, unit);
197 }
198 }
199 }