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

Complex signalcorr #742

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

kagalenko-m-b
Copy link

@kagalenko-m-b kagalenko-m-b commented Nov 30, 2021

This PR aims to fix the issue #459. It mostly replaces functions' input type signatures by the less restrictive ones. To produce test vectors for autocovariance and autocorrelation, I added the file rcall_test.jl that defines test functions, relying on R via RCall.jl.

I also fixed durbin!() function so that it is now valid for complex inputs, and avoids the need for repeated invocation by keeping the results for the succession of solved linear systems.

src/signalcorr.jl Outdated Show resolved Hide resolved
test/signalcorr.jl Outdated Show resolved Hide resolved
test/signalcorr.jl Outdated Show resolved Hide resolved
test/signalcorr.jl Outdated Show resolved Hide resolved
src/toeplitzsolvers.jl Outdated Show resolved Hide resolved
src/toeplitzsolvers.jl Outdated Show resolved Hide resolved
src/toeplitzsolvers.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
@devmotion
Copy link
Member

I wonder if any of the implementations could benefit from RealDot.jl? It contains optimized implementations of real(dot(x, y)).

@kagalenko-m-b
Copy link
Author

@devmotion The function demean_col() should be considered broken and replaced because of this .

@devmotion
Copy link
Member

devmotion commented Nov 30, 2021

Not sure why you pinged me but this seems unrelated to this PR and not specific to complex inputs? It would be good to keep the PR minimal and just make the changes that are needed to support complex numbers. I would prefer if other issues are discussed separately or directly fixed in separate PRs. It would be important as well to keep all existing tests to ensure that no existing functionality is broken (as I mentioned also in this comment: #742 (comment)).

src/signalcorr.jl Outdated Show resolved Hide resolved
Copy link
Member

@devmotion devmotion left a comment

Choose a reason for hiding this comment

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

I had another look and my impression is that apart from the changes of the input types most changes should not be needed. The existing code for the matrix case is already efficient and reuses a cache, so allocations should not be reduced by this PR (in contrast, for the vector case it will always allocate an array now but doesn't currently).

src/signalcorr.jl Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
src/signalcorr.jl Outdated Show resolved Hide resolved
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!

Could you add tests for when the input array contains missing? Previously this was an error, but now that the signature is less strict we should ensure we don't return misleading results.

src/signalcorr.jl Outdated Show resolved Hide resolved
test/signalcorr_complex.jl Outdated Show resolved Hide resolved
test/rcall_test.jl Outdated Show resolved Hide resolved
src/toeplitzsolvers.jl Outdated Show resolved Hide resolved
src/toeplitzsolvers.jl Outdated Show resolved Hide resolved
src/toeplitzsolvers.jl Outdated Show resolved Hide resolved
src/toeplitzsolvers.jl Show resolved Hide resolved
src/toeplitzsolvers.jl Outdated Show resolved Hide resolved
test/signalcorr_complex.jl Outdated Show resolved Hide resolved
test/signalcorr_complex.jl Outdated Show resolved Hide resolved
@kagalenko-m-b kagalenko-m-b force-pushed the complex_signalcorr branch 2 times, most recently from 330fefb to af9e1dc Compare December 5, 2021 15:59
@nalimilan
Copy link
Member

Thanks, but you don't seem to have answered all my questions/comments.

@kagalenko-m-b
Copy link
Author

kagalenko-m-b commented Jan 13, 2022

Thanks, but you don't seem to have answered all my questions/comments.

I have not resolved this and this conversations, because I am not sure how to proceed. Those are similar - I added functions to generate complex test vectors. On one hand, those functions are not necessary to run the tests, they can be replaced by their outputs, and the one with RCall isn't used by the tests at all. On the other hand, they document the origin of the test vectors. For the second of those, it is present only in the complex case, because the real case already has test vectors. So, as a maintainer, please indicate your preference for the best way to resolve this. It can be as simple as deleting those parts from PR, because they are really a kind of documentation and need not to be run.

@kagalenko-m-b
Copy link
Author

Thanks, but you don't seem to have answered all my questions/comments.

In the latest revision I have removed all parts that caused questions. Now this PR is streamlined - it does nothing other than correct function signatures and revise the Durbin algorithm to make it valid for complex inputs. The tests with the nightly Julia are failing, but not on the parts that I touched.

@kagalenko-m-b
Copy link
Author

Rebased on the latest master, any chance of having this merged?

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.

4 participants