package tensor
Yoshiki Tsunesada
y.tsunesada@kib.biglobe.ne.jp
Sat Nov 6 15:52:00 GMT 2004
Hello,
> I have prepared a package to do tensor manipulation.
That's very nice! Thank you for the package.
Now I am working on Ruby/GSL, a Ruby interface to GSL,
http://rubyforge.org/projects/rb-gsl/. I will include
gsl_tensor support in the next release. It looks like
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
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);
Yoshiki
More information about the Gsl-discuss
mailing list