Skip to content
Prev 34542 / 63424 Next

Confusion regarding allocating Matrices.

On Fri, Oct 23, 2009 at 2:02 PM, Abhijit Bera <abhibera at gmail.com> wrote:
Because you are making some sweeping and incorrect assumptions about
the way that the internals of R operate.  R allows for arrays to be
dynamically resized but this is accomplished internally by allocating
new storage, copying the current contents to this new location and
installing the values of the new elements.  It is an expensive
operation, which is why it is discouraged.

Your design is deeply flawed.  Go back to the drawing board.
Either one.
R stores floating-point numbers as the C data type double, not float.
It may seem pedantic to point out distinctions like that but not when
you are writing programs.  Compilers are the ultimate pedants - they
are real sticklers for getting the details right.

As I said, it just doesn't work the way that you think it does.  The
fact that there is an R object with a certain name before and after an
operation doesn't mean it is the same R object.