Commit b8d716a
fix diff engine converter bugs: 1D matmul dims, reshape, transpose, q… (#190)
* fix diff engine converter bugs: 1D matmul dims, reshape, transpose, quad form
- helpers.py: fix 1D dimension normalization in dense matmul helpers.
Right-matmul treated 1D A as (1,n) instead of (n,1), causing segfaults.
- converters.py: reshape 1D child to column vector in left-matmul for
dot products; add constant-atom fallback for unfolded expressions;
move QuadForm/SymbolicQuadForm dispatch out of ATOM_CONVERTERS (needs
n_vars); tolerate 1D dimension mismatches via reshape instead of error.
- registry.py: support C-order reshape via transpose decomposition;
fix 1D transpose to be a no-op; improve scalar quad form P handling;
raise NotImplementedError for vector SymbolicQuadForm (TODO: native
block quadform in SparseDiffPy).
- perspective_canon.py: handle DiffengineConeProgram which stores
q, d, A, b as separate arrays (vs ParamConeProg sparse tensors).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* adds converters changes for right matmul support
* fixes crashes for left matmul
* add changes to registry
* run linter
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 944eb91 commit b8d716a
6 files changed
Lines changed: 280 additions & 45 deletions
File tree
- cvxpy
- cvxcore/python
- reductions
- dcp2cone/canonicalizers
- solvers/nlp_solvers/diff_engine
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
295 | 302 | | |
296 | 303 | | |
297 | 304 | | |
| |||
Lines changed: 16 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
46 | 58 | | |
47 | 59 | | |
48 | 60 | | |
| |||
Lines changed: 68 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
33 | 46 | | |
34 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
35 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
36 | 65 | | |
37 | 66 | | |
38 | | - | |
| 67 | + | |
39 | 68 | | |
40 | 69 | | |
| 70 | + | |
| 71 | + | |
41 | 72 | | |
42 | 73 | | |
43 | 74 | | |
44 | | - | |
45 | | - | |
| 75 | + | |
| 76 | + | |
46 | 77 | | |
47 | 78 | | |
48 | | - | |
| 79 | + | |
49 | 80 | | |
50 | 81 | | |
| 82 | + | |
| 83 | + | |
51 | 84 | | |
52 | 85 | | |
53 | 86 | | |
54 | | - | |
55 | | - | |
| 87 | + | |
| 88 | + | |
56 | 89 | | |
57 | 90 | | |
58 | | - | |
| 91 | + | |
59 | 92 | | |
60 | 93 | | |
61 | 94 | | |
| |||
98 | 131 | | |
99 | 132 | | |
100 | 133 | | |
| 134 | + | |
| 135 | + | |
101 | 136 | | |
102 | 137 | | |
103 | 138 | | |
104 | 139 | | |
105 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
106 | 150 | | |
107 | 151 | | |
108 | 152 | | |
| |||
113 | 157 | | |
114 | 158 | | |
115 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
116 | 165 | | |
117 | 166 | | |
118 | 167 | | |
| |||
123 | 172 | | |
124 | 173 | | |
125 | 174 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
131 | 186 | | |
132 | 187 | | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
0 commit comments