Skip to content

Permit NoChange in setZero, setOnes, setConstant, setRandom

Submitted by Rhys Ulerich

Assigned to Nobody

Link to original bugzilla bug (#663)

Description

If feasible, please consider permitting NoChange as an argument in either the rows or cols slots within the following methods:

x.setZero(rows, cols);

x.setOnes(rows, cols);

x.setConstant(rows, cols, value);

x.setRandom(rows, cols);

That is, the LHS and RHS of the following equalities would behave identically:

x.setZero(NoChange, cols) "==" x.setZero(x.rows(), cols)

x.setZero(rows, NoChange) "==" x.setZero(rows, x.cols())

x.setOnes(NoChange, cols) "==" x.setOnes(x.rows(), cols)

x.setOnes(rows, NoChange) "==" x.setOnes(rows, x.cols())

x.setConstant(NoChange, cols, value) "==" x.setConstant(x.rows(), cols, value)

x.setConstant(rows, NoChange, value) "==" x.setConstant(rows, x.cols(), value)

x.setRandom(NoChange, cols) "==" x.setRandom(x.rows(), cols)

x.setRandom(rows, NoChange) "==" x.setRandom(rows, x.cols())

These would be handy when "x" is complicated to express. Feel free to close as irrelevant if I'm missing some portion of the API that handles this succinctly.

Blocking

#814