I'm using CVXPY
through Julia, a language where multidimentional arrays are stored in memory using column-major order. However CVXPY
is written in Python and accepts Numpy
style arrays (which are row-major by default) to be used as constants.
I want to know if I should care about ordering, e.g. with matrix A
, when translating Python code like this:
import cvxpy as cp
import numpy as np
m = 30
n = 20
A = np.random.randn(m, n)
b = np.random.randn(m)
# Construct the problem.
x = cp.Variable(n)
objective = cp.Minimize(cp.sum_squares(A*x - b))
constraints = [0 <= x, x <= 1]
prob = cp.Problem(objective, constraints)
to Julia:
using Random, PyCall
cp = pyimport("cvxpy")
m = 30
n = 20
A = randn(m, n)
b = randn(m)
# Construct the problem.
x = cp.Variable(n)
objective = cp.Minimize(cp.sum_squares(cp.matmul(A,x) - b))
constraints = [0 <= x, x <= 1]
prob = cp.Problem(objective, constraints)
I've seen exactly this done, and not seen any special handling from want I recall. So no, it doesn't cause any issues