# Table 3 The outside VMT algorithm

Outside-VMT (s, β)
1:    Allocate a matrix A of size ||s|| × ||s||, and initialize all entries in A with ϕ elements.
2:    Call Compute-Outside-Sub-Matrix ([0, n], [0, n]), where n is the length of s.
3:    return A
Compute-Outside-Sub-Matrix (I, J)
pre-condition: The values in A[0,I], [J,n], excluding the values in A I,J , are computed.
If μ i,j = q[0,i)(β q,i α q,j ), then A I,J = (β[0,I),I)T α[0,I),J. Else, if μ i,j = q(j,n](α i,q β j,q ), then A I,J = αI,(J,n] (βJ,(J,n])T.
post-condition: A[0,I], [J,n]= α[0,I], [J,n].
1:    if I = [i, i] and J = [j, j] then
2:       If ij, compute α i,j (in o (||s||) running time) by querying computed values in A and the value μ i,j which is stored in A i,j . Update A i,j α i,j .
3:    else
4:       if |I| ≤ |J| then
5:          Let J1 and J2 be the two intervals such that J2J1 = J, and |J2| = |J|/2.
6:          Call Compute-Outside-Sub-Matrix (I, J1).
7:          if μ i,j is of the form q(j,n](α i,q β j,q ) then
8:             Let L be the interval such that L(J, n] = (J2, n].
9:             Update ${A}_{I,{J}_{2}}←\left({A}_{I,L}\otimes {\left({\beta }_{{J}_{2},L}\right)}^{T}\right)\oplus {A}_{I,{J}_{2}}$.
10:          end if
11:          Call Compute-Outside-Sub-Matrix (I, J2).
12:       else
13:          Let I1 and I2 be the two intervals such that I1I2 = I, and |I1| = |I|/2.
14:          Call Compute-Outside-Sub-Matrix (I1, J).
15:          if μ i,j is of the form q[0,i)(β q,i α q,j ) then
16:             Let L be the interval such that [0, I)L = [0, I2).
17:             Update ${A}_{{I}_{2},J}←{A}_{{I}_{2},J}\oplus \left({\left({\beta }_{L,{I}_{2}}\right)}^{T}\otimes {A}_{L,J}\right)$.
18:          end if
19:          Call Compute-Outside-Sub-Matrix (I2, J).
20:       end if
21:    end if