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.
This should not be difficult to add, and a welcome addition for consistency. Patch welcome. In the meantime you can do: X.resize(NoChange, cols); X.setConstant(2); which is not much more verbose.
Not critical, but good junior-job. So let's keep it for newcomers.
Created attachment 666 [details] Patch for Bug 663 I've added support for NoChange in the functions mentioned above. Please have a look at it. Philipp
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/663.