-
Notifications
You must be signed in to change notification settings - Fork 0
/
ForestRowColPermute.R
60 lines (49 loc) · 998 Bytes
/
ForestRowColPermute.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
source('ForestUtils.R')
##### SHOULD BE MADE IN C++
DoRowPermutation <- function(size, row_permutation)
{
row_names = 0
if(length(row_permutation) == size[1])
{
v = vector(mode="numeric", length=0)
for(i in 1:length(row_permutation))
{
val = -row_permutation[i]
index = toString(val)
v[index] = i
}
row_names <- v
}
else
{
cat("No row permuation.")
# Name rows and columns.
row_names <- CreateRowNames(size[1])
}
return (row_names)
}
##### SHOULD BE MADE IN C++
DoColPermutation <- function(size, col_permutation)
{
col_names = 0
if(length(col_permutation) == size[2])
{
v = vector(mode="numeric", length=0)
for(i in 1:length(col_permutation))
{
val = -col_permutation[i]
index = toString(val)
v[index] = size[2] - (i - 1)
}
col_names <- v
plane_col_names <- v
}
else
{
cat("No col permuation.\n")
# Name rows and columns.
col_names <- CreateColNames(size[2])
plane_col_names <- col_names
}
return (col_names)
}