Skip to content

Conversation

@bkamins
Copy link
Contributor

@bkamins bkamins commented Jan 3, 2021

As in cor we get square root I think it is safe to assume that the result should be floating point.

An example of current surprising behavior:

julia> cor([im])
true

As in `cor` we get square root I think it is safe to assume that the result should be floating point.

An example of current surprising behavior:
```
julia> cor([im])
true
```
Copy link
Member

@nalimilan nalimilan left a comment

Choose a reason for hiding this comment

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

Thanks!

@nalimilan
Copy link
Member

Though could you add a test to check the new behavior?

@bkamins
Copy link
Contributor Author

bkamins commented Jan 3, 2021

A good point - I have added the tests. They highlight the cases that I think are critical. A check that in all cases we produce what we think should be produced is welcome (I think they are not always intuitive, but I made the PR to be non-breaking in these corner cases except changing the type of 1 produced).

@nalimilan nalimilan closed this Jan 3, 2021
@nalimilan nalimilan reopened this Jan 3, 2021
@codecov-io
Copy link

codecov-io commented Jan 3, 2021

Codecov Report

❗ No coverage uploaded for pull request base (master@7a0c0d1). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##             master     #61   +/-   ##
========================================
  Coverage          ?   0.00%           
========================================
  Files             ?       1           
  Lines             ?     381           
  Branches          ?       0           
========================================
  Hits              ?       0           
  Misses            ?     381           
  Partials          ?       0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a0c0d1...c6bfe2f. Read the comment docs.

@nalimilan
Copy link
Member

I just noticed corm and corzm have similar definitions. I guess these should be changed too, right?

@nalimilan nalimilan requested a review from stevengj January 9, 2021 14:12
@nalimilan
Copy link
Member

@stevengj You introduced this definition at JuliaLang/julia#13348, replacing float(one(T) * one(T)) with real(one(T)). Yet cor([1im, 2im], [1im, 2im]) returns 1.0 + 0.0im, not 1.0. I guess nobody really tested nor care about this use case. What do you think we should do? We could also use float(real(one(T)) to minimize breakage; what matters is that cor([1, 2]) returns 1.0, not 1.

@bkamins
Copy link
Contributor Author

bkamins commented Jan 9, 2021

I guess these should be changed too, right?

What do you mean exactly? I have already changed corm and corzm in this PR (and added tests for this).

@nalimilan
Copy link
Member

What do you mean exactly? I have already changed corm and corzm in this PR (and added tests for this).

Woops, forget it, I was just confused.

@nalimilan
Copy link
Member

@stevengj Any chance you could find the time to look at this?

@nalimilan nalimilan merged commit 27a63ae into JuliaStats:master Feb 13, 2021
@bkamins bkamins deleted the patch-2 branch February 13, 2021 18:32
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