1 package org.djunits.value.vdouble.matrix; 2 3 import java.util.Collection; 4 5 import org.djunits.unit.MagneticFluxDensityUnit; 6 import org.djunits.value.storage.StorageType; 7 import org.djunits.value.vdouble.matrix.base.DoubleMatrixRel; 8 import org.djunits.value.vdouble.matrix.base.DoubleSparseValue; 9 import org.djunits.value.vdouble.matrix.data.DoubleMatrixData; 10 import org.djunits.value.vdouble.scalar.MagneticFluxDensity; 11 import org.djunits.value.vdouble.vector.MagneticFluxDensityVector; 12 import org.djunits.value.vdouble.vector.data.DoubleVectorData; 13 14 import jakarta.annotation.Generated; 15 16 /** 17 * Immutable Double MagneticFluxDensityMatrix, a matrix of values with a MagneticFluxDensityUnit. 18 * <p> 19 * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 20 * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>. 21 * </p> 22 * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a> 23 * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a> 24 */ 25 @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2023-07-23T14:06:38.224104100Z") 26 public class MagneticFluxDensityMatrix extends 27 DoubleMatrixRel<MagneticFluxDensityUnit, MagneticFluxDensity, MagneticFluxDensityVector, MagneticFluxDensityMatrix> 28 29 { 30 /** */ 31 private static final long serialVersionUID = 20151109L; 32 33 /** 34 * Construct a MagneticFluxDensityMatrix from an internal data object. 35 * @param data DoubleMatrixData; the internal data object for the matrix 36 * @param displayUnit MagneticFluxDensityUnit; the display unit of the matrix data 37 */ 38 public MagneticFluxDensityMatrix(final DoubleMatrixData data, final MagneticFluxDensityUnit displayUnit) 39 { 40 super(data, displayUnit); 41 } 42 43 /* CONSTRUCTORS WITH double[][] */ 44 45 /** 46 * Construct a MagneticFluxDensityMatrix from a double[][] object. The double values are expressed in the displayUnit, and 47 * will be printed using the displayUnit. 48 * @param data double[][]; the data for the matrix, expressed in the displayUnit 49 * @param displayUnit MagneticFluxDensityUnit; the unit of the values in the data array, and display unit when printing 50 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix 51 */ 52 public MagneticFluxDensityMatrix(final double[][] data, final MagneticFluxDensityUnit displayUnit, 53 final StorageType storageType) 54 { 55 this(DoubleMatrixData.instantiate(data, displayUnit.getScale(), storageType), displayUnit); 56 } 57 58 /** 59 * Construct a MagneticFluxDensityMatrix from a double[][] object. The double values are expressed in the displayUnit. 60 * Assume that the StorageType is DENSE since we offer the data as an array of an array. 61 * @param data double[][]; the data for the matrix 62 * @param displayUnit MagneticFluxDensityUnit; the unit of the values in the data array, and display unit when printing 63 */ 64 public MagneticFluxDensityMatrix(final double[][] data, final MagneticFluxDensityUnit displayUnit) 65 { 66 this(data, displayUnit, StorageType.DENSE); 67 } 68 69 /** 70 * Construct a MagneticFluxDensityMatrix from a double[][] object with SI-unit values. 71 * @param data double[][]; the data for the matrix, in SI units 72 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix 73 */ 74 public MagneticFluxDensityMatrix(final double[][] data, final StorageType storageType) 75 { 76 this(data, MagneticFluxDensityUnit.SI, storageType); 77 } 78 79 /** 80 * Construct a MagneticFluxDensityMatrix from a double[][] object with SI-unit values. Assume that the StorageType is DENSE 81 * since we offer the data as an array of an array. 82 * @param data double[][]; the data for the matrix, in SI units 83 */ 84 public MagneticFluxDensityMatrix(final double[][] data) 85 { 86 this(data, StorageType.DENSE); 87 } 88 89 /* CONSTRUCTORS WITH MagneticFluxDensity[][] */ 90 91 /** 92 * Construct a MagneticFluxDensityMatrix from an array of an array of MagneticFluxDensity objects. The MagneticFluxDensity 93 * values are each expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit 94 * when printing. 95 * @param data MagneticFluxDensity[][]; the data for the matrix 96 * @param displayUnit MagneticFluxDensityUnit; the display unit of the values when printing 97 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix 98 */ 99 public MagneticFluxDensityMatrix(final MagneticFluxDensity[][] data, final MagneticFluxDensityUnit displayUnit, 100 final StorageType storageType) 101 { 102 this(DoubleMatrixData.instantiate(data, storageType), displayUnit); 103 } 104 105 /** 106 * Construct a MagneticFluxDensityMatrix from an array of an array of MagneticFluxDensity objects. The MagneticFluxDensity 107 * values are each expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit 108 * when printing. Assume that the StorageType is DENSE since we offer the data as an array of an array. 109 * @param data MagneticFluxDensity[][]; the data for the matrix 110 * @param displayUnit MagneticFluxDensityUnit; the display unit of the values when printing 111 */ 112 public MagneticFluxDensityMatrix(final MagneticFluxDensity[][] data, final MagneticFluxDensityUnit displayUnit) 113 { 114 this(data, displayUnit, StorageType.DENSE); 115 } 116 117 /** 118 * Construct a MagneticFluxDensityMatrix from an array of an array of MagneticFluxDensity objects. The MagneticFluxDensity 119 * values are each expressed in their own unit, but will be internally stored as SI values, and expressed using SI units 120 * when printing. since we offer the data as an array of an array. 121 * @param data MagneticFluxDensity[][]; the data for the matrix 122 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix 123 */ 124 public MagneticFluxDensityMatrix(final MagneticFluxDensity[][] data, final StorageType storageType) 125 { 126 this(data, MagneticFluxDensityUnit.SI, storageType); 127 } 128 129 /** 130 * Construct a MagneticFluxDensityMatrix from an array of an array of MagneticFluxDensity objects. The MagneticFluxDensity 131 * values are each expressed in their own unit, but will be internally stored as SI values, and expressed using SI units 132 * when printing. Assume that the StorageType is DENSE since we offer the data as an array of an array. 133 * @param data MagneticFluxDensity[][]; the data for the matrix 134 */ 135 public MagneticFluxDensityMatrix(final MagneticFluxDensity[][] data) 136 { 137 this(data, StorageType.DENSE); 138 } 139 140 /* CONSTRUCTORS WITH Collection<DoubleSparseValue> */ 141 142 /** 143 * Construct a MagneticFluxDensityMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates 144 * the unit in which the values in the collection are expressed, as well as the unit in which they will be printed. 145 * @param data Collection<DoubleSparseValue>; the data for the matrix 146 * @param displayUnit MagneticFluxDensityUnit; the display unit of the matrix data, and the unit of the data points 147 * @param rows int; the number of rows of the matrix 148 * @param cols int; the number of columns of the matrix 149 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix 150 */ 151 public MagneticFluxDensityMatrix(final Collection<DoubleSparseValue<MagneticFluxDensityUnit, MagneticFluxDensity>> data, 152 final MagneticFluxDensityUnit displayUnit, final int rows, final int cols, final StorageType storageType) 153 { 154 this(DoubleMatrixData.instantiate(data, rows, cols, storageType), displayUnit); 155 } 156 157 /** 158 * Construct a MagneticFluxDensityMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates 159 * the unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Assume 160 * the storage type is SPARSE, since we offer the data as a collection. 161 * @param data Collection<DoubleSparseValue>; the data for the matrix 162 * @param displayUnit MagneticFluxDensityUnit; the display unit of the matrix data, and the unit of the data points 163 * @param rows int; the number of rows of the matrix 164 * @param cols int; the number of columns of the matrix 165 */ 166 public MagneticFluxDensityMatrix(final Collection<DoubleSparseValue<MagneticFluxDensityUnit, MagneticFluxDensity>> data, 167 final MagneticFluxDensityUnit displayUnit, final int rows, final int cols) 168 { 169 this(data, displayUnit, rows, cols, StorageType.SPARSE); 170 } 171 172 /** 173 * Construct a MagneticFluxDensityMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates 174 * the unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Use the 175 * SI unit or base unit as the displayUnit. 176 * @param data Collection<DoubleSparseValue>; the data for the matrix 177 * @param rows int; the number of rows of the matrix 178 * @param cols int; the number of columns of the matrix 179 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix 180 */ 181 public MagneticFluxDensityMatrix(final Collection<DoubleSparseValue<MagneticFluxDensityUnit, MagneticFluxDensity>> data, 182 final int rows, final int cols, final StorageType storageType) 183 { 184 this(data, MagneticFluxDensityUnit.SI, rows, cols, storageType); 185 } 186 187 /** 188 * Construct a MagneticFluxDensityMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates 189 * the unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Use the 190 * SI unit or base unit as the displayUnit. Assume the storage type is SPARSE, since we offer the data as a collection. 191 * @param data Collection<DoubleSparseValue>; the data for the matrix 192 * @param rows int; the number of rows of the matrix 193 * @param cols int; the number of columns of the matrix 194 */ 195 public MagneticFluxDensityMatrix(final Collection<DoubleSparseValue<MagneticFluxDensityUnit, MagneticFluxDensity>> data, 196 final int rows, final int cols) 197 { 198 this(data, MagneticFluxDensityUnit.SI, rows, cols, StorageType.SPARSE); 199 } 200 201 @Override 202 public Class<MagneticFluxDensity> getScalarClass() 203 { 204 return MagneticFluxDensity.class; 205 } 206 207 @Override 208 public Class<MagneticFluxDensityVector> getVectorClass() 209 { 210 return MagneticFluxDensityVector.class; 211 } 212 213 @Override 214 public MagneticFluxDensityMatrix instantiateMatrix(final DoubleMatrixData dmd, final MagneticFluxDensityUnit displayUnit) 215 { 216 return new MagneticFluxDensityMatrix(dmd, displayUnit); 217 } 218 219 @Override 220 public MagneticFluxDensityVector instantiateVector(final DoubleVectorData dvd, final MagneticFluxDensityUnit displayUnit) 221 { 222 return new MagneticFluxDensityVector(dvd, displayUnit); 223 } 224 225 @Override 226 public MagneticFluxDensity instantiateScalarSI(final double valueSI, final MagneticFluxDensityUnit displayUnit) 227 { 228 MagneticFluxDensity result = MagneticFluxDensity.instantiateSI(valueSI); 229 result.setDisplayUnit(displayUnit); 230 return result; 231 } 232 233 }