Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-24 Thread Simon Urbanek
length) ; >>>int *psrc = INTEGER(s_src) ; >>>int *pdest ; >>>int i ; >>>SEXP s_dest ; >>>PROTECT(s_dest = allocVector(INTSXP, dest_length)) ; >>>pdest = INTEGER(s_dest) ; >>>if(TYPEOF(s_src) != INTSXP) error(&q

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-23 Thread Hervé Pagès
t.org [mailto:r-devel-boun...@r-project.org] On Behalf Of Romain Francois Sent: Wednesday, April 21, 2010 12:32 PM To: Matthew Dowle Cc: r-de...@stat.math.ethz.ch Subject: Re: [Rd] suggestion how to use memcpy in duplicate.c Le 21/04/10 17:54, Matthew Dowle a écrit : From copyVector in duplicate.c

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-23 Thread Hervé Pagès
rror("src must be integer data") ; for(i=0;i -Original Message- From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On Behalf Of Romain Francois Sent: Wednesday, April 21, 2010 12:32 PM To: Matthew Dowle Cc: r-de...@stat.math.ethz.ch Subject: Re: [Rd] sugges

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-23 Thread Hervé Pagès
main Francois Sent: Wednesday, April 21, 2010 12:32 PM To: Matthew Dowle Cc: r-de...@stat.math.ethz.ch Subject: Re: [Rd] suggestion how to use memcpy in duplicate.c Le 21/04/10 17:54, Matthew Dowle a écrit : From copyVector in duplicate.c : void copyVector(SEXP s, SEXP t) { int i, ns, nt;

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-22 Thread Simon Urbanek
On Apr 22, 2010, at 7:12 AM, Matthew Dowle wrote: > > Is this a thumbs up for memcpy for DUPLICATE_ATOMIC_VECTOR at least ? > > If there is further specific testing then let me know, happy to help, but > you seem to have beaten me to it. > I was not volunteering to do anything - I was just l

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-22 Thread Matthew Dowle
src) != INTSXP) error("src must be integer data") ; for(i=0;i -Original Message- > From: r-devel-boun...@r-project.org > [mailto:r-devel-boun...@r-project.org] On Behalf Of Romain Francois > Sent: Wednesday, April 21, 2010 12:32 PM > To: Matthew Dowle > Cc: r-de

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-22 Thread Matthew Dowle
Is this a thumbs up for memcpy for DUPLICATE_ATOMIC_VECTOR at least ? If there is further specific testing then let me know, happy to help, but you seem to have beaten me to it. Matthew "Simon Urbanek" wrote in message news:65d21b93-a737-4a94-bdf4-ad7e90518...@r-project.org... > > On Apr 21

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread William Dunlap
m: r-devel-boun...@r-project.org > [mailto:r-devel-boun...@r-project.org] On Behalf Of Romain Francois > Sent: Wednesday, April 21, 2010 12:32 PM > To: Matthew Dowle > Cc: r-de...@stat.math.ethz.ch > Subject: Re: [Rd] suggestion how to use memcpy in duplicate.c > > Le 21/04/10 17:

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Simon Urbanek
On Apr 21, 2010, at 4:39 PM, Simon Urbanek wrote: > > On Apr 21, 2010, at 4:13 PM, Romain Francois wrote: > >> Le 21/04/10 21:39, Simon Urbanek a écrit : >>> >>> >>> On Apr 21, 2010, at 3:32 PM, Romain Francois wrote: >>> Le 21/04/10 17:54, Matthew Dowle a écrit : > >> From cop

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Simon Urbanek
On Apr 21, 2010, at 4:13 PM, Romain Francois wrote: > Le 21/04/10 21:39, Simon Urbanek a écrit : >> >> >> On Apr 21, 2010, at 3:32 PM, Romain Francois wrote: >> >>> Le 21/04/10 17:54, Matthew Dowle a écrit : > From copyVector in duplicate.c : void copyVector(SEXP s, SEXP t

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Romain Francois
Le 21/04/10 21:39, Simon Urbanek a écrit : On Apr 21, 2010, at 3:32 PM, Romain Francois wrote: Le 21/04/10 17:54, Matthew Dowle a écrit : From copyVector in duplicate.c : void copyVector(SEXP s, SEXP t) { int i, ns, nt; nt = LENGTH(t); ns = LENGTH(s); switch (TYPEOF(

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Simon Urbanek
On Apr 21, 2010, at 3:32 PM, Romain Francois wrote: > Le 21/04/10 17:54, Matthew Dowle a écrit : >> >>> From copyVector in duplicate.c : >> >> void copyVector(SEXP s, SEXP t) >> { >> int i, ns, nt; >> nt = LENGTH(t); >> ns = LENGTH(s); >> switch (TYPEOF(s)) { >> ... >> case

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Simon Urbanek
On Apr 21, 2010, at 2:15 PM, Seth Falcon wrote: > On 4/21/10 10:45 AM, Simon Urbanek wrote: >> Won't that miss the last incomplete chunk? (and please don't use >> DATAPTR on INTSXP even though the effect is currently the same) >> >> In general it seems that the it depends on nt whether this is >

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Romain Francois
Le 21/04/10 17:54, Matthew Dowle a écrit : From copyVector in duplicate.c : void copyVector(SEXP s, SEXP t) { int i, ns, nt; nt = LENGTH(t); ns = LENGTH(s); switch (TYPEOF(s)) { ... case INTSXP: for (i = 0; i< ns; i++) INTEGER(s)[i] = INTEGER(t)[i % nt]

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Seth Falcon
On 4/21/10 10:45 AM, Simon Urbanek wrote: Won't that miss the last incomplete chunk? (and please don't use DATAPTR on INTSXP even though the effect is currently the same) In general it seems that the it depends on nt whether this is efficient or not since calls to short memcpy are expensive (ver

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Simon Urbanek
Matt, On Apr 21, 2010, at 11:54 AM, Matthew Dowle wrote: >> From copyVector in duplicate.c : > > void copyVector(SEXP s, SEXP t) > { >int i, ns, nt; >nt = LENGTH(t); >ns = LENGTH(s); >switch (TYPEOF(s)) { > ... >case INTSXP: >for (i = 0; i < ns; i++) >INTEGER(s)[i

[Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Matthew Dowle
>From copyVector in duplicate.c : void copyVector(SEXP s, SEXP t) { int i, ns, nt; nt = LENGTH(t); ns = LENGTH(s); switch (TYPEOF(s)) { ... case INTSXP: for (i = 0; i < ns; i++) INTEGER(s)[i] = INTEGER(t)[i % nt]; break; ... could that be replaced with : c