Package org.apache.hadoop.hbase.master
Class RegionPlacementMaintainer.RandomizedMatrix
java.lang.Object
org.apache.hadoop.hbase.master.RegionPlacementMaintainer.RandomizedMatrix
- Enclosing class:
- RegionPlacementMaintainer
Some algorithms for solving the assignment problem may traverse workers or jobs in linear order
 which may result in skewing the assignments of the first jobs in the matrix toward the last
 workers in the matrix if the costs are uniform. To avoid this kind of clumping, we can
 randomize the rows and columns of the cost matrix in a reversible way, such that the solution
 to the assignment problem can be interpreted in terms of the original untransformed cost
 matrix. Rows and columns are transformed independently such that the elements contained in any
 row of the input matrix are the same as the elements in the corresponding output matrix, and
 each row has its elements transformed in the same way. Similarly for columns.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final int[]private final intprivate final int[]private final int[]private final intprivate final int[]
- 
Constructor SummaryConstructorsConstructorDescriptionRandomizedMatrix(int rows, int cols) Create a randomization scheme for a matrix of a given size.
- 
Method SummaryModifier and TypeMethodDescriptionfloat[][]invert(float[][] matrix) Copy a given matrix into a new matrix, transforming each row index and each column index according to the inverse of the randomization scheme that was created at construction time.int[]invertIndices(int[] indices) Given an array where each elementindices[i]represents the randomized column index corresponding to randomized row indexi, create a new array with the corresponding inverted indices.float[][]transform(float[][] matrix) Copy a given matrix into a new matrix, transforming each row index and each column index according to the randomization scheme that was created at construction time.
- 
Field Details- 
rows
- 
cols
- 
rowTransform
- 
rowInverse
- 
colTransform
- 
colInverse
 
- 
- 
Constructor Details- 
RandomizedMatrixCreate a randomization scheme for a matrix of a given size.- Parameters:
- rows- the number of rows in the matrix
- cols- the number of columns in the matrix
 
 
- 
- 
Method Details- 
transformCopy a given matrix into a new matrix, transforming each row index and each column index according to the randomization scheme that was created at construction time.- Parameters:
- matrix- the cost matrix to transform
- Returns:
- a new matrix with row and column indices transformed
 
- 
invertCopy a given matrix into a new matrix, transforming each row index and each column index according to the inverse of the randomization scheme that was created at construction time.- Parameters:
- matrix- the cost matrix to be inverted
- Returns:
- a new matrix with row and column indices inverted
 
- 
invertIndicesGiven an array where each elementindices[i]represents the randomized column index corresponding to randomized row indexi, create a new array with the corresponding inverted indices.- Parameters:
- indices- an array of transformed indices to be inverted
- Returns:
- an array of inverted indices
 
 
-