You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1306,13 +1306,33 @@ Returns the projection of the n-th derivative of the objective of `nlp` at `x` a
1306
1306
1307
1307
#### Input arguments
1308
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);
1309
+
- `nlp`: An NLP model;
1310
+
- `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
1313
- `args...`: A list of vectors, one for each direction specified in `directions`.
1314
1314
"""
1315
-
function tensor_projection end
1315
+
functiontensor_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
+
returntensor_projection!(nlp, n, x, directions, P, args...)
1328
+
end
1329
+
1330
+
"""
1331
+
tensor_projection!(nlp, n, x, directions, P, args...)
1332
+
1333
+
In-place version of the function [`tensor_projection`](@ref) where the result is stored in `P`.
0 commit comments