'Test functions to multiply by A, A.T'

def test_mul_funcs(self):

    n = 10
    x = Variable(n)
    obj = Minimize(norm(x, 1))
    constraints = [(x >= 2)]
    prob = Problem(obj, constraints)
    data = prob.get_problem_data(solver=SCS)
    A = data['A']
    (objective, constraints) = prob.canonicalize()
    sym_data = SymData(objective, constraints, SOLVERS[SCS])
    sym_data.constraints = prune_constants(sym_data.constraints)
    (Amul, ATmul) = iterative.get_mul_funcs(sym_data)
    vec = np.array(range(sym_data.x_length))
    result = np.zeros(A.shape[0])
    Amul(vec, result)
    self.assertItemsAlmostEqual((A * vec), result)
    Amul(vec, result)
    self.assertItemsAlmostEqual(((2 * A) * vec), result)
    vec = np.array(range(A.shape[0]))
    result = np.zeros(A.shape[1])
    ATmul(vec, result)
    self.assertItemsAlmostEqual((A.T * vec), result)
    ATmul(vec, result)
    self.assertItemsAlmostEqual(((2 * A.T) * vec), result)
