Skip to content

Commit e102d7c

Browse files
committed
Add an API for n-th order tensor products
1 parent 04409d4 commit e102d7c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/nlp/api.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export jth_hess_coord, jth_hess_coord!, jth_hess
1111
export jth_hprod, jth_hprod!, ghjvprod, ghjvprod!
1212
export hess_structure!, hess_structure, hess_coord!, hess_coord
1313
export hess, hprod, hprod!, hess_op, hess_op!
14+
export tensor_projection
1415
export varscale, lagscale, conscale
1516

1617
"""
@@ -1298,6 +1299,21 @@ function hess_op!(
12981299
return LinearOperator{T}(nlp.meta.nvar, nlp.meta.nvar, true, true, prod!, prod!, prod!)
12991300
end
13001301

1302+
"""
1303+
P = tensor_projection(nlp, n, x, directions, args...)
1304+
1305+
Returns the projection of the n-th derivative of the objective of `nlp` at `x` along the specified directions.
1306+
1307+
#### Input arguments
1308+
1309+
- `nlp::AbstractNLPModel`: An NLP model;
1310+
- `n::Int`: The order of the derivative to compute;
1311+
- `x::AbstractVector`: The point at which the derivative is evaluated;
1312+
- `directions::Tuple{Int, Vararg{Int}}`: A tuple of indices specifying the directions (e.g., `(1, 2)` for a tensor projection along the first and second axes);
1313+
- `args...`: A list of vectors, one for each direction specified in `directions`.
1314+
"""
1315+
function tensor_projection end
1316+
13011317
function varscale end
13021318
function lagscale end
13031319
function conscale end

0 commit comments

Comments
 (0)