openmdao/core/total_jac.py
def matmat_jac_setter(self, inds, mode):
        """
        Set the appropriate part of the total jacobian for matrix matrix input indices.

        Parameters
        ----------
        inds : ndarray of int
            Total jacobian row or column indices.
        mode : str
            Direction of derivative solution. (ignored)
        """
        # in plain matmat, all inds are for a single variable for each iteration of the outer loop,
        # so any relevance can be determined only once.
        vecname, _, _ = self.in_idx_map[mode][inds[0]]
        ncol = self.output_vec[mode][vecname]._ncol
        nproc = self.comm.size
        fwd = self.mode == 'fwd'
        J = self.J
        out_meta = self.out_meta[mode]

        deriv_val = self.output_vec[mode][vecname]._data
        deriv_idxs, jac_idxs = self.solvec_map[mode]
        scatter = self.jac_scatters[mode][vecname]
        jac_inds = jac_idxs[vecname]
        if scatter is None:
            deriv_val = deriv_val[deriv_idxs[vecname], :]
            if mode == 'fwd':
                for col, i in enumerate(inds):
                    self.J[jac_inds, i] = deriv_val[:, col]
            else:  # rev
                for col, i in enumerate(inds):
                    self.J[i, jac_inds] = deriv_val[:, col]
        else:
            solution = self.soln_petsc[mode][vecname]
            for col, i in enumerate(inds):
                self.jac_petsc[mode].array[:] = 0.
                if ncol > 1:
                    solution[0].array = solution[1][:, col]
                else:
                    solution[0].array = solution[1]
                scatter.scatter(self.soln_petsc[mode][vecname][0],
                                self.jac_petsc[mode], addv=False, mode=False)
                if mode == 'fwd':
                    self.J[:, i] = self.jac_petsc[mode].array
                else:
                    self.J[i] = self.jac_petsc[mode].array

        Set the appropriate part of the total jacobian for matrix matrix input indices.

        Parameters
        ----------
        inds : ndarray of int
            Total jacobian row or column indices.
        mode : str
            Direction of derivative solution. (ignored)
        
Set the appropriate part of the total jacobian for matrix matrix input indices.
Parameters

inds : ndarray of int
Total jacobian row or column indices.
mode : str
Direction of derivative solution. (ignored)
Set the appropriate part of the total jacobian for matrix matrix input indices . Parameters inds : ndarray of int Total jacobian row or column indices . mode : str Direction of derivative solution . ( ignored )
def matmat_jac_setter(self, inds, mode):
        vecname, _, _ = self.in_idx_map[mode][inds[0]]
        ncol = self.output_vec[mode][vecname]._ncol
        nproc = self.comm.size
        fwd = self.mode == 'fwd'
        J = self.J
        out_meta = self.out_meta[mode]
        deriv_val = self.output_vec[mode][vecname]._data
        deriv_idxs, jac_idxs = self.solvec_map[mode]
        scatter = self.jac_scatters[mode][vecname]
        jac_inds = jac_idxs[vecname]
        if scatter is None:
            deriv_val = deriv_val[deriv_idxs[vecname], :]
            if mode == 'fwd':
                for col, i in enumerate(inds):
                    self.J[jac_inds, i] = deriv_val[:, col]
            else:  
                for col, i in enumerate(inds):
                    self.J[i, jac_inds] = deriv_val[:, col]
        else:
            solution = self.soln_petsc[mode][vecname]
            for col, i in enumerate(inds):
                self.jac_petsc[mode].array[:] = 0.
                if ncol > 1:
                    solution[0].array = solution[1][:, col]
                else:
                    solution[0].array = solution[1]
                scatter.scatter(self.soln_petsc[mode][vecname][0],
                                self.jac_petsc[mode], addv=False, mode=False)
                if mode == 'fwd':
                    self.J[:, i] = self.jac_petsc[mode].array
                else:
                    self.J[i] = self.jac_petsc[mode].array
def matmat_jac_setter ( self , inds , mode ) : vecname , _ , _ = self . in_idx_map [ mode ] [ inds [ 0 ] ] ncol = self . output_vec [ mode ] [ vecname ] . _ncol nproc = self . comm . size fwd = self . mode == 'fwd' J = self . J out_meta = self . out_meta [ mode ] deriv_val = self . output_vec [ mode ] [ vecname ] . _data deriv_idxs , jac_idxs = self . solvec_map [ mode ] scatter = self . jac_scatters [ mode ] [ vecname ] jac_inds = jac_idxs [ vecname ] if scatter is None : deriv_val = deriv_val [ deriv_idxs [ vecname ] , : ] if mode == 'fwd' : for col , i in enumerate ( inds ) : self . J [ jac_inds , i ] = deriv_val [ : , col ] else : for col , i in enumerate ( inds ) : self . J [ i , jac_inds ] = deriv_val [ : , col ] else : solution = self . soln_petsc [ mode ] [ vecname ] for col , i in enumerate ( inds ) : self . jac_petsc [ mode ] . array [ : ] = 0. if ncol > 1 : solution [ 0 ] . array = solution [ 1 ] [ : , col ] else : solution [ 0 ] . array = solution [ 1 ] scatter . scatter ( self . soln_petsc [ mode ] [ vecname ] [ 0 ] , self . jac_petsc [ mode ] , addv = False , mode = False ) if mode == 'fwd' : self . J [ : , i ] = self . jac_petsc [ mode ] . array else : self . J [ i ] = self . jac_petsc [ mode ] . array
Set the appropriate part of the total jacobian for matrix matrix input indices.
Set the appropriate part of the total jacobian for matrix matrix input indices .
"""
        Set the appropriate part of the total jacobian for matrix matrix input indices.

        Parameters
        ----------
        inds : ndarray of int
            Total jacobian row or column indices.
        mode : str
            Direction of derivative solution. (ignored)
        """ # in plain matmat, all inds are for a single variable for each iteration of the outer loop, # so any relevance can be determined only once. # rev
self
inds
mode