DenseDComplexMatrix1D
cern.colt.matrix.tdcomplex.impl

Class DenseDComplexMatrix1D

  • All Implemented Interfaces:
    Serializable, Cloneable


    public class DenseDComplexMatrix1Dextends DComplexMatrix1D
    Dense 1-d matrix (aka vector) holding complex elements.

    Internally holds one single contiguous one-dimensional array. Complex data is represented by 2 double values in sequence, i.e. elements[zero + 2 * k * stride] constitute real part and elements[zero + 2 * k * stride + 1] constitute imaginary part (k=0,...,size()-1).

    See Also:
    Serialized Form
    • Constructor Detail

      • DenseDComplexMatrix1D

        public DenseDComplexMatrix1D(double[] values)
        Constructs a matrix with a copy of the given values. The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa. Due to the fact that complex data is represented by 2 double values in sequence: the real and imaginary parts, the size of new matrix will be equal to values.length / 2.
        Parameters:
        values - The values to be filled into the new matrix.
      • DenseDComplexMatrix1D

        public DenseDComplexMatrix1D(DoubleMatrix1D realPart)
        Constructs a complex matrix with the same size as realPart matrix and fills the real part of this matrix with elements of realPart.
        Parameters:
        realPart - a real matrix whose elements become a real part of this matrix
        Throws:
        IllegalArgumentException - if size<0.
      • DenseDComplexMatrix1D

        public DenseDComplexMatrix1D(int size)
        Constructs a matrix with a given number of cells. All entries are initially 0.
        Parameters:
        size - the number of cells the matrix shall have.
        Throws:
        IllegalArgumentException - if size<0.
      • DenseDComplexMatrix1D

        public DenseDComplexMatrix1D(int size,                     double[] elements,                     int zero,                     int stride,                     boolean isNoView)
        Constructs a matrix with the given parameters.
        Parameters:
        size - the number of cells the matrix shall have.
        elements - the cells.
        zero - the index of the first element.
        stride - the number of indexes between any two elements, i.e. index(i+1)-index(i).
        isNoView - if false then the view is constructed
        Throws:
        IllegalArgumentException - if size<0.
    • Method Detail

      • assign

        public DComplexMatrix1D assign(DComplexMatrix1D source)
        Description copied from class: DComplexMatrix1D
        Replaces all cell values of the receiver with the values of another matrix. Both matrices must have the same size. If both matrices share the same cells (as is the case if they are views derived from the same matrix) and intersect in an ambiguous way, then replaces as if using an intermediate auxiliary deep copy of other.
        Overrides:
        assign in class DComplexMatrix1D
        Parameters:
        source - the source matrix to copy from (may be identical to the receiver).
        Returns:
        this (for convenience only).
      • assign

        public DComplexMatrix1D assign(double re,                      double im)
        Description copied from class: DComplexMatrix1D
        Sets all cells to the state specified by re and im.
        Overrides:
        assign in class DComplexMatrix1D
        Parameters:
        re - the real part of the value to be filled into the cells.
        im - the imaginary part of the value to be filled into the cells.
        Returns:
        this (for convenience only).
      • assign

        public DComplexMatrix1D assign(double[] values)
        Description copied from class: DComplexMatrix1D
        Sets all cells to the state specified by values. values is required to have the same number of cells as the receiver. Complex data is represented by 2 double values in sequence: the real and imaginary parts, i.e. input array must be of size 2*size().

        The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa.

        Overrides:
        assign in class DComplexMatrix1D
        Parameters:
        values - the values to be filled into the cells.
        Returns:
        this (for convenience only).
      • assignImaginary

        public DComplexMatrix1D assignImaginary(DoubleMatrix1D other)
        Description copied from class: DComplexMatrix1D
        Replaces imaginary part of the receiver with the values of another real matrix. The real part remains unchanged. Both matrices must have the same size.
        Overrides:
        assignImaginary in class DComplexMatrix1D
        Parameters:
        other - the source matrix to copy from
        Returns:
        this (for convenience only).
      • assignReal

        public DComplexMatrix1D assignReal(DoubleMatrix1D other)
        Description copied from class: DComplexMatrix1D
        Replaces real part of the receiver with the values of another real matrix. The imaginary part remains unchanged. Both matrices must have the same size.
        Overrides:
        assignReal in class DComplexMatrix1D
        Parameters:
        other - the source matrix to copy from
        Returns:
        this (for convenience only).
      • fft

        public void fft()
        Computes the discrete Fourier transform (DFT) of this matrix. Throws IllegalArgumentException if the size of this matrix is not a power of 2 number.
      • getNonZeros

        public void getNonZeros(IntArrayList indexList,               ArrayList<double[]> valueList)
        Description copied from class: DComplexMatrix1D
        Fills the coordinates and values of cells having non-zero values into the specified lists. Fills into the lists, starting at index 0. After this call returns the specified lists all have a new size, the number of non-zero values.

        In general, fill order is unspecified. This implementation fills like: for (index = 0..size()-1) do ... . However, subclasses are free to us any other order, even an order that may change over time as cell values are changed. (Of course, result lists indexes are guaranteed to correspond to the same cell).

        Overrides:
        getNonZeros in class DComplexMatrix1D
        Parameters:
        indexList - the list to be filled with indexes, can have any size.
        valueList - the list to be filled with values, can have any size.
      • getQuick

        public double[] getQuick(int index)
        Description copied from class: DComplexMatrix1D
        Returns the matrix cell value at coordinate index.

        Provided with invalid parameters this method may return invalid objects without throwing any exception. You should only use this method when you are absolutely sure that the coordinate is within bounds. Precondition (unchecked): index<0 || index>=size().

        Specified by:
        getQuick in class DComplexMatrix1D
        Parameters:
        index - the index of the cell.
        Returns:
        the value of the specified cell.
      • ifft

        public void ifft(boolean scale)
        Computes the inverse of the discrete Fourier transform (IDFT) of this matrix. Throws IllegalArgumentException if the size of this matrix is not a power of 2 number.
        Parameters:
        scale - if true, then scaling is performed.
      • like

        public DComplexMatrix1D like(int size)
        Description copied from class: DComplexMatrix1D
        Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified size. For example, if the receiver is an instance of type DenseDComplexMatrix1D the new matrix must also be of type DenseDComplexMatrix1D. In general, the new matrix should have internal parametrization as similar as possible.
        Specified by:
        like in class DComplexMatrix1D
        Parameters:
        size - the number of cell the matrix shall have.
        Returns:
        a new empty matrix of the same dynamic type.
      • like2D

        public DComplexMatrix2D like2D(int rows,                      int columns)
        Description copied from class: DComplexMatrix1D
        Construct and returns a new 2-d matrix of the corresponding dynamic type, entirely independent of the receiver. For example, if the receiver is an instance of type DenseDComplexMatrix1D the new matrix must be of type DenseDComplexMatrix2D.
        Specified by:
        like2D in class DComplexMatrix1D
        Parameters:
        rows - the number of rows the matrix shall have.
        columns - the number of columns the matrix shall have.
        Returns:
        a new matrix of the corresponding dynamic type.
      • reshape

        public DComplexMatrix2D reshape(int rows,                       int columns)
        Description copied from class: DComplexMatrix1D
        Returns new DoubleMatrix2D of size rows x columns whose elements are taken column-wise from this matrix.
        Specified by:
        reshape in class DComplexMatrix1D
        Parameters:
        rows - number of rows
        columns - number of columns
        Returns:
        new 2D matrix with columns being the elements of this matrix.
      • reshape

        public DComplexMatrix3D reshape(int slices,                       int rows,                       int columns)
        Description copied from class: DComplexMatrix1D
        Returns new DoubleMatrix3D of size slices x rows x columns, whose elements are taken column-wise from this matrix.
        Specified by:
        reshape in class DComplexMatrix1D
        rows - number of rows
        columns - number of columns
        Returns:
        new 2D matrix with columns being the elements of this matrix.
      • setQuick

        public void setQuick(int index,            double re,            double im)
        Description copied from class: DComplexMatrix1D
        Sets the matrix cell at coordinate index to the specified value.

        Provided with invalid parameters this method may access illegal indexes without throwing any exception. You should only use this method when you are absolutely sure that the coordinate is within bounds. Precondition (unchecked): index<0 || index>=size().

        Specified by:
        setQuick in class DComplexMatrix1D
        Parameters:
        index - the index of the cell.
        re - the real part of the value to be filled into the specified cell.
        im - the imaginary part of the value to be filled into the specified cell.
      • setQuick

        public void setQuick(int index,            double[] value)
        Description copied from class: DComplexMatrix1D
        Sets the matrix cell at coordinate index to the specified value.

        Provided with invalid parameters this method may access illegal indexes without throwing any exception. You should only use this method when you are absolutely sure that the coordinate is within bounds. Precondition (unchecked): index<0 || index>=size().

        Specified by:
        setQuick in class DComplexMatrix1D
        Parameters:
        index - the index of the cell.
        value - the value to be filled into the specified cell (re=value[0], im=value[1]).
      • toArray

        public void toArray(double[] values)
        Description copied from class: DComplexMatrix1D
        Fills the cell values into the specified 1-dimensional array. The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa. After this call returns the array values has the form
        for (int i = 0; i < size; i++) { tmp = getQuick(i); values[2 * i] = tmp[0]; //real part values[2 * i + 1] = tmp[1]; //imaginary part }
        Overrides:
        toArray in class DComplexMatrix1D
      • zDotProduct

        public double[] zDotProduct(DComplexMatrix1D y,                   int from,                   int length)
        Description copied from class: DComplexMatrix1D
        Returns the dot product of two vectors x and y. Operates on cells at indexes from .. Min(size(),y.size(),from+length)-1.
        Overrides:
        zDotProduct in class DComplexMatrix1D
        Parameters:
        y - the second vector.
        from - the first index to be considered.
        length - the number of cells to be considered.
        Returns:
        the sum of products; zero if from<0 || length<0.
      • index

        public long index(int rank)
        Description copied from class: AbstractMatrix1D
        Returns the position of the element with the given relative rank within the (virtual or non-virtual) internal 1-dimensional array. You may want to override this method for performance.
        Overrides:
        index in class AbstractMatrix1D
        Parameters:
        rank - the rank of the element.

SCaVis 1.8 © jWork.org