|
@@ -455,8 +455,6 @@ Void function eliminateGaussJordan(m : Element):
|
|
|
j = 0
|
|
|
|
|
|
while (i < read_nr_out(m)):
|
|
|
- log("Iteration " + cast_v2s(i))
|
|
|
- log(matrix2string(m))
|
|
|
// Make sure pivot m[i][j] != 0, swapping if necessary
|
|
|
while (v2f(m[i][j]) == 0.0):
|
|
|
// Is zero, so find row which is not zero
|
|
@@ -481,8 +479,6 @@ Void function eliminateGaussJordan(m : Element):
|
|
|
|
|
|
// Pivot in m[i][j] guaranteed to not be 0
|
|
|
// Now divide complete row by value of m[i][j] to make it equal 1
|
|
|
- log("Pivot OK")
|
|
|
- log(matrix2string(m))
|
|
|
f = j
|
|
|
divisor = v2f(m[i][j])
|
|
|
while (f < read_nr_out(m[i])):
|
|
@@ -490,8 +486,6 @@ Void function eliminateGaussJordan(m : Element):
|
|
|
f = f + 1
|
|
|
|
|
|
// Eliminate all rows in the j-th column, except the i-th row
|
|
|
- log("Eliminate")
|
|
|
- log(matrix2string(m))
|
|
|
f = 0
|
|
|
while (f < read_nr_out(m)):
|
|
|
if (bool_not(f == i)):
|
|
@@ -505,8 +499,6 @@ Void function eliminateGaussJordan(m : Element):
|
|
|
// Increase row and column
|
|
|
i = i + 1
|
|
|
j = j + 1
|
|
|
- log("Increase")
|
|
|
- log(matrix2string(m))
|
|
|
|
|
|
return !
|
|
|
|
|
@@ -528,33 +520,8 @@ String function matrix2string(m : Element):
|
|
|
return result!
|
|
|
|
|
|
Void function main():
|
|
|
- Element m
|
|
|
- Element t
|
|
|
- m = create_node()
|
|
|
- t = create_node()
|
|
|
-
|
|
|
- list_append(t, -1)
|
|
|
- list_append(t, 1)
|
|
|
- list_append(t, -4)
|
|
|
- list_append(m, t)
|
|
|
-
|
|
|
- t = create_node()
|
|
|
- list_append(t, 1)
|
|
|
- list_append(t, 1)
|
|
|
- list_append(t, 0)
|
|
|
- list_append(m, t)
|
|
|
-
|
|
|
- log("Before elimination")
|
|
|
- log(matrix2string(m))
|
|
|
- eliminateGaussJordan(m)
|
|
|
- log("After elimination")
|
|
|
- log(matrix2string(m))
|
|
|
-
|
|
|
- return !
|
|
|
+ Element model
|
|
|
+ String verify_result
|
|
|
|
|
|
-//Void function main():
|
|
|
-// Element model
|
|
|
-// String verify_result
|
|
|
-//
|
|
|
-// while (True):
|
|
|
-// execute_cbd(instantiate_model(import_node("models/CausalBlockDiagrams_Design")))
|
|
|
+ while (True):
|
|
|
+ execute_cbd(instantiate_model(import_node("models/CausalBlockDiagrams_Design")))
|