search for: kronecker

Displaying 20 results from an estimated 110 matches for "kronecker".

2013 Feb 23
1
how to calculate left kronecker product?
For an application, I have formulas defined in terms of a left Kronecker product of matrices, A,B, meaning A \otimes_L B = {A * B[i,j]} -- matrix on the left multiplies each element on the right. The standard kronecker() function is the right Kronecker product, A \otimes_R B = {A[i,j] * B} -- matrix on the right multiplies each element on the left. The example be...
2005 Dec 08
1
kronecker(... , make.dimnames=TRUE)
Hi I'm using kronecker() with a matrix and a vector. I'm interested in the column names that kronecker() returns: > a <- matrix(1:9,3,3) > rownames(a) <- letters[1:3] > colnames(a) <- LETTERS[1:3] > b <- c(x=1,y=2) > kronecker(a,b,make.dimnames=TRUE) A: B: C: a:x 1 4 7 a:y...
2012 Feb 09
1
Row-wise kronecker product with Matrix package
I'm trying to calculate the row-wise kronecker product A \Box B of two sparse matrices A and B, and am struggling to find a quick way to do this that takes advantage of sparseness. I thought a good idea would be to use "rep" to construct 2 matrices of the same dimension of the end product, and multiply these two together: library(M...
2010 Nov 25
1
Request: kronecker to get a sep= argument
kronecker, with make.dimnames=TRUE uses a hardwired sep=":" in the line tmp <- outer(dnx[[i]], dny[[i]], FUN = "paste", sep = ":") For an application in which dimnames arise from an n-way array, where different dimensions have different roles, and I would like...
2011 Jun 05
2
kronecker sum
Dear All, Could someone please suggest how to find the Kronecker sum of two 2x2 matrices, i.e. given two matrices: -A A a -a and -B B b -b I need: -A-B A B 0 a -a-B 0 B b 0 -A-b A 0 b a -a-b Many thanks, Lara [[alternative HTML version deleted]]
2012 Jun 09
2
Matrix package loading problem "Error : object ‘kronecker’ is not exported by 'namespace:methods'"
Hi R users all , I have a clean install of R-2.15.0 in a win32 machine and a problem loading Matrix 1.0-6 that looks like this: > library(Matrix) Loading required package: lattice Error : object ?kronecker? is not exported by 'namespace:methods' Error: package/namespace load failed for ?Matrix? > I understand that kronecker() now has an S4 generic in package methods. Is that a clue? I don't know what I can do with this. Here's my sessionInfo() and the library(Matrix) error again...
2005 Jul 13
2
Kronecker matrix product
Hi I want to write a little function that takes a matrix X of size m-by-n, and a list L of length "m", whose elements are matrices all of which have the same number of columns but possibly a different number of rows. I then want to get a sort of dumbed-down kronecker product in which X[i,j] is replaced by X[i,j]*L[[j]] where L[[j]] is the j-th of the "m" matrices. For example, if X = matrix(c(1,5,0,2),2,2) and L[[1]] = matrix(1:4,2,2) L[[2]] = matrix(c(1,1,1,1,1,10),ncol=2) I want [,1] [,2] [,3] [,4] [1,] 1 3 0 0 [2,] 2...
2008 Nov 12
2
Outer, kronecker, etc.
`outer` (and related functions like kronecker) require that their functional argument operate elementwise on arrays. This means for example that outer( 1:2, 3:4, list) or outer(1:2,3:4,function(a,b){1}) gives an error. Is there a version of `outer`/`kronecker`/etc. that takes arbitrary functions and does its own elementwise map...
2010 Jan 11
2
sparseM and kronecker product_R latest version
Dear all, I just installed the new version of R, 2.10.1, and I am currently using the package sparseM. (I also use a 64 bit windows version) I got a problem that I never had: when I try to multiply with a kronecker product (%x%) two sparse matrixes I get the following message: Error in dim(x) <- length(x) : invalid first argument I never had this problem with previous versions of R. May you help me? thanks alessia
2009 May 30
1
Spatiotemporal correlation function
Hi, I'm trying to compute  the spatiotemporal correlation matrix by using Delta Kronecker products of spatial and temporal correlation matrix  in R, but didn't find any delta Kronecker's operator in R. The operators in matrix such as multiplication, addition, eigen values/vector and etc is easily to find and used. Could someone help me, please? Cheers. Firdaus [[al...
2005 Oct 13
3
Help with Matrix package
...hat I should be using the "Matrix" package. Is there any dummies-level help available for this package? I am struggling even to apply simple functions such as "sum" and "mean" to matrixes constructed from this class (not that I need to yet), and more importantly "kronecker", to convert from "repmat". (The help for "kronecker" from the Matrix package doesn't seem to mention kronecker, so I am a bit stuck). Any guidance greatly accepted -- I have read the overview, looked through the various Matrix-listed functions, and unsuccessfully tried...
2009 Feb 23
1
trade-off between speed and storage in matrix multiplications
Dear R-users, I coded two equivalent ways to perform (in a simplified version) some matrix multiplications I would like to use in a more general framework. In the first case I used Kronecker product and vectorization of a certain matrix. This approach takes less time, but, as you may guess, I run out of memory when dimensions are large. In the second approach, I profited of sparseness and structure of the matrices and use outer-functions for performing operations. Here it takes more ti...
2004 Sep 28
2
S4 method selection based on second argument
...nces (all I have to deal with anyway): 1) B = repmat(A, m, n) 2) B = repmat(A, [m n]) 3) B = repmat(A, n) In all cases, A is the fill value, m is number of rows, and n is number of columns. As separate functions, the translations would roughly be: repmat1 <- function(A, m, n) { kronecker(matrix(1, n, m), A) } repmat2 <- function(A, rc) { repmat1(A, rc[1], rc[2]) } repmat3 <- function(A, n) { repmat1(A, n, n) } Suggestions? ---------------------------------------------------------- SIGSIG -- signature too long (core dumped)
2012 Nov 30
1
Fw: quantreg installation and conflicts with R 2.15.2
Just noticed that I get a similar error about object 'kronecker' in "Matrix" package when trying to load "lme4". So this is a more pervasive problem. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Collins, CO 80526-8818 email: brian_cade@usgs.gov tel: 970 226-9326 -...
2010 Jan 07
1
faster GLS code
...b10 + b11 * x1 + b12*x2 + r[,1] y2 <- b20 + b21 * x1 + b22*x2 + r[,2] y3 <- b30 + b31 * x1 + b32*x2 + r[,3] y <- cbind(y1,y2,y3) # matrix of endogenous x <- cbind(1,x1, x2) # matrix of exogenous #### MODEL ESTIMATION ### # build the big X matrix needed for GLS estimation: X <- kronecker(diag(1,3),x) Y <- c(y) # stack the y in a vector # residual covariance matrix for each observation covar <- kronecker(sigma,diag(1,N)) # GLS betas covariance matrix inv.sigma <- solve(covar) betav <- solve(t(X)%*%inv.sigma%*%X) # GLS mean parameter estimates betam <- betav%*%t(...
2012 Dec 08
5
How to efficiently compare each row in a matrix with each row in another matrix?
Dear expeRts, I have two matrices A and B. They have the same number of columns but possibly different number of rows. I would like to compare each row of A with each row of B and check whether all entries in a row of A are less than or equal to all entries in a row of B. Here is a minimal working example: A <- rbind(matrix(1:4, ncol=2, byrow=TRUE), c(6, 2)) # (3, 2) matrix B <-
2012 Nov 30
1
quantreg installation and conflicts with R 2.15.2
...but he is on travel and won't have chance to seriously investigate this for awhile. So I thought I would put it out to the R community and see if anyone has any suggestions about why this conflict might be occurring. > library(quantreg) Loading required package: SparseM Error : object ?kronecker? is not exported by 'namespace:methods' Error: package ?SparseM? could not be loaded or Error: object ?kronecker? is not exported by 'namespace:methods' During startup - Warning message: unable to restore saved data in C:\CADESTUFF\DATA\BarryNoon\.RData > Brian Brian S. Cad...
2004 Jul 28
6
elegant matrix creation
...an elegant way. If I have jj1 <- structure(c(1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 3,1,2,3,1,2,3,1,2,3,2,3,1,2,3,1,2,3,1,2,3, 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,3,1,2,3,1, 2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1, 2),.Dim = as.integer(c(9,9))) [ image(jj1) is good here ] then I can get this with kronecker(matrix(1,3,1),kronecker(1+outer(0:2,0:2,"+")%%3,matrix(1,1,3))) I want to reproduce the following matrices in an equivalent way: jj2 <- matrix(c(1,2,3,1,2,3,1,2,3,2,3,1,2,3,1,2,3,1, 1,2,3,1,2,3,1,2,3,3,1,2,3,1,2,3,1,2,1,2,3,1,2, 3,1,2,3,3,1,2,3,1,2,3,1,2,2,3,1,2,3,1,2,3,1,3, 1,2,3,1,...
2011 Jan 17
0
(no subject)
...#################### n <- 5 t <- 4 nt <- n*t pData <- data.frame(id = rep(paste("JohnDoe", 1:n, sep = "_"), each = t),time = rep(1981:1984, n)) rho <-0.95 alphai <- rnorm(n,mean=0,sd=1)#alphai simulation x<- as.matrix(rnorm(nt,1))#xi simulation akro <- kronecker(alphai ,matrix(1,t,1))#kronecker of alphai cormat<-matrix(c(1,rho,rho,1),nrow=2,ncol=2)#correlation matrix cormat.chold <- chol(cormat)#choleski transformation of correlation matrix akrox <- cbind(akro,x) ax <- akrox%*%cormat.chold ai <- as.matrix(ax[,1]) pData$alphai<-as.vector(a...
2011 Jan 17
0
PANEL DATA SIMULATION(sorry for my previous email with no subject)
...#################### n <- 5 t <- 4 nt <- n*t pData <- data.frame(id = rep(paste("JohnDoe", 1:n, sep = "_"), each = t),time = rep(1981:1984, n)) rho <-0.95 alphai <- rnorm(n,mean=0,sd=1)#alphai simulation x<- as.matrix(rnorm(nt,1))#xi simulation akro <- kronecker(alphai ,matrix(1,t,1))#kronecker of alphai cormat<-matrix(c(1,rho,rho,1),nrow=2,ncol=2)#correlation matrix cormat.chold <- chol(cormat)#choleski transformation of correlation matrix akrox <- cbind(akro,x) ax <- akrox%*%cormat.chold ai <- as.matrix(ax[,1]) pData$alphai<-as.vector(a...