Closed chinasaur closed 11 years ago
Was there a bug somewhere? I've put all the "printing" stuff under "codes/encoders"; it just looks for the type and prints the proper string. This way it's independent of the language (Python or C).
I see; sorry I probably put things in the wrong place. Does seem like something is missing. When I tried to run the demos I was getting default str or something in place of Coeffs. For example:
# for the constraint 1.0 + Y*a + -1*_t2 + -1*b <= 0
h[0:100] = -1.0
params['Y'] = o.sparse(<qcml.codes.coefficients.coefficient.ParameterCoeff object at 0x7f38090f0610>)
Gi.append((0 + 1*i for i in params['Y'].I))
Gj.append((0 + 1*j for j in params['Y'].J))
Gv.append((v for v in params['Y'].V))
...
# for the constraint 1.0 + -1*X*a + -1*_t1 + b <= 0
h[300:400] = -1.0
result = o.sparse(<qcml.codes.coefficients.coefficient.ConstantCoeff object at 0x7f38090f0950> * <qcml.codes.coefficients.coefficient.ParameterCoeff object at 0x7f38090f07d0>)
Gi.append((300 + 1*i for i in result.I))
Gj.append((0 + 1*j for j in result.J))
Gv.append((v for v in result.V))
...
I guess expr.to_sparse() needs to take an argument telling it the string to use in the current encoding?
yes, that's correct. but i have a fix coming in. for now, just have it print the python string. i won't commit your patch since i had planned to fix this a different way, but it's on my radar now. :) i'll check in a working version in a little bit.
also i've learned that calling cs_compress can actually be a little expensive. (i saw an application where it took 1/4 of the total solve time) it may be more worthwhile to compress "symbolically" and create mappings for the values, so something like
src = params.A; dest = paramsToSocp.Amap; while _dest != -1: Av[_dest++] = *src++;
it's random memory writes and requires storing the map for the parameters, but i'm hoping cache coherency will save us and, hey, maybe the compiler can do a vector of 4 loads and buffer the write to random memory locations! it's either this or unroll the entire loop, which i think is a worse idea.
eric
On Thu, Aug 29, 2013 at 11:17 PM, Peter H. Li notifications@github.comwrote:
I guess expr.to_sparse() needs to take an argument telling it the string to use in the current encoding?
— Reply to this email directly or view it on GitHubhttps://github.com/cvxgrp/qcml/pull/22#issuecomment-23542584 .
Cool, thanks!
On cs_compress, is it worth checking whether AMD is okay with the Ai Av being out of row sorted order within columns? Assuming AMD is okay with it, and after the input passes through AMD it no longer matters to the rest of ECOS (both of which I think are true?) then seems like you can save considerable trouble or at least be writing contiguous blocks more of the time?
I should have fixed this issue. If you can confirm it's been fixed in the latest version (without needing this patch), please close this pull request. Thanks!
I just pulled the latest and this seemed to need doing, but I actually have no idea what I'm doing, so just ignore it if it's not helpful!