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

Add getindex; replace a.coeffs[i] with a[i] #97

Merged
merged 6 commits into from
Mar 15, 2017
Merged

Add getindex; replace a.coeffs[i] with a[i] #97

merged 6 commits into from
Mar 15, 2017

Conversation

dpsanders
Copy link
Contributor

@dpsanders dpsanders commented Mar 15, 2017

  • Replace all occurrences of a.coeffs[i] by a[i].
  • Add corresponding getindex and setindex! methods.

@lbenet
Copy link
Member

lbenet commented Mar 15, 2017

I just approved this to be merged, but it seems that tests (at least in 0.5) are not passing. I'll check this again.

return a[n+1])

getindex(a::Taylor1, n::Int) = a.coeffs[n]
getindex(a::Taylor1, n::UnitRange) = a.coeffs[n]
Copy link
Member

Choose a reason for hiding this comment

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

Don't we need also methods for HomogeneousPolynomial and TaylorN? This may be the cause that the tests are not passing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we do. I wanted to begin just with Taylor1 to get it right. I won't be able to get to the rest for a while if you want to have a go.

Copy link
Member

Choose a reason for hiding this comment

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

I'll do it then.

One question: Should we also include setindex?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, I guess we should.

@dpsanders
Copy link
Contributor Author

setindex!

Is it surprising that the Taylor1 tests pass without setindex defined?

@lbenet
Copy link
Member

lbenet commented Mar 15, 2017

I guess this is because we haven't done anything like a[1] = b[1]+c[1], with all quantities Taylor1. This could simplify things even further! Yet, Taylor1 and the rest are immutable, so I don't know if it works completely...

@dpsanders
Copy link
Contributor Author

dpsanders commented Mar 15, 2017 via email

@dpsanders
Copy link
Contributor Author

dpsanders commented Mar 15, 2017 via email

@lbenet
Copy link
Member

lbenet commented Mar 15, 2017

Including setindex! the tests are passing. I'll include further tests.

@lbenet
Copy link
Member

lbenet commented Mar 15, 2017

I just pushed a new commit. With this functionality, I think we can simplify even further the code. I will work on that later (on a new PR)!

I'll wait to get the green lights and then merge.

@dpsanders
Copy link
Contributor Author

Tests are passing on Travis for 0.5 and 0.6 (on Linux).
The Mac queues seem to be eternal these days, so I suggest merging this.

@dpsanders dpsanders changed the title Add getindex and teplace a.coeffs[i] with a[i] everywhere Add getindex and replace a.coeffs[i] with a[i] Mar 15, 2017
@dpsanders dpsanders changed the title Add getindex and replace a.coeffs[i] with a[i] Add getindex; replace a.coeffs[i] with a[i] Mar 15, 2017
@lbenet
Copy link
Member

lbenet commented Mar 15, 2017

I agree with you.

One silly question: shall I rebase and merge, or squash and merge?

@dpsanders
Copy link
Contributor Author

I always just use the Squash and merge button.

@dpsanders dpsanders merged commit 487cb8b into master Mar 15, 2017
@lbenet
Copy link
Member

lbenet commented Mar 15, 2017

Thanks a lot!!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 98.216% when pulling e2cf47f on getindex into a7fd782 on master.

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.

None yet

3 participants