Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > stretchy NVector

Thread Tools

stretchy NVector

Joel VanderWerf
Posts: n/a

Anyone know a way to make a NVector (from the narray extension)
stretchy, i.e. support #push or #<< ?

irb(main):001:0> v = NVector.float(1)
=> NVector.float(1):
[ 0.0 ]
irb(main):002:0> v << 1.0
NoMethodError: undefined method `<<' for NVector.float(1):
[ 0.0 ]:NVector
from (irb):2

The answer can't involve realloc on every append. Some kind of exp
growth (like ruby arrays) would be fine.

I'm looking for an efficient way to log float data in memory.

vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
fluid with stretchy background (css) HTML 3 02-25-2007 08:09 PM
CSS 3 Col stretchy layouts Silkster HTML 5 10-06-2006 01:59 AM