def _combine_costs(self, Npwl, Hpwl, Cpwl, fparm_pwl, any_pwl,
                       Npol, Hpol, Cpol, fparm_pol, npol, nw):
        """ Combines pwl, polynomial and user-defined costs.
        """
        NN = vstack([n for n in [Npwl, Npol] if n is not None], "csr")

        if (Hpwl is not None) and (Hpol is not None):
            Hpwl = hstack([Hpwl, csr_matrix((any_pwl, npol))])
            Hpol = hstack([csr_matrix((npol, any_pwl)), Hpol])
#        if H is not None:
#            H = hstack([csr_matrix((nw, any_pwl+npol)), H])

        HHw = vstack([h for h in [Hpwl, Hpol] if h is not None], "csr")

        CCw = r_[Cpwl, Cpol]

        ffparm = r_[fparm_pwl, fparm_pol]

        return NN, HHw, CCw, ffparm
def _combine_costs ( self , Npwl , Hpwl , Cpwl , fparm_pwl , any_pwl , Npol , Hpol , Cpol , fparm_pol , npol , nw ) : NN = vstack ( [ n for n in [ Npwl , Npol ] if n is not None ] , "csr" ) if ( Hpwl is not None ) and ( Hpol is not None ) : Hpwl = hstack ( [ Hpwl , csr_matrix ( ( any_pwl , npol ) ) ] ) Hpol = hstack ( [ csr_matrix ( ( npol , any_pwl ) ) , Hpol ] ) HHw = vstack ( [ h for h in [ Hpwl , Hpol ] if h is not None ] , "csr" ) CCw = r_ [ Cpwl , Cpol ] ffparm = r_ [ fparm_pwl , fparm_pol ] return NN , HHw , CCw , ffparm
Combines pwl, polynomial and user-defined costs.