Displaying 20 results from an estimated 900 matches similar to: "Iterative Averages"
2010 Sep 27
1
conditional assignment of colors in xyplot()
# Dear R Community,
# I have this data frame:
df1 <- data.frame(
F1 = factor( c( rep("D1",12),rep("D2",12),rep("D3",12) ) ),
F2 = factor( rep( rep( paste("O",1:6,sep=""), rep(2,6) ), 3) ),
F3 = factor( rep( c("V1","V2"), 18 ) ),
S1 =
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 below shows the result of
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 2 8 14
b:x 2 5 8
b:y 4 10 16
c:x 3 6 9
c:y 6 12 18
>
The
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(Matrix)
A<-Matrix(c(1,0,0,0,0,1,2,0), 2, 4)
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 to be able to use kronecker in the form
kronecker(A, B, make.dimnames=TRUE,
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]]
2005 Oct 13
3
Help with Matrix package
Hello all,
A colleague at work set me the challenge to convert some MATLAB
code into R, to see which is faster. We'd seen that benchmark comparing
MATLAB 6.5 to R1.90 (and others), and so I thought that I should be able
to get roughly comparable speeds. The code has lots of multiplications
of matrixes, transposes, and MATLAB's "repmat". I did the code
conversion, and R was about
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
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
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
2004 Sep 28
2
S4 method selection based on second argument
I'm translating some Matlab code and need some help figuring
out how to change this call into an S4 generic method.
In matlab, there's a function called 'repmat' with three
calling sequences (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
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 <-
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
2010 Jul 23
4
how to calculate the product of every two elements in two vectors
Thanks in advance!
A=c(1, 2,3)
B=c (9, 10, 11, 12)
I want to get C=c(1*9, 1*10, 1*11, 1*12, ....., 3*9, 3*10, 3*11, 3*12)?
C is still a vector with 12 elements
Is there a way to do that?
--
View this message in context: http://r.789695.n4.nabble.com/how-to-calculate-the-product-of-every-two-elements-in-two-vectors-tp2300299p2300299.html
Sent from the R help mailing list archive at Nabble.com.
2004 Jul 28
6
elegant matrix creation
Hello everybody.
I am trying to reproduce a particular matrix in 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
2010 Jan 07
1
faster GLS code
Dear helpers,
I wrote a code which estimates a multi-equation model with generalized
least squares (GLS). I can use GLS because I know the covariance matrix of
the residuals a priori. However, it is a bit slow and I wonder if anybody
would be able to point out a way to make it faster (it is part of a bigger
code and needs to run several times).
Any suggestion would be greatly appreciated.
Carlo
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
2012 Nov 30
1
quantreg installation and conflicts with R 2.15.2
I recently lost the partitions on my hard drive (second time in 6 months)
so I had to have our IT folks image all my files over to a new drive. I
completely reinstalled R (now 2.15.2) and all my libraries to my computer
(Dell Latitude running Windows 7). A few of my previous workspaces
(created with R 2.14.1) can't be restored, reporting an error similar to
the one I get when I try to
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
----- Forwarded by Brian S
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 mapping? In the first example
above, I'd expect the