Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fmriToolkit
spdm
Commits
39f82046
Commit
39f82046
authored
Jun 15, 2018
by
Corson N. Areshenkoff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix exp/log maps
parent
dcdc9baa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
3 deletions
+32
-3
spd-expmap.R
R/spd-expmap.R
+1
-1
spd-interp-functions.R
R/spd-interp-functions.R
+1
-1
spd-logmap.R
R/spd-logmap.R
+1
-1
spd-transport.R
R/spd-transport.R
+29
-0
No files found.
R/spd-expmap.R
View file @
39f82046
...
...
@@ -17,7 +17,7 @@ spd.expmap <- function(x, p){
}
p.sqrt
<-
sqrtm
(
p
)
p.inv.sqrt
<-
solve
(
p.
inv
)
p.inv.sqrt
<-
solve
(
p.
sqrt
)
return
(
p.sqrt
%*%
expm2
(
p.inv.sqrt
%*%
x
%*%
p.inv.sqrt
)
%*%
p.sqrt
)
}
R/spd-interp-functions.R
View file @
39f82046
...
...
@@ -4,7 +4,7 @@ spd.interpolate.euclidean <- function(x, y, t, ...){
}
spd.interpolate.logeuclidean
<-
function
(
x
,
y
,
t
,
...
){
return
(
expm
((
1
-
t
)
*
logm
(
x
)
+
t
*
logm
(
y
)))
return
(
expm
((
1
-
t
)
*
logm
2
(
x
)
+
t
*
logm2
(
y
)))
}
spd.interpolate.riemannian
<-
function
(
x
,
y
,
t
,
...
){
...
...
R/spd-logmap.R
View file @
39f82046
...
...
@@ -16,7 +16,7 @@ spd.logmap <- function(x, p){
}
p.sqrt
<-
sqrtm
(
p
)
p.inv.sqrt
<-
solve
(
p.
inv
)
p.inv.sqrt
<-
solve
(
p.
sqrt
)
return
(
p.sqrt
%*%
logm2
(
p.inv.sqrt
%*%
x
%*%
p.inv.sqrt
)
%*%
p.sqrt
)
}
R/spd-transport.R
0 → 100644
View file @
39f82046
#' Parallel transport of a tangent vector
#'
#' Whitens an SPD matrix using the procedure advocated by Ng, et al. (2014)
#'
#' @param x An SPD matrix to be whitened
#' @param p The SPD baseline whitening matrix
#' @param unwhiten Logical. If TRUE, reverses a previously applied whitening transform.
#' @return A symmetric, positive-definite matrix.
to
<-
cov
(
matrix
(
rnorm
(
30
),
ncol
=
3
))
from
<-
cov
(
matrix
(
rnorm
(
30
),
ncol
=
3
))
x
<-
cov
(
matrix
(
rnorm
(
30
),
ncol
=
3
))
x
<-
spd.logmap
(
x
,
from
)
spd.transport
<-
function
(
x
,
to
,
from
){
if
(
!
's.mat'
%in%
input.type
(
x
)){
stop
(
'x must be a positive definite matrix'
)
}
if
(
!
'spd.mat'
%in%
input.type
(
to
)){
stop
(
'to must be a positive definite matrix'
)
}
if
(
!
'spd.mat'
%in%
input.type
(
from
)){
stop
(
'from must be a positive definite matrix'
)
}
return
(
x
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment