View Javadoc
1   package org.djunits.value.vdouble.matrix;
2   
3   import org.djunits.unit.AbsoluteLinearUnit;
4   import org.djunits.unit.Unit;
5   import org.djunits.value.FunctionsAbs;
6   import org.djunits.value.MathFunctionsAbs;
7   import org.djunits.value.MathFunctionsRel;
8   import org.djunits.value.StorageType;
9   import org.djunits.value.ValueException;
10  import org.djunits.value.vdouble.DoubleMathFunctions;
11  import org.djunits.value.vdouble.scalar.DoubleScalar;
12  
13  /**
14   * MutableDoubleMatrix.
15   * <p>
16   * This file was generated by the djunits value classes generator, 26 jun, 2015
17   * <p>
18   * Copyright (c) 2015-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
19   * BSD-style license. See <a href="http://djunits.org/docs/license.html">DJUNITS License</a>.
20   * <p>
21   * $LastChangedDate: 2019-01-18 00:35:01 +0100 (Fri, 18 Jan 2019) $, @version $Revision: 324 $, by $Author: averbraeck $,
22   * initial version 26 jun, 2015 <br>
23   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
24   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
25   */
26  public abstract class MutableDoubleMatrix
27  {
28      /**
29       * ABSOLUTE implementation of MutableDoubleVector.
30       * @param <AU> Absolute unit
31       * @param <RU> Relative unit
32       */
33      public static class Abs<AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>> extends
34              AbstractMutableDoubleMatrixAbs<AU, RU, DoubleMatrix.Abs<AU, RU>, DoubleMatrix.Rel<RU>,
35                      MutableDoubleMatrix.Abs<AU, RU>, DoubleScalar.Abs<AU, RU>>
36              implements MathFunctionsAbs<MutableDoubleMatrix.Abs<AU, RU>>,
37              FunctionsAbs<AU, RU, DoubleMatrix.Abs<AU, RU>, DoubleMatrix.Rel<RU>>,
38              DoubleMathFunctions<MutableDoubleMatrix.Abs<AU, RU>>
39      {
40          /**  */
41          private static final long serialVersionUID = 20151003L;
42  
43          /**
44           * Construct a new Absolute Mutable DoubleMatrix.
45           * @param values double[][]; the values of the entries in the new Absolute Mutable DoubleMatrix
46           * @param unit AU; the unit of the new Absolute Mutable DoubleMatrix
47           * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
48           * @throws ValueException when values is null
49           */
50          public Abs(final double[][] values, final AU unit, final StorageType storageType) throws ValueException
51          {
52              super(values, unit, storageType);
53          }
54  
55          /**
56           * Construct a new Absolute Mutable DoubleMatrix.
57           * @param values DoubleScalar.Abs&lt;AU, RU&gt;[][]; the values of the entries in the new Absolute Mutable DoubleMatrix
58           * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
59           * @throws ValueException when values has zero entries
60           */
61          public Abs(final DoubleScalar.Abs<AU, RU>[][] values, final StorageType storageType) throws ValueException
62          {
63              super(values, storageType);
64          }
65  
66          /**
67           * Construct a new Absolute Mutable DoubleMatrix.
68           * @param data DoubleMatrixData; an internal data object
69           * @param unit AU; the unit
70           */
71          Abs(final DoubleMatrixData data, final AU unit)
72          {
73              super(data, unit);
74          }
75  
76          /** {@inheritDoc} */
77          @Override
78          @SuppressWarnings("designforextension")
79          public MutableDoubleMatrix.Abs<AU, RU> toDense()
80          {
81              return this.data.isDense() ? this : instantiateMutableType(this.data.toDense(), getUnit());
82          }
83  
84          /** {@inheritDoc} */
85          @Override
86          @SuppressWarnings("designforextension")
87          public MutableDoubleMatrix.Abs<AU, RU> toSparse()
88          {
89              return this.data.isSparse() ? this : instantiateMutableType(this.data.toSparse(), getUnit());
90          }
91  
92          /** {@inheritDoc} */
93          @Override
94          protected final DoubleMatrix.Abs<AU, RU> instantiateTypeAbs(final DoubleMatrixData dmd, final AU unit)
95          {
96              return new DoubleMatrix.Abs<AU, RU>(dmd, unit);
97          }
98  
99          /** {@inheritDoc} */
100         @Override
101         protected final DoubleMatrix.Rel<RU> instantiateTypeRel(final DoubleMatrixData dmd, final RU unit)
102         {
103             return new DoubleMatrix.Rel<RU>(dmd, unit);
104         }
105 
106         /** {@inheritDoc} */
107         @Override
108         protected final MutableDoubleMatrix.Abs<AU, RU> instantiateMutableType(final DoubleMatrixData dmd, final AU unit)
109         {
110             return new MutableDoubleMatrix.Abs<AU, RU>(dmd, unit);
111         }
112 
113         /** {@inheritDoc} */
114         @Override
115         protected final DoubleScalar.Abs<AU, RU> instantiateScalar(final double value, final AU unit)
116         {
117             return new DoubleScalar.Abs<AU, RU>(value, unit);
118         }
119     }
120 
121     /**
122      * RELATIVE implementation of MutableDoubleMatrix.
123      * @param <U> Unit the unit for which this Matrix will be created
124      */
125     public static class Rel<U extends Unit<U>>
126             extends AbstractMutableDoubleMatrixRel<U, DoubleMatrix.Rel<U>, MutableDoubleMatrix.Rel<U>, DoubleScalar.Rel<U>>
127             implements MathFunctionsRel<MutableDoubleMatrix.Rel<U>>
128     {
129         /**  */
130         private static final long serialVersionUID = 20151003L;
131 
132         /**
133          * Construct a new Relative Mutable DoubleMatrix.
134          * @param values double[][]; the values of the entries in the new Relative Mutable DoubleMatrix
135          * @param unit U; the unit of the new Relative Mutable DoubleMatrix
136          * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
137          * @throws ValueException when values is null
138          */
139         public Rel(final double[][] values, final U unit, final StorageType storageType) throws ValueException
140         {
141             super(values, unit, storageType);
142         }
143 
144         /**
145          * Construct a new Relative Mutable DoubleMatrix.
146          * @param values DoubleScalar.Rel&lt;U&gt;[][]; the values of the entries in the new Relative Mutable DoubleMatrix
147          * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
148          * @throws ValueException when values has zero entries
149          */
150         public Rel(final DoubleScalar.Rel<U>[][] values, final StorageType storageType) throws ValueException
151         {
152             super(values, storageType);
153         }
154 
155         /**
156          * Construct a new Relative Mutable DoubleMatrix.
157          * @param data DoubleMatrixData; an internal data object
158          * @param unit U; the unit
159          */
160         Rel(final DoubleMatrixData data, final U unit)
161         {
162             super(data, unit);
163         }
164 
165         /** {@inheritDoc} */
166         @Override
167         @SuppressWarnings("designforextension")
168         public MutableDoubleMatrix.Rel<U> toDense()
169         {
170             return this.data.isDense() ? this : new MutableDoubleMatrix.Rel<U>(this.data.toDense(), getUnit());
171         }
172 
173         /** {@inheritDoc} */
174         @Override
175         @SuppressWarnings("designforextension")
176         public MutableDoubleMatrix.Rel<U> toSparse()
177         {
178             return this.data.isSparse() ? this : new MutableDoubleMatrix.Rel<U>(this.data.toSparse(), getUnit());
179         }
180 
181         /** {@inheritDoc} */
182         @Override
183         protected final DoubleMatrix.Rel<U> instantiateType(final DoubleMatrixData dmd, final U unit)
184         {
185             return new DoubleMatrix.Rel<U>(dmd, unit);
186         }
187 
188         /** {@inheritDoc} */
189         @Override
190         protected final MutableDoubleMatrix.Rel<U> instantiateMutableType(final DoubleMatrixData dmd, final U unit)
191         {
192             return new MutableDoubleMatrix.Rel<U>(dmd, unit);
193         }
194 
195         /** {@inheritDoc} */
196         @Override
197         protected final DoubleScalar.Rel<U> instantiateScalar(final double value, final U unit)
198         {
199             return new DoubleScalar.Rel<U>(value, unit);
200         }
201     }
202 }