'Tests problems with mul_elemwise.'

def test_mul_elemwise(self):

    c = [[1, (-1)], [2, (-2)]]
    expr = mul_elemwise(c, self.A)
    obj = Minimize(normInf(expr))
    p = Problem(obj, [(self.A == 5)])
    result = p.solve()
    self.assertAlmostEqual(result, 10)
    self.assertItemsAlmostEqual(expr.value, ([5, (-5)] + [10, (-10)]))
    import cvxopt
    interface = intf.get_matrix_interface(cvxopt.spmatrix)
    c = interface.const_to_matrix([1, 2])
    expr = mul_elemwise(c, self.x)
    obj = Minimize(normInf(expr))
    p = Problem(obj, [(self.x == 5)])
    result = p.solve()
    self.assertAlmostEqual(result, 10)
    self.assertItemsAlmostEqual(expr.value, [5, 10])
    c = [[1, (-1)], [2, (-2)]]
    expr = mul_elemwise(c, self.a)
    obj = Minimize(normInf(expr))
    p = Problem(obj, [(self.a == 5)])
    result = p.solve()
    self.assertAlmostEqual(result, 10)
    self.assertItemsAlmostEqual(expr.value, ([5, (-5)] + [10, (-10)]))
