Module ojalgo

Class MatrixTensor<N extends Comparable<N>>

java.lang.Object
org.ojalgo.tensor.MatrixTensor<N>
All Implemented Interfaces:
Consumer<Access2D<?>>, Group, Group.Additive<MatrixTensor<N>>, NormedVectorSpace<MatrixTensor<N>,N>, Operation, Operation.Addition<MatrixTensor<N>>, ScalarOperation, ScalarOperation.Multiplication<MatrixTensor<N>,N>, VectorSpace<MatrixTensor<N>,N>, Access1D<N>, Access2D<N>, Mutate1D, Mutate1D.Fillable<N>, Mutate2D, Mutate2D.Fillable<N>, Mutate2D.Receiver<N>, Structure1D, Structure2D, Tensor<N,MatrixTensor<N>>

public final class MatrixTensor<N extends Comparable<N>> extends Object implements Access2D<N>, Mutate2D.Receiver<N>
  • Method Details

    • factory

      public static <N extends Comparable<N>> TensorFactory2D<N,MatrixTensor<N>> factory(DenseArray.Factory<N,?> arrayFactory)
    • add

      public MatrixTensor<N> add(MatrixTensor<N> addend)
      Specified by:
      add in interface Operation.Addition<N extends Comparable<N>>
      Parameters:
      addend - What to add
      Returns:
      this + addend
    • byteValue

      public byte byteValue(int row, int col)
      Specified by:
      byteValue in interface Access2D<N extends Comparable<N>>
    • byteValue

      public byte byteValue(long row, long col)
      Specified by:
      byteValue in interface Access2D<N extends Comparable<N>>
    • conjugate

      public MatrixTensor<N> conjugate()
      Description copied from interface: VectorSpace

      This method will (most likely) be moved to some other interface in the future! Just have to figure out where it fits...

      The conjugate transpose of a matrix and/or the conjugate of a scalar/field like ComplexNumber or Quaternion.

      The conjugate transpose of a real matrix is simply its transpose.

      Specified by:
      conjugate in interface VectorSpace<MatrixTensor<N extends Comparable<N>>,N extends Comparable<N>>
    • count

      public long count()
      Description copied from interface: Structure2D
      count() == countRows() * countColumns()
      Specified by:
      count in interface Structure1D
      Specified by:
      count in interface Structure2D
    • countColumns

      public long countColumns()
      Description copied from interface: Structure2D
      Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.
      Specified by:
      countColumns in interface Structure2D
      Returns:
      The number of columns
    • countRows

      public long countRows()
      Description copied from interface: Structure2D
      Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.
      Specified by:
      countRows in interface Structure2D
      Returns:
      The number of rows
    • doubleValue

      public double doubleValue(int row, int col)
      Description copied from interface: Access2D
      Extracts one element of this matrix as a double.
      Specified by:
      doubleValue in interface Access2D<N extends Comparable<N>>
      Parameters:
      row - A row index.
      col - A column index.
      Returns:
      One matrix element
    • doubleValue

      public double doubleValue(long row, long col)
      Specified by:
      doubleValue in interface Access2D<N extends Comparable<N>>
    • equals

      public boolean equals(Object obj)
    • floatValue

      public float floatValue(int row, int col)
      Specified by:
      floatValue in interface Access2D<N extends Comparable<N>>
    • floatValue

      public float floatValue(long row, long col)
      Specified by:
      floatValue in interface Access2D<N extends Comparable<N>>
    • get

      public N get(long row, long col)
      Specified by:
      get in interface Access2D<N extends Comparable<N>>
    • getColDim

      public int getColDim()
      Specified by:
      getColDim in interface Structure2D
      Returns:
      The number of columns
    • getRowDim

      public int getRowDim()
      Specified by:
      getRowDim in interface Structure2D
      Returns:
      The number of rows
    • hashCode

      public int hashCode()
    • intValue

      public int intValue(int row, int col)
      Specified by:
      intValue in interface Access2D<N extends Comparable<N>>
    • intValue

      public int intValue(long row, long col)
      Specified by:
      intValue in interface Access2D<N extends Comparable<N>>
    • longValue

      public long longValue(int row, int col)
      Specified by:
      longValue in interface Access2D<N extends Comparable<N>>
    • longValue

      public long longValue(long row, long col)
      Specified by:
      longValue in interface Access2D<N extends Comparable<N>>
    • multiply

      public MatrixTensor<N> multiply(double scalarMultiplicand)
      Specified by:
      multiply in interface ScalarOperation.Multiplication<MatrixTensor<N extends Comparable<N>>,N extends Comparable<N>>
      Returns:
      this * scalarMultiplicand.
    • multiply

      public MatrixTensor<N> multiply(N scalarMultiplicand)
      Specified by:
      multiply in interface ScalarOperation.Multiplication<MatrixTensor<N extends Comparable<N>>,N extends Comparable<N>>
      Returns:
      this * multiplicand.
    • negate

      public MatrixTensor<N> negate()
      Description copied from interface: Group.Additive
      The additive inverse of this.
      Specified by:
      negate in interface Group.Additive<N extends Comparable<N>>
      Returns:
      -this.
    • norm

      public double norm()
      Description copied from interface: NormedVectorSpace
      this == this.signum().multiply(this.norm())
      Specified by:
      norm in interface NormedVectorSpace<MatrixTensor<N extends Comparable<N>>,N extends Comparable<N>>
      Returns:
      The norm
    • set

      public void set(int row, int col, byte value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(int row, int col, double value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(int row, int col, float value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(int row, int col, int value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(int row, int col, long value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(int row, int col, short value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(long row, long col, byte value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(long row, long col, Comparable<?> value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(long row, long col, double value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(long row, long col, float value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(long row, long col, int value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(long row, long col, long value)
      Specified by:
      set in interface Mutate2D
    • set

      public void set(long row, long col, short value)
      Specified by:
      set in interface Mutate2D
    • shortValue

      public short shortValue(int row, int col)
      Specified by:
      shortValue in interface Access2D<N extends Comparable<N>>
    • shortValue

      public short shortValue(long row, long col)
      Specified by:
      shortValue in interface Access2D<N extends Comparable<N>>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • dimensions

      public final int dimensions()
      Description copied from interface: Tensor
      The range of the indices that identify the scalar components. Each index of a tensor ranges over the number of dimensions.
      Specified by:
      dimensions in interface Tensor<N extends Comparable<N>,T extends org.ojalgo.tensor.ArrayBasedTensor<N,T>>
    • rank

      public final int rank()
      Description copied from interface: Tensor
      The total number of indices required to uniquely identify each scalar component is called the order, degree or rank of the tensor.
      Specified by:
      rank in interface Tensor<N extends Comparable<N>,T extends org.ojalgo.tensor.ArrayBasedTensor<N,T>>
    • signum

      public MatrixTensor<N> signum()
      Description copied from interface: NormedVectorSpace
      this == this.signum().multiply(this.norm())
      Specified by:
      signum in interface NormedVectorSpace<N extends Comparable<N>,T extends org.ojalgo.tensor.ArrayBasedTensor<N,T>>
      Returns:
      A unit "vector"