def transform_params_constraint(params, Sinv, R, q):
 rsr = R.dot(Sinv).dot(R.T)
 reduction = Sinv.dot(R.T).dot(np.linalg.solve(rsr, (R.dot(params) - q)))
 return (params - reduction)

def transform_params_constraint ( params , Sinv , R , q ) : rsr = R . dot ( Sinv ) . dot ( R . T ) reduction = Sinv . dot ( R . T ) . dot ( np . linalg . solve ( rsr , ( R . dot ( params ) - q ) ) ) return ( params - reduction )
find the parameters that statisfy linear constraint from unconstraint the linear constraint r params = q is imposed .