MCPcopy Create free account
hub / github.com/bgrimstad/splinter / eval_hessian

Method eval_hessian

python/splinter/function.py:43–58  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

41 return jacobians
42
43 def eval_hessian(self, x):
44 x = self._transform_input(x)
45
46 num_points = len(x) // self._num_variables
47 hes = splinter._call(splinter._get_handle().splinter_bspline_eval_hessian_row_major, self._handle, (c_double * len(x))(*x), len(x))
48
49 # Convert from ctypes array to Python list of list of lists
50 # hessians is a list of the hessians in all points
51 hessians = []
52 for i in range(num_points):
53 hessians.append([])
54 for j in range(self._num_variables):
55 hessians[i].append([])
56 for k in range(self._num_variables):
57 hessians[i][j].append(hes[i * self._num_variables * self._num_variables + j * self._num_variables + k])
58 return hessians
59
60 def get_num_variables(self):
61 return splinter._call(splinter._get_handle().splinter_bspline_get_num_variables, self._handle)

Callers

nothing calls this directly

Calls 2

_transform_inputMethod · 0.95
_get_handleMethod · 0.80

Tested by

no test coverage detected