similar to: How to compare two square matrices

Displaying 20 results from an estimated 10000 matches similar to: "How to compare two square matrices"

2004 Apr 15
5
Solving Matrices
On April 15th, Elizabeth wrote: <snip> > In execises 39-42, determine if the columns of the matrix span > R4: <snip> >(or x <- matrix(data=c(7, -5, 6, -7, 2, -3, 10, 9, -5, > 4, -2, 2, 8, -9, 7, 15), nrow=4, ncol=4) > >That is the whole of the question <snip> Have you tried det(x) and/or eigen(x) ? A zero determinant (within
2005 Jul 13
2
Efficient testing for +ve definiteness
Dear R-users, Is there a preferred method for testing whether a real symmetric matrix is positive definite? [modulo machine rounding errors.] The obvious way of computing eigenvalues via "E <- eigen(A, symmetric=T, only.values=T)$values" and returning the result of "!any(E <= 0)" seems less efficient than going through the LU decomposition invoked in
2011 Jun 02
4
generating random covariance matrices (with a uniform distribution of correlations)
List members, Via searches I've seen similar discussion of this topic but have not seen resolution of the particular issue I am experiencing. If my search on this topic failed, I apologize for the redundancy. I am attempting to generate random covariance matrices but would like the corresponding correlations to be uniformly distributed between -1 and 1. The approach I have been using is:
2012 Mar 09
1
Eigenvalue calculation of sparse matrices
Dear all, I am currently working on the calculation of eigenvalues (and -vectors) of large matrices. Since these are mostly sparse matrices and I remember some specific functionalities in MATLAB for sparse matrices, I started a research how to optimize the calculation of eigenvalues of a sparse matrix. The function eigen itself works with the LAPACK library which has no special handling for
2013 Jun 18
1
eigen(symmetric=TRUE) for complex matrices
R-3.0.1 rev 62743, binary downloaded from CRAN just now; macosx 10.8.3 Hello, eigen(symmetric=TRUE) behaves strangely when given complex matrices. The following two lines define 'A', a 100x100 (real) symmetric matrix which theoretical considerations [Bochner's theorem] show to be positive definite: jj <- matrix(0,100,100) A <- exp(-0.1*(row(jj)-col(jj))^2) A's being
2008 May 23
3
nls diagnostics?
Hi, All: What tools exist for diagnosing singular gradient problems with 'nls'? Consider the following toy example: DF1 <- data.frame(y=1:9, one=rep(1,9)) nlsToyProblem <- nls(y~(a+2*b)*one, DF1, start=list(a=1, b=1), control=nls.control(warnOnly=TRUE)) Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial
2011 May 27
1
eigenvalues and correlation matrices
I'm trying to test if a correlation matrix is positive semidefinite. My understanding is that a matrix is positive semidefinite if it is Hermitian and all its eigenvalues are positive. The values in my correlation matrix are real and the layout means that it is symmetric. This seems to satisfy the Hermitian criterion so I figure that my real challenge is to check if the eigenvalues are all
2005 Apr 13
5
Binary Matrices
I'm wanting to perform analysis (e.g. using eigen()) of binary matrices - i.e. matrices comprising 0s and 1s. For example: n<-1000 test.mat<-matrix(round(runif(n^2)),n,n) eigen(test.mat,only.values=T) Is there a more efficient way of setting up test.mat, as each cell only requires a binary digit? I imagine R is setting up a structure which could contain n^2 floats. Thanks in advance
2001 Mar 23
1
eigen segfaults on 0-diml matrices (PR#882)
>From one of my students' simulations: m <- matrix(1, 0, 0) # 1 to force numeric not logical eigen(m) and segfault in TRED2 in src/appl/eigen.f Easy to fix, but I wonder what else might have been overlooked? (svd is protected). --please do not edit the information below-- Version: platform = sparc-sun-solaris2.7 arch = sparc os = solaris2.7 system = sparc, solaris2.7 status =
2005 May 01
2
eigen() may fail for some symmetric matrices, affects mvrnorm()
Hi all, Recently our statistics students noticed that their Gibbs samplers were crashing due to some NaNs in some parameters. The NaNs came from mvrnorm (Ripley & Venables' MASS package multivariate normal sampling function) and with some more investigation it turned out that they were generated by function eigen, the eigenvalue computing function. The problem did not seem to happen
2004 Jul 27
4
Problems with Lapack's eigen() on 64-bit
I'm only now realizing that we have severe problems with R on our AMD 'Opteron' and 'Athlon64' clients running Redhat Enterprise with all 64-bit libraries (AFAICS). The Lapack problem happens for R-patched and R-devel both on the Opteron and the Athlon64. Here are platform details: o "gcc -v" and "g77 -v" both end with the line gcc version 3.2.3
2007 Nov 16
3
R det
Hi, Which R function I should use to obtain determinant of a matrix with real(and complex) numbers? Kalin --------------------------------- Never miss a thing. Make Yahoo your homepage. [[alternative HTML version deleted]]
2009 Jul 09
1
nls, reach limit bounds
Hi, I am trying to fit a 4p logistic to this data, using nls function. The function didn't freely converge; however, it converged if I put a lower and an upper bound (in algorithm port). Also, the b1.A parameter always takes value of the upper bound, which is very strange. Has anyone experienced about non-convergent of nls and how to deal with this kind of problem? Thank you very much.
2008 Nov 15
2
creating matrices from vectors
If I have 4 vectors (a, b, c, and d) each of length 1000, how do I then create 1000 two by two matrices from these vectors, such that: myMatrix[i] = matrix(c(a[i],b[i],c[i],d[i]),2) Then I'd like to create a single vector containing the largest eigenvalues of each matrix? (Sorry I am quite new to R) Many thanks, James _________________________________________________________________
2009 Feb 17
2
Efficient matrix computations
Hi, I am looking for two ways to speed up my computations: 1. Is there a function that efficiently computes the 'sandwich product' of three matrices, say, ZPZ' 2. Is there a function that efficiently computes the determinant of a positive definite symmetric matrix? Thanks, S.A. [[alternative HTML version deleted]]
2008 Mar 05
2
matrix inversion using solve() and matrices containing large/small values
Hello I've stumbled upon a problem for inversion of a matrix with large values, and I haven't found a solution yet... I wondered if someone could give a hand. (It is about automatic optimisation of a calibration process, which involves the inverse of the information matrix) code: ********************* > macht=0.8698965 > coeff=1.106836*10^(-8) >
2009 Mar 20
2
Finding determinants of x-loaded matrix?
R friends, I need to find the determinant of this matrix x 1 0 0 1 x 1 0 0 1 x 1 0 0 1 x det yields x^4-3x^2+1 I can then use polyroot to find the roots of the coefficients. The question is about the use of "x", which is what I'm solving for. thanks in advance, and this is a back-burner question. Apologies if I have posted this incorrectly/to the wrong place, I'm a newbie
2003 Apr 11
2
princomp with not non-negative definite correlation matrix
$ R --version R 1.6.1 (2002-11-01). So I would like to perform principal components analysis on a 16X16 correlation matrix, [princomp(cov.mat=x) where x is correlation matrix], the problem is princomp complains that it is not non-negative definite. I called eigen() on the correlation matrix and found that one of the eigenvectors is close to zero & negative (-0.001832311). Is there any way
2004 Apr 28
4
numericDeriv
Dear All, I am trying to solve a Generalized Method of Moments problem which necessitate the gradient of moments computation to get the standard errors of estimates. I know optim does not output the gradient, but I can use numericDeriv to get that. My question is: is this the best function to do this? Thank you Jean,
2001 May 19
1
COMPUTING DETERMINANT FROM SVD
Dear R-users, I computed determinant of a square matrix "var.r" using the SVD output: detr _ 1 d _ svd(var.r)$d for (i in 1:length(d)) { detr _ detr*d[i] } print(detr) 30.20886 BUT when I tried : det(var.r) I got : -30.20886 Is this because SVD output will only give absolute of the eigenvalues ?, If this is the case how can I get the original eigenvalues? Thanks, Agus