After letting this soak for a bit, I would tend to prefer either full-on R (less preferred) or Matlab with defects (more preferred). Matlab with defects would use * for matrix multiplication and have a method name for element by element product.
It is fine to have special syntax modules, but I think that this isn't all that big a deal. On Sun, Jul 28, 2013 at 11:17 AM, Dmitriy Lyubimov <[email protected]>wrote: > yeah. we are out of luck with matlab syntax. > > *&, *|, *^, *%, *#, *@, *~, *?, *!, *>, *<, *\ all work . '*.' or '*,' will > not work. "*:" or ":*" have special meaning. > > > On Sun, Jul 28, 2013 at 10:58 AM, Dmitriy Lyubimov <[email protected] > >wrote: > > > FWIW, > > > > one approach might be to separate DSL into several. E.g. RLikeOps and > > MatlabLikeOps or WhateverOps, none of which is imported by default. and > > then the code would have to say "import RLikeOps._" to enalbe R-like DSL, > > and vice versa. > > > > But matlab style '*.' symbol unfortunately doesn't seem to work in scala > > without backquotes. apparently scala treats '.' 'as a keyword and can't > > reduce it as a part of anything else. > > > > > > On Sat, Jul 27, 2013 at 6:43 PM, Dmitriy Lyubimov <[email protected] > >wrote: > > > >> > >> > >> > >> On Sat, Jul 27, 2013 at 6:31 PM, Dmitriy Lyubimov <[email protected] > >wrote: > >> > >>> > >>> > >>> > >>> > > >>>> > diagv(1 /: s) > >>>> > > >>>> > >>>> But since this is just the inverse of the matrix, and I imagine it's > >>>> actually > >>>> clearer to do just diagv(s).inverse instead of diagv(1 /: s) > >>>> > >>>> > >>> Well. DSL is just the icing. Nobody's taking the cake away. > >>> > >>> in a sense that, once/if/when Mahout supports inverse(), it would be > >>> exactly how one might use it. DSL is not about implementation, it is > about > >>> semantic sugar only. It only maps to what exists. > >>> > >>> On a side note, it never actually occurred to me to call pinv() or > >>> solve() on a diagonal matrix. Or orthonormal for that matter. Their > >>> identities are so appealing it kind of becomes second nature after some > >>> time. the only use for solve() i had is actually for solving linear > >>> equations. In my R prototype for SSVD [1] one will find exactly the > same > >>> style code, i.e. diag(1/e$values) . > >>> > >>> pardon, this should read "non-signular" of course, an honest typo. > >> > >> > >>> Even then you probably actually want leftInverse() and rightInverse(), > >>> not just inverse, which is only defined for *non *singular square > >>> matrices and would be equal right and left inverses in that case. Which > >>> oddly enough brings us back to left-associative and right-associative > >>> operations. > >>> > >>> [1] > >>> > https://cwiki.apache.org/confluence/download/attachments/27832158/ssvd.R?version=1&modificationDate=1323358453000 > >>> > >>> > >> > > >
