Hi Dmitry

​You can take a look at using the update "magic" method which is similar to 
apply but handles assignment. 



​If you want to keep the := as assignment I think you could do 


def :=(value: Double) = update ...


(I don't have my laptop around at the moment so can't check this works).


Also you can take a dig into the Breeze code which has a pretty similar DSL to 
what you're trying to put together, for examples of how David has done it - 
ignoring the code that is related to all the operators and specializing for 
Int, Double and Float, the core DSL is fairly compact I think.


N 

—
Sent from Mailbox for iPhone

On Fri, Jul 5, 2013 at 10:16 AM, Dmitriy Lyubimov <dlie...@gmail.com>
wrote:

> For anyone good at scala DSLs, the following is the puzzle i can't seem to
> figure at the moment.
> I mentioned  before that I implemented assignment notations to a row or a
> block, e.g. for a row vector : A(5,::) := (1,2,3)
> what it really translates into in this particular case is
> A.viewRow(5).assign(new Vector(new double[]{1,2,3}))
> One thing i can't quite figure for in-core matrix DSL is how to translate
> element assignments such as
> A(5,5) := 2.0
> into A.setQuick(5,5,2.0)
> while still having
> val k = A(5,5)
> translating into
> val k = A.getQuick(5,5).
> it could be implemented with a "elementView" analogue but would require the
> element view object creation  -- which is, first,  a big no-no (too
> expensive) for a simple solitary element assignment (or read-out)
> operation, and secondly, reading the element such as A(5,5) * 2.0 would
> also involve view element object creation with implicit conversion to
> Double whereas it is not even needed at all in this case.
> at this point i have only a very obvious apply(Double,Double):Double =
> m.getQuick(...), i.e. only element reads are supported with that syntax.
> I am guessing Jake, if anyone, might have an idea here... thanks.
> On Thu, Jul 4, 2013 at 11:23 PM, Dmitriy Lyubimov <dlie...@gmail.com> wrote:
>> FWIW, Givens streaming qr will be a bit more economical on memory than
>> Householder's since it doesn't need the full buffer to compute R and
>> doesn't need to keep entire original matrix around.
>>
>>
>> On Thu, Jul 4, 2013 at 11:15 PM, Dmitriy Lyubimov <dlie...@gmail.com>wrote:
>>
>>> Ted,
>>>
>>> would it make sense to port parts of QR in-core row-wise Givens solver
>>> out of SSVD to work on any Matrix? I know givens method is advertised as
>>> stable but not sure if it is the fastest accepted one. I guess they are all
>>> about the same.
>>>
>>> If yes, i will need also to port the UpperTriangular matrix to adhere to
>>> all the bells and wistles, and also have some sort of RowShift matrix (a
>>> much simpler analogue of Pivoted matrix for row-rolled buffers). would that
>>> make sense?
>>>
>>> thanks.
>>> -D
>>>
>>>
>>

Reply via email to