Package jline.lib.fjcodes
Class FJUtilsKt
-
- All Implemented Interfaces:
public final class FJUtilsKt
-
-
Method Summary
Modifier and Type Method Description final static Matrixkronsum(Matrix A, Matrix B)Compute Kronecker sum of two matricesReturns: A ⊕ B = A ⊗ I + I ⊗ B final static Integervectmatch(DoubleArray row, Matrix matrix)Find the row index in a matrix that matches a given row vectorAssumes there is exactly one matching row in the matrix. final static Matrixbuild_index(Integer m, Integer cr)Build combinatorial index patternsGenerates all ways to distribute 'cr' items into 'm' bins. final static DoubleArraygetRowAsArray(Matrix matrix, Integer row)Extract a row from a Matrix as a DoubleArray final static UnitsetSubMatrix(Matrix target, Integer startRow, Integer startCol, Matrix source)Copy a submatrix into a target matrix at specified position -
-
Method Detail
-
kronsum
final static Matrix kronsum(Matrix A, Matrix B)
Compute Kronecker sum of two matrices
Returns: A ⊕ B = A ⊗ I + I ⊗ B
- Parameters:
A- First matrixB- Second matrix- Returns:
Kronecker sum A ⊕ B
-
vectmatch
final static Integer vectmatch(DoubleArray row, Matrix matrix)
Find the row index in a matrix that matches a given row vector
Assumes there is exactly one matching row in the matrix.
- Parameters:
row- Row vector to search formatrix- Matrix to search in- Returns:
1-based index of the matching row, or -1 if not found
-
build_index
final static Matrix build_index(Integer m, Integer cr)
Build combinatorial index patterns
Generates all ways to distribute 'cr' items into 'm' bins. For example, build_index(2, 1) with m=2, cr=1 gives: 0, 1
- Parameters:
m- Number of bins/phasescr- Number of items to distribute- Returns:
Matrix where each row is a distribution pattern
-
getRowAsArray
final static DoubleArray getRowAsArray(Matrix matrix, Integer row)
Extract a row from a Matrix as a DoubleArray
- Parameters:
matrix- Source matrixrow- Row index (0-based)- Returns:
Row as DoubleArray
-
setSubMatrix
final static Unit setSubMatrix(Matrix target, Integer startRow, Integer startCol, Matrix source)
Copy a submatrix into a target matrix at specified position
- Parameters:
target- Target matrix to copy intostartRow- Starting row in target (0-based)startCol- Starting column in target (0-based)source- Source matrix to copy from
-
-
-
-