Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Give MathCell arithmetic ops implementations when MathCell is left value#1011

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
SparrowLii wants to merge1 commit intorust-ndarray:master
base:master
Choose a base branch
Loading
fromSparrowLii:mathcell_ops

Conversation

SparrowLii
Copy link
Contributor

@SparrowLiiSparrowLii commentedMay 21, 2021
edited
Loading

Update#969
Four functions are implemented forArrayView<MathCell, _> in impl_methods.rs:
zip_cell_with,zip_cell_with_elem,zip_cell_with_same_shape,zip_cell_with_by_rows.
Operator overloading is implemented in impl_ops.rs for the following situations:
ArrayView<MathCell, _> binary_op &ArrayBase
ArrayView<MathCell, _> binary_op Scalar
ArrayView<MathCell, _> assign_op &ArrayBase
ArrayView<MathCell, _> assign_op Scalar

The unresolved problems are:

  1. CurrentlyMathCell can only be left value. The main reason are:
    (1) Conflicts occur when compilingMathCell<A> op MathCell<B>
    (2) Rust's orphan rules. We can't write code like this:impl<T> Add<MathCell<T>> for T. This will causeE0210 error

  2. The value inMathCell must beCopy
    This is because the value in MathCell needs to be retrieved using theget() method. We cannot get&T from&MathCell<T> unless we create a new structureMathRefCell(RefCell<T>)

@bluss
Copy link
Member

bluss commentedMay 21, 2021
edited
Loading

We don't implement ArrayViewMut + x (only ArrayViewMut += x), and this should be the same way IMO. I.e we want the+= and similar ops. I hope we can do with without adding new copies like all the new.zip* methods.

SparrowLii reacted with eyes emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@SparrowLii@bluss

[8]ページ先頭

©2009-2025 Movatter.jp