Class DictLibMatrixMult
- java.lang.Object
- 
- org.apache.sysds.runtime.compress.colgroup.dictionary.DictLibMatrixMult
 
- 
 public class DictLibMatrixMult extends Object Utility interface for dictionary matrix multiplication
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddToUpperTriangle(int nCols, int row, int col, double[] res, double val)Add to the upper triangle, but twice if on the diagonalstatic voidMMDicts(ADictionary left, ADictionary right, int[] rowsLeft, int[] colsRight, MatrixBlock result)Matrix Multiply the two dictionaries, note that the left side is considered transposed but not allocated transposed making the multiplication a: t(left) %*% rightstatic voidMMDictsWithScaling(ADictionary left, ADictionary right, int[] leftRows, int[] rightColumns, MatrixBlock result, int[] counts)Matrix multiply with scaling (left side transposed)static voidTSMMDictionaryWithScaling(ADictionary dict, int[] counts, int[] rows, int[] cols, MatrixBlock ret)Perform the full tsmm with the dictionary (allocating into the entire output matrix.)static voidTSMMToUpperTriangle(ADictionary left, ADictionary right, int[] rowsLeft, int[] colsRight, MatrixBlock result)Does two matrix multiplications in one go but only add to the upper triangle.static voidTSMMToUpperTriangleScaling(ADictionary left, ADictionary right, int[] rowsLeft, int[] colsRight, int[] scale, MatrixBlock result)Does two matrix multiplications in one go but only add to the upper triangle with scaling.
 
- 
- 
- 
Method Detail- 
addToUpperTrianglepublic static void addToUpperTriangle(int nCols, int row, int col, double[] res, double val)Add to the upper triangle, but twice if on the diagonal- Parameters:
- nCols- number cols in res
- row- the row to add to
- col- the col to add to
- res- the double array to add to
- val- the value to add
 
 - 
MMDictsWithScalingpublic static void MMDictsWithScaling(ADictionary left, ADictionary right, int[] leftRows, int[] rightColumns, MatrixBlock result, int[] counts) Matrix multiply with scaling (left side transposed)- Parameters:
- left- Left side dictionary
- right- Right side dictionary
- leftRows- Left side row offsets
- rightColumns- Right side column offsets
- result- The result matrix
- counts- The scaling factors
 
 - 
TSMMDictionaryWithScalingpublic static void TSMMDictionaryWithScaling(ADictionary dict, int[] counts, int[] rows, int[] cols, MatrixBlock ret) Perform the full tsmm with the dictionary (allocating into the entire output matrix.)- Parameters:
- dict- The dictionary to tsmm
- counts- The frequency of each dictionary entry
- rows- The rows of the dictionary
- cols- The cols of the dictionary
- ret- The output to add the results to
 
 - 
MMDictspublic static void MMDicts(ADictionary left, ADictionary right, int[] rowsLeft, int[] colsRight, MatrixBlock result) Matrix Multiply the two dictionaries, note that the left side is considered transposed but not allocated transposed making the multiplication a: t(left) %*% right- Parameters:
- left- The left side dictionary
- right- The right side dictionary
- rowsLeft- The row indexes on the left hand side
- colsRight- The column indexes on the right hand side
- result- The result matrix to put the results into.
 
 - 
TSMMToUpperTrianglepublic static void TSMMToUpperTriangle(ADictionary left, ADictionary right, int[] rowsLeft, int[] colsRight, MatrixBlock result) Does two matrix multiplications in one go but only add to the upper triangle. the two multiplications are: t(left) %*% right t(right) %*% left In practice this operation then only does one of these multiplications but all results that would end up in the lower triangle is transposed and added to the upper triangle. Furthermore all results that would end up on the diagonal is added twice to adhere with the two multiplications- Parameters:
- left- Left dictionary to multiply
- right- Right dictionary to multiply
- rowsLeft- rows for the left dictionary
- colsRight- cols for the right dictionary
- result- the result
 
 - 
TSMMToUpperTriangleScalingpublic static void TSMMToUpperTriangleScaling(ADictionary left, ADictionary right, int[] rowsLeft, int[] colsRight, int[] scale, MatrixBlock result) Does two matrix multiplications in one go but only add to the upper triangle with scaling. the two multiplications are: t(left) %*% right t(right) %*% left In practice this operation then only does one of these multiplications but all results that would end up in the lower triangle is transposed and added to the upper triangle. Furthermore all results that would end up on the diagonal is added twice to adhere with the two multiplications- Parameters:
- left- Left dictionary to multiply
- right- Right dictionary to multiply
- rowsLeft- Rows for the left dictionary
- colsRight- Cols for the right dictionary
- scale- A multiplier to each dictionary entry
- result- The result
 
 
- 
 
-