package tensor

Jordi Burguet Castell jordi.burguet.castell@cern.ch
Sun Nov 7 00:37:00 GMT 2004


Hi Yoshiki, all,

>   yoshiki@maxwell[62] irb   (Ruby command-line interpreter)
>   irb(main):001:0> require("gsl")
>   irb(main):002:0> t = GSL::Tensor.alloc(2, 3)
>   irb(main):003:0> t.set(123, 0, 1, 2)
>   irb(main):004:0> t.get(0, 1, 2)
>   => 123.0
>   irb(main):005:0> t[1, 2, 2] = 9   # simple form
>   irb(main):006:0> t[1, 2, 2]
>   => 9.0

Looks very nice, and also it seems that using varargs didn't create you 
trouble to wrap it?! My main concern about varargs was their potentially 
hard-to-wrap nature. In any case, I guess it would be possible to still use 
that nice sintax in Ruby if indices were passed as (uint*) instead of varargs 
in gsl_tensor, right?


>   A remark and a bug:
>
>   * gsl_tensor_max_index() and other related functions
>  store the results in a pointer to int*, but it must
>  be size_t* (conflict position2index()).
>   * in gsl_tensor_copy(),
>        memcpy(t->data, tt->data, tt->size);
>        --->  memcpy(t->data, tt->data, sizeof(BASE)*tt->size);

I have added your fixes, thank you very much. They had escaped my "gcc -W 
-Wall ...", valgrind and test suite!

The updated version can be retrieved from anonymous CVS:

cvs -d :pserver:anonymous@evalu29.ific.uv.es:/usr/local/cvsroot login
(any password will do)

cvs -d :pserver:anonymous@evalu29.ific.uv.es:/usr/local/cvsroot co gsl_tensor

To keep it as a separate package (I don't know if it would suit into the gsl 
itself, probably it doesn't even have the appropiate maturity level) I am 
considering to register it as a new project in Savannah. If that is of any 
interest, I will let you know then.

Best regards,
Jordi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gsl-discuss/attachments/20041107/c7123063/attachment.sig>


More information about the Gsl-discuss mailing list