search for: k0

Displaying 20 results from an estimated 59 matches for "k0".

Did you mean: 0k
2002 Jun 27
2
Fastest way to find the last index k such that x[k] < y in a sorted vector x?
...test way to "find the last index k such that x[k] < y in a *sorted* vector x" These are my two alternatives: x <- sort(rnorm(1e4)) y <- 0.2 # Alt 1 k <- max(1, sum(x < y)) # Alt 2 "divide and conquer" lastIndexLessThan <- function(x, y) { k0 <- 1; k1 <- length(x) while ((dk <- (k1 - k0)) > 1) { k <- k0 + dk %/% 2 if (x[k] < y) k0 <- k else k1 <- k } k0 } k <- lastIndexLessThan(x, y) Simple benchmarking shows that alternative 1 is faster for short vectors and alternative 2 is faste...
2017 Jan 24
7
[X86][AVX512] RFC: make i1 illegal in the Codegen
...>%a, <8 x i32*> %p) { %r = call <8 x i32> @llvm.masked.gather.v8i32(<8 x i32*> %p, i32 4, <8 x i1> <i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>, <8 x i32> undef) ret 8 x i32>%r } Can be lowered to # BB#0: kxnorw %k0, %k0, %k1 vpgatherqd (,%zmm1), %ymm0 {%k1} retq Legal vectors of i1's require support for BUILD_VECTOR(i1, i1, .., i1), i1 EXTRACT_VEC_ELEMENT (...) and INSERT_VEC_ELEMENT(i1, ...) , so making i1 legal seemed like a sensible decision, and this is the current state in the top of trunk....
2018 Oct 17
3
pcie-expander-bus doesn't support pcie-pci-bridge and pcie-switch-upstream-port
...9;0x0'/> </controller> <controller type='pci' index='2' model='pcie-to-pci-bridge'> <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> </controller> ... # virsh -k0 -K0 define /tmp/c.xml error: Failed to define domain from /tmp/c.xml error: XML error: The device at PCI address 0000:01:00.0 cannot be plugged into the PCI controller with index='1'. It requires a controller that accepts a pcie-to-pci-bridge. # cat /tmp/b.xml ... <controller type=...
2016 Oct 20
2
[AVX512BW] Nasty KAND issue
...4 x i1> %r0, <i1 -1, i1 -1, i1 -1, i1 -1> At the IR level the all1s mask looks like the Identity for this operation, so LLVM will remove it. But it is not the Identity since this operation should clear the top 4 bits of the 8 bit hardware register in play. E.g. kmovb -4(%rsp), %k0 kandb %k0, %k1, %k0 kmovb %k0, -4(%rsp) I began tracking down this issue and found that InstCombine will incorrectly remove the AND. Then I noticed that the Reassociate pass would also remove the AND if InstCombine did not. That made me nervous. My current thinking is that this...
2016 Oct 20
2
[AVX512BW] Nasty KAND issue
...it is not the Identity since >> this operation should clear the top 4 bits of the 8 bit hardware >> register in play. E.g. > > No, this operation alone does not need to clear the upper bit, they are undefined before and after. > > >> >> kmovb -4(%rsp), %k0 >> kandb %k0, %k1, %k0 >> kmovb %k0, -4(%rsp) >> >> I began tracking down this issue and found that InstCombine will >> incorrectly remove the AND. Then I noticed that the Reassociate pass >> would also remove the AND if InstCombine did not. Tha...
2018 Oct 17
1
Re: pcie-expander-bus doesn't support pcie-pci-bridge and pcie-switch-upstream-port
On 10/17/2018 08:56 AM, Andrea Bolognani wrote: > On Wed, 2018-10-17 at 10:50 +0800, Han Han wrote: >> In libvirt, I found pcie-expander-bus controller doesn't support pcie-to-pci-bridge and pcie-switch-upstream-port. > [...] >> # virsh -k0 -K0 define /tmp/c.xml > Aside: the -k and -K virsh options are documented as > > -k | --keepalive-interval=NUM > keepalive interval in seconds, 0 for disable > -K | --keepalive-count=NUM > number of possible missed keepalive messages...
2006 Jun 07
1
knn - 10 fold cross validation
...ng function : knn.cvk <- function(datmat, cl, k = 2:9) { datmatT <- (datmat) cv.err <- cl.pred <- c() for (i in k) { newpre <- as.vector(knn.cv(datmatT, cl, k = i)) cl.pred <- cbind(cl.pred, newpre) cv.err <- c(cv.err, sum(cl != newpre)) } k0 <- k[which.min(cv.err)] print(k0) return(k0) } However, the knn.cv function does a 'leave one out' cross validation. I checked the documentation to see if I could change this, but it appears that I cannot. Since I have large datasets, I would like to do 10 fold cross validatio...
2012 May 15
2
Renaming names in R matrix
...22241 0.002705617 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 and given this: > new_names <- c("k0","k1","k2,"k3","k4","k5"); How can I get this? [,1] [,2] [,3] [,4] k0 0.7574657 0.2104075 0.02922241 0.002705617 k1 0.0000000 0.0000000 0.00000000 0.000000000 k2 0.0000000 0.0000000 0.00000000 0.000000000...
2011 Aug 13
1
Own R function doubt
Hi to all the people again, I was writting a simply function in R, and wish to collect the results in a excel file. The work goes as follows, Ciervos<-function(K1, K0, A, R,M,Pi,Hembras) {B<-(K1-K0)/A T1<-(R*Pi*Hembras-M*Pi+B)/(Pi-M*Pi+R*Pi*Hembras) P1<-Pi-B R1<-P1*Hembras*R M1<-P1*M T2<-(R1-M1+B)/(P1-M1+R1) P2<-P1-B R2<-P2*Hembras*R M2<-P2*M T3<-(R2-M2+B)/(P2-M2+R2) P3<-P2-B R3<-P3*Hembras*R M3<-P3*M T4<-(R3-M3+B)/(P3-M...
2016 Oct 20
2
[AVX512BW] Nasty KAND issue
...gt;>> this operation should clear the top 4 bits of the 8 bit hardware >>>> register in play. E.g. >>> No, this operation alone does not need to clear the upper bit, they are undefined before and after. >>> >>> >>>> kmovb -4(%rsp), %k0 >>>> kandb %k0, %k1, %k0 >>>> kmovb %k0, -4(%rsp) >>>> >>>> I began tracking down this issue and found that InstCombine will >>>> incorrectly remove the AND. Then I noticed that the Reassociate pass >>>> wou...
2008 May 02
0
Adaptive design code
...t.a[start.a<t.first])) #patTime.0<- sum(t.first-start.0[start.0<t.first]) #patTime.a<- sum(t.first-start.a[start.a<t.first]) med0.hat <-log(2)/(eventfirst.0/patTime.0) meda.hat <-log(2)/(eventfirst.a/patTime.a) # compute total number of events at interim look (k0) k0<-eventfirst.0 + eventfirst.a # calculate T(k0) from page 3744 of Schafer and Muller. # time.0 is the time on study for all patients experiencing an event before t.first # c.j is the number of patients randomized to the control group before t.first # that have been on study as...
2017 Jul 01
2
KNL Assembly Code for Matrix Multiplication
...;> vpbroadcastq zmm3, rsi >>>>> add rsi, 3856000 >>>>> vpbroadcastq zmm4, qword ptr [rip + .LCPI0_3] >>>>> vpbroadcastq zmm5, qword ptr [rip + .LCPI0_4] >>>>> vpbroadcastq zmm6, qword ptr [rip + .LCPI0_5] >>>>> kxnorw k1, k0, k0 >>>>> kshiftrw k1, k1, 8 >>>>> vpbroadcastq zmm7, qword ptr [rip + .LCPI0_6] >>>>> .p2align 4, 0x90 >>>>> .LBB0_1: # %.preheader26 >>>>> # =>This...
2020 Jan 14
2
[R] choose(n, k) as n approaches k
...ld 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. > But choose() very deliberately ensures that k is integer, so choose(n, n-k) is ill-defined for non-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> wro...
2020 Jan 14
4
[R] choose(n, k) as n approaches k
...read your suggestion, n would only be rounded to integer if k > n-k. I think both n and k should be rounded to integer in this near-integer situation, regardless of the value of k. > > I believe that lchoose(n, k) already does this. > > Duncan Murdoch > >> 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...
2006 Apr 26
1
help using tapply
...1] + 1 dur[5] <- dur[4] + 8 for( i in c(6:8) ) dur[i] <- dur[i-1] + 1 } if ( sum( diff(est) )!=0 ) # for those who changed state { j = which(diff(est)!=0) + 1 # j is when the change occured dur[j] = 1 k0 = which( c(1:8) < j )[-c(1)] k1 = which( c(1:8) > j ) if(length(j) > 1) { for( i in 1:(length(j)-1) ) k2 = c(1:8)[c(1:8)> j[i] & c(1:8)< j[i+1]] k = unique( c(k0,k1,k2) )...
2018 Oct 17
0
Re: pcie-expander-bus doesn't support pcie-pci-bridge and pcie-switch-upstream-port
On Wed, 2018-10-17 at 10:50 +0800, Han Han wrote: > In libvirt, I found pcie-expander-bus controller doesn't support pcie-to-pci-bridge and pcie-switch-upstream-port. [...] > # virsh -k0 -K0 define /tmp/c.xml Aside: the -k and -K virsh options are documented as -k | --keepalive-interval=NUM keepalive interval in seconds, 0 for disable -K | --keepalive-count=NUM number of possible missed keepalive messages So -k0 disables keepalive...
2008 Aug 14
1
time difference bug?
...uting some time differences. Using the linux version of R 2.7.1 And I am getting a strange result ( see below ) I need the difference in minutes. Actually looking for where it is NOT 15 minutes. Would anyone know why this could be happening? Or should I do this another way? Bill The script "k0.R" =============== a=read.table("buzwah005.txt") d=strptime(paste(a[,1]," ",a[,2]),"%m/%d/%Y %H:%M") tm=-24*60*as.numeric(as.POSIXlt("2007-1-1")-d) # time since midnight Jan 1 print(tm[2]-tm[1]) x=a[,3] diffs=round(tm[-1]-tm[-length(tm)]) not15=(1:length...
2016 Aug 25
3
invariant.load metadata semantics
...me dereferenceable". In the current langref, I find "The existence" somewhat confusing, since it seems to imply that adding dead code can change the behavior of the program. I don't want to specify the semantics in a way that: int* ptr = ... int k0 = *ptr; // normal load clobber(); int k1 = *ptr; // normal load has a different meaning than int* ptr = ... int k0 = *ptr; // normal load clobber(); int k1 = *ptr; // normal load if (<always false>) { int k2 = *ptr; // !i...
2011 Nov 29
0
[SOLVED]looking for beta parameters
...ntile2$p > x2 = quantile2$x > logK = seq(-3, 8, length = 100) > K = exp(logK) > m = sapply(K, betaprior1, x1, p1) > prob2 = pbeta(x2, K * m, K * (1 - m)) > ind = ((prob2 > 0) & (prob2 < 1)) > app = approx(prob2[ind], logK[ind], p2) > K0 = exp(app$y) > m0 = betaprior1(K0, x1, p1) > return(round(K0 * c(m0, (1 - m0)), 2)) > } > > I assume one could change this code to get the results I need, but > some parts of the function are not clear for me, any help would be > greatly appreciated. > > Thanks...
2020 Jan 14
0
[R] choose(n, k) as n approaches k
...d to integer. As I read your suggestion, n would only be rounded to integer if k > n-k. I think both n and k should be rounded to integer in this near-integer situation, regardless of the value of k. I believe that lchoose(n, k) already does this. Duncan Murdoch > > 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 , Wr...