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 f(x) = A*x, A\x #11

Merged
merged 6 commits into from
Aug 31, 2022
Merged

Add f(x) = A*x, A\x #11

merged 6 commits into from
Aug 31, 2022

Conversation

alyst
Copy link
Contributor

@alyst alyst commented Jul 20, 2022

The PR adds f(x) = A*x and f(x) = A\x functions, where A is a constant matrix, and x is either a vector or a matrix.
For vector arguments, the new VECTOR_TO_VECTOR_FUNCS list of test functions is introduced.

The tested A matrices are: diagonal, dense, lower and upper triangular. The last three matrix types are represented by the Lehmer matrix.

In particular, the A\x functions are useful to test the autodiff of multivariate normal distribution.
This PR would be required to properly test JuliaDiff/ForwardDiff.jl#589 (so when/if merged, the version number of DiffTools.jl has to be updated).

@alyst
Copy link
Contributor Author

alyst commented Jul 21, 2022

@oxinabox @fredrikekre Could some of you please review this PR, so we can move forward with JuliaDiff/ForwardDiff.jl#589? Thank you!

@alyst
Copy link
Contributor Author

alyst commented Aug 2, 2022

@mateuszbaran @mohamed82008 Could you pls take a look?

src/DiffTests.jl Outdated
Comment on lines 260 to 262
hilbert_matrix(::Type{T}, n::Integer) where T<:Real =
[convert(T, inv(i + j - 1)) for i in 1:n, j in 1:n]
hilbert_matrix(x::VecOrMat) = hilbert_matrix(Float64, size(x, 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

This function doesn't seem to be used anywhere in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function doesn't seem to be used anywhere in this PR.

Yes, it doesn't. I was undecided which constant matrix to use, it looked like with this one the errors are higher (it is beyond my capability to track and possibly fix the source of that errors).
I can remove, if it is critical, but maybe it is better to keep it, anticipating the future extension of the test coverage.

Copy link
Contributor

Choose a reason for hiding this comment

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

I generally think keeping unused code in the main branch should be avoided. Everything else looks fine though in case someone with merge rights cares about my opinion 🙂 .

Copy link
Member

Choose a reason for hiding this comment

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

I agree, this should be removed before we can merge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@oxinabox done

@alyst
Copy link
Contributor Author

alyst commented Aug 17, 2022

@oxinabox @fredrikekre gentle ping to anyone with PR merge rights :) Please help me to reduce the stack of dependent PRs that I have accumulated :)

@alyst
Copy link
Contributor Author

alyst commented Aug 29, 2022

@oxinabox Gentle ping :) I have removed the unused test function; also I have added the sparse variants of the new test functions.
Could you please merge if there are no further adjustments to make?

@oxinabox oxinabox merged commit 3771108 into JuliaDiff:master Aug 31, 2022
@alyst
Copy link
Contributor Author

alyst commented Aug 31, 2022

@oxinabox Thanks! Can you tag a new release?

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