similar to: Exponentiate a matrix

Displaying 20 results from an estimated 4000 matches similar to: "Exponentiate a matrix"

2007 May 06
7
A function for raising a matrix to a power?
Hi, Is there a function for raising a matrix to a power? For example if you like to compute A%*%A%*%A, is there an abbreviation similar to A^3? Atte Tenkanen > A=rbind(c(1,1),c(-1,-2)) > A [,1] [,2] [1,] 1 1 [2,] -1 -2 > A^3 [,1] [,2] [1,] 1 1 [2,] -1 -8 But: > A%*%A%*%A [,1] [,2] [1,] 1 2 [2,] -2 -5
2009 Dec 11
2
How to calculte the power of a matrix
Dear R family I have a following question. Suppose I have a matrix as follows, for instance: tau= 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 I want to calculate (-m) power of tau, for example, m=893. When I run tau^2, the outcome is just tau. Any help would be appreciated. thanks in advance. best moohwan
2017 Feb 09
2
R CMD check error
Martyn, No, that didn't work. One other thing in the mix (which I don't think is the issue) is that I call one of the C-entry points of expm. So the DESCRIPTION file imports expm, the NAMESPACE file imports expm, and the init.c file is #include "R.h" #include "R_ext/Rdynload.h" /* Interface to expm package. */ typedef enum {Ward_2, Ward_1, Ward_buggy_octave}
2011 Apr 14
2
Krylov subspace computations of matrix exponentials
I use the very nice expm functions available from the expm and Matrix packages. My understanding is that for large sparse matrices the currently best methods available are Krylov subspace methods, but they are as far as I can tell not implemented in either of the packages mentioned, nor in any other R package I have found. Does anybody know if Krylov subspace methods are available from any R
2011 Aug 17
2
An example of very slow computation
This message is about a curious difference in timing between two ways of computing the same function. One uses expm, so is expected to be a bit slower, but "a bit" turned out to be a factor of >1000. The code is below. We would be grateful if anyone can point out any egregious bad practice in our code, or enlighten us on why one approach is so much slower than the other. The problem
2017 Feb 09
2
R CMD check error
Martin, I am aware of --vanilla; I use it myself for some testing. In this case R_LIBS_USER was set externally (part of my login) and does not involve any of the R scripts. That means it is inherited by any subprocess. For example: tmt1495% R --vanilla --no-environ R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C) 2016 The R Foundation for Statistical Computing
2008 Nov 11
3
exponential of a matrix
Is the matrix exponential available in some package? The cannonical reference is "Nineteen dubious ways to take the exponential of a matrix". (Love that title) Terry T.
2007 Mar 06
2
Estimating parameters of 2 phase Coxian using optim
Hi, My name is Laura. I'm a PhD student at Queen's University Belfast and have just started learning R. I was wondering if somebody could help me to see where I am going wrong in my code for estimating the parameters [mu1, mu2, lambda1] of a 2-phase Coxian Distribution. cox2.lik<-function(theta, y){ mu1<-theta[1] mu2<-theta[2] lambda1<-theta[3]
2017 Feb 08
2
R CMD check error
I have a local library which depends on the expm library. The expm library is loaded into my personal space and I have the environment variable R_LIBS_USER set appropriately. The command "library(expm)" works just fine from the command line, and in fact the package works if I do the source() and dyn.load() commands by hand. The following sequence works: tmt% R CMD build
2007 Mar 15
1
expm() within the Matrix package
Hi Could anybody give me a bit of advice on some code I'm having trouble with? I've been trying to calculate the loglikelihood of a function iterated over a data of time values and I seem to be experiencing difficulty when I use the function expm(). Here's an example of what I am trying to do y<-c(5,10) #vector of 2 survival times p<-Matrix(c(1,0),1,2) #1x2 matrix
2008 Apr 05
2
Adding a Matrix Exponentiation Operator
Hi all I recently started to write a matrix exponentiation operator for R (by adding a new operator definition to names.c, and adding the following code to arrays.c). It is not finished yet, but I would like to solicit some comments, as there are a few areas of R's internals that I am still feeling my way around. Firstly: 1) Would there be interest in adding a new operator %^% that performs
2007 Mar 06
1
expm()
Can the expm function be used to calculate the exponential of a matrix where the matrix is multiplied by a vector in a data frame? For example for (i in 1:length(y)){ expmN<-expm(Q*y[i]) Q<-Matrix(c(1, 2, 3, 4), 2, 2) return(expmN) } Sorry I am new to R and I have been finding it difficult to get information on calculating Matrix exponentials in R. Many thanks in
2008 Aug 07
3
Create new dataframes with dames from dataset...
Hi I'm wondering if you could save new data frames with in a loop using the names within the data frame... I.e. If you have a data frame as below Product Type Test A One 67 A Two 55 B One 42 A One 55 I would like to generate new dataframes as follow... A.One (including) A One 67 A One 55 A.Two (including) A
2004 Jan 20
0
Matrix exponential
How about this: > expm function(x,pow=2) { xd <- diag((eigen(x)$values^pow)) xm <- eigen(x)$vector %*% xd %*% t(eigen(x)$vector) return(xm) } > xa [,1] [,2] [1,] 2 1 [2,] 1 3 > expm(xa,pow=3) [,1] [,2] [1,] 15 20 [2,] 20 35 > xa %*% xa %*% xa [,1] [,2] [1,] 15 20 [2,] 20 35 > From: Federico Calboli <f.calboli at ucl.ac.uk>
2017 May 09
2
registering Fortran routines in R packages
Dear list, I?m trying to register Fortran routines in randtoolbox (in srt/init.c file), see https://r-forge.r-project.org/scm/viewvc.php/pkg/randtoolbox/src/init.c?view=markup&root=rmetrics. Reading https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Registering-native-routines and looking at what is done in stats package, I first thought that the following code will do the job:
2020 Apr 17
3
Demo for linking native routines between R packages
Dear Davis, Thank you a lot for sharing this, and I am happy that I was not the only one who need to do it once to learn:) I proposed to add my repo to the manual. I think it makes sense to add both of ours, if possible, or we could merge them together and add that to the manual. Long-term URL stability is apparently an issue, but I think we may find a solution there. Anyway, thanks a lot for
2012 Dec 12
4
Matrix multiplication
Hi, I have a transition matrix T for which I want to find the steady state matrix for. This could be approximated by taking T^n , for large n. T= [ 0.8797 0.0382 0.0527 0.0008 0.0212 0.8002 0.0041 0.0143 0.0981 0.0273 0.8802 0.0527 0.0010 0.1343 0.0630 0.9322] According to a text book I have T^200 should have reached the steady state L L
2009 Oct 01
2
matrix exponential
Hi Guys, Im trying to find the exponential of a matrix. Can someone please help me do this? Thanks a lot _________________________________________________________________ View photos of singles in your area Click Here =1&lage=18&uage=55&cl=14&sl=0&dist=50&po=1&do=2&trackingid=1046138&r2s=1&_t=773166090&_r=WLM_EndText
2011 Sep 22
1
Error in as.vector(data) optim() / fkf()
Dear R users, When running the program below I receive the following error message: fit <- optim(parm, objective, yt = tyield, hessian = TRUE) Error in as.vector(data) : no method for coercing this S4 class to a vector I can't figure out what the problem is exactly. I imagine that it has something to do with "tyield" being a matrix. Any help on explaining what's going on
2001 Apr 09
1
Support for compartment models / matrix exponential method
I try to fit reaction kinetic data to a given hypothetical model consisting of 3 ODEs. After some reading in Bates/Watts and the literature cited there (e.g. Jennrich/Bright) I looked in R for functions that support the use of the matrix exponential method. Until now I used for a similar (but simpler) problem the nls package and fitted against the the parameterized solution function. But this