There are a bunch of matrix construction helpers in typical Matrix packages such as Armadillo. We could add some:
ones(n) to fill a matrix of size n with ones (not sure if we need non-square size here)zeros(n) similarly to fill with zeroseye(n) to file a matrix of zeros along the diagonal.We do have diag() as an extractor though.
I'm not sure if you wanted to add member and non-member versions of these functions, as is done with Armadillo, but I put something together to tackle (just) the latter case, and can submit a PR if you'd like to review.
Simpler may well be better -- was thinking 'sugar' so non-member functions is my leaning too.
I think this has been fixed in #566 and #569
Most helpful comment
I'm not sure if you wanted to add member and non-member versions of these functions, as is done with Armadillo, but I put something together to tackle (just) the latter case, and can submit a PR if you'd like to review.