Skip to content
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

Fix array return type #70

Merged
merged 2 commits into from
Jun 9, 2022
Merged

Fix array return type #70

merged 2 commits into from
Jun 9, 2022

Conversation

GiggleLiu
Copy link
Member

  • avoid returning subarrays,
  • add tests for +, -, = and isapprox

@GiggleLiu GiggleLiu requested a review from Roger-luo June 9, 2022 01:22
@GiggleLiu
Copy link
Member Author

I have to merge quickly because I need to tag a new version for tomorrow's community call.
Feel free to comment back. @Roger-luo

@GiggleLiu GiggleLiu merged commit 8cdfb99 into master Jun 9, 2022
@GiggleLiu GiggleLiu deleted the fix-array-return-type branch June 9, 2022 01:24
@@ -44,6 +44,9 @@ function PermMatrix(
PermMatrix{Tv,Ti,Vv,Vi}(perm, vals)
end

Base.:(==)(d1::PermMatrix, d2::PermMatrix) = SparseMatrixCSC(d1) == SparseMatrixCSC(d2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't you compare the value directly? Why covert it to CSC?

Copy link
Member Author

@GiggleLiu GiggleLiu Jun 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are two entries being zero, then their order are not important. This logic is too complicated.
If we ignore this corner case, some tests can not pass.

@@ -44,6 +44,9 @@ function PermMatrix(
PermMatrix{Tv,Ti,Vv,Vi}(perm, vals)
end

Base.:(==)(d1::PermMatrix, d2::PermMatrix) = SparseMatrixCSC(d1) == SparseMatrixCSC(d2)
Base.isapprox(d1::PermMatrix, d2::PermMatrix; kwargs...) = isapprox(SparseMatrixCSC(d1), SparseMatrixCSC(d2); kwargs...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants