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

bound: Add Union helper for bound package #966

Merged
merged 1 commit into from
Apr 18, 2019

Conversation

corona10
Copy link
Contributor

Add Union helper for bound package

Updates: #939

bound/bound.go Outdated Show resolved Hide resolved
bound/bound_test.go Show resolved Hide resolved
bound/bound.go Outdated Show resolved Hide resolved
bound/bound.go Outdated Show resolved Hide resolved
bound/bound.go Outdated Show resolved Hide resolved
@corona10 corona10 force-pushed the gh-939-union branch 2 times, most recently from 1b1c557 to 4fc07a2 Compare April 18, 2019 09:34
b3 := Bound{Min: 1.0, Max: 2.0}
b4 := Bound{Min: 1.1, Max: 2.0}

ret := Union(b0)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kortschak

Shall I update this one also into union := Union(b0)?
My intent was the return value VS expected value for testing.

Copy link
Member

Choose a reason for hiding this comment

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

You can leave the tests. We usually use got for test results, but this will be rewritten to use tables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay!

@corona10
Copy link
Contributor Author

@kortschak Please take a look!

@corona10
Copy link
Contributor Author

@kortschak I've updated the CL. Please take a look

@kortschak kortschak merged commit 5e6a2d4 into gonum:master Apr 18, 2019
@btracey
Copy link
Member

btracey commented Apr 18, 2019

Is this function right? If we have [[0, 1], [2, 3], [0.5, 2.5]] this has a valid union of [0,3] but this algorithm will return NaN as far as I can see

@kortschak
Copy link
Member

I'll add that to the tests I'm going to write in the next couple of hours and fix it up. It needs to sort the bounds first and then walk them. Thanks for pointing it out. This is why I always use trees for this.

@corona10 corona10 deleted the gh-939-union branch April 19, 2019 01:01
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.

3 participants