-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
additional plotting, problems with reshape2, new version of icu has b…
…roken the library
- Loading branch information
Showing
2 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
library(MASS) | ||
|
||
matriceTest <- t(matrix(c(0,0.2,0.4,0.5,0,0,0,0, | ||
0.2,0,0.4,0.5,0,0,1,0, | ||
0.3,0.2,0,0.5,0,0,0,0, | ||
0.4,0.2,0.4,0,0,0,0,1, | ||
0,1,0,0,0,0,0,0, | ||
1,1,1,0,0,0,0,0, | ||
0,0,0,0,0,0,0,0, | ||
0,0,0,0,0,0,0,0),nrow=8)) | ||
|
||
normalizedMatrix <- apply(t(matriceTest), 2, function(col) { | ||
if (sum(col) != 0) { | ||
col / sum(col) | ||
} else { | ||
rep(0, length(col)) | ||
} | ||
}) | ||
|
||
|
||
# Creating the identity matrix with the same dimensions as normalizedMatrix | ||
identityMatrix <- diag(nrow(normalizedMatrix)) | ||
|
||
# Subtracting the transpose of the normalizedMatrix from the identity matrix | ||
resultMatrix <- identityMatrix - normalizedMatrix | ||
|
||
inverted <- ginv(resultMatrix) | ||
|
||
input <- c(1,1,0.1,2,0,0,0,0) | ||
|
||
perturbation <- inverted %*% input | ||
|
||
perturvation.conserverd <- inverted %*% input - (input/2) |