11using Manopt, ManifoldsBase, Test
2- using Manopt: get_value, get_value_function, get_gradient_function
2+ using Manopt: get_value, get_value!, get_value_function, get_gradient_function
33@testset " VectorialGradientCost" begin
44 M = ManifoldsBase. DefaultManifold (3 )
55 g (M, p) = [p[1 ] - 1 , - p[2 ] - 1 ]
@@ -94,6 +94,12 @@ using Manopt: get_value, get_value_function, get_gradient_function
9494 @test get_value (M, vgf, p) == c
9595 @test get_value (M, vgf, p, :) == c
9696 @test get_value (M, vgf, p, 1 ) == c[1 ]
97+ ca = similar (c)
98+ get_value! (M, ca, vgf, p, :)
99+ @test ca == c
100+ ci = similar ([c[1 ]])
101+ get_value! (M, ci, vgf, p, 1 )
102+ @test ci[1 ] == c[1 ]
97103 if ! (vgf isa VectorDifferentialFunction)
98104 # range access not yet implemented / too expensive for VDF
99105 @test get_gradient (M, vgf, p) == gg
@@ -118,11 +124,24 @@ using Manopt: get_value, get_value_function, get_gradient_function
118124 j2 = similar (j1)
119125 get_jacobian! (M, j2, vgf, p, X, b)
120126 @test j2 == j1
127+ # and without basis
128+ j3 = get_jacobian (M, vgf, p, X)
129+ @test j3 == jX
130+ j4 = similar (j3)
131+ get_jacobian! (M, j4, vgf, p, X)
132+ @test j3 == j4
133+ # Adjoint cases
121134 aj1 = get_adjoint_jacobian (M, vgf, p, c, b)
122135 @test aj1 == jc
123136 aj2 = similar (aj1)
124137 get_adjoint_jacobian! (M, aj2, vgf, p, c, b)
125138 @test aj2 == aj1
139+ # and without basis
140+ aj3 = get_adjoint_jacobian (M, vgf, p, c)
141+ @test aj3 == jc
142+ aj4 = similar (aj3)
143+ get_adjoint_jacobian! (M, aj4, vgf, p, c)
144+ @test aj3 == aj4
126145 # Jacobian Matrix access
127146 J = get_jacobian (M, vgf, p)
128147 J2 = zeros (2 , 3 )
0 commit comments