openmdao/core/total_jac.py
def _get_dict_J(self, J, wrt, prom_wrt, of, prom_of, wrt_meta, of_meta, return_format):
        """
        Create a dict or flat-dict jacobian that maps to views in the given 2D array jacobian.

        Parameters
        ----------
        J : ndarray
            Array jacobian.
        wrt : iter of str
            Absolute names of input vars.
        prom_wrt : iter of str
            Promoted names of input vars.
        of : iter of str
            Absolute names of output vars.
        prom_of : iter of str
            Promoted names of output vars.
        wrt_meta : dict
            Dict mapping input name to array jacobian slice, indices, and distrib.
        of_meta : dict
            Dict mapping output name to array jacobian slice, indices, and distrib.
        return_format : str
            Indicates the desired form of the returned jacobian.

        Returns
        -------
        OrderedDict
            Dict form of the total jacobian that contains views of the ndarray jacobian.
        """
        J_dict = OrderedDict()
        if return_format == 'dict':
            for i, out in enumerate(of):
                J_dict[prom_of[i]] = outer = OrderedDict()
                out_slice = of_meta[out][0]
                for j, inp in enumerate(wrt):
                    outer[prom_wrt[j]] = J[out_slice, wrt_meta[inp][0]]
        elif return_format == 'flat_dict':
            for i, out in enumerate(of):
                out_slice = of_meta[out][0]
                for j, inp in enumerate(wrt):
                    J_dict[prom_of[i], prom_wrt[j]] = J[out_slice, wrt_meta[inp][0]]
        elif return_format == 'flat_dict_structured_key':
            # This format is supported by the recorders (specifically the sql recorder), which use
            # numpy structured arrays.
            for i, out in enumerate(of):
                out_slice = of_meta[out][0]
                for j, inp in enumerate(wrt):
                    key = "%s,%s" % (prom_of[i], prom_wrt[j])
                    J_dict[key] = J[out_slice, wrt_meta[inp][0]]
        else:
            raise ValueError("'%s' is not a valid jacobian return format." % return_format)

        return J_dict

        Create a dict or flat-dict jacobian that maps to views in the given 2D array jacobian.

        Parameters
        ----------
        J : ndarray
            Array jacobian.
        wrt : iter of str
            Absolute names of input vars.
        prom_wrt : iter of str
            Promoted names of input vars.
        of : iter of str
            Absolute names of output vars.
        prom_of : iter of str
            Promoted names of output vars.
        wrt_meta : dict
            Dict mapping input name to array jacobian slice, indices, and distrib.
        of_meta : dict
            Dict mapping output name to array jacobian slice, indices, and distrib.
        return_format : str
            Indicates the desired form of the returned jacobian.

        Returns
        -------
        OrderedDict
            Dict form of the total jacobian that contains views of the ndarray jacobian.
        
Create a dict or flat-dict jacobian that maps to views in the given 2D array jacobian.
Parameters

J : ndarray
Array jacobian.
wrt : iter of str
Absolute names of input vars.
prom_wrt : iter of str
Promoted names of input vars.
of : iter of str
Absolute names of output vars.
prom_of : iter of str
Promoted names of output vars.
wrt_meta : dict
Dict mapping input name to array jacobian slice, indices, and distrib.
of_meta : dict
Dict mapping output name to array jacobian slice, indices, and distrib.
return_format : str
Indicates the desired form of the returned jacobian.

Returns

OrderedDict
Dict form of the total jacobian that contains views of the ndarray jacobian.
Create a dict or flat - dict jacobian that maps to views in the given 2D array jacobian . Parameters J : ndarray Array jacobian . wrt : iter of str Absolute names of input vars . prom_wrt : iter of str Promoted names of input vars . of : iter of str Absolute names of output vars . prom_of : iter of str Promoted names of output vars . wrt_meta : dict Dict mapping input name to array jacobian slice indices and distrib . of_meta : dict Dict mapping output name to array jacobian slice indices and distrib . return_format : str Indicates the desired form of the returned jacobian . Returns OrderedDict Dict form of the total jacobian that contains views of the ndarray jacobian .
def _get_dict_J(self, J, wrt, prom_wrt, of, prom_of, wrt_meta, of_meta, return_format):
        J_dict = OrderedDict()
        if return_format == 'dict':
            for i, out in enumerate(of):
                J_dict[prom_of[i]] = outer = OrderedDict()
                out_slice = of_meta[out][0]
                for j, inp in enumerate(wrt):
                    outer[prom_wrt[j]] = J[out_slice, wrt_meta[inp][0]]
        elif return_format == 'flat_dict':
            for i, out in enumerate(of):
                out_slice = of_meta[out][0]
                for j, inp in enumerate(wrt):
                    J_dict[prom_of[i], prom_wrt[j]] = J[out_slice, wrt_meta[inp][0]]
        elif return_format == 'flat_dict_structured_key':
            for i, out in enumerate(of):
                out_slice = of_meta[out][0]
                for j, inp in enumerate(wrt):
                    key = "%s,%s" % (prom_of[i], prom_wrt[j])
                    J_dict[key] = J[out_slice, wrt_meta[inp][0]]
        else:
            raise ValueError("'%s' is not a valid jacobian return format." % return_format)
        return J_dict
def _get_dict_J ( self , J , wrt , prom_wrt , of , prom_of , wrt_meta , of_meta , return_format ) : J_dict = OrderedDict ( ) if return_format == 'dict' : for i , out in enumerate ( of ) : J_dict [ prom_of [ i ] ] = outer = OrderedDict ( ) out_slice = of_meta [ out ] [ 0 ] for j , inp in enumerate ( wrt ) : outer [ prom_wrt [ j ] ] = J [ out_slice , wrt_meta [ inp ] [ 0 ] ] elif return_format == 'flat_dict' : for i , out in enumerate ( of ) : out_slice = of_meta [ out ] [ 0 ] for j , inp in enumerate ( wrt ) : J_dict [ prom_of [ i ] , prom_wrt [ j ] ] = J [ out_slice , wrt_meta [ inp ] [ 0 ] ] elif return_format == 'flat_dict_structured_key' : for i , out in enumerate ( of ) : out_slice = of_meta [ out ] [ 0 ] for j , inp in enumerate ( wrt ) : key = "%s,%s" % ( prom_of [ i ] , prom_wrt [ j ] ) J_dict [ key ] = J [ out_slice , wrt_meta [ inp ] [ 0 ] ] else : raise ValueError ( "'%s' is not a valid jacobian return format." % return_format ) return J_dict
Create a dict or flat-dict jacobian that maps to views in the given 2D array jacobian.
Create a dict or flat - dict jacobian that maps to views in the given 2D array jacobian .
"""
        Create a dict or flat-dict jacobian that maps to views in the given 2D array jacobian.

        Parameters
        ----------
        J : ndarray
            Array jacobian.
        wrt : iter of str
            Absolute names of input vars.
        prom_wrt : iter of str
            Promoted names of input vars.
        of : iter of str
            Absolute names of output vars.
        prom_of : iter of str
            Promoted names of output vars.
        wrt_meta : dict
            Dict mapping input name to array jacobian slice, indices, and distrib.
        of_meta : dict
            Dict mapping output name to array jacobian slice, indices, and distrib.
        return_format : str
            Indicates the desired form of the returned jacobian.

        Returns
        -------
        OrderedDict
            Dict form of the total jacobian that contains views of the ndarray jacobian.
        """ # This format is supported by the recorders (specifically the sql recorder), which use # numpy structured arrays.
self
J
wrt
prom_wrt
of
prom_of
wrt_meta
of_meta
return_format