Merged
Conversation
eddyxu
commented
Apr 7, 2023
|
|
||
| let u_values = Arc::new(Float32Array::from_iter_values(u)); | ||
| let u = MatrixView::new(u_values, m as usize).transpose(); | ||
| let u = Self::new(u_values, m as usize).transpose(); |
changhiskhan
reviewed
Apr 7, 2023
| pub fn row(&self, i: usize) -> Option<Float32Array> { | ||
| /// Returns a row at index `i`. Returns `None` if the index is out of bound. | ||
| /// | ||
| /// # Panics if the matrix is transposed. |
Contributor
There was a problem hiding this comment.
Why Panic instead of Result?
Member
Author
There was a problem hiding this comment.
this is assert. which should not happen , and there is no code path to recover from such error?
| residual_builder.append_slice(resi_arr.values()); | ||
| unsafe { | ||
| residual_builder | ||
| .append_trusted_len_iter(vector.iter().zip(cent.iter()).map(|(v, c)| v - c)) |
Contributor
There was a problem hiding this comment.
If somehow vector and centroid are incompatible does this segfault or just panic or does it fail silently?
Member
Author
There was a problem hiding this comment.
I can check the length of the two slices. Their types should be the same to be compiled tho.
Member
Author
There was a problem hiding this comment.
I feel that this should be assert or debug_assert tho. no recoverable bug.
changhiskhan
approved these changes
Apr 7, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MatrixView::row()to return&[f32]slice for better code and performance (by avoiding more memory allocation to createFloat32Array)