-
Notifications
You must be signed in to change notification settings - Fork 28k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-5486] Added validate method to BlockMatrix #4279
Conversation
Test build #26344 has finished for PR 4279 at commit
|
Test build #26372 has finished for PR 4279 at commit
|
@@ -172,6 +172,64 @@ class BlockMatrix( | |||
assert(cols <= nCols, s"The number of columns $cols is more than claimed $nCols.") | |||
} | |||
|
|||
def validate: Unit = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validate()
, which is an action.
Test build #26390 has finished for PR 4279 at commit
|
// Check if each MatrixBlock (except edges) has the dimensions rowsPerBlock x colsPerBlock | ||
// The first tuple is the index and the second tuple is the dimensions of the MatrixBlock | ||
blockInfo.foreach { case ((blockRowIndex, blockColIndex), (m, n)) => | ||
if (m != rowsPerBlock || n != colsPerBlock) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct. Checking m
should be separate from checking n
. m
is valid if
(blockRowIndex < numRowBlocks - 1 && m == rowsPerBlock) || (blockRowIndex == numRowBlocks - 1 && m > 0 && m <= rowsPerBlock)
Test build #26411 has finished for PR 4279 at commit
|
LGTM. Merged into master. Thanks! |
The
validate
method will allow users to debug theirBlockMatrix
, if operations likeadd
ormultiply
return unexpected results. It checks the following properties in aBlockMatrix
:BlockMatrix
consistent with what the user entered: (nRows
,nCols
)MatrixBlock
consistent with what the user entered: (rowsPerBlock
,colsPerBlock
)