similar to: efficient code - yet another question

Displaying 20 results from an estimated 2000 matches similar to: "efficient code - yet another question"

2010 May 08
1
matrix cross product in R different from cross product in Matlab
Hi all, I have been searching all sorts of documentation, reference cards, cheat sheets but can't find why R's crossprod(A, B) which is identical to A%*%B does not produce the same as Matlabs cross(A, B) Supposedly both calculate the cross product, and say so, or where do I go wrong? R is only doing sums in the crossprod however, as indicated by (z <- crossprod(1:4)) # = sum(1 +
2011 Nov 03
1
Question about Calculation of Cross Product
The function of crossprod in R puzzled me. I would like to calculate the cross product of two vectors. According to my text book, it defines like this: a = (ax, ay, az) b = (bx, by, bz) then, the cross product of a and b is: a X b = (ay*bz-az*by, az*bx-ax*bz, ax*by-ay*bz) It can also write in a determinant format. But the crossprod or tcrossprod function in R appeared not calculate the cross
2015 Mar 19
6
RFC: Matrix package: Matrix products (%*%, crossprod, tcrossprod) involving "nsparseMatrix" aka sparse pattern matrices
This is a Request For Comment, also BCCed to 390 package maintainers of reverse dependencies of the Matrix package. Most users and package authors working with our 'Matrix' package will be using it for numerical computations, and so will be using "dMatrix" (d : double precision) matrix objects M, and indirectly, e.g., for M >= c will also use "lMatrix" (l:
2008 Apr 01
1
superimpose histogram on biplot
Hi all, I've been trying to figure out how to superimpose a histogram on a biplot that shows the relative contribution of each axis. I have been using the NIPALS function (http://biomserv.univ-lyon1.fr/~dray/ files/softwares/nipals.R) to run principal component analyses. Here is a toy example. source("http://biomserv.univ-lyon1.fr/~dray/files/softwares/nipals.R")
2011 Dec 01
2
nipals in the chemometrics package in R
Hello i need some precision about nipals in the chemometrics package in R . When i use nipals in chemometrics i obtain T and P matrix. I really don't understand what to do with these two matrix to obtain the scores for every the component (like in spss fo example) Comp1 Comp2 Comp3 quest1 0,8434 0,54333 0,3466 quest2 0,665 0,7655 0,433 Thank you very
2010 May 23
1
need help in understanding R code, and maybe some math
Hi, I am trying to implement Higham's algorithm for correcting a non positive definite covariance matrix. I found this code in R: http://projects.cs.kent.ac.uk/projects/cxxr/trac/browser/trunk/src/library/Recommended/Matrix/R/nearPD.R?rev=637 I managed to understand most of it, the only line I really don't understand is this one: X <- tcrossprod(Q * rep(d[p], each=nrow(Q)), Q) This
2008 Oct 26
1
[PATCH 1/1] ocfs2/xattr: Proper hash collision handle in bucket division.v3
Modification from V2 to V3: Use a more pefect code suggested by Joel. Thank Joel for it. In ocfs2/xattr, we must make sure the xattrs which have the same hash value exist in the same bucket so that the search schema can work. But in the old implementation, when we want to extend a bucket, we just move half number of xattrs to the new bucket. This works in most cases, but if we are lucky enough we
2007 Nov 07
1
strwidth and strheight for rotated text
Dear All, I would like to plot text with a box around it. I used strwidth and strheight to compute the size of the box which is plotted with rect: z <- rnorm(10) # horizontal text works plot(rnorm(10)) x1 <- 5 y1 <- 0 label <- "Label" cha <- paste(" ", label, " ", sep = "") xh <- strwidth(cha, cex = par("cex")) yh <-
2006 Sep 07
2
Matrix package in R-2.4.0alpha
In a newly downloaded version (today) of R-2-4-0alpha, with all packages from CRAN also installed today, I get: > library(Matrix) Erro en loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) : in 'Matrix' methods specified for export, but none defined: BIC, anova, coef, confint, deviance, fitted, fixef, formula, head, lmer, logLik, mcmcsamp, plot,
2009 Jan 14
3
Precision in R
Dear All, I'm preparing a simple algorithm for matrix multiplication for a specific purpose, but I'm getting some unexpected results. If anyone could give a clue, I would really appreciate. Basically what I want to do is a simple matrix multiplication: (WB) %*% t(WB). The WB is in the disk so I compared to approaches: - Load 'WB' using 'read.table' (put it in WB.tmp) and
2010 Jun 06
2
Generalized DCC GARCH ML estimation
-- View this message in context: http://r.789695.n4.nabble.com/Generalized-DCC-GARCH-ML-estimation-tp2245125p2245125.html Sent from the R help mailing list archive at Nabble.com.
2006 Dec 05
4
incidence and adjacency matrix conversion
Dear all, how can I convert an m x n incidence matrix into an m x m adjacency matrix or an n x n adjacency matrix? The current matrix contains binary data, hence the new matrix would contain counts of common occurrences. Thank you for your help. Phil
2014 Jun 23
2
Unfixed bugs in latest R-patched
A new version of pqR is now available at pqR-project.org, which fixes several bugs that are also present in the latest R Core patch release (r66002). A number of bugs found previously during pqR development are also unfixed in the latest R Core release. Here is the list of these bugs that are unfixed in r66002 (including documentation deficiencies), taken from the pqR bug fix and documentation
2010 Jul 30
4
transpose of complex matrices in R
Hello everybody When one is working with complex matrices, "transpose" very nearly always means *Hermitian* transpose, that is, A[i,j] <- Conj(A[j,i]). One often writes A^* for the Hermitian transpose. I have only once seen a "real-life" case where transposition does not occur simultaneously with complex conjugation. And I'm not 100% sure that that wasn't a
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.
2009 Aug 31
2
Problem in matrix definition?
I'm implementing a function to compute the moore-penrose inverse, using a code from the article: Fast Computation of Moore-Penrose Inverse Matrices. Neural Information Processing - Letters and Reviews. Vol.8, No.2, August 2005 However, the R presents an error message when I use the geninv. The odd thing is that the error occurs for some arrays, however they have the same size. And the R
2009 Feb 20
1
[PATCH 1/1] ocfs2: set gap to seperate entry and value when xattr in bucket
This patch set a gap (4 bytes) between xattr entry and name/value when xattr in bucket. This gap use to seperate entry and name/value when a bucket is full. It had already been set when xattr in inode/block. Signed-off-by: Tiger Yang <tiger.yang at oracle.com> --- fs/ocfs2/xattr.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/fs/ocfs2/xattr.c
2009 Mar 09
4
[PATCH] ocfs2: Use xs->bucket to set xattr value outside.
Tristan, could you please run your xattr test against it? xs->base used to be allocated a 4K size and all the contents in the bucket are copied to the it. So in ocfs2_xattr_bucket_set_value_outside, we are safe to use xs->base + offset. Now we use ocfs2_xattr_bucket to abstract xattr bucket and xs->base is initialized to the start of the bu_bhs[0]. So xs->base + offset will overflow
2005 Oct 06
3
Singular matrix
Dear All, I have written the following programs to find a non-singular (10*10) covariance matrix. Here is the program: nitems <- 10 x <- array(rnorm(5*nitems,3,3), c(5,nitems)) sigma <- t(x)%*%x inverse <- try(solve(sigma), TRUE) while(inherits(inverse, "try-error")) { x <- array(rnorm(5*nitems,3,3), c(5,nitems)) sigma <- t(x)%*%x inverse <-
2006 Dec 10
1
Problem with loading "library(Matrix)" at Ubuntu
Dear All, After upgrading to R-2.4.0-dapper2 (my system is ubuntu 6.06 LTS), I often met problems when loading some packages like Matrix. Here is the details: > library(Matrix) Error in loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) : in 'Matrix' methods specified for export, but none defined: Arith, Math, Math2, +, %*%, Schur, as.matrix, chol,