This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: package tensor
- From: Yoshiki Tsunesada <y dot tsunesada at kib dot biglobe dot ne dot jp>
- To: jordi dot burguet dot castell at cern dot ch
- Cc: gsl-discuss at sources dot redhat dot com
- Date: Sun, 7 Nov 2004 00:53:11 +0900
- Subject: Re: package tensor
- References: <200411060424.54911.jordi.burguet.castell@cern.ch>
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