예제 #1
0
    def calculate_H_matrix(self):
        """ unimodular completion of P(d/dt) with H = P1i * ... * P11 * P10
        """
        pc.print_line()
        print("Exit condition satisfied\n")

        H_relevant_matrices, H_tilde_relevant_matrices = self._myStack.get_H_relevant_matrices()

        H1 = self.multiply_matrices_in_list( H_relevant_matrices )

        if not len(H_tilde_relevant_matrices)==0:
            H2 = self.multiply_matrices_in_list( H_tilde_relevant_matrices )
        else:
            H2 = sp.Matrix([])

        H = st.concat_rows(H1, H2)

        m, n = H.shape
        assert n==len(self._myStack.vec_x), "Dimensions of H-Matrix do not fit."

        print "H-matrix = "
        pc.print_nicely(H)
        print "\n"

        self.H = H
예제 #2
0
    def calculate_H_matrix(self):
        """ unimodular completion of P(d/dt) with H = P1i * ... * P11 * P10
        """
        pc.print_line()
        print("Exit condition satisfied\n")

        H_relevant_matrices, H_tilde_relevant_matrices = self._myStack.get_H_relevant_matrices(
        )

        H1 = self.multiply_matrices_in_list(H_relevant_matrices)

        if not len(H_tilde_relevant_matrices) == 0:
            H2 = self.multiply_matrices_in_list(H_tilde_relevant_matrices)
        else:
            H2 = sp.Matrix([])

        H = st.concat_rows(H1, H2)

        m, n = H.shape
        assert n == len(
            self._myStack.vec_x), "Dimensions of H-Matrix do not fit."

        print("H-matrix = ")
        pc.print_nicely(H)
        print("\n")

        self.H = H
예제 #3
0
    def calculate_G_matrix(self):
        G = self.calculate_Gi_matrix(0)
        for i in range(self._myStack.iteration_steps() - 1):
            G = G * self.calculate_Gi_matrix(i + 1)

        G_shifted = self.right_shift_all_in_matrix(G)

        print("G-matrix = ")
        pc.print_nicely(G_shifted)

        self.G = G_shifted
예제 #4
0
    def calculate_G_matrix(self):
        G = self.calculate_Gi_matrix(0)
        for i in xrange(self._myStack.iteration_steps()-1):
            G = G*self.calculate_Gi_matrix(i+1)

        G_shifted = self.right_shift_all_in_matrix(G)

        print "G-matrix = "
        pc.print_nicely(G_shifted)

        self.G = G_shifted
예제 #5
0
 def integrate_dwi(self, w, i):
     print "------"
     print "w[" + str(i) + "].d = 0"
     print "------"
     print "<-> Integrability condition satisfied for w[" + str(i) + "].\n\n"
     print "Integrating w[" + str(i) + "]:"
     y=0
     for j in xrange(0,len(self._myStack.basis)):
         y += sp.integrate(w[i].coeff[j], self._myStack.basis[j])
     print "y[" + str(i) + "] ="
     pc.print_nicely(y)
     print "\n\n"
예제 #6
0
def tangent_system():
    # exterior derivative of F_eq:
    try:
        P1i # in case the system is given by the matrices P1i and P0i
    except NameError:
        print "\n\n0 = F(x,xdot) ="; pc.print_nicely(example.F_eq)

        P1i = example.F_eq.jacobian(myStack.vec_xdot)
        P0i = example.F_eq.jacobian(myStack.vec_x)

    print "\n\n"
    return P1i, P0i
예제 #7
0
def tangent_system():
    # exterior derivative of F_eq:
    try:
        P1i  # in case the system is given by the matrices P1i and P0i
    except NameError:
        print("\n\n0 = F(x,xdot) =")
        pc.print_nicely(example.F_eq)

        P1i = example.F_eq.jacobian(myStack.vec_xdot)
        P0i = example.F_eq.jacobian(myStack.vec_x)

    print("\n\n")
    return P1i, P0i
예제 #8
0
 def integrate_dwi(self, w, i):
     print("------")
     print("w[" + str(i) + "].d = 0")
     print("------")
     print("<-> Integrability condition satisfied for w[" + str(i) +
           "].\n\n")
     print("Integrating w[" + str(i) + "]:")
     y = 0
     for j in range(0, len(self._myStack.basis)):
         y += sp.integrate(w[i].coeff[j], self._myStack.basis[j])
     print("y[" + str(i) + "] =")
     pc.print_nicely(y)
     print("\n\n")
예제 #9
0
    diff_symbols = example.diff_symbols
else:
    diff_symbols = sp.Matrix([])

mode = "auto" # "manual" or "auto"

calc_G = False # calculate G matrix

# raw_input() does not seem to handle empty strings, so this is a
# workaround to escape from the input
auto = None

myStack = sc.SystemStack(diff_symbols)
myStack.vec_x = example.vec_x
myStack.calc_G = calc_G
print "x ="; pc.print_nicely(myStack.vec_x)
print "\n\n","xdot ="; pc.print_nicely(myStack.vec_xdot)

def end_condition(Bi):
    """ The algorithm ends if Bi has full row rank.
    """
    n, p = Bi.shape
    return True if (n == st.rnd_number_rank(Bi)) else False

def is_special_case(Bi):
    """ Checks for special case
    """
    n, p = Bi.shape
    return True if (st.rnd_number_rank(Bi) < p) else False

def roc_hint(matrix_string, i,  matrix):
예제 #10
0
else:
    diff_symbols = sp.Matrix([])

mode = "auto"  # "manual" or "auto"

calc_G = False  # calculate G matrix

# raw_input() does not seem to handle empty strings, so this is a
# workaround to escape from the input
auto = None

myStack = sc.SystemStack(diff_symbols)
myStack.vec_x = example.vec_x
myStack.calc_G = calc_G
print("x =")
pc.print_nicely(myStack.vec_x)
print("\n\n", "xdot =")
pc.print_nicely(myStack.vec_xdot)


def end_condition(Bi):
    """ The algorithm ends if Bi has full row rank.
    """
    n, p = Bi.shape
    return True if (n == st.rnd_number_rank(Bi)) else False


def is_special_case(Bi):
    """ Checks for special case
    """
    n, p = Bi.shape