search for: ndigit

Displaying 20 results from an estimated 25 matches for "ndigit".

Did you mean: digit
2011 Dec 01
2
How to speed up int2bin conversion?
...an 8 digit binary flag to get access to the stored quality code (e.g. in2bin(165,8) = 1 0 1 0 0 1 0 1). Unfortunately, I did not manage to find a package providing a fast function to do so. I need to run this on millions of pixels and thus wrote the following function. int2bin <- function(x,ndigits){ base <- array(NA, dim=c(length(x), ndigits)) for(q in 1:ndigits){ base[, ndigits-q+1] <- (x %% 2) x <- (x %/% 2) } bin<- apply(base,1,paste,collapse="") return(bin) } Since it is still slow, I have to find a way to express t...
2003 Oct 23
1
Re: ichar() function in R : 1st implementation, RFC
...Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <>< -------------- next part -------------- ### This was digits.v() in library(sfsmisc): ### --> get it's help() file /u/maechler/R/Pkgs/sfsmisc/man/digits.Rd digitsBase <- function(x, base = 2, ndigits = 1 + floor(log(max(x),base))) { ## Purpose: Give the vector A of the base-_base_ representation of _n_: ## ------- n = sum_{k=0}^M A_{M-k} base ^ k , where M = length(a) - 1 ## Value: MATRIX M where M[,i] corresponds to x[i] ## c( result ) then contains the blocks in prop...
2000 Mar 06
1
nlm and optional arguments
...e of nlm() but defining a temporary function that passes the optional arguments to the objective function), but I presume this would be cleaner and faster if implemented at a lower level ... nlm2 <- function(f, p, hessian=FALSE, typsize=rep(1,length(p)), fscale=1, print.level=0, ndigit=12, gradtol=1e-6, stepmax=max(1000 * sqrt(sum((p/typsize)^2)), 1000), steptol=1e-6, iterlim=100, check.analyticals=TRUE, ...) { tmpf <- function(x) { f(x,...) } nlm(tmpf,p,hessian=hessian,typsize=typsize,fscale=fscale,print.level=print.level, ndigi...
2018 Feb 08
2
[PATCH] syslinux/com32: Fix the printing of left zero padded hexadecimals with a leading '0x'.
...rtened by up to two characters if any leading zero padding character required is. int hexnum = 0x00001234; printf("%08X", hexnum); // results in 00001234 printf("%#08X", hexnum); // results in 0x001234 To correct this, the zero padding counting logic needs to use ndigits instead of nchars. Signed-off-by: Brett Walker <brett.walker at geometry.com.au> --- --- ./syslinux/com32/lib/vsnprintf.c.orig +++ ./syslinux/com32/lib/vsnprintf.c @@ -126,7 +126,7 @@ format_int(char *q, size_t n, uintmax_t /* Emit zero padding */ if ((flags & (FL_MINUS | F...
2003 Sep 14
2
Convert decimal to binary data
Hi, I would like to convert a decimal into a binary number, for instance : 2->(1,0) Any one knows how to do that ? Thanks a lot paul --- [[alternative HTML version deleted]]
2008 Jan 15
1
Viewing source code for .Internal functions
I am trying to view the source code of the function nlm in the stats package of R 2.4.1. I downloaded the source from CRAN and opened nlm.R, and it calls a .Internal function: .Internal(nlm(function(x) f(x, ...), p, hessian, typsize, fscale, msg, ndigit, gradtol, stepmax, steptol, iterlim)) This is the same thing I saw when entering the function name at the R command prompt. Where will I find the actual code? Thanks.
2008 Nov 21
3
Dynamic generation of a (sub) layout
Hi, first of all - I''m relatively unexpierienced with GUI programming in general and with FXRuby in particular. I''ve managed to write a little FXRuby app that animates some data I''ve collected. I made really good progress for a while, but now I''m stuck with the following problem. My data is read from file and can have a varying number of elements, depending on
2015 Nov 14
2
Inexplicable ASAN report. Code generation bug?
...you prepare a minimized example? Pretty recent, I updated a couple days ago. I tried to minimize the attached but at the same time I didn't want to lose too many unions and casts in case it didn't trigger any more. $ clang -fsanitize=address -Wall numeric-asan-test.c $ ./a.out VARSIZE 6 NDIGITS 0 WEIGHT 0 SIGN 0 DSCALE 0 $ clang -fsanitize=address -O2 -Wall numeric-asan-test.c $ ./a.out VARSIZE 6 ================================================================= ==19982==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000eff4 at pc 0x0000004d4986 bp 0x7ffe14e2cb90 sp 0x7f...
2018 Feb 08
0
[PATCH] syslinux/com32: Fix the printing of left zero padded hexadecimals with a leading '0x'.
...ny leading zero padding character required is. > > int hexnum = 0x00001234; > > printf("%08X", hexnum); // results in 00001234 > printf("%#08X", hexnum); // results in 0x001234 > > To correct this, the zero padding counting logic needs to use ndigits instead of > nchars. No. You asked for at least 8 chars output. You got 8 chars output. If you want/expect at least 10 chars output, ask for 10 chars. -- MartinS
2005 Apr 21
1
Fwd: (KAME-snap 9012) racoon in the kame project
FYI, looks like support for Racoon is ending. Does anyone have any experience with the version in ipsec-tools ? ---Mike >Racoon users, > >This is the announcement that the kame project will quit providing >a key management daemon, the racoon, and that "ipsec-tools" will become >the formal team to release the racoon. >The final release of the racoon in the
2004 Apr 14
4
binary numbers
Hi, Is there a function in R that lets one represent an integer in binary format for a given number of bits? So an example would be.... > binary.function(num=5, num.of.bits=8) > "00000101" Or, is this something I have to write myself? Any help would be appreciated. Cheers, Sam.
2013 Oct 18
0
pamer.fnc y la nueva versión de R
...################################ # "solución" ################################################################################################################################# ############################## ############################################# pamer.fnc2 <- function (model, ndigits = 4) { if (length(rownames(anova(model))) == 0) { cat("nothing to evaluate: model has only an intercept.\n\n") cat("printing model fixed effects:\n") fixef(model) } else { dims <- NULL # rank.X = qr(model@X)$rank rank.X = qr(model@pp$X)$rank...
2005 Oct 11
2
Sometimes having problems finding a minimum using optim(), optimize(), and nlm() (while searching for noncentral F parameters)
...h the same task with a different R function. optimize(f=Low.Lim.NC.F, lower=LL.0, upper=50, maximum=FALSE, tol=tol, alpha.lower=alpha.lower, F.value=F.value, df.1=df.1, df.2=df.2) # Try to accomplish the same task with a different R function. nlm(f=Low.Lim.NC.F, p=LL.0, fscale=1, print.level = 0, ndigit=12, gradtol = 1e-6, stepmax = max(1000 * sqrt(sum((LL.0/10)^2)), 1000), steptol = 1e-6, iterlim = 1000, check.analyticals = TRUE, alpha.lower=alpha.lower, F.value=F.value, df.1=df.1, df.2=df.2) # The answer in each case is 3.0725. Thus, a noncentral F with # 5 and 200 df with a noncentrality para...
2013 Oct 18
2
pamer.fnc y la nueva versión de R
Javier, Creo que aquí aplica la ley de Linus que dice: "Dado un número suficientemente elevado de ojos, todos los errores se convierten en obvios". La persona que revisa y encuentra un error no necesariamente tiene que ser la misma que la que lo escribe. Una motivación muy importante al compartir un código es la de recibir los beneficios del control de calidad por parte de tus pares.
2013 Dec 02
1
pamer.fnc y la nueva versión de R
...gt; # "solución" > > ################################################################################################################################# > ############################## > ############################################# > > pamer.fnc2 <- function (model, ndigits = 4) { > if (length(rownames(anova(model))) == 0) { > cat("nothing to evaluate: model has only an intercept.\n\n") > cat("printing model fixed effects:\n") > > > fixef(model) > } > else { > dims <- NULL > # rank.X = qr(...
2007 Mar 02
2
nlm() problem : extra parameters
Hello: Below is a toy logistic regression problem. When I wrote my own code, Newton-Raphson converged in three iterations using both the gradient and the Hessian and the starting values given below. But I can't get nlm() to work! I would much appreciate any help. > x [1] 10.2 7.7 5.1 3.8 2.6 > y [1] 9 8 3 2 1 > n [1] 10 9 6 8 10 derfs4=function(b,x,y,n) {
2015 Nov 12
3
Inexplicable ASAN report. Code generation bug?
I'm struggling to explain an ASAN report I'm now getting that I didn't get previously on the same code. In fact the report only happens with -O2 and not when I remove the -O flags which makes it hard to debug and makes me suspect it's dependent on exactly which instructions the code generation decides to access the bytes involved. Afaict the C code shouldn't be accessing the
2020 Jun 16
0
[PATCH v5 2/2] mm, treewide: Rename kzfree() to kfree_sensitive()
...sh(sdesc->shash.tfm); - kzfree(sdesc); + kfree_sensitive(sdesc); } drbg->priv_data = NULL; return 0; diff --git a/crypto/ecc.c b/crypto/ecc.c index 02d35be7702b..37540332c1f3 100644 --- a/crypto/ecc.c +++ b/crypto/ecc.c @@ -67,7 +67,7 @@ static u64 *ecc_alloc_digits_space(unsigned int ndigits) static void ecc_free_digits_space(u64 *space) { - kzfree(space); + kfree_sensitive(space); } static struct ecc_point *ecc_alloc_point(unsigned int ndigits) @@ -101,9 +101,9 @@ static void ecc_free_point(struct ecc_point *p) if (!p) return; - kzfree(p->x); - kzfree(p->y); - kz...
2020 Apr 13
0
[PATCH 1/2] mm, treewide: Rename kzfree() to kfree_sensitive()
...sh(sdesc->shash.tfm); - kzfree(sdesc); + kfree_sensitive(sdesc); } drbg->priv_data = NULL; return 0; diff --git a/crypto/ecc.c b/crypto/ecc.c index 02d35be7702b..37540332c1f3 100644 --- a/crypto/ecc.c +++ b/crypto/ecc.c @@ -67,7 +67,7 @@ static u64 *ecc_alloc_digits_space(unsigned int ndigits) static void ecc_free_digits_space(u64 *space) { - kzfree(space); + kfree_sensitive(space); } static struct ecc_point *ecc_alloc_point(unsigned int ndigits) @@ -101,9 +101,9 @@ static void ecc_free_point(struct ecc_point *p) if (!p) return; - kzfree(p->x); - kzfree(p->y); - kz...
2020 Jun 16
0
[PATCH v4 2/3] mm, treewide: Rename kzfree() to kfree_sensitive()
...sh(sdesc->shash.tfm); - kzfree(sdesc); + kfree_sensitive(sdesc); } drbg->priv_data = NULL; return 0; diff --git a/crypto/ecc.c b/crypto/ecc.c index 02d35be7702b..37540332c1f3 100644 --- a/crypto/ecc.c +++ b/crypto/ecc.c @@ -67,7 +67,7 @@ static u64 *ecc_alloc_digits_space(unsigned int ndigits) static void ecc_free_digits_space(u64 *space) { - kzfree(space); + kfree_sensitive(space); } static struct ecc_point *ecc_alloc_point(unsigned int ndigits) @@ -101,9 +101,9 @@ static void ecc_free_point(struct ecc_point *p) if (!p) return; - kzfree(p->x); - kzfree(p->y); - kz...