@@ -1300,37 +1300,31 @@ function hess_op!(
1300
1300
end
1301
1301
1302
1302
"""
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...)
1304
1305
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)`.
1306
1308
1307
1309
#### Input arguments
1308
1310
1309
- - `nlp`: An NLP model ;
1311
+ - `nlp`: An [`AbstractNLPModel`](@ref) ;
1310
1312
- `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
1329
1322
1330
1323
"""
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...)
1332
1326
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 `.
1334
1328
"""
1335
1329
function tensor_projection! end
1336
1330
0 commit comments