View Javadoc
1   package org.djunits.value.vfloat.matrix;
2   
3   import java.util.Collection;
4   
5   import org.djunits.unit.DimensionlessUnit;
6   import org.djunits.value.function.DimensionlessFunctions;
7   import org.djunits.value.storage.StorageType;
8   import org.djunits.value.vfloat.function.FloatMathFunctions;
9   import org.djunits.value.vfloat.matrix.base.FloatMatrixRel;
10  import org.djunits.value.vfloat.matrix.base.FloatSparseValue;
11  import org.djunits.value.vfloat.matrix.data.FloatMatrixData;
12  import org.djunits.value.vfloat.scalar.FloatDimensionless;
13  import org.djunits.value.vfloat.vector.FloatDimensionlessVector;
14  import org.djunits.value.vfloat.vector.data.FloatVectorData;
15  
16  import jakarta.annotation.Generated;
17  
18  /**
19   * Immutable FloatFloatDimensionlessMatrix, a matrix of values with a DimensionlessUnit.
20   * <p>
21   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
22   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
23   * </p>
24   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
25   * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
26   */
27  @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2023-07-23T14:06:38.224104100Z")
28  public class FloatDimensionlessMatrix
29          extends FloatMatrixRel<DimensionlessUnit, FloatDimensionless, FloatDimensionlessVector, FloatDimensionlessMatrix>
30          implements DimensionlessFunctions<DimensionlessUnit, FloatDimensionlessMatrix>
31  {
32      /** */
33      private static final long serialVersionUID = 20151109L;
34  
35      /**
36       * Construct a FloatDimensionlessMatrix from an internal data object.
37       * @param data FloatMatrixData; the internal data object for the matrix
38       * @param displayUnit DimensionlessUnit; the display unit of the matrix data
39       */
40      public FloatDimensionlessMatrix(final FloatMatrixData data, final DimensionlessUnit displayUnit)
41      {
42          super(data, displayUnit);
43      }
44  
45      /* CONSTRUCTORS WITH float[][] */
46  
47      /**
48       * Construct a FloatDimensionlessMatrix from a float[][] object. The float values are expressed in the displayUnit, and will
49       * be printed using the displayUnit.
50       * @param data float[][]; the data for the matrix, expressed in the displayUnit
51       * @param displayUnit DimensionlessUnit; the unit of the values in the data array, and display unit when printing
52       * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
53       */
54      public FloatDimensionlessMatrix(final float[][] data, final DimensionlessUnit displayUnit, final StorageType storageType)
55      {
56          this(FloatMatrixData.instantiate(data, displayUnit.getScale(), storageType), displayUnit);
57      }
58  
59      /**
60       * Construct a FloatDimensionlessMatrix from a float[][] object. The float values are expressed in the displayUnit. Assume
61       * that the StorageType is DENSE since we offer the data as an array of an array.
62       * @param data float[][]; the data for the matrix
63       * @param displayUnit DimensionlessUnit; the unit of the values in the data array, and display unit when printing
64       */
65      public FloatDimensionlessMatrix(final float[][] data, final DimensionlessUnit displayUnit)
66      {
67          this(data, displayUnit, StorageType.DENSE);
68      }
69  
70      /**
71       * Construct a FloatDimensionlessMatrix from a float[][] object with SI-unit values.
72       * @param data float[][]; the data for the matrix, in SI units
73       * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
74       */
75      public FloatDimensionlessMatrix(final float[][] data, final StorageType storageType)
76      {
77          this(data, DimensionlessUnit.SI, storageType);
78      }
79  
80      /**
81       * Construct a FloatDimensionlessMatrix from a float[][] object with SI-unit values. Assume that the StorageType is DENSE
82       * since we offer the data as an array of an array.
83       * @param data float[][]; the data for the matrix, in SI units
84       */
85      public FloatDimensionlessMatrix(final float[][] data)
86      {
87          this(data, StorageType.DENSE);
88      }
89  
90      /* CONSTRUCTORS WITH Dimensionless[][] */
91  
92      /**
93       * Construct a FloatDimensionlessMatrix from an array of an array of FloatDimensionless objects. The FloatDimensionless
94       * values are each expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit
95       * when printing.
96       * @param data FloatDimensionless[][]; the data for the matrix
97       * @param displayUnit DimensionlessUnit; the display unit of the values when printing
98       * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
99       */
100     public FloatDimensionlessMatrix(final FloatDimensionless[][] data, final DimensionlessUnit displayUnit,
101             final StorageType storageType)
102     {
103         this(FloatMatrixData.instantiate(data, storageType), displayUnit);
104     }
105 
106     /**
107      * Construct a FloatDimensionlessMatrix from an array of an array of FloatDimensionless objects. The FloatDimensionless
108      * values are each expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit
109      * when printing. Assume that the StorageType is DENSE since we offer the data as an array of an array.
110      * @param data FloatDimensionless[][]; the data for the matrix
111      * @param displayUnit DimensionlessUnit; the display unit of the values when printing
112      */
113     public FloatDimensionlessMatrix(final FloatDimensionless[][] data, final DimensionlessUnit displayUnit)
114     {
115         this(data, displayUnit, StorageType.DENSE);
116     }
117 
118     /**
119      * Construct a FloatDimensionlessMatrix from an array of an array of FloatDimensionless objects. The FloatDimensionless
120      * values are each expressed in their own unit, but will be internally stored as SI values, and expressed using SI units
121      * when printing. since we offer the data as an array of an array.
122      * @param data FloatDimensionless[][]; the data for the matrix
123      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
124      */
125     public FloatDimensionlessMatrix(final FloatDimensionless[][] data, final StorageType storageType)
126     {
127         this(data, DimensionlessUnit.SI, storageType);
128     }
129 
130     /**
131      * Construct a FloatDimensionlessMatrix from an array of an array of FloatDimensionless objects. The FloatDimensionless
132      * values are each expressed in their own unit, but will be internally stored as SI values, and expressed using SI units
133      * when printing. Assume that the StorageType is DENSE since we offer the data as an array of an array.
134      * @param data FloatDimensionless[][]; the data for the matrix
135      */
136     public FloatDimensionlessMatrix(final FloatDimensionless[][] data)
137     {
138         this(data, StorageType.DENSE);
139     }
140 
141     /* CONSTRUCTORS WITH Collection<FloatSparseValue> */
142 
143     /**
144      * Construct a FloatDimensionlessMatrix from a (sparse) collection of FloatSparseValue objects. The displayUnit indicates
145      * the unit in which the values in the collection are expressed, as well as the unit in which they will be printed.
146      * @param data Collection&lt;FloatSparseValue&gt;; the data for the matrix
147      * @param displayUnit DimensionlessUnit; the display unit of the matrix data, and the unit of the data points
148      * @param rows int; the number of rows of the matrix
149      * @param cols int; the number of columns of the matrix
150      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
151      */
152     public FloatDimensionlessMatrix(final Collection<FloatSparseValue<DimensionlessUnit, FloatDimensionless>> data,
153             final DimensionlessUnit displayUnit, final int rows, final int cols, final StorageType storageType)
154     {
155         this(FloatMatrixData.instantiate(data, rows, cols, storageType), displayUnit);
156     }
157 
158     /**
159      * Construct a FloatDimensionlessMatrix from a (sparse) collection of FloatSparseValue objects. The displayUnit indicates
160      * the unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Assume
161      * the storage type is SPARSE, since we offer the data as a collection.
162      * @param data Collection&lt;FloatSparseValue&gt;; the data for the matrix
163      * @param displayUnit DimensionlessUnit; the display unit of the matrix data, and the unit of the data points
164      * @param rows int; the number of rows of the matrix
165      * @param cols int; the number of columns of the matrix
166      */
167     public FloatDimensionlessMatrix(final Collection<FloatSparseValue<DimensionlessUnit, FloatDimensionless>> data,
168             final DimensionlessUnit displayUnit, final int rows, final int cols)
169     {
170         this(data, displayUnit, rows, cols, StorageType.SPARSE);
171     }
172 
173     /**
174      * Construct a FloatDimensionlessMatrix from a (sparse) collection of FloatSparseValue objects. The displayUnit indicates
175      * the unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Use the
176      * SI unit or base unit as the displayUnit.
177      * @param data Collection&lt;FloatSparseValue&gt;; the data for the matrix
178      * @param rows int; the number of rows of the matrix
179      * @param cols int; the number of columns of the matrix
180      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
181      */
182     public FloatDimensionlessMatrix(final Collection<FloatSparseValue<DimensionlessUnit, FloatDimensionless>> data,
183             final int rows, final int cols, final StorageType storageType)
184     {
185         this(data, DimensionlessUnit.SI, rows, cols, storageType);
186     }
187 
188     /**
189      * Construct a FloatDimensionlessMatrix from a (sparse) collection of FloatSparseValue objects. The displayUnit indicates
190      * the unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Use the
191      * SI unit or base unit as the displayUnit. Assume the storage type is SPARSE, since we offer the data as a collection.
192      * @param data Collection&lt;FloatSparseValue&gt;; the data for the matrix
193      * @param rows int; the number of rows of the matrix
194      * @param cols int; the number of columns of the matrix
195      */
196     public FloatDimensionlessMatrix(final Collection<FloatSparseValue<DimensionlessUnit, FloatDimensionless>> data,
197             final int rows, final int cols)
198     {
199         this(data, DimensionlessUnit.SI, rows, cols, StorageType.SPARSE);
200     }
201 
202     /** {@inheritDoc} */
203     @Override
204     public Class<FloatDimensionless> getScalarClass()
205     {
206         return FloatDimensionless.class;
207     }
208 
209     /** {@inheritDoc} */
210     @Override
211     public Class<FloatDimensionlessVector> getVectorClass()
212     {
213         return FloatDimensionlessVector.class;
214     }
215 
216     /** {@inheritDoc} */
217     @Override
218     public FloatDimensionlessMatrix instantiateMatrix(final FloatMatrixData fmd, final DimensionlessUnit displayUnit)
219     {
220         return new FloatDimensionlessMatrix(fmd, displayUnit);
221     }
222 
223     /** {@inheritDoc} */
224     @Override
225     public FloatDimensionlessVector instantiateVector(final FloatVectorData fvd, final DimensionlessUnit displayUnit)
226     {
227         return new FloatDimensionlessVector(fvd, displayUnit);
228     }
229 
230     /** {@inheritDoc} */
231     @Override
232     public FloatDimensionless instantiateScalarSI(final float valueSI, final DimensionlessUnit displayUnit)
233     {
234         FloatDimensionless result = FloatDimensionless.instantiateSI(valueSI);
235         result.setDisplayUnit(displayUnit);
236         return result;
237     }
238 
239     /** {@inheritDoc} */
240     @Override
241     public final FloatDimensionlessMatrix acos()
242     {
243         assign(FloatMathFunctions.ACOS);
244         return this;
245     }
246 
247     /** {@inheritDoc} */
248     @Override
249     public final FloatDimensionlessMatrix asin()
250     {
251         assign(FloatMathFunctions.ASIN);
252         return this;
253     }
254 
255     /** {@inheritDoc} */
256     @Override
257     public final FloatDimensionlessMatrix atan()
258     {
259         assign(FloatMathFunctions.ATAN);
260         return this;
261     }
262 
263     /** {@inheritDoc} */
264     @Override
265     public final FloatDimensionlessMatrix cbrt()
266     {
267         assign(FloatMathFunctions.CBRT);
268         return this;
269     }
270 
271     /** {@inheritDoc} */
272     @Override
273     public final FloatDimensionlessMatrix cos()
274     {
275         assign(FloatMathFunctions.COS);
276         return this;
277     }
278 
279     /** {@inheritDoc} */
280     @Override
281     public final FloatDimensionlessMatrix cosh()
282     {
283         assign(FloatMathFunctions.COSH);
284         return this;
285     }
286 
287     /** {@inheritDoc} */
288     @Override
289     public final FloatDimensionlessMatrix exp()
290     {
291         assign(FloatMathFunctions.EXP);
292         return this;
293     }
294 
295     /** {@inheritDoc} */
296     @Override
297     public final FloatDimensionlessMatrix expm1()
298     {
299         assign(FloatMathFunctions.EXPM1);
300         return this;
301     }
302 
303     /** {@inheritDoc} */
304     @Override
305     public final FloatDimensionlessMatrix log()
306     {
307         assign(FloatMathFunctions.LOG);
308         return this;
309     }
310 
311     /** {@inheritDoc} */
312     @Override
313     public final FloatDimensionlessMatrix log10()
314     {
315         assign(FloatMathFunctions.LOG10);
316         return this;
317     }
318 
319     /** {@inheritDoc} */
320     @Override
321     public final FloatDimensionlessMatrix log1p()
322     {
323         assign(FloatMathFunctions.LOG1P);
324         return this;
325     }
326 
327     /** {@inheritDoc} */
328     @Override
329     public final FloatDimensionlessMatrix pow(final double x)
330     {
331         assign(FloatMathFunctions.POW((float) x));
332         return this;
333     }
334 
335     /** {@inheritDoc} */
336     @Override
337     public final FloatDimensionlessMatrix signum()
338     {
339         assign(FloatMathFunctions.SIGNUM);
340         return this;
341     }
342 
343     /** {@inheritDoc} */
344     @Override
345     public final FloatDimensionlessMatrix sin()
346     {
347         assign(FloatMathFunctions.SIN);
348         return this;
349     }
350 
351     /** {@inheritDoc} */
352     @Override
353     public final FloatDimensionlessMatrix sinh()
354     {
355         assign(FloatMathFunctions.SINH);
356         return this;
357     }
358 
359     /** {@inheritDoc} */
360     @Override
361     public final FloatDimensionlessMatrix sqrt()
362     {
363         assign(FloatMathFunctions.SQRT);
364         return this;
365     }
366 
367     /** {@inheritDoc} */
368     @Override
369     public final FloatDimensionlessMatrix tan()
370     {
371         assign(FloatMathFunctions.TAN);
372         return this;
373     }
374 
375     /** {@inheritDoc} */
376     @Override
377     public final FloatDimensionlessMatrix tanh()
378     {
379         assign(FloatMathFunctions.TANH);
380         return this;
381     }
382 
383     /** {@inheritDoc} */
384     @Override
385     public final FloatDimensionlessMatrix inv()
386     {
387         assign(FloatMathFunctions.INV);
388         return this;
389     }
390 
391 }