# dictionary_jacobian.py¶

Define the DictionaryJacobian class.

class openmdao.jacobians.dictionary_jacobian.DictionaryJacobian(system, **kwargs)[source]

Bases: openmdao.jacobians.jacobian.Jacobian

No global <Jacobian>; use dictionary of user-supplied sub-Jacobians.

Parameters
systemSystem

Parent system to this jacobian.

**kwargsdict

Options dictionary.

Attributes
_iter_keyslist of (vname, vname) tuples

List of tuples of variable names that match subjacs in the this Jacobian.

_is_explicitbool

True if corresponding system is an ExplicitComponent

__contains__(key)

Return whether there is a subjac for the given promoted or relative name pair.

Parameters
key(str, str)

Promoted or relative name pair of sub-Jacobian.

Returns
bool

return whether sub-Jacobian has been defined.

__getitem__(key)

Get sub-Jacobian.

Parameters
key(str, str)

Promoted or relative name pair of sub-Jacobian.

Returns
ndarray or spmatrix or list[3]

sub-Jacobian as an array, sparse mtx, or AIJ/IJ list or tuple.

__init__(system, **kwargs)[source]

Initialize all attributes.

__iter__()

Yield next name pair of sub-Jacobian.

Yields
str
__setitem__(key, subjac)

Set sub-Jacobian.

Parameters
key(str, str)

Promoted or relative name pair of sub-Jacobian.

subjacint or float or ndarray or sparse matrix

sub-Jacobian as a scalar, vector, array, or AIJ list or tuple.

items()

Yield name pair and value of sub-Jacobian.

Yields
str
keys()

Yield next name pair of sub-Jacobian.

Yields
str
property msginfo

Return info to prepend to messages.

Returns
str

Info to prepend to messages.

set_col(system, icol, column)

Set a column of the jacobian.

The column is assumed to be the same size as a column of the jacobian.

This also assumes that the column does not attempt to set any nonzero values that are outside of specified sparsity patterns for any of the subjacs.

Parameters
systemSystem

The system that owns this jacobian.

icolint

Column index.

columnndarray

Column value.

set_complex_step_mode(active)

Turn on or off complex stepping mode.

When turned on, the value in each subjac is cast as complex, and when turned off, they are returned to real values.

Parameters
activebool

Complex mode flag; set to True prior to commencing complex step.

set_dense_jac(system, jac)

Assign a dense jacobian to this jacobian.

This assumes that any column does not attempt to set any nonzero values that are outside of specified sparsity patterns for any of the subjacs.

Parameters
systemSystem

The system that owns this jacobian.

jacndarray

Dense jacobian.