Learn R Programming

LoopDetectR (version 0.1.2)

compare_loop_list: Compare two loop lists

Description

Compared two loop lists and returns the indices of those loops that are identical in both lists, that switch only the sign or that do not occur in both lists

Usage

compare_loop_list(loop_list_a, loop_list_b)

Arguments

loop_list_a, loop_list_b

Loop lists with columns loop and sign, for example generated from find_loops.

Value

A list with 5 (possible empty) vectors as entries.

  • ind_a_id - indices of the loops in the first loop list that occur identically in the second loop list

  • ind_a_switch - indices of the loops in the first loop list that occur in the second loop list with a different sign

  • ind_a_notin - indices of the loops in the first loop list that do not occur in the second loop list

  • ind_b_id - indices of loops in the second loop list corresponding to the loops reported in ind_a_id

  • ind_b_switch - indices of loops in the second loop list corresponding to loops reported in ind_a_switch.

Details

Indices of loops are given with respect to the order of the loops in the first supplied loop list as well as for the second loop list. The loops are sorted to represent their loops starting from the smallest variable index (using the function sort_loop_index).

Examples

Run this code
# NOT RUN {
#sample Jacobian matrix of a system with 4 variables
jac_matrix <- rbind(c(-1,0,0,-1),c(1,-1,0,1),c(0,1,-1,0),c(0,0,1,-1))
#find the feedback loops of the system
loop_list <- find_loops(jac_matrix,10)
#a slightly different Jacobian matrix of the system with 4 variables
jac_matrix_alt <- rbind(c(-1,0,0,1),c(1,-1,0,-1),c(0,1,-1,0),c(0,0,1,-1))
#find the feedback loops of the system
loop_list_alt <- find_loops(jac_matrix_alt,10)
#compare the loop lists
comp_loop_list <- compare_loop_list(loop_list,loop_list_alt)
#loops that switch sign
comp_loop_list[['ind_a_switch']]

# }

Run the code above in your browser using DataLab