API Reference
OpenMDAOCore.DenseADExplicitComp — TypeDenseADExplicitComp{InPlace,TAD,TCompute,TX,TY,TJ,TPrep,TXCS,TYCS,TAMD} <: AbstractExplicitComp{InPlace}An <:AbstractADExplicitComp for dense Jacobians.
Fields
ad_backend::TAD:<:ADTypes.AbstractADTypeautomatic differentation "backend" librarycompute_adable::TCompute: function of the formcompute_adable(Y, X)orY = compute_adable(x)compatible with DifferentiationInterface.jl that performs the desired computation, whereYandXareComponentVectors of outputs and inputs, respectivelyX_ca::ComponentVector:ComponentVectorof inputsY_ca::ComponentVector:ComponentVectorof outputsJ_ca::ComponentMatrix: DenseComponentMatrixof the Jacobian ofY_cawith respect toX_caunits_dict::Dict{Symbol,String}: mapping of variable names to units. Can be an emptyDictif units are not desired.tags_dict::Dict{Symbol,Vector{String}: mapping of variable names toVectors ofStrings specifing variable tags.shape_by_conn_dict::Dict{Symbol,Bool}: mapping of variable names toBoolindicating if the variable shape should be determined dynamically by a connection.copy_shape_dict::Dict{Symbol,Symbol}: mapping of variable names to variable names indicating if a variable shape should be copied from another variable.aviary_input_names::Dict{Symbol,String}: mapping of input variable names to Aviary names.aviary_output_names::Dict{Symbol,String}: mapping of output variable names to Aviary names.aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the"units"and"default_value"fields are used.prep::DifferentiationInterface.JacobianPrep:DifferentiationInterface.jl"preparation" objectX_ca::ComponentVector:ComplexF64version ofX_ca(for the complex-step method)Y_ca::ComponentVector:ComplexF64version ofY_ca(for the complex-step method)
OpenMDAOCore.DenseADExplicitComp — MethodDenseADExplicitComp(ad_backend, f!, Y_ca::ComponentVector, X_ca::ComponentVector; params=nothing, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), force_skip_prep=false, aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())Create a DenseADExplicitComp from a user-defined function and output and input ComponentVectors.
Positional Arguments
ad_backend:<:ADTypes.AbstractADTypeautomatic differentation "backend" libraryf!: function of the formf!(Y_ca, X_ca, params)which writes outputs toY_causing inputsX_caand, optionally, parametersparams.Y_ca:ComponentVectorof outputsX_ca:ComponentVectorof inputs
Keyword Arguments
params: parameters passed to the third argument tof!. Could be anything, ornothing, but the derivatives ofY_cawith respect toparamswill not be calculatedunits_dict:Dictmapping variable names (asSymbols) to OpenMDAO units (expressed asStrings)tags_dict:Dictmapping variable names (asSymbols) toVectors of OpenMDAO tagsshape_by_conn_dict:Dictmapping variable names (asSymbols) toBools indicating if the variable's shape (size) will be set dynamically by a connectioncopy_shape_dict:Dictmapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbolforce_skip_prep: if true, defer creating internal arrays and other structs until the user callsupdate_prep!aviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary input variables.aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary output variables.aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the"units"and"default_value"fields are used.
OpenMDAOCore.DenseADExplicitComp — MethodDenseADExplicitComp(ad_backend, f, X_ca::ComponentVector; params=nothing, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), force_skip_prep=false, aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())Create a DenseADExplicitComp from a user-defined function and output and input ComponentVectors.
Positional Arguments
ad_backend:<:ADTypes.AbstractADTypeautomatic differentation "backend" libraryf: function of the formY_ca = f(X_ca, params)which returns outputsY_causing inputsX_caand, optionally, parametersparams.X_ca:ComponentVectorof inputs
Keyword Arguments
params: parameters passed to the third argument tof!. Could be anything, ornothing, but the derivatives ofY_cawith respect toparamswill not be calculatedunits_dict:Dictmapping variable names (asSymbols) to OpenMDAO units (expressed asStrings)tags_dict:Dictmapping variable names (asSymbols) toVectors of OpenMDAO tagsshape_by_conn_dict:Dictmapping variable names (asSymbols) toBools indicating if the variable's shape (size) will be set dynamically by a connectioncopy_shape_dict:Dictmapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbolforce_skip_prep: if true, defer creating internal arrays and other structs until the user callsupdate_prep!aviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary input variables.aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary output variables.aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the"units"and"default_value"fields are used.
OpenMDAOCore.MatrixFreeADExplicitComp — MethodMatrixFreeADExplicitComp(ad_backend, f!, Y_ca::ComponentVector, X_ca::ComponentVector; params=nothing, force_mode="", disable_prep=false, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())Create a MatrixFreeADExplicitComp from a user-defined function and output and input ComponentVectors.
Positional Arguments
ad_backend:<:ADTypes.AbstractADTypeautomatic differentation "backend" libraryf!: function of the formf!(Y_ca, X_ca, params)which writes outputs toY_causing inputsX_caand, optionally, parametersparams.Y_ca:ComponentVectorof outputsX_ca:ComponentVectorof inputs
Keyword Arguments
params: parameters passed to the third argument tof!. Could be anything, ornothing, but the derivatives ofY_cawith respect toparamswill not be calculatedforce_mode="": If"fwd", useDifferentiationInterface.pushforward!to compute the derivatives (aka perform a Jacobian-vector product). If"rev", useDifferentiationInterface.pullback!to compute the derivatives (aka perform a vector-Jacobian product). If"", use whatever would be faster, as determined byDifferentiationInterface.pushforward_performanceandDifferentiationInterface.pullback_performance, preferingpushforward.disable_prep: iftrue, do not use eitherprepare_pushforwardorprepare_pullbackto create aDifferentiationInterface.PushforwardPreporPullbackPrepobject to accelerate the derivative calculation. Disabling prep can avoid correctness issues with ReverseDiff.jl, see the discussion of branching and theAbstractTapeAPI.units_dict:Dictmapping variable names (asSymbols) to OpenMDAO units (expressed asStrings)tags_dict:Dictmapping variable names (asSymbols) toVectors of OpenMDAO tagsshape_by_conn_dict:Dictmapping variable names (asSymbols) toBools indicating if the variable's shape (size) will be set dynamically by a connectioncopy_shape_dict:Dictmapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbolaviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary input variables.aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary output variables.aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the"units"and"default_value"fields are used.
OpenMDAOCore.MatrixFreeADExplicitComp — MethodMatrixFreeADExplicitComp(ad_backend, f, X_ca::ComponentVector; params=nothing, force_mode="", disable_prep=false, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())Create a MatrixFreeADExplicitComp from a user-defined function and output and input ComponentVectors.
Positional Arguments
ad_backend:<:ADTypes.AbstractADTypeautomatic differentation "backend" libraryf: function of the formY_ca = f(X_ca, params)which returns outputsY_causing inputsX_caand, optionally, parametersparams.X_ca:ComponentVectorof inputs
Keyword Arguments
params: parameters passed to the third argument tof!. Could be anything, ornothing, but the derivatives ofY_cawith respect toparamswill not be calculatedforce_mode="": If"fwd", useDifferentiationInterface.pushforward!to compute the derivatives (aka perform a Jacobian-vector product). If"rev", useDifferentiationInterface.pullback!to compute the derivatives (aka perform a vector-Jacobian product). If"", use whatever would be faster, as determined byDifferentiationInterface.pushforward_performanceandDifferentiationInterface.pullback_performance, preferingpushforward.disable_prep: iftrue, do not use eitherprepare_pushforwardorprepare_pullbackto create aDifferentiationInterface.PushforwardPreporPullbackPrepobject to accelerate the derivative calculation. Disabling prep can avoid correctness issues with ReverseDiff.jl, see the discussion of branching and theAbstractTapeAPI.units_dict:Dictmapping variable names (asSymbols) to OpenMDAO units (expressed asStrings)tags_dict:Dictmapping variable names (asSymbols) toVectors of OpenMDAO tagsshape_by_conn_dict:Dictmapping variable names (asSymbols) toBools indicating if the variable's shape (size) will be set dynamically by a connectioncopy_shape_dict:Dictmapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbolaviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary input variables.aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary output variables.aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the"units"and"default_value"fields are used.
OpenMDAOCore.PartialsData — TypePartialsData(of::String, wrt::String; <keyword arguments>)Create a PartialsData object for the derivative of variable of with respect to variable wrt.
PartialsData objects are used to construct arguments to OpenMDAO's Component.declare_partials method. Specifically, a PartialsData object pd will eventually be used to call Component.declare_partials like this:
Component.declare_partials(pd.of, pd.wrt, rows=pd.rows, cols=pd.cols, val=pd.val, method=pd.method)The of and wrt positional arguments are required and set the of and wrt fields. The value of the other PartialsData fields (e.g., pd.rows, pd.val, etc.) are set via constructor keyword arguments, here:
Keyword Arguments
rows::Union{<:AbstractVector{Int64},Nothing} = nothing: row indices for each non-zero Jacobian entry, if notnothing.cols::Union{<:AbstractVector{Int64},Nothing} = nothing: column indices for each non-zero Jacobian entry, if notnothing.val::Union{Float64,<:AbstractArray{Float64},Nothing} = nothing: value of Jacobian, if notnothing.method::String = "exact": method use to calcluate the partial derivative(s). Should be one of"exact": user-defined partial derivatives viacompute_partials!,linearize!, etc."fd": finite difference approximation"cs": complex step approximation
OpenMDAOCore.PerturbedDenseSparsityDetector — TypePerturbedDenseSparsityDetectorTweaked version of DenseSparsityDetector sparsity pattern detector satisfying the detection API of ADTypes.jl that evaluates the Jacobian multiple times using a perturbed input vector. Specifically, input vector x will be perturbed via
x_perturb = (1 .+ rel_x_perturb.*perturb1).*x .+ perturb2.*abs_x_perturbwhere perturb1 and perturb2 are random Vectors of numbers ranging from -0.5 to 0.5, and rel_x_perturb and abs_x_perturb are relative and absolute perturbation magnitudes specified by the user.
All of the caveats associated with the performance of DenseSparsityDetector apply to PerturbedDenseSparsityDetector, since it essentially does the same thing as DenseSparsityDetector multiple times. The nonzeros in a Jacobian or Hessian are detected by computing the relevant matrix with dense AD, and thresholding the entries with a given tolerance (which can be numerically inaccurate). This process can be very slow, and should only be used if its output can be exploited multiple times to compute many sparse matrices.
In general, the sparsity pattern you obtain can depend on the provided input x. If you want to reuse the pattern, make sure that it is input-agnostic. Perturbing the input vector should hopefully guard against getting "unlucky" and finding zero Jacobian entries that aren't actually zero for all x, but is of course problem-dependent.
Fields
backend::AbstractADTypeis the dense AD backend used under the hoodatol::Float64is the minimum magnitude of a matrix entry to be considered nonzeronevals::Int=3is the number of times the Jacobian will be evaluated using the perturbed inputxrel_x_perturb=0.001: is the relative magnitude of thexperturbation.
Constructor
PerturbedDenseSparsityDetector(backend; atol, method=:iterative, nevals=3, rel_x_perturb=0.001, abs_x_perturb=0.0001)The keyword argument method::Symbol can be either:
:iterative: compute the matrix in a sequence of matrix-vector products (memory-efficient):direct: compute the matrix all at once (memory-hungry but sometimes faster).
Note that the constructor is type-unstable because method ends up being a type parameter of the PerturbedDenseSparsityDetector object (this is not part of the API and might change).
OpenMDAOCore.SparseADExplicitComp — TypeSparseADExplicitComp{InPlace,TAD,TCompute,TX,TY,TJ,TPrep,TXCS,TYCS,TAMD} <: AbstractExplicitComp{InPlace}An <:AbstractADExplicitComp for sparse Jacobians.
Fields
ad_backend::TAD:<:ADTypes.AutoSparseautomatic differentation "backend" librarycompute_adable::TCompute: function of the formcompute_adable(Y, X)compatible with DifferentiationInterface.jl that performs the desired computation, whereYandXareComponentVectors of outputs and inputs, respectivelyX_ca::ComponentVector:ComponentVectorof inputsY_ca::ComponentVector:ComponentVectorof outputsJ_ca_sparse::ComponentMatrix: SparseComponentMatrixof the Jacobian ofY_cawith respect toX_caunits_dict::Dict{Symbol,String}: mapping of variable names to units. Can be an emptyDictif units are not desired.tags_dict::Dict{Symbol,Vector{String}: mapping of variable names toVectors ofStrings specifing variable tags.shape_by_conn_dict::Dict{Symbol,Bool}: mapping of variable names toBoolindicating if the variable shape should be determined dynamically by a connection.aviary_input_names::Dict{Symbol,String}: mapping of input variable names to Aviary names.aviary_output_names::Dict{Symbol,String}: mapping of output variable names to Aviary names.aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the"units"and"default_value"fields are used.prep::DifferentiationInterface.JacobianPrep:DifferentiationInterface.jl"preparation" objectrcdict:Dict{Tuple{Symbol,Sympol}, Tuple{Vector{Int}, Vector{Int}}mapping sub-Jacobians of the form(:output_name, :input_name)toVectors of non-zero row and column indices (1-based)X_ca::ComponentVector:ComplexF64version ofX_ca(for the complex-step method)Y_ca::ComponentVector:ComplexF64version ofY_ca(for the complex-step method)
OpenMDAOCore.SparseADExplicitComp — MethodSparseADExplicitComp(ad_backend, f!, Y_ca::ComponentVector, X_ca::ComponentVector; params=nothing, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), force_skip_prep=false, aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())Create a SparseADExplicitComp from a user-defined function and output and input ComponentVectors.
Positional Arguments
ad_backend:<:ADTypes.AutoSparseautomatic differentation "backend" libraryf!: function of the formf!(Y_ca, X_ca, params)which writes outputs toY_causing inputsX_caand, optionally, parametersparams.Y_ca:ComponentVectorof outputsX_ca:ComponentVectorof inputs
Keyword Arguments
params: parameters passed to the third argument tof!. Could be anything, ornothing, but the derivatives ofY_cawith respect toparamswill not be calculatedunits_dict:Dictmapping variable names (asSymbols) to OpenMDAO units (expressed asStrings)tags_dict:Dictmapping variable names (asSymbols) toVectors of OpenMDAO tagsshape_by_conn_dict:Dictmapping variable names (asSymbols) toBools indicating if the variable's shape (size) will be set dynamically by a connectioncopy_shape_dict:Dictmapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbolforce_skip_prep: if true, defer creating internal arrays and other structs until the user callsupdate_prep!aviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary input variables.aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary output variables.aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the"units"and"default_value"fields are used.
OpenMDAOCore.SparseADExplicitComp — MethodSparseADExplicitComp(ad_backend, f, X_ca::ComponentVector; params=nothing, units_dict=Dict{Symbol,String}(), tags_dict=Dict{Symbol,Vector{String}}(), shape_by_conn_dict=Dict{Symbol,Bool}(), copy_shape_dict=Dict{Symbol,Symbol}(), force_skip_prep=false, aviary_input_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_output_vars=Dict{Symbol,Dict{String,<:Any}}(), aviary_meta_data=Dict{String,Any}())Create a SparseADExplicitComp from a user-defined function and output and input ComponentVectors.
Positional Arguments
ad_backend:<:ADTypes.AutoSparseautomatic differentation "backend" libraryf: function of the formY_ca = f(X_ca, params)which returns outputsY_causing inputsX_caand, optionally, parametersparams.X_ca:ComponentVectorof inputs
Keyword Arguments
params: parameters passed to the third argument tof!. Could be anything, ornothing, but the derivatives ofY_cawith respect toparamswill not be calculatedunits_dict:Dictmapping variable names (asSymbols) to OpenMDAO units (expressed asStrings)tags_dict:Dictmapping variable names (asSymbols) toVectors of OpenMDAO tagsshape_by_conn_dict:Dictmapping variable names (asSymbols) toBools indicating if the variable's shape (size) will be set dynamically by a connectioncopy_shape_dict:Dictmapping variable names to other variable names indicating the "key" symbol should take its size from the "value" symbolforce_skip_prep: if true, defer creating internal arrays and other structs until the user callsupdate_prep!aviary_input_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of input variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary input variables.aviary_output_vars::Dict{Symbol,Dict{String,<:Any}}: mapping of output variable names to aDictthat contains keysnameand optionallyshapedefining the Aviary name and shape for Aviary output variables.aviary_meta_data::Dict{String,Any}: mapping of Aviary variable names to aviary metadata. Currently only the"units"and"default_value"fields are used.
OpenMDAOCore.VarData — TypeVarData(name::String; <keyword arguments>)Create a VarData object for an OpenMDAO variable named name.
VarData objects are used to construct arguments to OpenMDAO's Component.add_input and Component.add_output methods. Specifically, if a VarData object var refers to an input variable, the Component.add_input call will look like this:
Component.add_input(var.name, shape=var.shape, val=var.val, units=var.units, tags=var.tags, shape_by_conn=var.shape_by_conn)and if the VarData object var is an output variable, the Component.add_output call will look like this:
Component.add_output(var.name, shape=var.shape, val=var.val, units=var.units, lower=var.lower, upper=var.upper, tags=var.tags, shape_by_conn=var.shape_by_conn)The name positional argument is required and sets the name field. The value of the other VarData fields (e.g., var.shape, var.val, etc.) are set via constructor keyword arguments, here:
Keyword Arguments
val::Union{Float64,<:AbstractArray{Float64},Nothing} = 1.0: variable's default value, set to1.0ifnothing.shape::Union{Int64,NTuple{N,Int64},Nothing} = (1,): variable shape, set to(1,)ifnothing.units::Union{String,Nothing} = nothing: variable units.lower::Union{Float64,<:AbstractArray{Float64,N},Nothing} = nothing: variable's lower limit.upper::Union{Float64,<:AbstractArray{Float64,N},Nothing} = nothing: variable's upper limit.tags::Union{<:AbstractVector{String},Nothing} = nothing: variable tags.shape_by_conn::Bool = false: iftrue, shape this variable by its connected output (if an input) or input (if an output)copy_shape::Union{String,Nothing} = nothing: if a string, shape this variable by the local variable indicated bycopy_shape
OpenMDAOCore.get_rows_cols — Methodget_rows_cols(; ss_sizes::Dict{Symbol, Int}, of_ss::AbstractVector{Symbol}, wrt_ss::AbstractVector{Symbol})Get the non-zero row and column indices for a sparsity pattern defined by output subscripts of_ss and input subscripts wrt_ss.
ss_sizes is a Dict mapping the subscript symbols in of_ss and wrt_ss to the size of each dimension the subscript symbols correspond to. The returned indices will be zero-based, which is what the OpenMDAO declare_partials method expects.
Examples
Diagonal partials for 1D output and 1D input, both with length 5:
julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>5), of_ss=[:i], wrt_ss=[:i])
([0, 1, 2, 3, 4], [0, 1, 2, 3, 4])1D output with length 2 depending on all elements of 1D input with length 3 (so not actually sparse).
julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>2, :j=>3), of_ss=[:i], wrt_ss=[:j])
([0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2])2D output with size (2, 3) and 1D input with size 2, where each i output row only depends on the i input element.
julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>2, :j=>3), of_ss=[:i, :j], wrt_ss=[:i])
([0, 1, 2, 3, 4, 5], [0, 0, 0, 1, 1, 1])2D output with size (2, 3) and 1D input with size 3, where each j output column only depends on the j input element.
julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>2, :j=>3), of_ss=[:i, :j], wrt_ss=[:j])
([0, 1, 2, 3, 4, 5], [0, 1, 2, 0, 1, 2])2D output with size (2, 3) depending on input with size (3, 2), where the output element at index i, j only depends on input element j, i (like a transpose operation).
julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>2, :j=>3), of_ss=[:i, :j], wrt_ss=[:j, :i])
([0, 1, 2, 3, 4, 5], [0, 2, 4, 1, 3, 5])2D output with size (2, 3) depending on input with size (3, 4), where output y[:, j] for each j depends on input x[j, :].
julia> rows, cols = get_rows_cols(; ss_sizes=Dict(:i=>2, :j=>3, :k=>4), of_ss=[:i, :j], wrt_ss=[:j, :k]);
julia> @show rows cols; # to prevent abbreviating the array display
rows = [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5]
cols = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
OpenMDAOCore.get_rows_cols_dict_from_sparsity — Methodget_rows_cols_dict_from_sparsity(J::ComponentMatrix)Get a Dict of the non-zero row and column indices for a sparsity pattern defined by a ComponentMatrix representation of a Jacobian.
OpenMDAO.make_component — Functionmake_component(comp::OpenMDAOCore.AbstractComp)Convinience method for creating either a JuliaExplicitComp or JuliaImplicitComp, depending on if comp is <:OpenMDAOCore.AbstractExplicitComp or <:OpenMDAOCore.AbstractImplicitComp, respectively.