MCPcopy Create free account
hub / github.com/cvxpy/cvxpy / set_slice_data

Function set_slice_data

cvxpy/cvxcore/python/cppbackend.py:189–201  ·  view source on GitHub ↗

Loads the slice data, start, stop, and step into our C++ linOp. The semantics of the slice operator is treated exactly the same as in Python. Note that the 'None' cases had to be handled at the wrapper level, since we must load integers into our vector.

(linC, linPy)

Source from the content-addressed store, hash-verified

187
188
189def set_slice_data(linC, linPy) -> None:
190 """
191 Loads the slice data, start, stop, and step into our C++ linOp.
192 The semantics of the slice operator is treated exactly the same as in
193 Python. Note that the 'None' cases had to be handled at the wrapper level,
194 since we must load integers into our vector.
195 """
196
197 for sl in linPy.data:
198 slice_vec = cvxcore.IntVector()
199 for var in [sl.start, sl.stop, sl.step]:
200 slice_vec.push_back(int(var))
201 linC.push_back_slice_vec(slice_vec)
202
203
204def build_lin_op_tree(root_linPy, linPy_to_linC) -> None:

Callers 1

set_linC_dataFunction · 0.85

Calls 2

push_backMethod · 0.95
push_back_slice_vecMethod · 0.45

Tested by

no test coverage detected