Go compiler moving from C to Go

CJS Prometheus85 at hotmail.com
Sun Dec 29 13:26:32 PST 2013


> > I'm not sure if D's operator overloading is
>> sufficiently rich to
>> allow separate operators for matrix multiplication and 
>> element-wise
>> multiplication in matrix. (Dealing with this is a pain in 
>> numpy, the most common
>> Python matrix library, as well as in Eigen, a common c++ 
>> matrix library.)
>
> I don't see why in principle it shouldn't be doable.  Whether 
> it's possible to directly define custom operators for this akin 
> to what MATLAB/Octave have: .+, .-, .*, ./, etc. I'm not sure, 
> but it ought to be possible to define some kind of DSL/template 
> along the lines of:
>
>     c = ElementWise!("a + b");

A variation of that is what numpy and Eigen use. In numpy, for
the array class '*' is element-wise by default and the function
np.dot is matrix multiplication. For Eigen '*' is matrix
multiplication by default while the (member) function
cwiseProduct is element-wise. One the one hand, this is more
readable than matlab or R in terms of having a clear default.
(Whereas in matlab you have to be careful to distinguish between
'.*' and '*', or '*' and '%*%' in R.) But it's both hideous to
look at and to type. An improvement over .add or .times in Java
matrix libraries, but far from Nirvana. I'm hoping D can do
better.


More information about the Digitalmars-d mailing list