From lexcarvalho at gmail.com  Fri Dec  6 16:51:39 2013
From: lexcarvalho at gmail.com (Luis Carvalho)
Date: Fri, 6 Dec 2013 10:51:39 -0500
Subject: [Rd] Matrix memory layout R vs. C
In-Reply-To: <52A1F06D.3080701@stats.ox.ac.uk>
References: <52A1CF46.7070408@googlemail.com> <52A1E17B.8090200@gmail.com>
	<CABtg=KnYfx_VYvGdmximPm7GSSj-eY-vzdcYKpPPtHDcd1ppXg@mail.gmail.com>
	<52A1F06D.3080701@stats.ox.ac.uk>
Message-ID: <20131206155139.GA2804@saci>

> 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?

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

Cheers,
Luis

-- 
Computers are useless. They can only give you answers.
                -- Pablo Picasso

-- 
Luis Carvalho (Kozure)
lua -e 'print((("lexcarvalho at NO.gmail.SPAM.com"):gsub("(%u+%.)","")))'



[Rd] Matrix memory layout R vs. C
Luis Carvalho