# assembled_jacobian.py

# assembled_jacobian.py¶

Define the AssembledJacobian class.

classopenmdao.jacobians.assembled_jacobian.AssembledJacobian(matrix_class,system)[source]Bases:

`openmdao.jacobians.jacobian.Jacobian`

Assemble a global <Jacobian>.

- Parameters

matrix_classtypeClass to use to create internal matrices.

systemSystemParent system to this jacobian.

- Attributes

_view_rangesdictMaps system pathnames to jacobian sub-view ranges

_int_mtx<Matrix>Global internal Jacobian.

_ext_mtx{str: <Matrix>, …}External Jacobian for each viewing subsystem.

_mask_cachesdictContains masking arrays for when a subset of the variables are present in a vector, keyed by the input._names set.

_matrix_classtypeClass used to create Matrix objects.

_subjac_itersdictMapping of system pathname to tuple of lists of absolute key tuples used to index into the jacobian.

_in_rangesdictColumn ranges for inputs.

_out_rangesdictRow ranges for outputs.

- __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__(
matrix_class,system)[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 matrixsub-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

propertymsginfoReturn 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

systemSystemThe system that owns this jacobian.

icolintColumn index.

columnndarrayColumn value.

- set_complex_step_mode(
active)[source]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

activeboolComplex 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

systemSystemThe system that owns this jacobian.

jacndarrayDense jacobian.

classopenmdao.jacobians.assembled_jacobian.COOJacobian(system)[source]Bases:

`openmdao.jacobians.assembled_jacobian.AssembledJacobian`

Assemble sparse global <Jacobian> in Coordinate list format.

- Parameters

systemSystemParent system to this jacobian.

- __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)[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 matrixsub-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

propertymsginfoReturn 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

systemSystemThe system that owns this jacobian.

icolintColumn index.

columnndarrayColumn 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

activeboolComplex 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

systemSystemThe system that owns this jacobian.

jacndarrayDense jacobian.

classopenmdao.jacobians.assembled_jacobian.CSCJacobian(system)[source]Bases:

`openmdao.jacobians.assembled_jacobian.AssembledJacobian`

Assemble sparse global <Jacobian> in Compressed Col Storage format.

- Parameters

systemSystemParent system to this jacobian.

- __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)[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 matrixsub-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

propertymsginfoReturn 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

systemSystemThe system that owns this jacobian.

icolintColumn index.

columnndarrayColumn 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

activeboolComplex 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

systemSystemThe system that owns this jacobian.

jacndarrayDense jacobian.

classopenmdao.jacobians.assembled_jacobian.CSRJacobian(system)[source]Bases:

`openmdao.jacobians.assembled_jacobian.AssembledJacobian`

Assemble sparse global <Jacobian> in Compressed Row Storage format.

- Parameters

systemSystemParent system to this jacobian.

- __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)[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 matrixsub-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

propertymsginfoReturn 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.

- Parameters

systemSystemThe system that owns this jacobian.

icolintColumn index.

columnndarrayColumn value.

- set_complex_step_mode(
active)Turn on or off complex stepping mode.

- Parameters

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

- set_dense_jac(
system,jac)Assign a dense jacobian to this jacobian.

- Parameters

systemSystemThe system that owns this jacobian.

jacndarrayDense jacobian.

classopenmdao.jacobians.assembled_jacobian.DenseJacobian(system)[source]Bases:

`openmdao.jacobians.assembled_jacobian.AssembledJacobian`

Assemble dense global <Jacobian>.

- Parameters

systemSystemParent system to this jacobian.

- __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)[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 matrixsub-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

propertymsginfoReturn 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.

- Parameters

systemSystemThe system that owns this jacobian.

icolintColumn index.

columnndarrayColumn value.

- set_complex_step_mode(
active)Turn on or off complex stepping mode.

- Parameters

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

- set_dense_jac(
system,jac)Assign a dense jacobian to this jacobian.

- Parameters

systemSystemThe system that owns this jacobian.

jacndarrayDense jacobian.