Skip to content

Commit fff287d

Browse files
committed
Clean up items involving matrix exp.
Rename miscAlgorithm.r to .R.
1 parent fa86a1e commit fff287d

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

UserManual/src/tables/functionTableMatrixLong.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ provided in NIMBLE.
2323
`pmin(x, y), pmax(x,y)` vector of mins (maxs) of elements of yes
2424
`x` and `y`
2525
`interp.lin(x, v1, v2)` linear interpolation no
26+
`expm(A)` matrix exponential $e^A$; $A$ non-negative diags yes
27+
`expAv(A,v)` matrix exponential multiplied by vector $e^A v$; $A$ non-neg. diags yes

packages/nimble/DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Authors@R: c(
3030
person("Wei", "Zhang", role = "aut", comment = "Laplace approximation"),
3131
person("Sally", "Paganin", role = "aut", comment = "reversible jump MCMC"),
3232
person("Joshua", "Hug", role = "aut", comment = "WAIC"),
33-
person("Paul", "van Dam-Bates", role = "aut", comment = "P\u00f3lya-Gamma sampler, nimIntegrate"),
33+
person("Paul", "van Dam-Bates", role = "aut", comment = "P\u00f3lya-Gamma sampler, nimIntegrate, matrix exponential"),
3434
person("Jagadish", "Babu", role = "ctb", comment = "code for the compilation system for an early version of NIMBLE"),
3535
person("Lauren", "Ponisio", role = "ctb", comment = "contributions to the cross-validation code"),
3636
person("Peter", "Sujan", role = "ctb", comment = "multivariate t distribution code")
@@ -150,5 +150,6 @@ Collate:
150150
registration.R
151151
nimble-package.r
152152
QuadratureGrids.R
153+
miscAlgorithms.R
153154
zzz.R
154155
RoxygenNote: 7.3.2
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ spectrumBound <- nimbleFunction(
2929
Min <- Inf
3030
Max <- -Inf
3131
for( i in 1:q[1] ){
32-
centre <- A[i,i]
33-
radius <- sum(abs(A[i,])) - abs(centre)
34-
minC <- centre - radius
35-
maxC <- centre + radius
32+
center <- A[i,i]
33+
radius <- sum(abs(A[i,])) - abs(center)
34+
minC <- center - radius
35+
maxC <- center + radius
3636
if(minC < Min) Min <- minC
3737
if(maxC > Max) Max <- maxC
3838
}
@@ -94,7 +94,7 @@ expAv <- nimbleFunction(
9494
if(q[2] != q[1]) stop("A must be a square matrix.")
9595
if(length(v) != q[1]) stop("Length of v must be equal to the number of columns of A.")
9696

97-
## Only centre, perform uniformization, if no diag > 0.
97+
## Only center, perform uniformization, if no diag > 0.
9898
CR <- spectrumBound(A)
9999
diag(A) <- diag(A) - CR[1]
100100
ans <- v
@@ -209,7 +209,7 @@ expm <- nimbleFunction(
209209
if(dim(A)[1] != dim(A)[2]) stop("`A' must be a square matrix")
210210
# if(dim(tol)[1] > 1) stop("`tol' must be a scalar.")
211211

212-
## Only centre, perform uniformization, if no diag > 0.
212+
## Only center, perform uniformization, if no diag > 0.
213213
CR <- spectrumBound(A)
214214
Niter <- 1L
215215
C <- CR[1]
@@ -249,5 +249,5 @@ expm <- nimbleFunction(
249249

250250
for( i in 1:s ) expMsmall <- expMsmall %*% expMsmall
251251
return(expMsmall)
252-
}#, buildDerivs = TRUE
252+
} #, buildDerivs = TRUE
253253
)

0 commit comments

Comments
 (0)