CPD Results

The following document contains the results of PMD's CPD 7.7.0.

Duplications

File Line
org/djunits/vecmat/dnxm/MatrixNxM.java 64
org/djunits/vecmat/table/QuantityTable.java 58
return new MatrixNxM<SIQuantity>(this.dataGridSi.instantiateNew(siNew), siUnit);
    }

    /**
     * Return the internal datagrid object, so we can retrieve data from it.
     * @return the internal datagrid object
     */
    public DataGridSi<?> getDataGrid()
    {
        return this.dataGridSi;
    }

    @Override
    public double[] getSiArray()
    {
        return this.dataGridSi.getSiArray();
    }

    @Override
    public double[] unsafeSiArray()
    {
        return this.dataGridSi.unsafeSiArray();
    }

    @Override
    public double si(final int row, final int col) throws IndexOutOfBoundsException
    {
        checkRow(row);
        checkCol(col);
        return this.dataGridSi.get(row, col);
    }

    @Override
    public VectorN.Row<Q> getRowVector(final int row)
    {
        return VectorN.Row.ofSi(getRowSi(row), getDisplayUnit());
    }

    @Override
    public VectorN.Row<Q> mgetRowVector(final int mRow)
    {
        return VectorN.Row.ofSi(mgetRowSi(mRow), getDisplayUnit());
    }

    @Override
    public VectorN.Col<Q> getColumnVector(final int col)
    {
        return VectorN.Col.ofSi(getColumnSi(col), getDisplayUnit());
    }

    @Override
    public VectorN.Col<Q> mgetColumnVector(final int mCol)
    {
        return VectorN.Col.ofSi(mgetColumnSi(mCol), getDisplayUnit());
    }

    @Override
    public double[] getRowSi(final int row)
    {
        checkRow(row);
        return this.dataGridSi.getRowArray(row);
    }

    @Override
    public double[] getColumnSi(final int col)
    {
        checkCol(col);
        return this.dataGridSi.getColArray(col);
    }

    @Override
    public int rows()
    {
        return this.dataGridSi.rows();
    }

    @Override
    public int cols()
    {
        return this.dataGridSi.cols();
    }

    @Override
    public int nonZeroCount()
    {
        return this.dataGridSi.nonZeroCount();
    }

    /**
     * Return the transposed matrix. A transposed matrix has the same unit as the original one.
     * @return the transposed matrix
     */
    @Override
    @SuppressWarnings("checkstyle:needbraces")
    public MatrixNxM<Q> transpose()
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 347
org/djunits/vecmat/storage/SparseFloatDataSi.java 434
}

    /**
     * Check whether the row and column are within bounds.
     * @param row the row number
     * @param col the column number
     * @throws IndexOutOfBoundsException when row &gt; rows() or col &gt; cols() or row &lt; 0 or col &lt; 0
     */
    private void checkRowCol(final int row, final int col) throws IndexOutOfBoundsException
    {
        Throw.when(row < 0 || row >= this.rows, IndexOutOfBoundsException.class, "row %d not in range 0..%d", row,
                this.rows - 1);
        Throw.when(col < 0 || col >= this.cols, IndexOutOfBoundsException.class, "column %d not in range 0..%d", col,
                this.cols - 1);
    }

    @Override
    public double get(final int row, final int col)
    {
        checkRowCol(row, col);
        int index = row * this.cols + col; // zero-based
        final int pos = Arrays.binarySearch(this.indexes, index);
        return (pos >= 0) ? this.sparseData[pos] : 0.0;
    }

    @SuppressWarnings("checkstyle:needbraces")
    @Override
    public double[] getSiArray()
    {
        double[] denseData = new double[rows() * cols()];
        for (int i = 0; i < this.sparseData.length; i++)
            denseData[this.indexes[i]] = this.sparseData[i];
        return denseData;
    }

    @Override
    public double[] unsafeSiArray()
    {
        return getSiArray();
    }

    @Override
    public SparseDoubleDataSi copy()
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 195
org/djunits/vecmat/storage/SparseFloatDataSi.java 234
this.sparseData[index] = value.si();
            this.indexes[index++] = value.getRow() * this.cols + value.getColumn();
        }
    }

    /**
     * Check the correctness of the indexes array.
     * @param indexArray the indexes with the data coordinates, where index = row * cols() + col (0-based)
     * @throws IllegalArgumentException when indexes is not in strictly increasing order
     * @throws IndexOutOfBoundsException when one of the entries in indexes is out of bounds
     */
    protected void checkIndexes(final int[] indexArray)
    {
        for (int i = 0; i < indexArray.length; i++)
        {
            if (indexArray[i] < 0 || indexArray[i] >= this.rows * this.cols)
            {
                throw new IndexOutOfBoundsException(
                        String.format("indexes[%d] out of bounds, %d rows x %d cols; value should be 0..%d", i, this.rows,
                                this.cols, this.rows * this.cols - 1));
            }
        }
        for (int i = 1; i < indexArray.length; i++)
        {
            if (indexArray[i] <= indexArray[i - 1])
            {
                throw new IllegalArgumentException(
                        "indexes[] must be strictly increasing, found " + indexArray[i - 1] + " then " + indexArray[i]);
            }
        }
    }

    /**
     * Store sparse data[] and indexes[].
     * @param denseData the dense data in row-major format
     */
    @SuppressWarnings("checkstyle:needbraces")
    public void storeSparse(final double[] denseData)
    {
        int nonzero = 0;
        for (int i = 0; i < denseData.length; i++)
            if (denseData[i] != 0.0)
                nonzero++;
        this.sparseData = new double[nonzero];
File Line
org/djunits/vecmat/storage/DenseFloatDataSi.java 239
org/djunits/vecmat/storage/DenseFloatDataSi.java 270
public static <Q extends Quantity<Q>> DenseFloatDataSi of(final double[][] gridInUnit, final Unit<?, Q> unit)
    {
        Throw.whenNull(gridInUnit, "gridInUnit");
        Throw.whenNull(unit, "unit");
        Throw.when(gridInUnit.length == 0, IllegalArgumentException.class, "Number of rows in the data matrix = 0");
        int rows = gridInUnit.length;
        Throw.whenNull(gridInUnit[0], "gridInUnit[0] = null");
        int cols = gridInUnit[0].length;
        float[] dataSi = new float[rows * cols];
        for (int r = 0; r < rows; r++)
        {
            Throw.whenNull(gridInUnit[r], "gridInUnit[%d] = null", r);
            Throw.when(gridInUnit[r].length != cols, IllegalArgumentException.class,
                    "Number of columns in row %d (%d) is not equal to number of columns in row 0 (%d)", r, gridInUnit[r].length,
                    cols);
            for (int c = 0; c < cols; c++)
            {
                dataSi[r * cols + c] = (float) unit.toBaseValue(gridInUnit[r][c]);
            }
        }
        return new DenseFloatDataSi(dataSi, rows, cols);
    }

    /**
     * Instantiate a data object with a float[rows][cols]. A safe copy of the data is stored.
     * @param gridInUnit the data as a double[][] array in row-major format, expressed in the given unit
     * @param unit the unit of the data
     * @return a dense float data object with SI values for vectors, matrices and tables
     * @throws IllegalArgumentException when the size of the data object is not equal to rows*cols
     * @param <Q> the quantity type
     */
    public static <Q extends Quantity<Q>> DenseFloatDataSi of(final float[][] gridInUnit, final Unit<?, Q> unit)
File Line
org/djunits/quantity/Energy.java 138
org/djunits/quantity/Torque.java 138
public final Dimensionless divide(final Energy v)
    {
        return new Dimensionless(this.si() / v.si(), Unitless.BASE);
    }

    /**
     * Calculate the division of Energy and Force, which results in a Length scalar.
     * @param v scalar
     * @return scalar as a division of Energy and Force
     */
    public final Length divide(final Force v)
    {
        return new Length(this.si() / v.si(), Length.Unit.SI);
    }

    /**
     * Calculate the division of Energy and Length, which results in a Force scalar.
     * @param v scalar
     * @return scalar as a division of Energy and Length
     */
    public final Force divide(final Length v)
    {
        return new Force(this.si() / v.si(), Force.Unit.SI);
    }

    /**
     * Calculate the multiplication of Energy and LinearDensity, which results in a Force scalar.
     * @param v scalar
     * @return scalar as a multiplication of Energy and LinearDensity
     */
    public final Force multiply(final LinearObjectDensity v)
    {
        return new Force(this.si() * v.si(), Force.Unit.SI);
    }

    /**
     * Calculate the division of Energy and Duration, which results in a Power scalar.
     * @param v scalar
     * @return scalar as a division of Energy and Duration
     */
    public final Power divide(final Duration v)
    {
        return new Power(this.si() / v.si(), Power.Unit.SI);
    }

    /**
     * Calculate the division of Energy and Power, which results in a Duration scalar.
     * @param v scalar
     * @return scalar as a division of Energy and Power
     */
    public final Duration divide(final Power v)
    {
        return new Duration(this.si() / v.si(), Duration.Unit.SI);
    }

    /**
     * Calculate the division of Energy and Volume, which results in a Pressure scalar.
     * @param v scalar
     * @return scalar as a division of Energy and Volume
     */
    public final Pressure divide(final Volume v)
File Line
org/djunits/quantity/def/AbsQuantity.java 105
org/djunits/quantity/def/Quantity.java 92
}

    /**
     * Return the "pretty" and localized name of the quantity.
     * @return the "pretty" and localized name of the quantity
     */
    public String getName()
    {
        String name = Units.localizedQuantityName(Locale.getDefault(), getClass().getSimpleName());
        final StringBuilder sb = new StringBuilder(name.length() + 8);
        sb.append(name.charAt(0)); // keep first character exactly as-is
        for (int i = 1; i < name.length(); i++)
        {
            final char c = name.charAt(i);
            if (Character.isUpperCase(c))
            {
                if (sb.length() > 0 && sb.charAt(sb.length() - 1) != ' ')
                {
                    sb.append(' ');
                }
                sb.append(Character.toLowerCase(c));
            }
            else
            {
                sb.append(c);
            }
        }
        return sb.toString();
    }

    /**********************************************************************************/
    /******************************** SI-RELATED METHODS ******************************/
    /**********************************************************************************/

    /**
     * Return the SI unit of this quantity.
     * @return the SI unit of this quantity
     */
    public SIUnit siUnit()
    {
        return getDisplayUnit().siUnit();
    }

    /**
     * Return the SI value of the quantity.
     * @return the SI value of the quantity
     */
    public double si()
    {
        return this.quantity.si();
File Line
org/djunits/vecmat/dn/AbsMatrixNxN.java 41
org/djunits/vecmat/dnxm/AbsMatrixNxM.java 42
return new AbsMatrixNxN<>(relativeMatrix, reference);
    }

    @Override
    public AbsVectorN.Row<A, Q> getRowVector(final int row)
    {
        return new AbsVectorN.Row<>(getRelativeVecMat().getRowVector(row), getReference());
    }

    @Override
    public AbsVectorN.Row<A, Q> mgetRowVector(final int mRow)
    {
        return new AbsVectorN.Row<>(getRelativeVecMat().mgetRowVector(mRow), getReference());
    }

    @Override
    public AbsVectorN.Col<A, Q> getColumnVector(final int col)
    {
        return new AbsVectorN.Col<>(getRelativeVecMat().getColumnVector(col), getReference());
    }

    @Override
    public AbsVectorN.Col<A, Q> mgetColumnVector(final int mCol)
    {
        return new AbsVectorN.Col<>(getRelativeVecMat().mgetColumnVector(mCol), getReference());
    }

    @Override
    public AbsVectorN.Col<A, Q> getDiagonalVector()
File Line
org/djunits/vecmat/dn/AbsMatrixNxN.java 41
org/djunits/vecmat/table/AbsQuantityTable.java 44
return new AbsMatrixNxN<>(relativeMatrix, reference);
    }

    @Override
    public AbsVectorN.Row<A, Q> getRowVector(final int row)
    {
        return new AbsVectorN.Row<>(getRelativeVecMat().getRowVector(row), getReference());
    }

    @Override
    public AbsVectorN.Row<A, Q> mgetRowVector(final int mRow)
    {
        return new AbsVectorN.Row<>(getRelativeVecMat().mgetRowVector(mRow), getReference());
    }

    @Override
    public AbsVectorN.Col<A, Q> getColumnVector(final int col)
    {
        return new AbsVectorN.Col<>(getRelativeVecMat().getColumnVector(col), getReference());
    }

    @Override
    public AbsVectorN.Col<A, Q> mgetColumnVector(final int mCol)
    {
        return new AbsVectorN.Col<>(getRelativeVecMat().mgetColumnVector(mCol), getReference());
    }

    @Override
    public AbsVectorN.Col<A, Q> getDiagonalVector()
File Line
org/djunits/vecmat/dnxm/AbsMatrixNxM.java 42
org/djunits/vecmat/table/AbsQuantityTable.java 44
return new AbsMatrixNxM<>(relativeMatrix, reference);
    }

    @Override
    public AbsVectorN.Row<A, Q> getRowVector(final int row)
    {
        return new AbsVectorN.Row<>(getRelativeVecMat().getRowVector(row), getReference());
    }

    @Override
    public AbsVectorN.Row<A, Q> mgetRowVector(final int mRow)
    {
        return new AbsVectorN.Row<>(getRelativeVecMat().mgetRowVector(mRow), getReference());
    }

    @Override
    public AbsVectorN.Col<A, Q> getColumnVector(final int col)
    {
        return new AbsVectorN.Col<>(getRelativeVecMat().getColumnVector(col), getReference());
    }

    @Override
    public AbsVectorN.Col<A, Q> mgetColumnVector(final int mCol)
    {
        return new AbsVectorN.Col<>(getRelativeVecMat().mgetColumnVector(mCol), getReference());
    }

    @Override
    public AbsMatrixNxM<A, Q> transpose()
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 417
org/djunits/vecmat/storage/SparseFloatDataSi.java 504
return new SparseDoubleDataSi(denseData, newRows, newCols);
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + Arrays.hashCode(unsafeSiArray());
        result = prime * result + Objects.hash(this.cols, this.rows);
        return result;
    }

    @SuppressWarnings("checkstyle:needbraces")
    @Override
    public boolean equals(final Object obj)
    {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
        {
            if (obj instanceof DataGridSi dg)
                return this.cols == dg.cols() && this.rows == dg.rows() && Arrays.equals(unsafeSiArray(), dg.unsafeSiArray());
            return false;
        }
File Line
org/djunits/vecmat/def/AbsVectorMatrix.java 152
org/djunits/vecmat/def/Table.java 278
}

    /**
     * Check if the 0-based row is within bounds.
     * @param row the 0-based row to check
     * @throws IndexOutOfBoundsException when row is out of bounds
     */
    protected void checkRow(final int row)
    {
        Throw.when(row < 0 || row >= rows(), IndexOutOfBoundsException.class, "Row %d out of bounds [0..%d]", row, rows() - 1);
    }

    /**
     * Check if the 0-based column is within bounds.
     * @param col the 0-based column to check
     * @throws IndexOutOfBoundsException when column is out of bounds
     */
    protected void checkCol(final int col)
    {
        Throw.when(col < 0 || col >= cols(), IndexOutOfBoundsException.class, "Column %d out of bounds [0..%d]", col,
                cols() - 1);
    }

    /**
     * Check if the 1-based row is within bounds.
     * @param mRow the 1-based row to check
     * @throws IndexOutOfBoundsException when row is out of bounds
     */
    protected void mcheckRow(final int mRow)
    {
        Throw.when(mRow < 1 || mRow > rows(), IndexOutOfBoundsException.class, "Row %d out of bounds [1..%d]", mRow, rows());
    }

    /**
     * Check if the 1-based column is within bounds.
     * @param mCol the 1-based column to check
     * @throws IndexOutOfBoundsException when column is out of bounds
     */
    protected void mcheckCol(final int mCol)
    {
        Throw.when(mCol < 1 || mCol > cols(), IndexOutOfBoundsException.class, "Column %d out of bounds [1..%d]", mCol, cols());
    }
File Line
org/djunits/vecmat/storage/DenseFloatDataSi.java 420
org/djunits/vecmat/storage/SparseDoubleDataSi.java 417
org/djunits/vecmat/storage/SparseFloatDataSi.java 504
return new DenseFloatDataSi(floatData, newRows, newCols);
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + Arrays.hashCode(unsafeSiArray());
        result = prime * result + Objects.hash(this.cols, this.rows);
        return result;
    }

    @SuppressWarnings("checkstyle:needbraces")
    @Override
    public boolean equals(final Object obj)
    {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
        {
            if (obj instanceof DataGridSi dg)
                return this.cols == dg.cols() && this.rows == dg.rows() && Arrays.equals(unsafeSiArray(), dg.unsafeSiArray());
            return false;
        }
File Line
org/djunits/vecmat/storage/DenseFloatDataSi.java 181
org/djunits/vecmat/storage/DenseFloatDataSi.java 209
public static DenseFloatDataSi ofSi(final double[][] gridSi)
    {
        Throw.whenNull(gridSi, "gridSi");
        Throw.when(gridSi.length == 0, IllegalArgumentException.class, "Number of rows in the data matrix = 0");
        int rows = gridSi.length;
        Throw.whenNull(gridSi[0], "gridSi[0] = null");
        int cols = gridSi[0].length;
        float[] dataSi = new float[rows * cols];
        for (int r = 0; r < rows; r++)
        {
            Throw.whenNull(gridSi[r], "gridSi[%d] = null", r);
            Throw.when(gridSi[r].length != cols, IllegalArgumentException.class,
                    "Number of columns in row %d (%d) is not equal to number of columns in row 0 (%d)", r, gridSi[r].length,
                    cols);
            for (int c = 0; c < cols; c++)
            {
                dataSi[r * cols + c] = (float) gridSi[r][c];
File Line
org/djunits/vecmat/def/Matrix.java 51
org/djunits/vecmat/dnxm/MatrixNxM.java 249
public MatrixNxM<SIQuantity> multiply(final MatrixNxM<?> matrix)
    {
        checkMultiply(matrix);
        double[] result = MatrixMath.multiply(unsafeSiArray(), matrix.unsafeSiArray(), rows(), cols(), matrix.cols());
        SIUnit siUnit = getDisplayUnit().siUnit().plus(matrix.getDisplayUnit().siUnit());
        if (matrix.getDataGrid().isDouble())
        {
            return new MatrixNxM<SIQuantity>(new DenseDoubleDataSi(result, rows(), matrix.cols()), siUnit);
        }
        return new MatrixNxM<SIQuantity>(new DenseFloatDataSi(result, rows(), matrix.cols()), siUnit);
    }
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 86
org/djunits/vecmat/storage/SparseDoubleDataSi.java 156
public SparseDoubleDataSi(final double[][] denseData)
    {
        Throw.whenNull(denseData, "denseData");
        Throw.when(denseData.length == 0, IllegalArgumentException.class, "Number of rows in the data matrix = 0");
        this.rows = denseData.length;
        this.cols = denseData[0].length;
        for (int r = 1; r < this.rows; r++)
            Throw.when(denseData[r].length != this.cols, IllegalArgumentException.class,
                    "Number of columns in row %d (%d) is not equal to number of columns in row 0 (%d)", r, denseData[r].length,
                    this.cols);
        storeSparse(denseData);
    }

    /**
     * Instantiate a data object with one array in row-major format. Note that a safe copy of the data is stored.
     * @param sparseData the sparse data in row-major format
     * @param indexes the indexes with the data coordinates, where index = row * cols() + col (0-based)
     * @param rows the number of rows
     * @param cols the number of columns
     * @throws IllegalArgumentException when the size of the data object is not equal to rows*cols, or when the number of rows
     *             or columns is not positive, or when indexes is not in strictly increasing order
     * @throws IndexOutOfBoundsException when one of the entries in indexes is out of bounds
     * @param <Q> the quantity type
     */
    @SuppressWarnings("checkstyle:needbraces")
    public <Q extends Quantity<Q>> SparseDoubleDataSi(final Q[] sparseData, final int[] indexes, final int rows, final int cols)
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 156
org/djunits/vecmat/storage/SparseFloatDataSi.java 195
public <Q extends Quantity<Q>> SparseDoubleDataSi(final Q[][] denseData)
    {
        Throw.whenNull(denseData, "denseData");
        Throw.when(denseData.length == 0, IllegalArgumentException.class, "Number of rows in the data matrix = 0");
        this.rows = denseData.length;
        this.cols = denseData[0].length;
        for (int r = 1; r < this.rows; r++)
            Throw.when(denseData[r].length != this.cols, IllegalArgumentException.class,
                    "Number of columns in row %d (%d) is not equal to number of columns in row 0 (%d)", r, denseData[r].length,
                    this.cols);
        storeSparse(denseData);
    }

    /**
     * Instantiate a data object with an indexed collection of values. Note that a safe copy of the data is stored.
     * @param indexedData the sparse data in an indexed format
     * @param rows the number of rows
     * @param cols the number of columns
     * @throws IndexOutOfBoundsException when a row or column index of an element is out of bounds
     * @param <Q> the quantity type
     */
    @SuppressWarnings("checkstyle:needbraces")
    public <Q extends Quantity<Q>> SparseDoubleDataSi(final Collection<DoubleSparseValue<Q>> indexedData, final int rows,
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 45
org/djunits/vecmat/storage/SparseFloatDataSi.java 45
protected SparseDoubleDataSi(final double[] sparseData, final int[] indexes, final int rows, final int cols)
    {
        Throw.whenNull(sparseData, "sparseData");
        Throw.whenNull(indexes, "indexes");
        Throw.when(rows <= 0, IllegalArgumentException.class, "Number of rows <= 0");
        Throw.when(cols <= 0, IllegalArgumentException.class, "Number of columns <= 0");
        Throw.when(sparseData.length != indexes.length, IllegalArgumentException.class,
                "sparseData array (%d) has different length from indexes array (%d)", sparseData.length, indexes.length);
        this.rows = rows;
        this.cols = cols;
        checkIndexes(indexes);
        this.sparseData = sparseData;
        this.indexes = indexes;
    }

    /**
     * Instantiate a data object with one array in row-major format. Note that NO safe copy of the data is stored.
     * @param denseData the dense data in row-major format
     * @param rows the number of rows
     * @param cols the number of columns
     * @throws IllegalArgumentException when the size of the data object is not equal to rows*cols, or when the number of rows
     *             or columns is not positive
     */
    public SparseDoubleDataSi(final double[] denseData, final int rows, final int cols)
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 86
org/djunits/vecmat/storage/SparseFloatDataSi.java 125
org/djunits/vecmat/storage/SparseFloatDataSi.java 195
public SparseDoubleDataSi(final double[][] denseData)
    {
        Throw.whenNull(denseData, "denseData");
        Throw.when(denseData.length == 0, IllegalArgumentException.class, "Number of rows in the data matrix = 0");
        this.rows = denseData.length;
        this.cols = denseData[0].length;
        for (int r = 1; r < this.rows; r++)
            Throw.when(denseData[r].length != this.cols, IllegalArgumentException.class,
                    "Number of columns in row %d (%d) is not equal to number of columns in row 0 (%d)", r, denseData[r].length,
                    this.cols);
        storeSparse(denseData);
    }

    /**
     * Instantiate a data object with one array in row-major format. Note that a safe copy of the data is stored.
     * @param sparseData the sparse data in row-major format
     * @param indexes the indexes with the data coordinates, where index = row * cols() + col (0-based)
     * @param rows the number of rows
     * @param cols the number of columns
     * @throws IllegalArgumentException when the size of the data object is not equal to rows*cols, or when the number of rows
     *             or columns is not positive, or when indexes is not in strictly increasing order
     * @throws IndexOutOfBoundsException when one of the entries in indexes is out of bounds
     * @param <Q> the quantity type
     */
    @SuppressWarnings("checkstyle:needbraces")
    public <Q extends Quantity<Q>> SparseDoubleDataSi(final Q[] sparseData, final int[] indexes, final int rows, final int cols)
File Line
org/djunits/vecmat/def/AbsTable.java 98
org/djunits/vecmat/def/Table.java 118
final A[][] out = (A[][]) Array.newInstance(qClass, rows(), cols());
        for (int i = 0; i < rows(); i++)
        {
            for (int j = 0; j < cols(); j++)
            {
                out[i][j] = get(i, j);
            }
        }
        return out;
    }

    /**
     * Return the vector or matrix as a 2D array of double SI values.
     * @return a new double[rows()][cols()] array; entry [i][j] contains si(i, j).
     */
    public double[][] getSiGrid()
    {
        // Allocate a double[rows()][cols()] array and fill it.
        final double[][] out = (double[][]) Array.newInstance(double.class, rows(), cols());
        for (int r = 0; r < rows(); r++)
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 111
org/djunits/vecmat/storage/SparseFloatDataSi.java 150
public <Q extends Quantity<Q>> SparseDoubleDataSi(final Q[] sparseData, final int[] indexes, final int rows, final int cols)
    {
        Throw.whenNull(sparseData, "sparseData");
        Throw.whenNull(indexes, "indexes");
        Throw.when(rows <= 0, IllegalArgumentException.class, "Number of rows <= 0");
        Throw.when(cols <= 0, IllegalArgumentException.class, "Number of columns <= 0");
        Throw.when(sparseData.length != indexes.length, IllegalArgumentException.class,
                "sparseData array (%d) has different length from indexes array (%d)", sparseData.length, indexes.length);
        this.rows = rows;
        this.cols = cols;
        checkIndexes(indexes);
        this.sparseData = new double[sparseData.length];
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 86
org/djunits/vecmat/storage/SparseFloatDataSi.java 106
public SparseDoubleDataSi(final double[][] denseData)
    {
        Throw.whenNull(denseData, "denseData");
        Throw.when(denseData.length == 0, IllegalArgumentException.class, "Number of rows in the data matrix = 0");
        this.rows = denseData.length;
        this.cols = denseData[0].length;
        for (int r = 1; r < this.rows; r++)
            Throw.when(denseData[r].length != this.cols, IllegalArgumentException.class,
                    "Number of columns in row %d (%d) is not equal to number of columns in row 0 (%d)", r, denseData[r].length,
                    this.cols);
        storeSparse(denseData);
    }

    /**
     * Instantiate a data object with one array in row-major format. Note that a safe copy of the data is stored.
     * @param sparseData the sparse data in row-major format
     * @param indexes the indexes with the data coordinates, where index = row * cols() + col (0-based)
     * @param rows the number of rows
     * @param cols the number of columns
     * @throws IllegalArgumentException when the size of the data object is not equal to rows*cols, or when the number of rows
     *             or columns is not positive, or when indexes is not in strictly increasing order
     * @throws IndexOutOfBoundsException when one of the entries in indexes is out of bounds
     * @param <Q> the quantity type
     */
    @SuppressWarnings("checkstyle:needbraces")
    public <Q extends Quantity<Q>> SparseDoubleDataSi(final Q[] sparseData, final int[] indexes, final int rows, final int cols)
File Line
org/djunits/vecmat/storage/DenseFloatDataSi.java 116
org/djunits/vecmat/storage/DenseFloatDataSi.java 140
public static <Q extends Quantity<Q>> DenseFloatDataSi of(final float[] dataInUnit, final int rows, final int cols,
            final Unit<?, Q> unit)
    {
        Throw.whenNull(dataInUnit, "dataInUnit");
        Throw.whenNull(unit, "unit");
        float[] dataSi = new float[dataInUnit.length];
        for (int i = 0; i < dataInUnit.length; i++)
        {
            dataSi[i] = (float) unit.toBaseValue(dataInUnit[i]);
        }
        return new DenseFloatDataSi(dataSi, rows, cols);
    }

    /**
     * Instantiate a data object with one array in row-major format. A safe copy of the data is stored.
     * @param dataInUnit the data expressed in the given unit in row-major format
     * @param rows the number of rows
     * @param cols the number of columns
     * @param unit the unit of the data
     * @return a dense float data object with SI values for vectors, matrices and tables
     * @throws IllegalArgumentException when the size of the data object is not equal to rows*cols, or when the number of rows
     *             or columns is not positive
     * @param <Q> the quantity type
     */
    public static <Q extends Quantity<Q>> DenseFloatDataSi of(final double[] dataInUnit, final int rows, final int cols,
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 45
org/djunits/vecmat/storage/SparseDoubleDataSi.java 111
org/djunits/vecmat/storage/SparseFloatDataSi.java 45
org/djunits/vecmat/storage/SparseFloatDataSi.java 150
protected SparseDoubleDataSi(final double[] sparseData, final int[] indexes, final int rows, final int cols)
    {
        Throw.whenNull(sparseData, "sparseData");
        Throw.whenNull(indexes, "indexes");
        Throw.when(rows <= 0, IllegalArgumentException.class, "Number of rows <= 0");
        Throw.when(cols <= 0, IllegalArgumentException.class, "Number of columns <= 0");
        Throw.when(sparseData.length != indexes.length, IllegalArgumentException.class,
                "sparseData array (%d) has different length from indexes array (%d)", sparseData.length, indexes.length);
        this.rows = rows;
        this.cols = cols;
        checkIndexes(indexes);
        this.sparseData = sparseData;
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 137
org/djunits/vecmat/storage/SparseFloatDataSi.java 176
public <Q extends Quantity<Q>> SparseDoubleDataSi(final Q[] denseData, final int rows, final int cols)
    {
        Throw.whenNull(denseData, "denseData");
        Throw.when(rows <= 0, IllegalArgumentException.class, "Number of rows <= 0");
        Throw.when(cols <= 0, IllegalArgumentException.class, "Number of columns <= 0");
        Throw.when(denseData.length != rows * cols, IllegalArgumentException.class,
                "denseData.length (%d) != rows x cols (%d x %d)", denseData.length, rows, cols);
        this.rows = rows;
        this.cols = cols;
        storeSparse(denseData);
    }

    /**
     * Instantiate a data object with a dense double[rows][cols]. A sparse, safe copy of the data is stored.
     * @param denseData the data in row-major format as a double[][]
     * @throws IllegalArgumentException when the data matrix is ragged
     * @param <Q> the quantity type
     */
    @SuppressWarnings("checkstyle:needbraces")
    public <Q extends Quantity<Q>> SparseDoubleDataSi(final Q[][] denseData)
File Line
org/djunits/vecmat/storage/SparseDoubleDataSi.java 156
org/djunits/vecmat/storage/SparseFloatDataSi.java 106
public <Q extends Quantity<Q>> SparseDoubleDataSi(final Q[][] denseData)
    {
        Throw.whenNull(denseData, "denseData");
        Throw.when(denseData.length == 0, IllegalArgumentException.class, "Number of rows in the data matrix = 0");
        this.rows = denseData.length;
        this.cols = denseData[0].length;
        for (int r = 1; r < this.rows; r++)
            Throw.when(denseData[r].length != this.cols, IllegalArgumentException.class,
                    "Number of columns in row %d (%d) is not equal to number of columns in row 0 (%d)", r, denseData[r].length,
                    this.cols);
        storeSparse(denseData);
    }

    /**
     * Instantiate a data object with an indexed collection of values. Note that a safe copy of the data is stored.
     * @param indexedData the sparse data in an indexed format
     * @param rows the number of rows
     * @param cols the number of columns
     * @throws IndexOutOfBoundsException when a row or column index of an element is out of bounds
     * @param <Q> the quantity type
     */
    @SuppressWarnings("checkstyle:needbraces")
    public <Q extends Quantity<Q>> SparseDoubleDataSi(final Collection<DoubleSparseValue<Q>> indexedData, final int rows,
File Line
org/djunits/vecmat/storage/SparseFloatDataSi.java 106
org/djunits/vecmat/storage/SparseFloatDataSi.java 125
org/djunits/vecmat/storage/SparseFloatDataSi.java 195
public SparseFloatDataSi(final double[][] denseData)
    {
        Throw.whenNull(denseData, "denseData");
        Throw.when(denseData.length == 0, IllegalArgumentException.class, "Number of rows in the data matrix = 0");
        this.rows = denseData.length;
        this.cols = denseData[0].length;
        for (int r = 1; r < this.rows; r++)
            Throw.when(denseData[r].length != this.cols, IllegalArgumentException.class,
                    "Number of columns in row %d (%d) is not equal to number of columns in row 0 (%d)", r, denseData[r].length,
                    this.cols);
        storeSparse(denseData);
    }

    /**
     * Instantiate a data object with a dense double[rows][cols]. A sparse, safe copy of the data is stored.
     * @param denseData the data in row-major format as a float[][]
     * @throws IllegalArgumentException when the matrix is ragged
     */
    @SuppressWarnings("checkstyle:needbraces")
    public SparseFloatDataSi(final float[][] denseData)
File Line
org/djunits/quantity/Angle.java 269
org/djunits/quantity/AngularAcceleration.java 220
org/djunits/quantity/AngularVelocity.java 190
grad.deriveUnit("cds", "c\"", "centesimal arcsecond", 1.0 / 10000.0, UnitSystem.OTHER);

        /**
         * Create a new Angle unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        /** {@inheritDoc} */
        @Override
        public Angle ofSi(final double si)
File Line
org/djunits/vecmat/dn/VectorN.java 347
org/djunits/vecmat/dn/VectorN.java 548
public static <Q extends Quantity<Q>> VectorN.Col<Q> of(final List<Q> data)
        {
            Throw.when(data.size() < 1, IllegalArgumentException.class, "data.size < 1");
            double[] dataSi = new double[data.size()];
            for (int i = 0; i < data.size(); i++)
            {
                dataSi[i] = data.get(i).si();
            }
            return ofSi(dataSi, data.get(0).getDisplayUnit());
        }

        // ------------------------------------------ AS METHODS ------------------------------------------

        /**
         * Return the vector 'as' a vector with a known quantity, using a unit to express the result in. Throw a Runtime
         * exception when the SI units of this vector and the target vector do not match. The dataSi object containing the
         * vector values is NOT copied.
         * @param targetUnit the unit to convert the vector to
         * @return a quantity typed in the target vector class
         * @throws IllegalArgumentException when the units do not match
         * @param <TQ> target quantity type
         */
        public <TQ extends Quantity<TQ>> VectorN.Col<TQ> as(final Unit<?, TQ> targetUnit) throws IllegalArgumentException
File Line
org/djunits/vecmat/dnxm/MatrixNxM.java 285
org/djunits/vecmat/dnxm/MatrixNxM.java 301
public VectorN.Col<SIQuantity> multiply(final Vector2.Col<?> vector)
    {
        checkMultiply(vector);
        double[] result = MatrixMath.multiply(unsafeSiArray(), vector.unsafeSiArray(), rows(), cols(), vector.cols());
        SIUnit siUnit = getDisplayUnit().siUnit().plus(vector.getDisplayUnit().siUnit());
        return new VectorN.Col<SIQuantity>(new DenseDoubleDataSi(result, rows(), vector.cols()), siUnit);
    }

    /**
     * Multiply this vector or matrix with a Vector3.Col, resulting in a Vector3.Col. The multiplication is a (Mx3) x (3x1)
     * matrix multiplication resulting in an (Mx1) column vector.
     * @param vector the vector to multiply with
     * @return a VectorN.Col of an SIQuantity as the result of the matrix multiplication
     * @throws IllegalArgumentException when the number of columns of this matrix does not equal the number of rows of the
     *             vector to multiply with
     */
    public VectorN.Col<SIQuantity> multiply(final Vector3.Col<?> vector)
File Line
org/djunits/vecmat/def/AbsVector.java 211
org/djunits/vecmat/def/Vector.java 145
return VectorFormatter.format((AbsVector<?, ?, ?, ?, ?>) this, format);
        }

        /**
         * String representation of this vector, expressed in the specified unit.
         * @param targetUnit the unit into which the values of the vector are converted for display
         * @return printable string with the vector's values expressed in the specified unit
         */
        @Override
        default String format(final Unit<?, Q> targetUnit)
        {
            return format(VectorFormat.Col.defaults().setDisplayUnit(targetUnit));
        }
    }

    /**
     * Formatting methods for absolute row vector.
     * @param <V> the vector type
     * @param <Q> the quantity type
     */
    public interface Row<V extends Value<V, Q>, Q extends Quantity<Q>> extends Value<V, Q>
    {
        /**
         * Concise description of this vector.
         * @return a String with the vector, with the unit attached.
         */
        @Override
        default String format()
        {
            return format(VectorFormat.Row.defaults());
        }

        /**
         * String representation of this vector after applying the format.
         * @param format the format to apply for the vector
         * @return a String representation of this vector, formatted according to the given format
         */
        default String format(final VectorFormat.Row format)
File Line
org/djunits/quantity/Acceleration.java 254
org/djunits/quantity/EquivalentDose.java 174
public static final Acceleration.Unit Gal = new Acceleration.Unit("Gal", "gal", 0.01, UnitSystem.CGS);

        /**
         * Create a new Acceleration unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        @Override
        public Acceleration ofSi(final double si)
File Line
org/djunits/quantity/ElectricalInductance.java 166
org/djunits/quantity/LuminousIntensity.java 175
public static final ElectricalInductance.Unit SI = H.generateSiPrefixes(false, false);

        /**
         * Create a new ElectricalInductance unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        @Override
        public ElectricalInductance ofSi(final double si)
File Line
org/djunits/quantity/Energy.java 354
org/djunits/quantity/Power.java 297
public static final Energy.Unit erg = J.deriveUnit("erg", "erg", 1.0E-7, UnitSystem.CGS);

        /**
         * Create a new Energy unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        @Override
        public Energy ofSi(final double si)
File Line
org/djunits/quantity/Force.java 267
org/djunits/quantity/Pressure.java 242
public static final Force.Unit sn = SI.deriveUnit("sn", "sthene", 1000.0, UnitSystem.MTS);

        /**
         * Create a new Force unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        @Override
        public Force ofSi(final double si)
File Line
org/djunits/quantity/Length.java 372
org/djunits/quantity/Volume.java 336
new Length.Unit("A", "\u00C5", "angstrom", new LinearScale(1.0E-10), UnitSystem.OTHER);

        /**
         * Create a new length unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        @Override
        public Length ofSi(final double si)
File Line
org/djunits/quantity/AbsorbedDose.java 180
org/djunits/quantity/Acceleration.java 254
org/djunits/quantity/Energy.java 354
org/djunits/quantity/EquivalentDose.java 174
org/djunits/quantity/MagneticFlux.java 237
org/djunits/quantity/MagneticFluxDensity.java 187
org/djunits/quantity/Power.java 297
public static final AbsorbedDose.Unit rad = new AbsorbedDose.Unit("rad", "rad", 1.0E-2, UnitSystem.CGS);

        /**
         * Create a new AbsorbedDose unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        @Override
        public AbsorbedDose ofSi(final double si)
File Line
org/djunits/quantity/Angle.java 269
org/djunits/quantity/Duration.java 319
org/djunits/quantity/Frequency.java 246
org/djunits/quantity/Illuminance.java 190
org/djunits/quantity/Length.java 372
org/djunits/quantity/Mass.java 295
org/djunits/quantity/RadioActivity.java 192
org/djunits/quantity/Speed.java 338
org/djunits/quantity/Volume.java 336
grad.deriveUnit("cds", "c\"", "centesimal arcsecond", 1.0 / 10000.0, UnitSystem.OTHER);

        /**
         * Create a new Angle unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        /** {@inheritDoc} */
        @Override
        public Angle ofSi(final double si)
File Line
org/djunits/quantity/AngularAcceleration.java 220
org/djunits/quantity/Duration.java 319
org/djunits/quantity/Frequency.java 246
org/djunits/quantity/Illuminance.java 190
org/djunits/quantity/Length.java 372
org/djunits/quantity/Mass.java 295
org/djunits/quantity/RadioActivity.java 192
org/djunits/quantity/Speed.java 338
org/djunits/quantity/Volume.java 336
"centesimal arcsecond per second squared", 1.0 / 10000.0, UnitSystem.OTHER);

        /**
         * Create a new AngularAcceleration unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        /** {@inheritDoc} */
        @Override
        public AngularAcceleration ofSi(final double si)
File Line
org/djunits/quantity/AngularVelocity.java 190
org/djunits/quantity/Duration.java 319
org/djunits/quantity/Frequency.java 246
org/djunits/quantity/Illuminance.java 190
org/djunits/quantity/Length.java 372
org/djunits/quantity/Mass.java 295
org/djunits/quantity/RadioActivity.java 192
org/djunits/quantity/Speed.java 338
org/djunits/quantity/Volume.java 336
grad_s.deriveUnit("cds/s", "c\"/s", "centesimal arcsecond per second", 1.0 / 10000.0, UnitSystem.OTHER);

        /**
         * Create a new AngularVelocity unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        /** {@inheritDoc} */
        @Override
        public AngularVelocity ofSi(final double si)
File Line
org/djunits/quantity/Area.java 328
org/djunits/quantity/FlowMass.java 239
org/djunits/quantity/LinearObjectDensity.java 246
org/djunits/quantity/Torque.java 257
new Area.Unit("ac", "acre", Length.Unit.CONST_MI * Length.Unit.CONST_MI / 640.0, UnitSystem.IMPERIAL);

        /**
         * Create a new Area unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        @Override
        public Area ofSi(final double si)
File Line
org/djunits/quantity/Density.java 190
org/djunits/quantity/SolidAngle.java 179
kg_m3.deriveUnit("g/cm3", "gram per cubic centimeter", 1.0E3, UnitSystem.SI_DERIVED);

        /**
         * Create a new Density unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        @Override
        public Density ofSi(final double si)
File Line
org/djunits/quantity/ElectricCharge.java 250
org/djunits/quantity/ElectricCurrent.java 234
org/djunits/quantity/ElectricPotential.java 217
org/djunits/quantity/ElectricalResistance.java 227
public static final ElectricCharge.Unit emu = abC.deriveUnit("emu", "electromagnetic unit", 1.0, UnitSystem.CGS_EMU);

        /**
         * Create a new ElectricCharge unit.
         * @param id the id or main abbreviation of the unit
         * @param name the full name of the unit
         * @param scaleFactorToBaseUnit the scale factor of the unit to convert it TO the base (SI) unit
         * @param unitSystem the unit system such as SI or IMPERIAL
         */
        public Unit(final String id, final String name, final double scaleFactorToBaseUnit, final UnitSystem unitSystem)
        {
            super(id, name, new LinearScale(scaleFactorToBaseUnit), unitSystem);
        }

        /**
         * Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
         * @param textualAbbreviation the textual abbreviation of the unit, which doubles as the id
         * @param displayAbbreviation the display abbreviation of the unit
         * @param name the full name of the unit
         * @param scale the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
         * @param unitSystem unit system, e.g. SI or Imperial
         */
        public Unit(final String textualAbbreviation, final String displayAbbreviation, final String name, final Scale scale,
                final UnitSystem unitSystem)
        {
            super(textualAbbreviation, displayAbbreviation, name, scale, unitSystem);
        }

        @Override
        public SIUnit siUnit()
        {
            return SI_UNIT;
        }

        @Override
        public Unit getBaseUnit()
        {
            return SI;
        }

        @Override
        public ElectricCharge ofSi(final double si)
File Line
org/djunits/vecmat/storage/DenseDoubleDataSi.java 251
org/djunits/vecmat/storage/DenseFloatDataSi.java 307
double[] dataSi = new double[rows * cols];
        for (int r = 0; r < rows; r++)
        {
            Throw.whenNull(grid[r], "grid[%d] = null", r);
            Throw.when(grid[r].length != cols, IllegalArgumentException.class,
                    "Number of columns in row %d (%d) is not equal to number of columns in row 0 (%d)", r, grid[r].length,
                    cols);
            for (int c = 0; c < cols; c++)
            {
                Throw.whenNull(grid[r][c], "grid[%d][%d] = null", r, c);
                dataSi[r * cols + c] = grid[r][c].si();
File Line
org/djunits/vecmat/d3/AbsVector3.java 130
org/djunits/vecmat/d3/AbsVector3.java 333
R extends Reference<R, A, Q>> AbsVector3.Col<A, Q> of(final A absX, final A absY, final A absZ)
        {
            Throw.whenNull(absX, "absX");
            Throw.whenNull(absY, "absY");
            Throw.whenNull(absZ, "absZ");
            Throw.when(!absX.getReference().equals(absY.getReference()), IllegalArgumentException.class,
                    "absX.reference != absY.reference");
            Throw.when(!absX.getReference().equals(absZ.getReference()), IllegalArgumentException.class,
                    "absX.reference != absZ.reference");
            return new AbsVector3.Col<>(Vector3.Col.of(absX.getQuantity(), absY.getQuantity(), absZ.getQuantity()),
File Line
org/djunits/vecmat/dnxm/MatrixNxM.java 201
org/djunits/vecmat/dnxm/MatrixNxM.java 217
org/djunits/vecmat/dnxm/MatrixNxM.java 233
public MatrixNxM<SIQuantity> multiply(final Matrix1x1<?> matrix)
    {
        checkMultiply(matrix);
        double[] result = MatrixMath.multiply(unsafeSiArray(), matrix.unsafeSiArray(), rows(), cols(), matrix.cols());
        SIUnit siUnit = getDisplayUnit().siUnit().plus(matrix.getDisplayUnit().siUnit());
        return new MatrixNxM<SIQuantity>(new DenseDoubleDataSi(result, rows(), matrix.cols()), siUnit);
    }

    /**
     * Multiply this vector or matrix with a Matrix2x2, resulting in a MatrixNxM. The multiplication is a (Mx2) x (2x2) matrix
     * multiplication resulting in an (Mx2) matrix.
     * @param matrix the matrix to multiply with
     * @return a MatrixNxM of an SIQuantity as the result of the matrix multiplication
     * @throws IllegalArgumentException when the number of columns of this matrix does not equal the number of rows of the
     *             matrix or vector to multiply with
     */
    public MatrixNxM<SIQuantity> multiply(final Matrix2x2<?> matrix)