in reply to why does this array take up so much memory?

If you are doing matrix operations in Perl (which your code and variable name suggest), consider using the PDL module (it stands for Perl Data Lanuguage). This is a compiled C matrix library highly optimized for speed, and the data structures take up much less memory than native Perl arrays.

PDL is very full-featured, and overloads many common operators, so you can do matrix operations like addition and multiplication in a very DWIMmish way. The only downside is having to read through a small mountain of documentation.

  • Comment on Re: why does this array take up so much memory?