From: "Brian Schröder" Date: 2005-01-26T18:33:39+09:00 Subject: Re: Hacking NArray On Wed, 26 Jan 2005 09:26:50 +0900 Yoshiki Tsunesada wrote: > > than I thought. I would really appreciate an example on how to extend > > narray. That would be: > > - How to create a function that works on one or more arrays (in > > place|with copy), one element at a time > > - How to create a function that works on one or more arrays with random > > access to the entries. > Could you show Ruby code you expect to work with it ? > > Yoshiki > Well: a.abs! for example. And something like: define_inplace_operator 'abs!', {[[:float, :float], [:double, :double], [:int, :int]] => '*p = *p > 0 ? p : -p;'} in the mkop.rb skript to create those functions automatically in the c source. That would be a nice dream... But at the moment I'll try to go with the other advice and implement my own purely double based volume class. (And with code generation maybe also float, int etc, but I have to do some exploration first, as I've never written a c extension. Regards, Brian