gradinit [ad]
— Loadable Function: g = gradinit (x)

Create a gradient with value x and derivative eye(numel(x))

Substituting x -> g in an analytical expression F depending on x will then produce at once F(x) and the jacobian DF(x). See example below:

          a = gradinit ([1; 2]);
          b = [a.' * a; 2 * a]
          
          b =
          
          value =
          
            5
            2
            4
          
          (partial) derivative(s) =
          
            2  4
            2  0
            0  2

Members can be accessed by suffixing the variable with .x and .J respectively

" )