ddg.optimize.ifs package
Submodules
Module contents
- ddg.optimize.ifs.wrap_functional(ifs, functional, gradient, cell_type, *attr_name, boundary=[])[source]
Returns a functional and a gradient function over ifs, both taking a flat array as input.
The resulting function will accept an array of length #(non-boundary-cells)*dim(attribute) and the columns corresponding to the boundary vertices of the jacobian/gradient will be removed.
- Parameters:
- ifsIndexedFaceSet
IndexedFaceSet to apply the function on
- functional: Callable
Functional to wrap into a flattened input format
- gradient: Callable
Gradient of the functional
- cell_type: {‘verts’, ‘edges’, ‘faces’}
Cell type of the attribute
- *attr_name: tuple of str
Name of the indexed faceset attribute(s) to use The first entry is assumed to be the parameters
- boundary: Iterable (default=[])
Vertices to ignore for applying new values
- Returns:
- wr_functionalCallable
Wrapped functional
- wr_gradientCallable
Wrapped jacobian/gradient
See also
wrap_function_ignore,wrap_function_remove
- ddg.optimize.ifs.flatten_functional_ignore(ifs, functional, cell_type, *attr_name, boundary=[])[source]
Returns a functional over ifs that takes a flat array as input. The resulting function will accept an array of length #cells*dim(attribute) and will ignore the values for boundary-cells.
- Parameters:
- ifsIndexedFaceSet
IndexedFaceSet to apply the function on
- functional: Callable
Functional to wrap into a flattened input format
- attr_name: str
Name of the indexed faceset attribute to use
- cell_type: {‘verts’, ‘edges’, ‘faces’}
Cell type of the attribute
- boundary: Iterable (default=[])
Vertices to ignore for applying new values
- Returns:
- Callable
Wrapped Function
See also
wrap_function_remove,wrap_functional
- ddg.optimize.ifs.flatten_functional(ifs, functional, cell_type, *attr_name, boundary=[])[source]
Returns a functional over ifs that takes a flat array as input. The resulting function will accept an array of length #(non-boundary-cells)*dim(attribute).
- Parameters:
- ifsIndexedFaceSet
IndexedFaceSet to apply the function on
- functional: Callable
Functional to wrap into a flattened input format
- cell_type: {‘verts’, ‘edges’, ‘faces’}
Cell type of the attribute
- attr_name: str
Name of the indexed faceset attribute to use
- boundary: Iterable (default=[])
Vertices to ignore for applying new values
- Returns:
- Callable
Wrapped Function
See also
wrap_function_ignore,wrap_functional
- ddg.optimize.ifs.minimize(ifs, functional, cell_type, *attr_name, boundary=[])[source]
Quick access for scipy.optimize.minimize for IndexedFaceSet functionals.
- Parameters:
- ifsIndexedFaceSet
indexed face set to optimize on
- functionalCallable
functional to optimize for
- cell_type{‘verts’, ‘edges’, ‘faces’}
cell type of the parameter attribute
- *attr_name
names of attributes to use in the functional. attr_name[0] is regarded as the only parameter attribute
- boundarylist (default = [])
list of boundary cells to ignore
- Returns:
- resscipy.optimize.OptimizeResult
See also
Notes
Similar to
wrap_functionalvalues for the boundary cells are removed from the signature of the flattened functional before the optimization step. The optimization method used is ‘L-BFGS-B’. For more information consult the scipy documentation.
- ddg.optimize.ifs.least_squares(ifs, functional, cell_type, *attr_name, boundary=[])[source]
Quick access for scipy.optimize.least_squares for IndexedFaceSet functionals.
- Parameters:
- ifsIndexedFaceSet
indexed face set to optimize on
- functionalCallable
functional to optimize for
- cell_type{‘verts’, ‘edges’, ‘faces’}
cell type of the parameter attribute
- *attr_name
names of attributes to use in the functional. attr_name[0] is regarded as the only parameter attribute
- boundarylist (default = [])
list of boundary cells to ignore
- Returns:
- resscipy.optimize.OptimizeResult
See also
Notes
Similar to
wrap_functionalvalues for the boundary cells are removed from the signature of the flattened functional before the optimization step.
- ddg.optimize.ifs.flatten_gradient(ifs, gradient, cell_type, *attr_name, boundary=[])[source]
Returns a gradient function over ifs that takes a flat array as input. The resulting function will accept an array of length #(non-boundary-cells)*dim(attribute).
- Parameters:
- ifsIndexedFaceSet
IndexedFaceSet to apply the function on
- gradient: Callable returning sparse matrices
Gradient to wrap into a flattened input format
- cell_type: {‘verts’, ‘edges’, ‘faces’}
Cell type of the attribute
- attr_name: str
Name of the indexed faceset attribute to use
- boundary: Iterable (default=[])
Vertices to ignore for applying new values
- Returns:
- Callable
Wrapped Function
See also
- ddg.optimize.ifs.flatten_gradient_ignore(ifs, gradient, cell_type, *attr_name, boundary=[])[source]
Returns a gradient function over ifs that takes a flat array as input. The resulting function will accept an array of length #cells*dim(attribute) and will ignore the values for boundary-cells.
- Parameters:
- ifsIndexedFaceSet
IndexedFaceSet to apply the function on
- gradient: Callable returning sparse matrices
Gradient to wrap into a flattened input format
- cell_type: {‘verts, ‘edges’, ‘faces’}
Cell type of the attribute
- attr_name: str
Name of the indexed faceset attribute to use
- boundary: Iterable (default=[])
Vertices to ignore for applying new values
- Returns:
- Callable
Wrapped Function
See also