[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-devel
Subject:    Re: [Rd] Matrix memory layout R vs. C
From:       Prof Brian Ripley <ripley () stats ! ox ! ac ! uk>
Date:       2013-12-06 16:06:02
Message-ID: 52A1F5EA.9000909 () stats ! ox ! ac ! uk
[Download RAW message or body]

On 06/12/2013 15:51, Luis Carvalho wrote:
>> And to be safer on a 64-bit platform
>>
>> #define INDEX(i,j) ((i) + rows*(R_xlen_t)(j))
>>
>> since rows*j might overflow there.
>
> Shouldn't 'rows' be also a parameter?

This is a macro, not a function.  'rows' (I would have use nr or nrows) 
is going to be the same at all invocations.

>
> #define INDEX(rows,i,j) ((i) + (rows)*((R_xlen_t)(j)))
>
> Cheers,
> Luis
>


-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic