Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6714219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:28:11+00:00 2026-05-26T08:28:11+00:00

I just came across the NArray library for Ruby — please excuse my ignorance

  • 0

I just came across the NArray library for Ruby — please excuse my ignorance when asking this question 🙂

What are the advantages of using the NArray library over the standard Ruby Array implementation?

I’ve seen that NArray is geared towards numerical computing, but looking at the API, it looks like there are only a few extensions over Array geared towards numerical values — nothing that you couldn’t do with Array..

  1. Why not just use Array?
  2. Is there a huge speed advantage?
  3. Is there a huge memory advantage?
  4. Any other advantages over using the regular Ruby Array class?

Google didn’t really come up with a useful explanation of this question.

References I found:

http://rubydoc.info/gems/narray-ruby19/0.5.9.7/NArray

http://narray.rubyforge.org/index.html.en

http://raa.ruby-lang.org/project/narray/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:28:12+00:00Added an answer on May 26, 2026 at 8:28 am

    See also the slide about NArray:
    http://www.slideshare.net/masa16tanaka/narray-and-scientific-computing-with-ruby

    it looks like there are only a few extensions over Array

    No, it’s completely different from Array.
    NArray has many numerical functions and multi-dimensional features.
    On the other hand, NArray is static; it does not have push/pop methods, etc.
    NArray’s method list is http://narray.rubyforge.org/SPEC.en

    _1. Why not just use Array?

    Array holds Ruby Objects. It is inefficient to hold numerical values.

    _2. Is there a huge speed advantage?

    Yes. p.36 of the above slide shows NArray is up to 50 times faster.

    Note that Array is faster than NArray if the loop is written in Ruby.

    _3. Is there a huge memory advantage?

    Yes. As for Float values, Array consumes about 4 times more memory than NArray on my 64bit Linux machine.

    _4. Any other advantages over using the regular Ruby Array class?

    • Support of multi-dimensional array
    • Support of Numerical functions
    • No need for garbage collection on Array items. GC takes large time for large Arrays.
    • etc.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just came across this question about initializing local variables. Many of the answers
I just came across this question in the Go FAQ, and it reminded me
im working on application using delphi 7 , and i just came across this
Just came across this quote in a book on OOP that I'm reading, A
Just came across this website . Feature 9 is memory management and they claim
Just came across this by Chris Coyier - http://css-tricks.com/examples/CSSTabs/ Can anyone explain me, how
I just came across this code and a few Google searches turn up no
I just came across this idiom in some open-source Python, and I choked on
I just came across the question - is the access of an object safely
I just came across a C++ SDK that makes heavy use of this really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.