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

vector space operations #57

Merged
merged 7 commits into from
May 17, 2022
Merged

vector space operations #57

merged 7 commits into from
May 17, 2022

Conversation

ranocha
Copy link
Owner

@ranocha ranocha commented May 16, 2022

Closes #56

test/runtests.jl Outdated
Comment on lines 85 to 114
@testset "vector space interface" begin
# explicit midpoint method
A = @SArray [0 0; 1//2 0]; b = @SArray [0, 1//1]; c = @SArray [0, 1//2];
series1 = @inferred bseries(A, b, c, 2)
series2 = @inferred bseries(float.(A), b, c, 3)
exact = ExactSolution{Rational{Int128}}()

diff = @inferred series1 - series2
@test mapreduce(iszero, &, values(diff))

diff = @inferred series1 - exact
@test mapreduce(iszero, &, values(diff))

diff = @inferred exact - series1
@test mapreduce(iszero, &, values(diff))

@test @inferred(series1 + series2) == @inferred(2 * series1)
@test @inferred(series1 + exact) == @inferred(2 * series1)
@test @inferred(exact + series1) == @inferred(2 * series1)

half1 = @inferred 0.5 * series1
half2 = @inferred 2 \ series1
@test half1 == half2

@test @inferred(+series2) == series2
@test @inferred(-series2) == -1 * series2

diff = @inferred(series2 + (-series2))
@test mapreduce(iszero, &, values(diff))
end
Copy link
Owner Author

Choose a reason for hiding this comment

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

@ketch This is the set of operations allowed by this PR. Does this look good to you or do you have additional suggestions?

@ranocha ranocha closed this May 16, 2022
@ranocha ranocha reopened this May 16, 2022
@ranocha ranocha marked this pull request as ready for review May 17, 2022 04:04
@ranocha ranocha enabled auto-merge (squash) May 17, 2022 04:04
@ranocha ranocha merged commit 85e0c54 into main May 17, 2022
@ranocha ranocha deleted the hr/vector_space branch May 17, 2022 04:10
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.

Overload + and - for TruncatedBSeries
1 participant