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 an API for n-th order tensor products #486

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

amontoison
Copy link
Member

Copy link
Member

@tmigot tmigot left a comment

Choose a reason for hiding this comment

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

Thanks guys for starting this! This is a first batch of comments.

src/nlp/api.jl Outdated
"""
P = tensor_projection(nlp, n, x, directions, args...)

Returns the projection of the n-th derivative of the objective of `nlp` at `x` along the specified directions.
Copy link
Member

Choose a reason for hiding this comment

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

What about tensor_projection ?
You should also have
P = tensor_projection(nlp, n, x, y, directions, args...)
as the default, where by default
P = tensor_projection(nlp, n, x, directions, args...)
call the first one with zeros(n).

Copy link
Member Author

@amontoison amontoison Nov 23, 2024

Choose a reason for hiding this comment

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

I agree that it will be great to have tensor products with both the objective and the Lagrangian.
Should we also add an API for just the constraints, or include a scaling factor \alpha that can go in front of the objective?
\alpha can be zero.

Copy link
Member

Choose a reason for hiding this comment

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

I think it makes sense to be coherent with the other functions like hprod.

src/nlp/api.jl Outdated
) where {T, S}
@lencheck nlp.meta.nvar x
m = n - length(directions)
@assert m ≥ 1
Copy link
Member

Choose a reason for hiding this comment

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

Can we use NLPModels.@rangecheck instead of @Assert ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can we use rangecheck to ensure inequalities?

Copy link
Member

Choose a reason for hiding this comment

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

Not tested, but I would expect @rangecheck 1 typemax(Int) m to work

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.

2 participants