Displaying 20 results from an estimated 1000 matches similar to: "Krylov subspace computations of matrix exponentials"
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
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 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
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 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
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
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:
2009 Nov 23
1
R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails
It works! But Once I have the square root of this matrix, how do I convert it
to a real (not imaginary) matrix which has the same property? Is that
possible?
Best,
Simon
>----Messaggio originale----
>Da: p.dalgaard at biostat.ku.dk
>Data: 21-nov-2009 18.56
>A: "Charles C. Berry"<cberry at tajo.ucsd.edu>
>Cc: "simona.racioppi at
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
2006 Sep 21
2
Exponentiate a matrix
Suppose I have a square matrix P
P <- matrix(c(.3,.7, .7, .3), ncol=2)
I know that
> P * P
Returns the element by element product, whereas
> P%*%P
Returns the matrix product.
Now, P^2 also returns the element by element product. But, is there a
slick way to write
P %*% P %*% P
Obviously, P^3 does not return the result I expect.
Thanks,
Harold
[[alternative HTML version
2020 Apr 17
1
Demo for linking native routines between R packages
Dear Davis and Dirk,
Thank you very much for the suggestions, which are very valuable and
helpful.
I will add references to prior examples, document my project with the clear
step-by-step-style document of Davis's project, and come back again to the
mailing list.
Best wishes,
David
On Fri, Apr 17, 2020 at 3:40 PM Dirk Eddelbuettel <edd at debian.org> wrote:
>
> Jitao,
>
2011 Mar 02
2
Vector manipulations
I have a question regarding the most efficient way to select a substring of
a vector:
I have a vector of value v, and I want to select a subspace of this vector
called w such that:
w=v[1:n]
where
sum(w) = x
I am interested in what you thing would be the most efficient way to do this
- I would like to avoid slowing down my simulations as much as possible.
Thank you very much for any help that
2020 Aug 10
4
Rebuild against FlexiBLAS
Hi,
R has been built against FlexiBLAS in rawhide [1, 2]. These are the R
packages that need to be rebuilt:
R-ape-0:5.4-2.fc33.x86_64
R-expm-0:0.999.4-7.fc33.x86_64
R-gee-0:4.13.20-4.fc33.x86_64
R-gss-0:2.2.2-3.fc33.x86_64
R-igraph-0:1.2.5-3.fc33.x86_64
R-msm-0:1.6.8-5.fc33.x86_64
R-preprocessCore-0:1.50.0-4.fc33.x86_64
R-qtl-0:1.46.2-4.fc33.x86_64
R-quadprog-0:1.5.8-5.fc33.x86_64
Could
2009 Nov 25
1
R: Re: R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails
Dear Peter,
thank you very much for your answer.
My problem is that I need to calculate the following quantity:
solve(chol(A)%*%Y)
Y is a 3*3 diagonal matrix and A is a 3*3 matrix. Unfortunately one
eigenvalue of A is negative. I can anyway take the square root of A but when I
multiply it by Y, the imaginary part of the square root of A is dropped, and I
do not get the right answer.
I tried
2005 Nov 30
0
Running Continuum/Subspace
As of version 0.9.2 the program continuum has started, and not failed right
at the beginning like it did in 0.9.1. Now, due to its anti cheating
measures, it goes through many kernel32, ntdll, gdi32, advapi32, and
comctl32 calls along with some winex11drv calls. For some reason, when i
try to log it to a file, it grows to 2 GB or greater. I haven't waited for
it to finish, as i don't
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,
2017 Feb 10
0
R CMD check error (interfacing to C API of other pkg)
>>>>> Therneau, Terry M , Ph D <therneau at mayo.edu>
>>>>> on Thu, 9 Feb 2017 12:56:17 -0600 writes:
> 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
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,
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>