Skip to content

Commit 56960d5

Browse files
committed
Update api.jl
1 parent c16f63f commit 56960d5

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

src/nlp/api.jl

+17-23
Original file line numberDiff line numberDiff line change
@@ -1300,37 +1300,31 @@ function hess_op!(
13001300
end
13011301

13021302
"""
1303-
P = tensor_projection(nlp, n, x, directions, args...)
1303+
p = tensor_projection(nlp, n, x, dimension, directions...)
1304+
p = tensor_projection(nlp, n, x, y, dimension, directions...)
13041305
1305-
Returns the projection of the n-th derivative of the objective of `nlp` at `x` along the specified directions.
1306+
Returns a vector `p` after `n-1` projections of the n-th derivative of the objective of `nlp` at `x` if only `x` is provided.
1307+
Otherwise when `x` and `y` are provided, we do `n-1` projections of the n-th derivative of the Lagrangian of `nlp` at `(x,y)`.
13061308
13071309
#### Input arguments
13081310
1309-
- `nlp`: An NLP model;
1311+
- `nlp`: An [`AbstractNLPModel`](@ref);
13101312
- `n`: The order of the derivative to compute;
1311-
- `x`: The point at which the derivative is evaluated;
1312-
- `directions`: 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(
1316-
nlp::AbstractNLPModel{T, S},
1317-
n::Int,
1318-
x::AbstractVector,
1319-
directions::Tuple{Int, Vararg{Int}},
1320-
args...
1321-
) where {T, S}
1322-
@lencheck nlp.meta.nvar x
1323-
m = n - length(directions)
1324-
@assert m 1
1325-
dim = NTuple{m, Int}(nlp.meta.nvar for i = 1:m)
1326-
P = similar(x, dim)
1327-
return tensor_projection!(nlp, n, x, directions, P, args...)
1328-
end
1313+
- `x`: The point at which the n-th derivative is evaluated;
1314+
- `dimension`: An integer that speficies the axis of the output subspace;
1315+
- `directions`: A collection of `n-1` directions for the projection.
1316+
1317+
#### Output argument
1318+
1319+
- `p`: vector storing the result of the tensor projection in the subspace represented by the axis `dimension`.
1320+
"""
1321+
function tensor_projection end
13291322

13301323
"""
1331-
tensor_projection!(nlp, n, x, directions, P, args...)
1324+
tensor_projection!(nlp, n, x, dimension, p, args...)
1325+
tensor_projection!(nlp, n, x, y, dimension, p, args...)
13321326
1333-
In-place version of the function [`tensor_projection`](@ref) where the result is stored in `P`.
1327+
In-place version of the function [`tensor_projection`](@ref) where the result is stored in `p`.
13341328
"""
13351329
function tensor_projection! end
13361330

0 commit comments

Comments
 (0)