- java.lang.Object
-
- org.ojalgo.matrix.store.AbstractStore<N>
-
- org.ojalgo.matrix.store.FactoryStore<java.lang.Double>
-
- org.ojalgo.matrix.store.CompressedSparseR064
-
- org.ojalgo.matrix.store.R064CSC
-
- All Implemented Interfaces:
Group,Group.Additive<MatrixStore<java.lang.Double>>,NormedVectorSpace<MatrixStore<java.lang.Double>,java.lang.Double>,Operation,Operation.Addition<MatrixStore<java.lang.Double>>,Operation.Multiplication<MatrixStore<java.lang.Double>>,Operation.Subtraction<MatrixStore<java.lang.Double>>,ScalarOperation,ScalarOperation.Addition<MatrixStore<java.lang.Double>,java.lang.Double>,ScalarOperation.Division<MatrixStore<java.lang.Double>,java.lang.Double>,ScalarOperation.Multiplication<MatrixStore<java.lang.Double>,java.lang.Double>,ScalarOperation.Subtraction<MatrixStore<java.lang.Double>,java.lang.Double>,VectorSpace<MatrixStore<java.lang.Double>,java.lang.Double>,Matrix2D<java.lang.Double,MatrixStore<java.lang.Double>>,ElementsSupplier<java.lang.Double>,MatrixStore<java.lang.Double>,SparseStructure2D,Access1D<java.lang.Double>,Access1D.Aggregatable<java.lang.Double>,Access1D.Collectable<java.lang.Double,Mutate1D>,Access1D.Sliceable<java.lang.Double>,Access1D.Visitable<java.lang.Double>,Access2D<java.lang.Double>,Access2D.Aggregatable<java.lang.Double>,Access2D.Collectable<java.lang.Double,TransformableRegion<java.lang.Double>>,Access2D.Sliceable<java.lang.Double>,Access2D.Visitable<java.lang.Double>,Operate2D<java.lang.Double,ElementsSupplier<java.lang.Double>>,Structure1D,Structure2D,Structure2D.Logical<Access2D<java.lang.Double>,MatrixStore<java.lang.Double>>,Structure2D.ReducibleTo1D<ElementsSupplier<java.lang.Double>>
public final class R064CSC extends CompressedSparseR064
A compressed sparse column (CSC) matrix store implementation for double precision values. This format is efficient for column-wise operations and matrix-vector multiplication.The CSC format uses three arrays to store the matrix:
- values[] - stores the non-zero values
- rowIndices[] - stores the row index for each non-zero value
- columnPointers[] - stores the starting position in values/rowIndices arrays for each column
This format is particularly efficient for:
- Column-wise access and operations
- Matrix-vector multiplication
- Iterating over non-zero elements column by column
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classR064CSC.NonZeroView-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Access2D
Access2D.Aggregatable<N extends java.lang.Comparable<N>>, Access2D.Collectable<N extends java.lang.Comparable<N>,R extends Mutate2D>, Access2D.ColumnView<N extends java.lang.Comparable<N>>, Access2D.ElementView<N extends java.lang.Comparable<N>>, Access2D.RowView<N extends java.lang.Comparable<N>>, Access2D.SelectionView<N extends java.lang.Comparable<N>>, Access2D.Sliceable<N extends java.lang.Comparable<N>>, Access2D.Visitable<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.Group
Group.Additive<T>, Group.Multiplicative<T>
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.Operation
Operation.Addition<T>, Operation.Division<T>, Operation.Multiplication<T>, Operation.Subtraction<T>
-
Nested classes/interfaces inherited from interface org.ojalgo.algebra.ScalarOperation
ScalarOperation.Addition<T,N extends java.lang.Comparable<N>>, ScalarOperation.Division<T,N extends java.lang.Comparable<N>>, ScalarOperation.Multiplication<T,N extends java.lang.Comparable<N>>, ScalarOperation.Subtraction<T,N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S extends Structure1D,B extends Structure1D.Logical<S,B>>, Structure1D.LongIndex, Structure1D.LoopCallback
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure2D
Structure2D.IntRowColumn, Structure2D.Logical<S extends Structure2D,B extends Structure2D.Logical<S,B>>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R extends Structure1D>, Structure2D.Reshapable, Structure2D.RowColumnKey<R,C>, Structure2D.RowColumnMapper<R,C>
-
-
Field Summary
-
Fields inherited from class org.ojalgo.matrix.store.CompressedSparseR064
indices, pointers, values
-
-
Constructor Summary
Constructors Constructor Description R064CSC(int nbRows, int nbCols, double[] elementValues, int[] rowIndices, int[] columnPointers)Creates a new CSC matrix store.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidbtran(R064CSC mtrxL, int r, PhysicalStore<java.lang.Double> arg)Assumes mtrxL is unit lower/left triangular, with the unit diagonal not stored.doubledoubleValue(int row, int col)Gets the value at the specified row and column.intfirstInColumn(int col)The default value is simply0, and if all elements are zeros thenthis.countRows().intfirstInRow(int row)The default value is simply0, and if all elements are zeros thenthis.countColumns().static voidftran(R064CSC mtrxL, int r, PhysicalStore<java.lang.Double> arg)Assumes mtrxL is unit lower/left triangular, with the unit diagonal not stored.intlimitOfColumn(int col)The default value is simplythis.countRows(), and if all elements are zeros then0.intlimitOfRow(int row)The default value is simplythis.countColumns(), and if all elements are zeros then0.voidmultiply(Access1D<java.lang.Double> right, TransformableRegion<java.lang.Double> target)Performs matrix-vector multiplication using the CSC format.R064CSC.NonZeroViewnonzeros()Similar toAccess1D.elements()but avoids elements that are structurally known to be zero.R064CSCtoCSC()R064CSRtoCSR()-
Methods inherited from class org.ojalgo.matrix.store.CompressedSparseR064
countNonzeros, get
-
Methods inherited from class org.ojalgo.matrix.store.FactoryStore
equals, hashCode, one, physical, zero
-
Methods inherited from class org.ojalgo.matrix.store.AbstractStore
buildColumn, buildColumn, buildColumn, buildRow, buildRow, buildRow, cast, countColumns, countRows, getColDim, getComponentType, getMaxDim, getMinDim, getRowDim, isPrimitive, multiplyBoth, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ojalgo.structure.Access1D
asCollectable1D, asKeyed1D, asList, axpy, dot, select, supplyTo, toList, toRawCopy1D
-
Methods inherited from interface org.ojalgo.structure.Access1D.Collectable
collect
-
Methods inherited from interface org.ojalgo.structure.Access1D.Visitable
visitAll, visitRange
-
Methods inherited from interface org.ojalgo.structure.Access2D
asCollectable2D, asKeyed2D, byteValue, byteValue, byteValue, byteValue, columns, doubleValue, doubleValue, doubleValue, elements, floatValue, floatValue, floatValue, floatValue, get, intValue, intValue, intValue, intValue, longValue, longValue, longValue, longValue, rows, shortValue, shortValue, shortValue, shortValue, toRawCopy2D
-
Methods inherited from interface org.ojalgo.structure.Access2D.Aggregatable
aggregateColumn, aggregateDiagonal, aggregateRow, reduceColumns, reduceRows
-
Methods inherited from interface org.ojalgo.structure.Access2D.Collectable
collect
-
Methods inherited from interface org.ojalgo.structure.Access2D.Sliceable
sliceColumn, sliceDiagonal, sliceRow
-
Methods inherited from interface org.ojalgo.structure.Access2D.Visitable
visitColumn, visitColumn, visitDiagonal, visitDiagonal, visitOne, visitRow, visitRow
-
Methods inherited from interface org.ojalgo.matrix.store.ElementsSupplier
onAny, onColumns, onColumns, onMatching, onMatching, onRows, onRows
-
Methods inherited from interface org.ojalgo.matrix.store.MatrixStore
above, above, above, add, add, add, aggregateAll, aggregateColumn, aggregateDiagonal, aggregateRange, aggregateRow, below, below, below, bidiagonal, column, column, columns, columns, conjugate, copy, diagonal, diagonally, divide, divide, equals, get, get, hermitian, hessenberg, indexOfLargest, isHermitian, isNormal, isSmall, isSmall, left, left, left, limits, logical, multiply, multiply, multiply, negate, norm, offsets, onAll, operate, power, premultiply, reduceColumns, reduceRows, repeat, right, right, right, row, row, rows, rows, select, select, signum, sliceColumn, sliceDiagonal, sliceRange, sliceRow, subtract, subtract, subtract, superimpose, superimpose, supplyTo, supplyTo, symmetric, toScalar, transpose, triangular, tridiagonal, visitOne
-
Methods inherited from interface org.ojalgo.structure.Operate2D
onAll, onAll, onAll, onAll, onAll, onCompatible, onCompatible
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Addition
add
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Division
divide
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Multiplication
multiply
-
Methods inherited from interface org.ojalgo.algebra.ScalarOperation.Subtraction
subtract
-
Methods inherited from interface org.ojalgo.matrix.store.SparseStructure2D
density
-
-
-
-
Constructor Detail
-
R064CSC
R064CSC(int nbRows, int nbCols, double[] elementValues, int[] rowIndices, int[] columnPointers)Creates a new CSC matrix store.- Parameters:
rows- The number of rows in the matrixcols- The number of columns in the matrixelementValues- The non-zero valuesrowIndices- The row index for each non-zero valuecolumnPointers- The starting position in elementValues/rowIndices for each column
-
-
Method Detail
-
btran
public static void btran(R064CSC mtrxL, int r, PhysicalStore<java.lang.Double> arg)
Assumes mtrxL is unit lower/left triangular, with the unit diagonal not stored.
-
ftran
public static void ftran(R064CSC mtrxL, int r, PhysicalStore<java.lang.Double> arg)
Assumes mtrxL is unit lower/left triangular, with the unit diagonal not stored.
-
doubleValue
public double doubleValue(int row, int col)Gets the value at the specified row and column. Returns 0.0 if the element is not stored (i.e., is zero).- Parameters:
row- The row indexcol- The column index- Returns:
- The value at the specified position, or 0.0 if not stored
-
firstInColumn
public int firstInColumn(int col)
Description copied from interface:Structure2DThe default value is simply0, and if all elements are zeros thenthis.countRows().- Parameters:
col- The column index- Returns:
- The row index of the first non-zero element in the specified column
-
firstInRow
public int firstInRow(int row)
Description copied from interface:Structure2DThe default value is simply0, and if all elements are zeros thenthis.countColumns().- Returns:
- The column index of the first non-zero element in the specified row
-
limitOfColumn
public int limitOfColumn(int col)
Description copied from interface:Structure2DThe default value is simplythis.countRows(), and if all elements are zeros then0.- Specified by:
limitOfColumnin interfaceStructure2D- Overrides:
limitOfColumnin classAbstractStore<java.lang.Double>- Returns:
- The row index of the first zero element, after all non-zeros, in the specified column (index of the last non-zero + 1)
-
limitOfRow
public int limitOfRow(int row)
Description copied from interface:Structure2DThe default value is simplythis.countColumns(), and if all elements are zeros then0.- Specified by:
limitOfRowin interfaceStructure2D- Overrides:
limitOfRowin classAbstractStore<java.lang.Double>- Returns:
- The column index of the first zero element, after all non-zeros, in the specified row (index of the last non-zero + 1)
-
multiply
public void multiply(Access1D<java.lang.Double> right, TransformableRegion<java.lang.Double> target)
Performs matrix-vector multiplication using the CSC format. This implementation is optimized for the CSC format by iterating over non-zero elements column by column and accumulating the results.- Parameters:
right- The vector to multiply withtarget- The target vector to store the result
-
nonzeros
public R064CSC.NonZeroView nonzeros()
Description copied from interface:Access1DSimilar toAccess1D.elements()but avoids elements that are structurally known to be zero. (That does not eliminate all zero-values from this view.) With an arbitrary (dense) unstructured implementation theAccess1D.nonzeros()andAccess1D.elements()methods do the same thing! Only some specific implementations are able to actually exploit structure/sparsity to view fewer elements.
-
toCSC
public R064CSC toCSC()
-
toCSR
public R064CSR toCSR()
-
-