cvxgrp / qcml

A Python parser for generating Python/C/Matlab solver interfaces
Other
42 stars 9 forks source link

ValueError: broadcast from shape (10,1) into shape (10) #41

Closed alexvoronov closed 10 years ago

alexvoronov commented 10 years ago

Hi, I'm getting the following error when running either prob2socp or prob_to_socp on generated python code:

ValueError: could not broadcast input array from shape (10,1) into shape (10)

The minimal example where I get this error is here:

#!/usr/bin/env python
from qcml import QCML

if __name__ == '__main__':

    s = """variable x(10)
    minimize sum(2 * x)"""

    p = QCML()
    p.parse(s)
    p.canonicalize()
    p.codegen("python")
    socp_data = p.prob2socp(params=locals())
echu commented 10 years ago

Ah, thanks. I have the wrong "type" for numpy: They distinguish between arrays of size (10,1) and arrays of size (10,).

On Fri, Jun 13, 2014 at 8:52 AM, alexvoronov notifications@github.com wrote:

Hi, I'm getting the following error when running either prob2socp or prob_to_socp on generated python code:

ValueError: could not broadcast input array from shape (10,1) into shape (10)

The minimal example where I get this error is here:

!/usr/bin/env python

from qcml import QCML

if name == 'main':

s = """variable x(10)
minimize sum(2 * x)"""

p = QCML()
p.parse(s)
p.canonicalize()
p.codegen("python")
socp_data = p.prob2socp(params=locals())

— Reply to this email directly or view it on GitHub https://github.com/cvxgrp/qcml/issues/41.