Hi,
In C++ or in MATLAB I would use static member functions to keep the
constructors nice and simple, e.g.
class MyMatrix {
public:
static MyMatrix zeros(int n, int m);
static MyMatrix ones(int n, int m);
static MyMatrix eye(int n);
...
};
Which allows me to create class instances with an IMO natural syntax, which
should also be relatively efficient due to return value optimization:
MyMatrix x = MyMatrix::zeros(3,4);
In MATLAB, I would do the same with a static method, e.g.:
x = MyMatrix.zeros(3,4);
What is the equivalent way to do it in Julia? I have seen discussions of
whether and how to overload the dot operator ".", but I did not fully
understand if this discussion applies to the above case or if that's
already possible somehow.
Best regards,
Joel