similar to: Matrix: how to re-use the symbolic Cholesky factorization?

Displaying 20 results from an estimated 400 matches similar to: "Matrix: how to re-use the symbolic Cholesky factorization?"

2004 Apr 14
2
attaching data.frame/list within a function
I'm trying to find a good way of attaching a list within a function such that the attached variables (the list's members) precede the global environment (.GlobalEnv) in the search list. Here is a non-working example using attach(), which hopefully explains better what I'm trying to do: > foo <- function(x=0, input=list(a=10)) { + attach(input) + on.exit(detach(input)) +
2009 Mar 10
5
Cholesky Decomposition in R
Hi everyone: I try to use r to do the Cholesky Decomposition,which is A=LDL',so far I only found how to decomposite A in to LL' by using chol(A),the function Cholesky(A) doesnt work,any one know other command to decomposte A in to LDL' My r code is: library(Matrix) A=matrix(c(1,1,1,1,5,5,1,5,14),nrow=3) > chol(A) [,1] [,2] [,3] [1,] 1 1 1 [2,] 0 2 2
2010 Sep 25
1
(no subject)
hi how can i plot now this function??? have to be m= 2??? because of the dimensions?thanks for ur help myfun <- function(n, m, alpha = .05, seeder = 1000) { set.seed(seeder) x <- matrix(rnorm(n, 0, 0.5), ncol = m) y <- matrix(rnorm(n, 0, 0.8), ncol = m) l <- diag(cor(x, y)) cat("Correlations between two random variables \n", l, fill = TRUE) gute
2010 Sep 25
3
3D plot
hey, how can i plot this function??? thanks for ur help n=1000 m=2 k=n/m N=100 myfun <- function(n, m, alpha = .05, seeder = 1000) { l=matrix(0,nrow=m,ncol=N) for(i in 1:N){ set.seed(i) for(j in 1:m){ x=rnorm(n,0,0.5) y=rnorm(n,0,0.8) l[j,i]=cor((x[(((j-1)*k)+1):(((j-1)*k)+k)]), (y[(((j-1)*k)+1):(((j-1)*k)+k)])) } } for(i in 1:N){ for (j in 1:m){ gute <- function() { q_1 <-
2005 Jan 04
2
x11 is not available
Dear list, I have problems installing R-2.0.1 on SUSE Linux 9.2. I used the following commands in order install R in /usr/local ./configure --with x11 --with-readline make make install When starting R and trying to display a plot on the X-window system output is written to a postscript file. When I try to run x11 with >x11() Error in X11(): X11 is not available. I do have a running
2003 Oct 16
1
Improving efficiency in "outer"-like calculation
Hello, I am doing mcmc=10000 simulations from a posterior distribution of the parameters of a mixture of K=6 normal densities. I have mcmc by K matrices simMeans, simVars and simWeights containing the simulation output: one row for each simulation, one column for each normal component of the mixture. One thing I would like to do is a plot of the posterior predictive density. In order to do that
2010 Sep 26
8
the function doesn´t work
hey, my function doesn?t work. can somebody help me? the graphic doesn?t work and also the function. thnx a lot. N=10 n=100 p_0=c(1/5,1-1/5) power = function(p,m) { set.seed(1000) H=matrix(0,nrow=N,ncol=1) for(i in 1:N) { x <- matrix(rnorm(n, 0, 0.5), ncol = m) y <- matrix(rnorm(n, 0, 0.8), ncol = m) l <- diag(cor(x, y)) q_1 = qnorm(0.05, 0, 0.05) q_2 = qnorm(1 - 0.05, 0, 0.05)
2002 Nov 27
1
problem with attr()
I got this wired behaviour of the attr() function using R-1.6.1 on both linux redhat 7.3 (i386) and Solaris 8 (Sparc): > tmp <- list(id=1) > > attr(tmp,"n.ch") <- 2 > attr(tmp,"n") <- 1 > tmp $id [1] 1 attr(,"n.ch") [1] 2 attr(,"n") [1] 1 > > attributes(tmp) $names [1] "id" $n.ch [1] 2 $n [1] 1 >
2009 Mar 27
3
about the Choleski factorization
Hi there, Given a positive definite symmetric matrix, I can use chol(x) to obtain U where U is upper triangular and x=U'U. For example, x=matrix(c(5,1,2,1,3,1,2,1,4),3,3) U=chol(x) U # [,1] [,2] [,3] #[1,] 2.236068 0.4472136 0.8944272 #[2,] 0.000000 1.6733201 0.3585686 #[3,] 0.000000 0.0000000 1.7525492 t(U)%*%U # this is exactly x Does anyone know how to obtain L such
2011 Jul 15
1
Confusing inheritance problem
I have library in development with a function that works when called from the top level, but fails under R CMD check. The paricular line of failure is rsum <- rowSums(kmat>0) where kmat is a dsCMatrix object. I'm currently stumped and looking for some ideas. I've created a stripped down library "ktest" that has only 3 functions: pedigree.R to create a pedigree or
2001 Nov 26
2
R not giving memory back to system?
This might be because I didn't get it right, but; I thought R would release memory back to the system as (big) objects get removed? Here is my platform (with 1Gb of RAM): platform sparc-sun-solaris2.8 arch sparc os solaris2.8 system sparc, solaris2.8 status major 1 minor 3.1 year 2001 month 08 day 31 language R A little example: Start a new section of R, with
2001 Dec 20
1
optimizing R-1.4.0 build on Solaris; a show-and-tell storry
This is a little success story about the benefits of changing the defaults in config.site when I was building R-1.4.0 for Solaris (on a Sun Sparc that I'm currently using). For previous versions of R, I had just used the default config.site and not given it any thought. Since the Sun machine that I'm using is not getting any faster, I decided I would give config.site a look when building
2000 Jun 22
1
'pausing' in R
I have this 'odd' problem; I need to let R pause, for a given time, before starting next iteration in a loop. I'm using the following to do this task, but feel a little bit guilty because I'm using as much CPU time as I can get while pausing: while(keepGoing) { t.end <- proc.time()[3] + 5 ## the time this loop should end at [block of R commands] while(proc.time()[3]
2002 Sep 18
1
problem with make fullcheck on Sparc Solaris 8
I have been trying out R-1.6.0 tarballs (2002-9-10 and 2002-9-17) on: arch sparc os solaris2.8 system sparc, solaris2.8 status beta major 1 minor 6.0 year 2002 month 09 day 17 language R As you see form above, R-1.6.0 compiles fine and works. However, when I "make fullcheck" I get the following error: running code in 'tools-Ex.R' ... OK
2012 Jul 31
1
about changing order of Choleski factorization and inverse operation of a matrix
Dear All, My question is simple but I need someone to help me out. Suppose I have a positive definite matrix A. The funtion chol() gives matrix L, such that A = L'L. The inverse of A, say A.inv, is also positive definite and can be factorized as A.inv = M'M. Then A = inverse of (A.inv) = inverse of (M'M) = (inverse of M) %*% (inverse of M)' = ((inverse of
2003 Sep 01
1
Gram-Schmidt orthonormal factorization
Hi: Does R have a function as gsorth is SAS, that perform a the Gram-Schmidt orthonormal factorization of the m ?n matrix A, where m is greater than or equal to n? That is, the GSORTH subroutine in SAS computes the column-orthonormal m ?n matrix P and the upper triangular n ?n matrix T such that A = P*T. or any other version of Gram-Schmidt orthonormal factorization? I search the help, but I
2001 Nov 20
0
Summary: non-negative least squares
Thank you Brian Ripley, Gardar Johannesson, and Marcel Wolbers for your prompt and friendly help! I will share any further learnings as I move through these suggestions. -Bob Abugov Brian Ripley wrote: I just use optim() on the sum of squares with non-negativity constraints. That did not exist in 1999. Gardar Johannesson wrote: You can always just use the quadratic programing library in R
2010 Sep 21
1
Prime Factorization
Hi everyone, I have a very quick question: Is there a ready-made function in R or any R packages to find the prime factorization of an integer? -- View this message in context: http://r.789695.n4.nabble.com/Prime-Factorization-tp2548877p2548877.html Sent from the R help mailing list archive at Nabble.com.
2012 Aug 14
2
Communative Matrix Multiplcation
Friends I'm not seeing why the following occurs: > T1 <- (A1 - A2) %*% D > T2 <- (A1 %*% D) - (A2 %*% D) > identical(T1, T2) [1] FALSE Harold > dput(A1) new("dsCMatrix" , i = c(0L, 1L, 2L, 3L, 0L, 1L, 4L, 2L, 3L, 5L) , p = c(0L, 1L, 2L, 3L, 4L, 7L, 10L) , Dim = c(6L, 6L) , Dimnames = list(NULL, NULL) , x = c(5, 5, 5, 5, 5, 5, 10, 5, 5, 10)
2003 Aug 24
1
regression constraints (again)
Im trying to do regressions with constraints that the weights are all >=0 and sum(weights) = 1. I've read the archive and have set the problem up with solve.QP and just the non-negativity constraints along the lines of: y as the data vector X as the design matrix D <- t(X) %*% X d <- t(t(y) %*% X) A <- diag(ncol(X)) b <- rep(0,ncol(X)) fit <-