Closed ericjang closed 12 years ago
Hi Eric,
Thanks for this comment. It was a conscious decision not to include numeric.ones and numeric.zeros. The reason is that there's only one of me and early on I noticed that, as I would optimize and rewrite functions, it was advantageous to concentrate on fewer functions. As you point out, the function numeric.ones and numeric.zeros are "syntactic sugar" for numeric.rep and so I did not include those functions.
Thanks,
Sébastien Loisel
I agree with Eric, zeros and ones were probably the first functions that I looked for, and I ended up creating my own utility function until I realized I could use numeric.rep. Perhaps you could add a line to the documentation where you point out that you can use rep as a replacement for zeros and ones, it's a bit hard to "spot" when skimming the documentation.
Otherwise, thanks for a great library!
In matlab, numpy and many other linalg packages, there is a convenient constructor for a matrix of zeros or ones.
I understand these implementations are rather trivial given that rep is around but they are pretty convenient to have around for familiarity's sake with other packages.
numeric.ones = function identity(n) { return numeric.rep(n,1);}
numeric.zeros = function identity(n) {return numeric.rep(n,0);}