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 s
> 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.
On 06/12/2013 15:49, Gábor Csárdi wrote:
On Fri, Dec 6, 2013 at 10:42 AM, Prof Brian Ripley
wrote:
On 06/12/2013 14:42, Gábor Csárdi wrote:
On Fri, Dec 6, 2013 at 9:38 AM, Duncan Murdoch
wrote:
On 06/12/2013 8:21 AM, Larissa Hauer wrote:
[...]
I would not assume that a 2D matrix in C
Hi Larissa,
> I'm trying to pass a matrix from R to C, where some computation is
> done for performance reasons, and back to R for evaluation. But I've
> run into the problem that R and C seem to have different ways of
> representing the matrix in main memory. The C representation of a 2D
> matrix
On Fri, Dec 6, 2013 at 10:42 AM, Prof Brian Ripley
wrote:
> On 06/12/2013 14:42, Gábor Csárdi wrote:
>>
>> On Fri, Dec 6, 2013 at 9:38 AM, Duncan Murdoch
>> wrote:
>>>
>>> On 06/12/2013 8:21 AM, Larissa Hauer wrote:
>>
>> [...]
>>>
>>>
>>>
>>> I would not assume that a 2D matrix in C doesn't have
On 06/12/2013 14:42, Gábor Csárdi wrote:
On Fri, Dec 6, 2013 at 9:38 AM, Duncan Murdoch wrote:
On 06/12/2013 8:21 AM, Larissa Hauer wrote:
[...]
I would not assume that a 2D matrix in C doesn't have gaps in it between the
rows. Let C treat it as a vector, and write a little macro that does
On Fri, Dec 6, 2013 at 9:38 AM, Duncan Murdoch wrote:
> On 06/12/2013 8:21 AM, Larissa Hauer wrote:
[...]
>
>
> I would not assume that a 2D matrix in C doesn't have gaps in it between the
> rows. Let C treat it as a vector, and write a little macro that does the
> indexing. For example,
>
> #de
On 06/12/2013 8:21 AM, Larissa Hauer wrote:
Hi everybody,
I'm trying to pass a matrix from R to C, where some computation is done
for performance reasons, and back to R for evaluation. But I've run into
the problem that R and C seem to have different ways of representing the
matrix in main memor
Larissa,
So is the problem "in the matrix reference is mat[col][row] whereas in R
it is mar[row, col]?"
The solution is just recognizing the difference in references.
Dave
On Fri, Dec 6, 2013 at 7:21 AM, Larissa Hauer
wrote:
>
> Hi everybody,
>
> I'm trying to pass a matrix from R to C, wher