View Javadoc
1   package org.djunits.value.vfloat.matrix;
2   
3   import org.djunits.unit.AbsorbedDoseUnit;
4   import org.djunits.unit.AccelerationUnit;
5   import org.djunits.unit.AmountOfSubstanceUnit;
6   import org.djunits.unit.AngleUnit;
7   import org.djunits.unit.AngularAccelerationUnit;
8   import org.djunits.unit.AngularVelocityUnit;
9   import org.djunits.unit.AreaUnit;
10  import org.djunits.unit.CatalyticActivityUnit;
11  import org.djunits.unit.DensityUnit;
12  import org.djunits.unit.DimensionlessUnit;
13  import org.djunits.unit.DurationUnit;
14  import org.djunits.unit.ElectricalCapacitanceUnit;
15  import org.djunits.unit.ElectricalChargeUnit;
16  import org.djunits.unit.ElectricalConductanceUnit;
17  import org.djunits.unit.ElectricalCurrentUnit;
18  import org.djunits.unit.ElectricalInductanceUnit;
19  import org.djunits.unit.ElectricalPotentialUnit;
20  import org.djunits.unit.ElectricalResistanceUnit;
21  import org.djunits.unit.EnergyUnit;
22  import org.djunits.unit.EquivalentDoseUnit;
23  import org.djunits.unit.FlowMassUnit;
24  import org.djunits.unit.FlowVolumeUnit;
25  import org.djunits.unit.ForceUnit;
26  import org.djunits.unit.FrequencyUnit;
27  import org.djunits.unit.IlluminanceUnit;
28  import org.djunits.unit.LengthUnit;
29  import org.djunits.unit.LinearDensityUnit;
30  import org.djunits.unit.LuminousFluxUnit;
31  import org.djunits.unit.LuminousIntensityUnit;
32  import org.djunits.unit.MagneticFluxDensityUnit;
33  import org.djunits.unit.MagneticFluxUnit;
34  import org.djunits.unit.MassUnit;
35  import org.djunits.unit.MomentumUnit;
36  import org.djunits.unit.PowerUnit;
37  import org.djunits.unit.PressureUnit;
38  import org.djunits.unit.RadioActivityUnit;
39  import org.djunits.unit.SIUnit;
40  import org.djunits.unit.SolidAngleUnit;
41  import org.djunits.unit.SpeedUnit;
42  import org.djunits.unit.TemperatureUnit;
43  import org.djunits.unit.TorqueUnit;
44  import org.djunits.unit.Unit;
45  import org.djunits.unit.VolumeUnit;
46  import org.djunits.unit.si.SIDimensions;
47  import org.djunits.unit.util.UnitRuntimeException;
48  import org.djunits.value.ValueRuntimeException;
49  import org.djunits.value.storage.StorageType;
50  import org.djunits.value.vfloat.matrix.base.FloatMatrixRel;
51  import org.djunits.value.vfloat.matrix.data.FloatMatrixData;
52  import org.djunits.value.vfloat.scalar.FloatSIScalar;
53  import org.djunits.value.vfloat.vector.FloatSIVector;
54  import org.djunits.value.vfloat.vector.data.FloatVectorData;
55  import org.djutils.exceptions.Throw;
56  
57  import jakarta.annotation.Generated;
58  
59  /**
60   * Easy access methods for the generic Relative SI FloatMatrix.
61   * <p>
62   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. <br>
63   * All rights reserved. <br>
64   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
65   * </p>
66   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
67   * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
68   */
69  @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2023-07-23T14:06:38.224104100Z")
70  public class FloatSIMatrix extends FloatMatrixRel<SIUnit, FloatSIScalar, FloatSIVector, FloatSIMatrix>
71  {
72      /** */
73      private static final long serialVersionUID = 20150901L;
74  
75      /**
76       * Construct a new Relative FloatSIMatrix on the basis of a data object.
77       * @param data FloatMatrixData; an internal data object
78       * @param displayUnit SIUnit; the display unit
79       */
80      public FloatSIMatrix(final FloatMatrixData data, final SIUnit displayUnit)
81      {
82          super(data, displayUnit);
83      }
84  
85      /**
86       * Construct a new Relative FloatSIMatrix with a unit for the float values that will also be used for the displayUnit.
87       * @param values float[][]; the values of the entries in the new Relative FloatSIMatrix
88       * @param unit SIUnit; the unit of the new Relative FloatSIMatrix
89       * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
90       * @throws ValueRuntimeException when values is null
91       */
92      public FloatSIMatrix(final float[][] values, final SIUnit unit, final StorageType storageType) throws ValueRuntimeException
93      {
94          this(FloatMatrixData.instantiate(values, unit.getScale(), storageType), unit);
95      }
96  
97      /**
98       * Construct a new Relative FloatSIMatrix with a unit for the float values that will also be used for the displayUnit.
99       * Assume the StorageType is DENSE since we offer the content as an array.
100      * @param values float[][]; the values of the entries in the new Relative FloatSIMatrix
101      * @param unit SIUnit; the unit of the new Relative FloatSIMatrix
102      * @throws ValueRuntimeException when values is null
103      */
104     public FloatSIMatrix(final float[][] values, final SIUnit unit) throws ValueRuntimeException
105     {
106         this(values, unit, StorageType.DENSE);
107     }
108 
109     @Override
110     public Class<FloatSIScalar> getScalarClass()
111     {
112         return FloatSIScalar.class;
113     }
114 
115     @Override
116     public Class<FloatSIVector> getVectorClass()
117     {
118         return FloatSIVector.class;
119     }
120 
121     /**
122      * Returns an FloatSIMatrix based on an array of values and the textual representation of the unit.
123      * @param values float[][]; the values to use
124      * @param unitString String; the textual representation of the unit
125      * @param storageType StorageType; the storage type to use
126      * @return FloatSIMatrix; the matrix representation of the values in their unit
127      * @throws IllegalArgumentException when the unit cannot be parsed or is incorrect
128      * @throws NullPointerException when the unitString argument is null
129      */
130     public static FloatSIMatrix of(final float[][] values, final String unitString, final StorageType storageType)
131     {
132         Throw.whenNull(values, "Error parsing FloatSIMatrix: value is null");
133         Throw.whenNull(unitString, "Error parsing FloatSIMatrix: unitString is null");
134         Throw.whenNull(storageType, "Error parsing FloatSIMatrix: storageType is null");
135         try
136         {
137             SIUnit unit = Unit.lookupOrCreateUnitWithSIDimensions(SIDimensions.of(unitString));
138             if (unit != null)
139             {
140                 return new FloatSIMatrix(values, unit, storageType);
141             }
142         }
143         catch (Exception exception)
144         {
145             throw new IllegalArgumentException("Error parsing SIUnit from " + unitString, exception);
146         }
147         throw new IllegalArgumentException("Error parsing FloatSIMatrix with unit " + unitString);
148     }
149 
150     @Override
151     public FloatSIMatrix instantiateMatrix(final FloatMatrixData fmd, final SIUnit unit)
152     {
153         return new FloatSIMatrix(fmd, unit);
154     }
155 
156     @Override
157     public FloatSIVector instantiateVector(final FloatVectorData fvd, final SIUnit unit)
158     {
159         return new FloatSIVector(fvd, unit);
160     }
161 
162     @Override
163     public FloatSIScalar instantiateScalarSI(final float valueSI, final SIUnit unit)
164     {
165         return new FloatSIScalar(valueSI, unit);
166     }
167 
168     @Override
169     public String toString(final SIUnit displayUnit, final boolean verbose, final boolean withUnit)
170     {
171         return super.toString(displayUnit, verbose, withUnit).replaceAll("!", "");
172     }
173 
174     /**********************************************************************************/
175     /******************************** 'CAST AS' METHODS *******************************/
176     /**********************************************************************************/
177 
178     /**
179      * Return the current matrix as a absorbeddose matrix.
180      * @return FloatAbsorbedDoseMatrix; the current matrix as a absorbeddose matrix
181      */
182     public final FloatAbsorbedDoseMatrix asAbsorbedDose()
183     {
184         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AbsorbedDoseUnit.BASE.getSiDimensions())),
185                 UnitRuntimeException.class, "cannot cast %s to FloatAbsorbedDoseMatrix", this.toString());
186         return new FloatAbsorbedDoseMatrix(this.data, AbsorbedDoseUnit.SI);
187     }
188 
189     /**
190      * Return the current matrix as a absorbeddose matrix, and provide a display unit.
191      * @param displayUnit the unit in which the value will be displayed
192      * @return FloatAbsorbedDoseMatrix; the current matrix as a absorbeddose matrix
193      */
194     public final FloatAbsorbedDoseMatrix asAbsorbedDose(final AbsorbedDoseUnit displayUnit)
195     {
196         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AbsorbedDoseUnit.BASE.getSiDimensions())),
197                 UnitRuntimeException.class, "cannot cast %s to FloatAbsorbedDoseMatrix", this.toString());
198         FloatAbsorbedDoseMatrix result = new FloatAbsorbedDoseMatrix(this.data, displayUnit.getStandardUnit());
199         result.setDisplayUnit(displayUnit);
200         return result;
201     }
202 
203     /**
204      * Return the current matrix as a acceleration matrix.
205      * @return FloatAccelerationMatrix; the current matrix as a acceleration matrix
206      */
207     public final FloatAccelerationMatrix asAcceleration()
208     {
209         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AccelerationUnit.BASE.getSiDimensions())),
210                 UnitRuntimeException.class, "cannot cast %s to FloatAccelerationMatrix", this.toString());
211         return new FloatAccelerationMatrix(this.data, AccelerationUnit.SI);
212     }
213 
214     /**
215      * Return the current matrix as a acceleration matrix, and provide a display unit.
216      * @param displayUnit the unit in which the value will be displayed
217      * @return FloatAccelerationMatrix; the current matrix as a acceleration matrix
218      */
219     public final FloatAccelerationMatrix asAcceleration(final AccelerationUnit displayUnit)
220     {
221         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AccelerationUnit.BASE.getSiDimensions())),
222                 UnitRuntimeException.class, "cannot cast %s to FloatAccelerationMatrix", this.toString());
223         FloatAccelerationMatrix result = new FloatAccelerationMatrix(this.data, displayUnit.getStandardUnit());
224         result.setDisplayUnit(displayUnit);
225         return result;
226     }
227 
228     /**
229      * Return the current matrix as a amountofsubstance matrix.
230      * @return FloatAmountOfSubstanceMatrix; the current matrix as a amountofsubstance matrix
231      */
232     public final FloatAmountOfSubstanceMatrix asAmountOfSubstance()
233     {
234         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AmountOfSubstanceUnit.BASE.getSiDimensions())),
235                 UnitRuntimeException.class, "cannot cast %s to FloatAmountOfSubstanceMatrix", this.toString());
236         return new FloatAmountOfSubstanceMatrix(this.data, AmountOfSubstanceUnit.SI);
237     }
238 
239     /**
240      * Return the current matrix as a amountofsubstance matrix, and provide a display unit.
241      * @param displayUnit the unit in which the value will be displayed
242      * @return FloatAmountOfSubstanceMatrix; the current matrix as a amountofsubstance matrix
243      */
244     public final FloatAmountOfSubstanceMatrix asAmountOfSubstance(final AmountOfSubstanceUnit displayUnit)
245     {
246         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AmountOfSubstanceUnit.BASE.getSiDimensions())),
247                 UnitRuntimeException.class, "cannot cast %s to FloatAmountOfSubstanceMatrix", this.toString());
248         FloatAmountOfSubstanceMatrix result = new FloatAmountOfSubstanceMatrix(this.data, displayUnit.getStandardUnit());
249         result.setDisplayUnit(displayUnit);
250         return result;
251     }
252 
253     /**
254      * Return the current matrix as a angularacceleration matrix.
255      * @return FloatAngularAccelerationMatrix; the current matrix as a angularacceleration matrix
256      */
257     public final FloatAngularAccelerationMatrix asAngularAcceleration()
258     {
259         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngularAccelerationUnit.BASE.getSiDimensions())),
260                 UnitRuntimeException.class, "cannot cast %s to FloatAngularAccelerationMatrix", this.toString());
261         return new FloatAngularAccelerationMatrix(this.data, AngularAccelerationUnit.SI);
262     }
263 
264     /**
265      * Return the current matrix as a angularacceleration matrix, and provide a display unit.
266      * @param displayUnit the unit in which the value will be displayed
267      * @return FloatAngularAccelerationMatrix; the current matrix as a angularacceleration matrix
268      */
269     public final FloatAngularAccelerationMatrix asAngularAcceleration(final AngularAccelerationUnit displayUnit)
270     {
271         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngularAccelerationUnit.BASE.getSiDimensions())),
272                 UnitRuntimeException.class, "cannot cast %s to FloatAngularAccelerationMatrix", this.toString());
273         FloatAngularAccelerationMatrix result = new FloatAngularAccelerationMatrix(this.data, displayUnit.getStandardUnit());
274         result.setDisplayUnit(displayUnit);
275         return result;
276     }
277 
278     /**
279      * Return the current matrix as a angularvelocity matrix.
280      * @return FloatAngularVelocityMatrix; the current matrix as a angularvelocity matrix
281      */
282     public final FloatAngularVelocityMatrix asAngularVelocity()
283     {
284         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngularVelocityUnit.BASE.getSiDimensions())),
285                 UnitRuntimeException.class, "cannot cast %s to FloatAngularVelocityMatrix", this.toString());
286         return new FloatAngularVelocityMatrix(this.data, AngularVelocityUnit.SI);
287     }
288 
289     /**
290      * Return the current matrix as a angularvelocity matrix, and provide a display unit.
291      * @param displayUnit the unit in which the value will be displayed
292      * @return FloatAngularVelocityMatrix; the current matrix as a angularvelocity matrix
293      */
294     public final FloatAngularVelocityMatrix asAngularVelocity(final AngularVelocityUnit displayUnit)
295     {
296         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngularVelocityUnit.BASE.getSiDimensions())),
297                 UnitRuntimeException.class, "cannot cast %s to FloatAngularVelocityMatrix", this.toString());
298         FloatAngularVelocityMatrix result = new FloatAngularVelocityMatrix(this.data, displayUnit.getStandardUnit());
299         result.setDisplayUnit(displayUnit);
300         return result;
301     }
302 
303     /**
304      * Return the current matrix as a area matrix.
305      * @return FloatAreaMatrix; the current matrix as a area matrix
306      */
307     public final FloatAreaMatrix asArea()
308     {
309         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AreaUnit.BASE.getSiDimensions())),
310                 UnitRuntimeException.class, "cannot cast %s to FloatAreaMatrix", this.toString());
311         return new FloatAreaMatrix(this.data, AreaUnit.SI);
312     }
313 
314     /**
315      * Return the current matrix as a area matrix, and provide a display unit.
316      * @param displayUnit the unit in which the value will be displayed
317      * @return FloatAreaMatrix; the current matrix as a area matrix
318      */
319     public final FloatAreaMatrix asArea(final AreaUnit displayUnit)
320     {
321         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AreaUnit.BASE.getSiDimensions())),
322                 UnitRuntimeException.class, "cannot cast %s to FloatAreaMatrix", this.toString());
323         FloatAreaMatrix result = new FloatAreaMatrix(this.data, displayUnit.getStandardUnit());
324         result.setDisplayUnit(displayUnit);
325         return result;
326     }
327 
328     /**
329      * Return the current matrix as a catalyticactivity matrix.
330      * @return FloatCatalyticActivityMatrix; the current matrix as a catalyticactivity matrix
331      */
332     public final FloatCatalyticActivityMatrix asCatalyticActivity()
333     {
334         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(CatalyticActivityUnit.BASE.getSiDimensions())),
335                 UnitRuntimeException.class, "cannot cast %s to FloatCatalyticActivityMatrix", this.toString());
336         return new FloatCatalyticActivityMatrix(this.data, CatalyticActivityUnit.SI);
337     }
338 
339     /**
340      * Return the current matrix as a catalyticactivity matrix, and provide a display unit.
341      * @param displayUnit the unit in which the value will be displayed
342      * @return FloatCatalyticActivityMatrix; the current matrix as a catalyticactivity matrix
343      */
344     public final FloatCatalyticActivityMatrix asCatalyticActivity(final CatalyticActivityUnit displayUnit)
345     {
346         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(CatalyticActivityUnit.BASE.getSiDimensions())),
347                 UnitRuntimeException.class, "cannot cast %s to FloatCatalyticActivityMatrix", this.toString());
348         FloatCatalyticActivityMatrix result = new FloatCatalyticActivityMatrix(this.data, displayUnit.getStandardUnit());
349         result.setDisplayUnit(displayUnit);
350         return result;
351     }
352 
353     /**
354      * Return the current matrix as a density matrix.
355      * @return FloatDensityMatrix; the current matrix as a density matrix
356      */
357     public final FloatDensityMatrix asDensity()
358     {
359         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DensityUnit.BASE.getSiDimensions())),
360                 UnitRuntimeException.class, "cannot cast %s to FloatDensityMatrix", this.toString());
361         return new FloatDensityMatrix(this.data, DensityUnit.SI);
362     }
363 
364     /**
365      * Return the current matrix as a density matrix, and provide a display unit.
366      * @param displayUnit the unit in which the value will be displayed
367      * @return FloatDensityMatrix; the current matrix as a density matrix
368      */
369     public final FloatDensityMatrix asDensity(final DensityUnit displayUnit)
370     {
371         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DensityUnit.BASE.getSiDimensions())),
372                 UnitRuntimeException.class, "cannot cast %s to FloatDensityMatrix", this.toString());
373         FloatDensityMatrix result = new FloatDensityMatrix(this.data, displayUnit.getStandardUnit());
374         result.setDisplayUnit(displayUnit);
375         return result;
376     }
377 
378     /**
379      * Return the current matrix as a dimensionless matrix.
380      * @return FloatDimensionlessMatrix; the current matrix as a dimensionless matrix
381      */
382     public final FloatDimensionlessMatrix asDimensionless()
383     {
384         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DimensionlessUnit.BASE.getSiDimensions())),
385                 UnitRuntimeException.class, "cannot cast %s to FloatDimensionlessMatrix", this.toString());
386         return new FloatDimensionlessMatrix(this.data, DimensionlessUnit.SI);
387     }
388 
389     /**
390      * Return the current matrix as a dimensionless matrix, and provide a display unit.
391      * @param displayUnit the unit in which the value will be displayed
392      * @return FloatDimensionlessMatrix; the current matrix as a dimensionless matrix
393      */
394     public final FloatDimensionlessMatrix asDimensionless(final DimensionlessUnit displayUnit)
395     {
396         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DimensionlessUnit.BASE.getSiDimensions())),
397                 UnitRuntimeException.class, "cannot cast %s to FloatDimensionlessMatrix", this.toString());
398         FloatDimensionlessMatrix result = new FloatDimensionlessMatrix(this.data, displayUnit.getStandardUnit());
399         result.setDisplayUnit(displayUnit);
400         return result;
401     }
402 
403     /**
404      * Return the current matrix as a electricalcapacitance matrix.
405      * @return FloatElectricalCapacitanceMatrix; the current matrix as a electricalcapacitance matrix
406      */
407     public final FloatElectricalCapacitanceMatrix asElectricalCapacitance()
408     {
409         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalCapacitanceUnit.BASE.getSiDimensions())),
410                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalCapacitanceMatrix", this.toString());
411         return new FloatElectricalCapacitanceMatrix(this.data, ElectricalCapacitanceUnit.SI);
412     }
413 
414     /**
415      * Return the current matrix as a electricalcapacitance matrix, and provide a display unit.
416      * @param displayUnit the unit in which the value will be displayed
417      * @return FloatElectricalCapacitanceMatrix; the current matrix as a electricalcapacitance matrix
418      */
419     public final FloatElectricalCapacitanceMatrix asElectricalCapacitance(final ElectricalCapacitanceUnit displayUnit)
420     {
421         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalCapacitanceUnit.BASE.getSiDimensions())),
422                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalCapacitanceMatrix", this.toString());
423         FloatElectricalCapacitanceMatrix result =
424                 new FloatElectricalCapacitanceMatrix(this.data, displayUnit.getStandardUnit());
425         result.setDisplayUnit(displayUnit);
426         return result;
427     }
428 
429     /**
430      * Return the current matrix as a electricalcharge matrix.
431      * @return FloatElectricalChargeMatrix; the current matrix as a electricalcharge matrix
432      */
433     public final FloatElectricalChargeMatrix asElectricalCharge()
434     {
435         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalChargeUnit.BASE.getSiDimensions())),
436                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalChargeMatrix", this.toString());
437         return new FloatElectricalChargeMatrix(this.data, ElectricalChargeUnit.SI);
438     }
439 
440     /**
441      * Return the current matrix as a electricalcharge matrix, and provide a display unit.
442      * @param displayUnit the unit in which the value will be displayed
443      * @return FloatElectricalChargeMatrix; the current matrix as a electricalcharge matrix
444      */
445     public final FloatElectricalChargeMatrix asElectricalCharge(final ElectricalChargeUnit displayUnit)
446     {
447         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalChargeUnit.BASE.getSiDimensions())),
448                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalChargeMatrix", this.toString());
449         FloatElectricalChargeMatrix result = new FloatElectricalChargeMatrix(this.data, displayUnit.getStandardUnit());
450         result.setDisplayUnit(displayUnit);
451         return result;
452     }
453 
454     /**
455      * Return the current matrix as a electricalconductance matrix.
456      * @return FloatElectricalConductanceMatrix; the current matrix as a electricalconductance matrix
457      */
458     public final FloatElectricalConductanceMatrix asElectricalConductance()
459     {
460         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalConductanceUnit.BASE.getSiDimensions())),
461                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalConductanceMatrix", this.toString());
462         return new FloatElectricalConductanceMatrix(this.data, ElectricalConductanceUnit.SI);
463     }
464 
465     /**
466      * Return the current matrix as a electricalconductance matrix, and provide a display unit.
467      * @param displayUnit the unit in which the value will be displayed
468      * @return FloatElectricalConductanceMatrix; the current matrix as a electricalconductance matrix
469      */
470     public final FloatElectricalConductanceMatrix asElectricalConductance(final ElectricalConductanceUnit displayUnit)
471     {
472         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalConductanceUnit.BASE.getSiDimensions())),
473                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalConductanceMatrix", this.toString());
474         FloatElectricalConductanceMatrix result =
475                 new FloatElectricalConductanceMatrix(this.data, displayUnit.getStandardUnit());
476         result.setDisplayUnit(displayUnit);
477         return result;
478     }
479 
480     /**
481      * Return the current matrix as a electricalcurrent matrix.
482      * @return FloatElectricalCurrentMatrix; the current matrix as a electricalcurrent matrix
483      */
484     public final FloatElectricalCurrentMatrix asElectricalCurrent()
485     {
486         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalCurrentUnit.BASE.getSiDimensions())),
487                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalCurrentMatrix", this.toString());
488         return new FloatElectricalCurrentMatrix(this.data, ElectricalCurrentUnit.SI);
489     }
490 
491     /**
492      * Return the current matrix as a electricalcurrent matrix, and provide a display unit.
493      * @param displayUnit the unit in which the value will be displayed
494      * @return FloatElectricalCurrentMatrix; the current matrix as a electricalcurrent matrix
495      */
496     public final FloatElectricalCurrentMatrix asElectricalCurrent(final ElectricalCurrentUnit displayUnit)
497     {
498         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalCurrentUnit.BASE.getSiDimensions())),
499                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalCurrentMatrix", this.toString());
500         FloatElectricalCurrentMatrix result = new FloatElectricalCurrentMatrix(this.data, displayUnit.getStandardUnit());
501         result.setDisplayUnit(displayUnit);
502         return result;
503     }
504 
505     /**
506      * Return the current matrix as a electricalinductance matrix.
507      * @return FloatElectricalInductanceMatrix; the current matrix as a electricalinductance matrix
508      */
509     public final FloatElectricalInductanceMatrix asElectricalInductance()
510     {
511         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalInductanceUnit.BASE.getSiDimensions())),
512                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalInductanceMatrix", this.toString());
513         return new FloatElectricalInductanceMatrix(this.data, ElectricalInductanceUnit.SI);
514     }
515 
516     /**
517      * Return the current matrix as a electricalinductance matrix, and provide a display unit.
518      * @param displayUnit the unit in which the value will be displayed
519      * @return FloatElectricalInductanceMatrix; the current matrix as a electricalinductance matrix
520      */
521     public final FloatElectricalInductanceMatrix asElectricalInductance(final ElectricalInductanceUnit displayUnit)
522     {
523         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalInductanceUnit.BASE.getSiDimensions())),
524                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalInductanceMatrix", this.toString());
525         FloatElectricalInductanceMatrix result = new FloatElectricalInductanceMatrix(this.data, displayUnit.getStandardUnit());
526         result.setDisplayUnit(displayUnit);
527         return result;
528     }
529 
530     /**
531      * Return the current matrix as a electricalpotential matrix.
532      * @return FloatElectricalPotentialMatrix; the current matrix as a electricalpotential matrix
533      */
534     public final FloatElectricalPotentialMatrix asElectricalPotential()
535     {
536         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalPotentialUnit.BASE.getSiDimensions())),
537                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalPotentialMatrix", this.toString());
538         return new FloatElectricalPotentialMatrix(this.data, ElectricalPotentialUnit.SI);
539     }
540 
541     /**
542      * Return the current matrix as a electricalpotential matrix, and provide a display unit.
543      * @param displayUnit the unit in which the value will be displayed
544      * @return FloatElectricalPotentialMatrix; the current matrix as a electricalpotential matrix
545      */
546     public final FloatElectricalPotentialMatrix asElectricalPotential(final ElectricalPotentialUnit displayUnit)
547     {
548         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalPotentialUnit.BASE.getSiDimensions())),
549                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalPotentialMatrix", this.toString());
550         FloatElectricalPotentialMatrix result = new FloatElectricalPotentialMatrix(this.data, displayUnit.getStandardUnit());
551         result.setDisplayUnit(displayUnit);
552         return result;
553     }
554 
555     /**
556      * Return the current matrix as a electricalresistance matrix.
557      * @return FloatElectricalResistanceMatrix; the current matrix as a electricalresistance matrix
558      */
559     public final FloatElectricalResistanceMatrix asElectricalResistance()
560     {
561         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalResistanceUnit.BASE.getSiDimensions())),
562                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalResistanceMatrix", this.toString());
563         return new FloatElectricalResistanceMatrix(this.data, ElectricalResistanceUnit.SI);
564     }
565 
566     /**
567      * Return the current matrix as a electricalresistance matrix, and provide a display unit.
568      * @param displayUnit the unit in which the value will be displayed
569      * @return FloatElectricalResistanceMatrix; the current matrix as a electricalresistance matrix
570      */
571     public final FloatElectricalResistanceMatrix asElectricalResistance(final ElectricalResistanceUnit displayUnit)
572     {
573         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalResistanceUnit.BASE.getSiDimensions())),
574                 UnitRuntimeException.class, "cannot cast %s to FloatElectricalResistanceMatrix", this.toString());
575         FloatElectricalResistanceMatrix result = new FloatElectricalResistanceMatrix(this.data, displayUnit.getStandardUnit());
576         result.setDisplayUnit(displayUnit);
577         return result;
578     }
579 
580     /**
581      * Return the current matrix as a energy matrix.
582      * @return FloatEnergyMatrix; the current matrix as a energy matrix
583      */
584     public final FloatEnergyMatrix asEnergy()
585     {
586         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(EnergyUnit.BASE.getSiDimensions())),
587                 UnitRuntimeException.class, "cannot cast %s to FloatEnergyMatrix", this.toString());
588         return new FloatEnergyMatrix(this.data, EnergyUnit.SI);
589     }
590 
591     /**
592      * Return the current matrix as a energy matrix, and provide a display unit.
593      * @param displayUnit the unit in which the value will be displayed
594      * @return FloatEnergyMatrix; the current matrix as a energy matrix
595      */
596     public final FloatEnergyMatrix asEnergy(final EnergyUnit displayUnit)
597     {
598         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(EnergyUnit.BASE.getSiDimensions())),
599                 UnitRuntimeException.class, "cannot cast %s to FloatEnergyMatrix", this.toString());
600         FloatEnergyMatrix result = new FloatEnergyMatrix(this.data, displayUnit.getStandardUnit());
601         result.setDisplayUnit(displayUnit);
602         return result;
603     }
604 
605     /**
606      * Return the current matrix as a equivalentdose matrix.
607      * @return FloatEquivalentDoseMatrix; the current matrix as a equivalentdose matrix
608      */
609     public final FloatEquivalentDoseMatrix asEquivalentDose()
610     {
611         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(EquivalentDoseUnit.BASE.getSiDimensions())),
612                 UnitRuntimeException.class, "cannot cast %s to FloatEquivalentDoseMatrix", this.toString());
613         return new FloatEquivalentDoseMatrix(this.data, EquivalentDoseUnit.SI);
614     }
615 
616     /**
617      * Return the current matrix as a equivalentdose matrix, and provide a display unit.
618      * @param displayUnit the unit in which the value will be displayed
619      * @return FloatEquivalentDoseMatrix; the current matrix as a equivalentdose matrix
620      */
621     public final FloatEquivalentDoseMatrix asEquivalentDose(final EquivalentDoseUnit displayUnit)
622     {
623         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(EquivalentDoseUnit.BASE.getSiDimensions())),
624                 UnitRuntimeException.class, "cannot cast %s to FloatEquivalentDoseMatrix", this.toString());
625         FloatEquivalentDoseMatrix result = new FloatEquivalentDoseMatrix(this.data, displayUnit.getStandardUnit());
626         result.setDisplayUnit(displayUnit);
627         return result;
628     }
629 
630     /**
631      * Return the current matrix as a flowmass matrix.
632      * @return FloatFlowMassMatrix; the current matrix as a flowmass matrix
633      */
634     public final FloatFlowMassMatrix asFlowMass()
635     {
636         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FlowMassUnit.BASE.getSiDimensions())),
637                 UnitRuntimeException.class, "cannot cast %s to FloatFlowMassMatrix", this.toString());
638         return new FloatFlowMassMatrix(this.data, FlowMassUnit.SI);
639     }
640 
641     /**
642      * Return the current matrix as a flowmass matrix, and provide a display unit.
643      * @param displayUnit the unit in which the value will be displayed
644      * @return FloatFlowMassMatrix; the current matrix as a flowmass matrix
645      */
646     public final FloatFlowMassMatrix asFlowMass(final FlowMassUnit displayUnit)
647     {
648         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FlowMassUnit.BASE.getSiDimensions())),
649                 UnitRuntimeException.class, "cannot cast %s to FloatFlowMassMatrix", this.toString());
650         FloatFlowMassMatrix result = new FloatFlowMassMatrix(this.data, displayUnit.getStandardUnit());
651         result.setDisplayUnit(displayUnit);
652         return result;
653     }
654 
655     /**
656      * Return the current matrix as a flowvolume matrix.
657      * @return FloatFlowVolumeMatrix; the current matrix as a flowvolume matrix
658      */
659     public final FloatFlowVolumeMatrix asFlowVolume()
660     {
661         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FlowVolumeUnit.BASE.getSiDimensions())),
662                 UnitRuntimeException.class, "cannot cast %s to FloatFlowVolumeMatrix", this.toString());
663         return new FloatFlowVolumeMatrix(this.data, FlowVolumeUnit.SI);
664     }
665 
666     /**
667      * Return the current matrix as a flowvolume matrix, and provide a display unit.
668      * @param displayUnit the unit in which the value will be displayed
669      * @return FloatFlowVolumeMatrix; the current matrix as a flowvolume matrix
670      */
671     public final FloatFlowVolumeMatrix asFlowVolume(final FlowVolumeUnit displayUnit)
672     {
673         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FlowVolumeUnit.BASE.getSiDimensions())),
674                 UnitRuntimeException.class, "cannot cast %s to FloatFlowVolumeMatrix", this.toString());
675         FloatFlowVolumeMatrix result = new FloatFlowVolumeMatrix(this.data, displayUnit.getStandardUnit());
676         result.setDisplayUnit(displayUnit);
677         return result;
678     }
679 
680     /**
681      * Return the current matrix as a force matrix.
682      * @return FloatForceMatrix; the current matrix as a force matrix
683      */
684     public final FloatForceMatrix asForce()
685     {
686         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ForceUnit.BASE.getSiDimensions())),
687                 UnitRuntimeException.class, "cannot cast %s to FloatForceMatrix", this.toString());
688         return new FloatForceMatrix(this.data, ForceUnit.SI);
689     }
690 
691     /**
692      * Return the current matrix as a force matrix, and provide a display unit.
693      * @param displayUnit the unit in which the value will be displayed
694      * @return FloatForceMatrix; the current matrix as a force matrix
695      */
696     public final FloatForceMatrix asForce(final ForceUnit displayUnit)
697     {
698         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ForceUnit.BASE.getSiDimensions())),
699                 UnitRuntimeException.class, "cannot cast %s to FloatForceMatrix", this.toString());
700         FloatForceMatrix result = new FloatForceMatrix(this.data, displayUnit.getStandardUnit());
701         result.setDisplayUnit(displayUnit);
702         return result;
703     }
704 
705     /**
706      * Return the current matrix as a frequency matrix.
707      * @return FloatFrequencyMatrix; the current matrix as a frequency matrix
708      */
709     public final FloatFrequencyMatrix asFrequency()
710     {
711         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FrequencyUnit.BASE.getSiDimensions())),
712                 UnitRuntimeException.class, "cannot cast %s to FloatFrequencyMatrix", this.toString());
713         return new FloatFrequencyMatrix(this.data, FrequencyUnit.SI);
714     }
715 
716     /**
717      * Return the current matrix as a frequency matrix, and provide a display unit.
718      * @param displayUnit the unit in which the value will be displayed
719      * @return FloatFrequencyMatrix; the current matrix as a frequency matrix
720      */
721     public final FloatFrequencyMatrix asFrequency(final FrequencyUnit displayUnit)
722     {
723         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FrequencyUnit.BASE.getSiDimensions())),
724                 UnitRuntimeException.class, "cannot cast %s to FloatFrequencyMatrix", this.toString());
725         FloatFrequencyMatrix result = new FloatFrequencyMatrix(this.data, displayUnit.getStandardUnit());
726         result.setDisplayUnit(displayUnit);
727         return result;
728     }
729 
730     /**
731      * Return the current matrix as a illuminance matrix.
732      * @return FloatIlluminanceMatrix; the current matrix as a illuminance matrix
733      */
734     public final FloatIlluminanceMatrix asIlluminance()
735     {
736         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(IlluminanceUnit.BASE.getSiDimensions())),
737                 UnitRuntimeException.class, "cannot cast %s to FloatIlluminanceMatrix", this.toString());
738         return new FloatIlluminanceMatrix(this.data, IlluminanceUnit.SI);
739     }
740 
741     /**
742      * Return the current matrix as a illuminance matrix, and provide a display unit.
743      * @param displayUnit the unit in which the value will be displayed
744      * @return FloatIlluminanceMatrix; the current matrix as a illuminance matrix
745      */
746     public final FloatIlluminanceMatrix asIlluminance(final IlluminanceUnit displayUnit)
747     {
748         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(IlluminanceUnit.BASE.getSiDimensions())),
749                 UnitRuntimeException.class, "cannot cast %s to FloatIlluminanceMatrix", this.toString());
750         FloatIlluminanceMatrix result = new FloatIlluminanceMatrix(this.data, displayUnit.getStandardUnit());
751         result.setDisplayUnit(displayUnit);
752         return result;
753     }
754 
755     /**
756      * Return the current matrix as a lineardensity matrix.
757      * @return FloatLinearDensityMatrix; the current matrix as a lineardensity matrix
758      */
759     public final FloatLinearDensityMatrix asLinearDensity()
760     {
761         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LinearDensityUnit.BASE.getSiDimensions())),
762                 UnitRuntimeException.class, "cannot cast %s to FloatLinearDensityMatrix", this.toString());
763         return new FloatLinearDensityMatrix(this.data, LinearDensityUnit.SI);
764     }
765 
766     /**
767      * Return the current matrix as a lineardensity matrix, and provide a display unit.
768      * @param displayUnit the unit in which the value will be displayed
769      * @return FloatLinearDensityMatrix; the current matrix as a lineardensity matrix
770      */
771     public final FloatLinearDensityMatrix asLinearDensity(final LinearDensityUnit displayUnit)
772     {
773         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LinearDensityUnit.BASE.getSiDimensions())),
774                 UnitRuntimeException.class, "cannot cast %s to FloatLinearDensityMatrix", this.toString());
775         FloatLinearDensityMatrix result = new FloatLinearDensityMatrix(this.data, displayUnit.getStandardUnit());
776         result.setDisplayUnit(displayUnit);
777         return result;
778     }
779 
780     /**
781      * Return the current matrix as a luminousflux matrix.
782      * @return FloatLuminousFluxMatrix; the current matrix as a luminousflux matrix
783      */
784     public final FloatLuminousFluxMatrix asLuminousFlux()
785     {
786         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LuminousFluxUnit.BASE.getSiDimensions())),
787                 UnitRuntimeException.class, "cannot cast %s to FloatLuminousFluxMatrix", this.toString());
788         return new FloatLuminousFluxMatrix(this.data, LuminousFluxUnit.SI);
789     }
790 
791     /**
792      * Return the current matrix as a luminousflux matrix, and provide a display unit.
793      * @param displayUnit the unit in which the value will be displayed
794      * @return FloatLuminousFluxMatrix; the current matrix as a luminousflux matrix
795      */
796     public final FloatLuminousFluxMatrix asLuminousFlux(final LuminousFluxUnit displayUnit)
797     {
798         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LuminousFluxUnit.BASE.getSiDimensions())),
799                 UnitRuntimeException.class, "cannot cast %s to FloatLuminousFluxMatrix", this.toString());
800         FloatLuminousFluxMatrix result = new FloatLuminousFluxMatrix(this.data, displayUnit.getStandardUnit());
801         result.setDisplayUnit(displayUnit);
802         return result;
803     }
804 
805     /**
806      * Return the current matrix as a luminousintensity matrix.
807      * @return FloatLuminousIntensityMatrix; the current matrix as a luminousintensity matrix
808      */
809     public final FloatLuminousIntensityMatrix asLuminousIntensity()
810     {
811         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LuminousIntensityUnit.BASE.getSiDimensions())),
812                 UnitRuntimeException.class, "cannot cast %s to FloatLuminousIntensityMatrix", this.toString());
813         return new FloatLuminousIntensityMatrix(this.data, LuminousIntensityUnit.SI);
814     }
815 
816     /**
817      * Return the current matrix as a luminousintensity matrix, and provide a display unit.
818      * @param displayUnit the unit in which the value will be displayed
819      * @return FloatLuminousIntensityMatrix; the current matrix as a luminousintensity matrix
820      */
821     public final FloatLuminousIntensityMatrix asLuminousIntensity(final LuminousIntensityUnit displayUnit)
822     {
823         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LuminousIntensityUnit.BASE.getSiDimensions())),
824                 UnitRuntimeException.class, "cannot cast %s to FloatLuminousIntensityMatrix", this.toString());
825         FloatLuminousIntensityMatrix result = new FloatLuminousIntensityMatrix(this.data, displayUnit.getStandardUnit());
826         result.setDisplayUnit(displayUnit);
827         return result;
828     }
829 
830     /**
831      * Return the current matrix as a magneticfluxdensity matrix.
832      * @return FloatMagneticFluxDensityMatrix; the current matrix as a magneticfluxdensity matrix
833      */
834     public final FloatMagneticFluxDensityMatrix asMagneticFluxDensity()
835     {
836         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MagneticFluxDensityUnit.BASE.getSiDimensions())),
837                 UnitRuntimeException.class, "cannot cast %s to FloatMagneticFluxDensityMatrix", this.toString());
838         return new FloatMagneticFluxDensityMatrix(this.data, MagneticFluxDensityUnit.SI);
839     }
840 
841     /**
842      * Return the current matrix as a magneticfluxdensity matrix, and provide a display unit.
843      * @param displayUnit the unit in which the value will be displayed
844      * @return FloatMagneticFluxDensityMatrix; the current matrix as a magneticfluxdensity matrix
845      */
846     public final FloatMagneticFluxDensityMatrix asMagneticFluxDensity(final MagneticFluxDensityUnit displayUnit)
847     {
848         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MagneticFluxDensityUnit.BASE.getSiDimensions())),
849                 UnitRuntimeException.class, "cannot cast %s to FloatMagneticFluxDensityMatrix", this.toString());
850         FloatMagneticFluxDensityMatrix result = new FloatMagneticFluxDensityMatrix(this.data, displayUnit.getStandardUnit());
851         result.setDisplayUnit(displayUnit);
852         return result;
853     }
854 
855     /**
856      * Return the current matrix as a magneticflux matrix.
857      * @return FloatMagneticFluxMatrix; the current matrix as a magneticflux matrix
858      */
859     public final FloatMagneticFluxMatrix asMagneticFlux()
860     {
861         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MagneticFluxUnit.BASE.getSiDimensions())),
862                 UnitRuntimeException.class, "cannot cast %s to FloatMagneticFluxMatrix", this.toString());
863         return new FloatMagneticFluxMatrix(this.data, MagneticFluxUnit.SI);
864     }
865 
866     /**
867      * Return the current matrix as a magneticflux matrix, and provide a display unit.
868      * @param displayUnit the unit in which the value will be displayed
869      * @return FloatMagneticFluxMatrix; the current matrix as a magneticflux matrix
870      */
871     public final FloatMagneticFluxMatrix asMagneticFlux(final MagneticFluxUnit displayUnit)
872     {
873         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MagneticFluxUnit.BASE.getSiDimensions())),
874                 UnitRuntimeException.class, "cannot cast %s to FloatMagneticFluxMatrix", this.toString());
875         FloatMagneticFluxMatrix result = new FloatMagneticFluxMatrix(this.data, displayUnit.getStandardUnit());
876         result.setDisplayUnit(displayUnit);
877         return result;
878     }
879 
880     /**
881      * Return the current matrix as a mass matrix.
882      * @return FloatMassMatrix; the current matrix as a mass matrix
883      */
884     public final FloatMassMatrix asMass()
885     {
886         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MassUnit.BASE.getSiDimensions())),
887                 UnitRuntimeException.class, "cannot cast %s to FloatMassMatrix", this.toString());
888         return new FloatMassMatrix(this.data, MassUnit.SI);
889     }
890 
891     /**
892      * Return the current matrix as a mass matrix, and provide a display unit.
893      * @param displayUnit the unit in which the value will be displayed
894      * @return FloatMassMatrix; the current matrix as a mass matrix
895      */
896     public final FloatMassMatrix asMass(final MassUnit displayUnit)
897     {
898         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MassUnit.BASE.getSiDimensions())),
899                 UnitRuntimeException.class, "cannot cast %s to FloatMassMatrix", this.toString());
900         FloatMassMatrix result = new FloatMassMatrix(this.data, displayUnit.getStandardUnit());
901         result.setDisplayUnit(displayUnit);
902         return result;
903     }
904 
905     /**
906      * Return the current matrix as a momentum matrix.
907      * @return FloatMomentumMatrix; the current matrix as a momentum matrix
908      */
909     public final FloatMomentumMatrix asMomentum()
910     {
911         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MomentumUnit.BASE.getSiDimensions())),
912                 UnitRuntimeException.class, "cannot cast %s to FloatMomentumMatrix", this.toString());
913         return new FloatMomentumMatrix(this.data, MomentumUnit.SI);
914     }
915 
916     /**
917      * Return the current matrix as a momentum matrix, and provide a display unit.
918      * @param displayUnit the unit in which the value will be displayed
919      * @return FloatMomentumMatrix; the current matrix as a momentum matrix
920      */
921     public final FloatMomentumMatrix asMomentum(final MomentumUnit displayUnit)
922     {
923         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MomentumUnit.BASE.getSiDimensions())),
924                 UnitRuntimeException.class, "cannot cast %s to FloatMomentumMatrix", this.toString());
925         FloatMomentumMatrix result = new FloatMomentumMatrix(this.data, displayUnit.getStandardUnit());
926         result.setDisplayUnit(displayUnit);
927         return result;
928     }
929 
930     /**
931      * Return the current matrix as a power matrix.
932      * @return FloatPowerMatrix; the current matrix as a power matrix
933      */
934     public final FloatPowerMatrix asPower()
935     {
936         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(PowerUnit.BASE.getSiDimensions())),
937                 UnitRuntimeException.class, "cannot cast %s to FloatPowerMatrix", this.toString());
938         return new FloatPowerMatrix(this.data, PowerUnit.SI);
939     }
940 
941     /**
942      * Return the current matrix as a power matrix, and provide a display unit.
943      * @param displayUnit the unit in which the value will be displayed
944      * @return FloatPowerMatrix; the current matrix as a power matrix
945      */
946     public final FloatPowerMatrix asPower(final PowerUnit displayUnit)
947     {
948         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(PowerUnit.BASE.getSiDimensions())),
949                 UnitRuntimeException.class, "cannot cast %s to FloatPowerMatrix", this.toString());
950         FloatPowerMatrix result = new FloatPowerMatrix(this.data, displayUnit.getStandardUnit());
951         result.setDisplayUnit(displayUnit);
952         return result;
953     }
954 
955     /**
956      * Return the current matrix as a pressure matrix.
957      * @return FloatPressureMatrix; the current matrix as a pressure matrix
958      */
959     public final FloatPressureMatrix asPressure()
960     {
961         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(PressureUnit.BASE.getSiDimensions())),
962                 UnitRuntimeException.class, "cannot cast %s to FloatPressureMatrix", this.toString());
963         return new FloatPressureMatrix(this.data, PressureUnit.SI);
964     }
965 
966     /**
967      * Return the current matrix as a pressure matrix, and provide a display unit.
968      * @param displayUnit the unit in which the value will be displayed
969      * @return FloatPressureMatrix; the current matrix as a pressure matrix
970      */
971     public final FloatPressureMatrix asPressure(final PressureUnit displayUnit)
972     {
973         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(PressureUnit.BASE.getSiDimensions())),
974                 UnitRuntimeException.class, "cannot cast %s to FloatPressureMatrix", this.toString());
975         FloatPressureMatrix result = new FloatPressureMatrix(this.data, displayUnit.getStandardUnit());
976         result.setDisplayUnit(displayUnit);
977         return result;
978     }
979 
980     /**
981      * Return the current matrix as a radioactivity matrix.
982      * @return FloatRadioActivityMatrix; the current matrix as a radioactivity matrix
983      */
984     public final FloatRadioActivityMatrix asRadioActivity()
985     {
986         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(RadioActivityUnit.BASE.getSiDimensions())),
987                 UnitRuntimeException.class, "cannot cast %s to FloatRadioActivityMatrix", this.toString());
988         return new FloatRadioActivityMatrix(this.data, RadioActivityUnit.SI);
989     }
990 
991     /**
992      * Return the current matrix as a radioactivity matrix, and provide a display unit.
993      * @param displayUnit the unit in which the value will be displayed
994      * @return FloatRadioActivityMatrix; the current matrix as a radioactivity matrix
995      */
996     public final FloatRadioActivityMatrix asRadioActivity(final RadioActivityUnit displayUnit)
997     {
998         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(RadioActivityUnit.BASE.getSiDimensions())),
999                 UnitRuntimeException.class, "cannot cast %s to FloatRadioActivityMatrix", this.toString());
1000         FloatRadioActivityMatrix result = new FloatRadioActivityMatrix(this.data, displayUnit.getStandardUnit());
1001         result.setDisplayUnit(displayUnit);
1002         return result;
1003     }
1004 
1005     /**
1006      * Return the current matrix as a solidangle matrix.
1007      * @return FloatSolidAngleMatrix; the current matrix as a solidangle matrix
1008      */
1009     public final FloatSolidAngleMatrix asSolidAngle()
1010     {
1011         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(SolidAngleUnit.BASE.getSiDimensions())),
1012                 UnitRuntimeException.class, "cannot cast %s to FloatSolidAngleMatrix", this.toString());
1013         return new FloatSolidAngleMatrix(this.data, SolidAngleUnit.SI);
1014     }
1015 
1016     /**
1017      * Return the current matrix as a solidangle matrix, and provide a display unit.
1018      * @param displayUnit the unit in which the value will be displayed
1019      * @return FloatSolidAngleMatrix; the current matrix as a solidangle matrix
1020      */
1021     public final FloatSolidAngleMatrix asSolidAngle(final SolidAngleUnit displayUnit)
1022     {
1023         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(SolidAngleUnit.BASE.getSiDimensions())),
1024                 UnitRuntimeException.class, "cannot cast %s to FloatSolidAngleMatrix", this.toString());
1025         FloatSolidAngleMatrix result = new FloatSolidAngleMatrix(this.data, displayUnit.getStandardUnit());
1026         result.setDisplayUnit(displayUnit);
1027         return result;
1028     }
1029 
1030     /**
1031      * Return the current matrix as a speed matrix.
1032      * @return FloatSpeedMatrix; the current matrix as a speed matrix
1033      */
1034     public final FloatSpeedMatrix asSpeed()
1035     {
1036         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(SpeedUnit.BASE.getSiDimensions())),
1037                 UnitRuntimeException.class, "cannot cast %s to FloatSpeedMatrix", this.toString());
1038         return new FloatSpeedMatrix(this.data, SpeedUnit.SI);
1039     }
1040 
1041     /**
1042      * Return the current matrix as a speed matrix, and provide a display unit.
1043      * @param displayUnit the unit in which the value will be displayed
1044      * @return FloatSpeedMatrix; the current matrix as a speed matrix
1045      */
1046     public final FloatSpeedMatrix asSpeed(final SpeedUnit displayUnit)
1047     {
1048         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(SpeedUnit.BASE.getSiDimensions())),
1049                 UnitRuntimeException.class, "cannot cast %s to FloatSpeedMatrix", this.toString());
1050         FloatSpeedMatrix result = new FloatSpeedMatrix(this.data, displayUnit.getStandardUnit());
1051         result.setDisplayUnit(displayUnit);
1052         return result;
1053     }
1054 
1055     /**
1056      * Return the current matrix as a torque matrix.
1057      * @return FloatTorqueMatrix; the current matrix as a torque matrix
1058      */
1059     public final FloatTorqueMatrix asTorque()
1060     {
1061         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(TorqueUnit.BASE.getSiDimensions())),
1062                 UnitRuntimeException.class, "cannot cast %s to FloatTorqueMatrix", this.toString());
1063         return new FloatTorqueMatrix(this.data, TorqueUnit.SI);
1064     }
1065 
1066     /**
1067      * Return the current matrix as a torque matrix, and provide a display unit.
1068      * @param displayUnit the unit in which the value will be displayed
1069      * @return FloatTorqueMatrix; the current matrix as a torque matrix
1070      */
1071     public final FloatTorqueMatrix asTorque(final TorqueUnit displayUnit)
1072     {
1073         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(TorqueUnit.BASE.getSiDimensions())),
1074                 UnitRuntimeException.class, "cannot cast %s to FloatTorqueMatrix", this.toString());
1075         FloatTorqueMatrix result = new FloatTorqueMatrix(this.data, displayUnit.getStandardUnit());
1076         result.setDisplayUnit(displayUnit);
1077         return result;
1078     }
1079 
1080     /**
1081      * Return the current matrix as a volume matrix.
1082      * @return FloatVolumeMatrix; the current matrix as a volume matrix
1083      */
1084     public final FloatVolumeMatrix asVolume()
1085     {
1086         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(VolumeUnit.BASE.getSiDimensions())),
1087                 UnitRuntimeException.class, "cannot cast %s to FloatVolumeMatrix", this.toString());
1088         return new FloatVolumeMatrix(this.data, VolumeUnit.SI);
1089     }
1090 
1091     /**
1092      * Return the current matrix as a volume matrix, and provide a display unit.
1093      * @param displayUnit the unit in which the value will be displayed
1094      * @return FloatVolumeMatrix; the current matrix as a volume matrix
1095      */
1096     public final FloatVolumeMatrix asVolume(final VolumeUnit displayUnit)
1097     {
1098         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(VolumeUnit.BASE.getSiDimensions())),
1099                 UnitRuntimeException.class, "cannot cast %s to FloatVolumeMatrix", this.toString());
1100         FloatVolumeMatrix result = new FloatVolumeMatrix(this.data, displayUnit.getStandardUnit());
1101         result.setDisplayUnit(displayUnit);
1102         return result;
1103     }
1104 
1105     /**
1106      * Return the current matrix as a angle matrix.
1107      * @return FloatAngleMatrix; the current matrix as a angle matrix
1108      */
1109     public final FloatAngleMatrix asAngle()
1110     {
1111         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngleUnit.BASE.getSiDimensions())),
1112                 UnitRuntimeException.class, "cannot cast %s to FloatAngleMatrix", this.toString());
1113         return new FloatAngleMatrix(this.data, AngleUnit.SI);
1114     }
1115 
1116     /**
1117      * Return the current matrix as a angle matrix, and provide a display unit.
1118      * @param displayUnit the unit in which the value will be displayed
1119      * @return FloatAngleMatrix; the current matrix as a angle matrix
1120      */
1121     public final FloatAngleMatrix asAngle(final AngleUnit displayUnit)
1122     {
1123         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngleUnit.BASE.getSiDimensions())),
1124                 UnitRuntimeException.class, "cannot cast %s to FloatAngleMatrix", this.toString());
1125         FloatAngleMatrix result = new FloatAngleMatrix(this.data, displayUnit.getStandardUnit());
1126         result.setDisplayUnit(displayUnit);
1127         return result;
1128     }
1129 
1130     /**
1131      * Return the current matrix as a length matrix.
1132      * @return FloatLengthMatrix; the current matrix as a length matrix
1133      */
1134     public final FloatLengthMatrix asLength()
1135     {
1136         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LengthUnit.BASE.getSiDimensions())),
1137                 UnitRuntimeException.class, "cannot cast %s to FloatLengthMatrix", this.toString());
1138         return new FloatLengthMatrix(this.data, LengthUnit.SI);
1139     }
1140 
1141     /**
1142      * Return the current matrix as a length matrix, and provide a display unit.
1143      * @param displayUnit the unit in which the value will be displayed
1144      * @return FloatLengthMatrix; the current matrix as a length matrix
1145      */
1146     public final FloatLengthMatrix asLength(final LengthUnit displayUnit)
1147     {
1148         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LengthUnit.BASE.getSiDimensions())),
1149                 UnitRuntimeException.class, "cannot cast %s to FloatLengthMatrix", this.toString());
1150         FloatLengthMatrix result = new FloatLengthMatrix(this.data, displayUnit.getStandardUnit());
1151         result.setDisplayUnit(displayUnit);
1152         return result;
1153     }
1154 
1155     /**
1156      * Return the current matrix as a temperature matrix.
1157      * @return FloatTemperatureMatrix; the current matrix as a temperature matrix
1158      */
1159     public final FloatTemperatureMatrix asTemperature()
1160     {
1161         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(TemperatureUnit.BASE.getSiDimensions())),
1162                 UnitRuntimeException.class, "cannot cast %s to FloatTemperatureMatrix", this.toString());
1163         return new FloatTemperatureMatrix(this.data, TemperatureUnit.SI);
1164     }
1165 
1166     /**
1167      * Return the current matrix as a temperature matrix, and provide a display unit.
1168      * @param displayUnit the unit in which the value will be displayed
1169      * @return FloatTemperatureMatrix; the current matrix as a temperature matrix
1170      */
1171     public final FloatTemperatureMatrix asTemperature(final TemperatureUnit displayUnit)
1172     {
1173         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(TemperatureUnit.BASE.getSiDimensions())),
1174                 UnitRuntimeException.class, "cannot cast %s to FloatTemperatureMatrix", this.toString());
1175         FloatTemperatureMatrix result = new FloatTemperatureMatrix(this.data, displayUnit.getStandardUnit());
1176         result.setDisplayUnit(displayUnit);
1177         return result;
1178     }
1179 
1180     /**
1181      * Return the current matrix as a duration matrix.
1182      * @return FloatDurationMatrix; the current matrix as a duration matrix
1183      */
1184     public final FloatDurationMatrix asDuration()
1185     {
1186         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DurationUnit.BASE.getSiDimensions())),
1187                 UnitRuntimeException.class, "cannot cast %s to FloatDurationMatrix", this.toString());
1188         return new FloatDurationMatrix(this.data, DurationUnit.SI);
1189     }
1190 
1191     /**
1192      * Return the current matrix as a duration matrix, and provide a display unit.
1193      * @param displayUnit the unit in which the value will be displayed
1194      * @return FloatDurationMatrix; the current matrix as a duration matrix
1195      */
1196     public final FloatDurationMatrix asDuration(final DurationUnit displayUnit)
1197     {
1198         Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DurationUnit.BASE.getSiDimensions())),
1199                 UnitRuntimeException.class, "cannot cast %s to FloatDurationMatrix", this.toString());
1200         FloatDurationMatrix result = new FloatDurationMatrix(this.data, displayUnit.getStandardUnit());
1201         result.setDisplayUnit(displayUnit);
1202         return result;
1203     }
1204 
1205 }