Re: [ANN] GSL Shell 2.2.0 beta1 release

  • From: Francesco Abbate <francesco.bbt@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 17 Sep 2012 23:24:22 +0200

2012/9/17 Coda Highland <chighland@xxxxxxxxx>:
>> For example in LuaJIT you cannot refer to an element of a matrix like
>> m[i, j] as it would be natural for matrices.
>
> You can define the __call metamethod to allow m(i,j) to work. This is
> probably more efficient than the two-level approach you're currently
> using, although of course it may not necessarily be source-compatible.
> (Though you could probably keep the current implementation you have to
> avoid breakage.)

Be assured, you're not the first one to propose this solution :-)
The problem is that it should work also like as a LHS expression in an
assignment and

m(i, j) = x

doesn't work.

> Is it particularly problematic to introduce proxy objects that expose
> the matrix API but are in fact composition operators that don't get
> evaluated until it's actually needed? (e.g. when accessing a matrix
> element or calculating the inverse) This would be essentially
> equivalent to building a string by assembling a table and then calling
> table.concat() in order to avoid the intermediate products.

It is a long time that I'm ruminating in my head this solution but the
problem is that it does add a big layer of complexity and you are no
longer able to pass a matrix to a C GSL function directly.

For these reasons I've discarded this idea even if it could be
possible from the technical point of view.

Thank you in any case for the suggestions. They are always welcome :-)

Francesco

Other related posts: