search for: eswright

Displaying 13 results from an estimated 13 matches for "eswright".

2020 Jan 14
2
[R] choose(n, k) as n approaches k
...integer n. double r, k0 = k; k = R_forceint(k); ... if (fabs(k - k0) > 1e-7) MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k); > Duncan Murdoch > >> -pd >>> On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote: >>> >>> This struck me as incorrect: >>> >>>> choose(3.999999, 4) >>> [1] 0.9999979 >>>> choose(3.9999999, 4) >>> [1] 0 >>>> choose(4, 4) >>> [1] 1 >>>> choose(4.0000001, 4...
2020 Jan 14
1
[R] choose(n, k) as n approaches k
...reasonable and in accordance with the limit as n -> 4, e.g. > factorial(4 - 1e-10)/factorial(1e-10)/factorial(4) -1 [1] -9.289025e-11 I guess that the fix could be as simple as replacing n by R_forceint(n) in the k = n - k step. -pd > On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote: > > This struck me as incorrect: > >> choose(3.999999, 4) > [1] 0.9999979 >> choose(3.9999999, 4) > [1] 0 >> choose(4, 4) > [1] 1 >> choose(4.0000001, 4) > [1] 4 >> choose(4.000001, 4) > [1] 1.000002 > > Should ba...
2020 Jan 13
3
choose(n, k) as n approaches k
This struck me as incorrect: > choose(3.999999, 4) [1] 0.9999979 > choose(3.9999999, 4) [1] 0 > choose(4, 4) [1] 1 > choose(4.0000001, 4) [1] 4 > choose(4.000001, 4) [1] 1.000002 Should base::choose(n, k) check whether n is within machine precision of k and return 1? Thanks, Erik *** sessionInfo() R version 3.6.0 beta (2019-04-15 r76395) Platform: x86_64-apple-darwin15.6.0
2020 Jan 13
3
choose(n, k) as n approaches k
This struck me as incorrect: > choose(3.999999, 4) [1] 0.9999979 > choose(3.9999999, 4) [1] 0 > choose(4, 4) [1] 1 > choose(4.0000001, 4) [1] 4 > choose(4.000001, 4) [1] 1.000002 Should base::choose(n, k) check whether n is within machine precision of k and return 1? Thanks, Erik *** sessionInfo() R version 3.6.0 beta (2019-04-15 r76395) Platform: x86_64-apple-darwin15.6.0
2020 Jan 14
4
[R] choose(n, k) as n approaches k
..... >> if (fabs(k - k0) > 1e-7) >> MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k); >> >>> Duncan Murdoch >>> >>>> -pd >>>>> On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote: >>>>> >>>>> This struck me as incorrect: >>>>> >>>>>> choose(3.999999, 4) >>>>> [1] 0.9999979 >>>>>> choose(3.9999999, 4) >>>>> [1] 0 >>>>>> choo...
2020 Jan 14
0
[R] choose(n, k) as n approaches k
...ep. I think that would break symmetry: you want choose(n, k) to equal choose(n, n-k) when n is very close to an integer. So I'd suggest the replacement whenever R_IS_INT(n) is true. Duncan Murdoch > > -pd > > > >> On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote: >> >> This struck me as incorrect: >> >>> choose(3.999999, 4) >> [1] 0.9999979 >>> choose(3.9999999, 4) >> [1] 0 >>> choose(4, 4) >> [1] 1 >>> choose(4.0000001, 4) >> [1] 4 >>> choose(4.000...
2020 Jan 14
0
[R] choose(n, k) as n approaches k
..._forceint(k); > ... > if (fabs(k - k0) > 1e-7) > MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k); > > >> Duncan Murdoch >> >>> -pd >>>> On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote: >>>> >>>> This struck me as incorrect: >>>> >>>>> choose(3.999999, 4) >>>> [1] 0.9999979 >>>>> choose(3.9999999, 4) >>>> [1] 0 >>>>> choose(4, 4) >>>> [1] 1 &g...
2020 Jan 15
1
[R] choose(n, k) as n approaches k
...gt;>>> MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k); >>>> >>>>> Duncan Murdoch >>>>> >>>>>> -pd >>>>>>> On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote: >>>>>>> >>>>>>> This struck me as incorrect: >>>>>>> >>>>>>>> choose(3.999999, 4) >>>>>>> [1] 0.9999979 >>>>>>>> choose(3.9999999, 4) >>...
2020 Jan 14
0
[R] choose(n, k) as n approaches k
...abs(k - k0) > 1e-7) >>> MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k); >>> >>>> Duncan Murdoch >>>> >>>>> -pd >>>>>> On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote: >>>>>> >>>>>> This struck me as incorrect: >>>>>> >>>>>>> choose(3.999999, 4) >>>>>> [1] 0.9999979 >>>>>>> choose(3.9999999, 4) >>>>>> [1] 0 &...
2010 Apr 10
1
.Call function crashes initializing matrix
Hello, I have a C function that I call from R using .Call. I recently discovered a bug in my code, and I am not sure if it is a problem with what I am doing in C or if it has something to do with my use of .Call. I have narrowed my problem down to these two C statements: int size = 5000; double matrix[size][size]; When I run this in R it crashes, with this message: *** caught segfault ***
2010 Apr 05
2
Rprintf not updating
Hello all, I am using Rprintf in a C for loop (from .Call) to print a progress indicator showing the current percent complete. The loop I am doing is an time intensive call to another function. I have noticed that Rprintf does not print to the R-window until the entire loop has been completed. When it reaches the end of the loop it suddenly prints 0 percent to 100 percent in a split second.
2010 Jul 09
2
Compress string memCompress/Decompress
Hello, I would like to compress a long string (character vector), store the compressed string in the text field of a SQLite database (using RSQLite), and then load the text back into memory and decompress it back into the the original string. My character vector can be compressed considerably using standard gzip/bzip2 compression. In theory it should be much faster for me to compress/decompress
2012 Jan 20
1
Building R on RHEL 5
Hello, I am trying to upgrade to the latest R release on a machine running Red Hat el5.? Previously I was successful at building R 2.11, but now I am having troubles with R 2.14. Configure goes fine, but then make throws a lot of errors (output below).? Any idea what I am doing wrong this time around? Thanks in advance, Erik make output: ... gcc -std=gnu99 -I../../src/extra/zlib