Orthogonal Block Change & Block Building Using Ordered Lists of

3 downloads 0 Views 102KB Size Report
orthogonal vector lists, an algorithm known as block change & block building. ... ternary vector, which contains only dash elements, describes all 2k Boolean vectors of the Boolean space. ... This property is satisfied, if these ternary vectors have a 0/1 combination in at ..... algorithm, which takes into account the ordered data.
Orthogonal Block Change & Block Building Using Ordered Lists of Ternary Vectors Christina Dorotska, Bernd Steinbach

Freiberg University of Mining and Technology, Institute of Computer Science, D-09596 Freiberg, Germany, e-mail: {dorotsk, steinb}@informatik.tu-freiberg.de Abstract. In this paper we investigate the possibility of efficient minimization of number of vectors in lists representing Boolean functions. We use the representation of a function as an ordered list of ternary or Boolean vectors and propose a faster algorithm that is based on ordering of vectors. We sort the vectors in lists using the number of ones and dashes to create classes and subclasses. This model is used to speed up the optimization of orthogonal vector lists, an algorithm known as block change & block building. Unlike the algorithm used in XBOOLE system this algorithm uses additional knowledge from the ordered model and changes only blocks, that lead to new possibilities of block building. Our new algorithm is compared with algorithm, used in XBOOLE system, and finally it is shown by means of experimental results that our algorithm with ordering of vectors requires fewer comparisons to find a new block building possibility.

1. Introduction As representation of Boolean function this paper uses Ternary Vector List (TVL), TVLs are based on the data structure called Binary Vector List (BVL) [1]. A binary vector consists of elements ZERO and ONE. The BVL data structure represents a Boolean function including all this vectors in the list, for which the function has the value ONE. In the most unfavorable case 2n vectors may be also necessary to represent a Boolean function with BVL. Using of Ternary Vector Lists make it possible, to reduce this number of vectors, because a TVL may represent all Boolean vectors of a BVL by a smaller number of vectors. It may be achieved thanks to using the third element DASH (in previous papers [2, 3, 6 - 8] mark as a STROKE) in ternary vectors. The DASH is able to present a ONE or a ZERO [2]. The minimization of the number of vectors in the Ternary Vector List is based on building blocks of ternary vector [4]. Every two vectors that differ in one place only are combined into a single ternary vector that contains DASH in the place of difference. If a TVL does not include a pair of vectors that can build a block, the Block Change operation can be used. Its main objective is to find all pairs of ternary vectors that can be converted to other pairs of ternary vectors, that may be later applicable to build a block. Block Change operation can be also extend with Block Building operation. There exists an very simple algorithm to process Block Change & Block Building, which is a part of the system XBOOLE. All pairs of ternary vectors taken from the two special lists have to be compared. In the case that these vectors can be convert to other ternary vectors, the Block Changing is executed. After all pairs of vectors were checked, a Block Building algorithm [2, 3, 7] reduces the number of vectors in the list through combining the matching vectors to vectors with more dashes. The disadvantage of this simple algorithm is the time consuming large number of comparisons between vectors. The aim of this paper is speed up the process of the minimization of the number of vectors in the list. We have created an ordered data structure called Ordered Ternary Vector List (OTVL) to represent a Boolean function. Owing to the ordering of ternary vectors into classes and subclasses the number of necessary comparisons during block building [7] and block change & block building procedures can be reduced. The rest of the paper is organized as follows. Section 2 gives the basic knowledge of block building and block change algorithms. Section 3 introduces improvements of the data structure Ordered List of Ternary vectors (OTVL). In section 4 the block change and the block building algorithms are represented at first separately and after that two as complete orthogonal block change & block building (OBCBB) algorithms. In section 5 we compare the results of employing of this two OBCBBalgorithms. Finally, in section 6, we summarize our paper.

2. Preliminaries A TVL may represent all Boolean vectors of a BVL by a smaller number of ternary vectors. One single ternary vector, which contains only dash elements, describes all 2k Boolean vectors of the Boolean space. The set of Boolean vectors collected in one ternary vector can be reconstructed, if the dashes in the ternary vector are substituted by all possible patterns of zero and one elements. Two different Boolean vectors of the same length are called orthogonal. Two ternary vectors have the property of orthogonality, that means they are disjoint, if there exists no Boolean vector included in both ternary vectors. This property is satisfied, if these ternary vectors have a 0/1 combination in at least one column. The ternary vectors t1 = “01-“ and t2 = “11-“ for example, have a 0/1 combination in the first column. Vector t1 includes the binary vectors {“010”, “011”} and t2 includes {“110”, “111”}. There is no Boolean vector included in both sets. Therefore, t1 is orthogonal with respect to t2. An TVL is orthogonal if each pair of ternary vectors in the TVL is orthogonal (disjoint). Definition 1. If two ternary vectors (two lines) of a orthogonal TVL differ in exactly one column, in which the combination 0/1 is present, both TV’s can be combined into one TV. This operation is called orthogonal block building (OBB), because the new ternary vector is orthogonal to other ternary vectors in this TVL. Example 1. Ternary vectors “0-0” and “1-0” have the 0/1 combination in the first column and can be merged into the ternary vector “- - 0”. The reader can learn more about Orthogonal Block Building in [7]. To speed up the processing of many Boolean operation and to minimize the necessary memory space to store a TVL the number of vectors in the TVL can be reduced further, even no more block buildings are possible. Definition 2. If two ternary vectors are different in two positions, when the first one is a “0/1” combination, and the second is a “0/-“ or “1/-” pattern, the Boolean vectors, included in this two ternary vectors can be combined to two other ternary vectors. This operation is called orthogonal block changing. Example 2. Two ternary vectors “0-1-“ and “010-“ can’t build a block, because they are different in two positions. But they can be transformed to two other ternary vectors. If we decompose the first ternary vector relating to the position two, the vectors “001-“ and “011-“ will be obtained. Now we combine the second obtained vector “011-“ with ternary vector “010-“ and have therefore the following resulting ternary vectors: “001-“ and “01--“. They cover the same Boolean vectors and are orthogonal to each other. Example 3. The function in the Figure 1 is represented as the Kmap (see Figure 1, a) ) and as the BVL (see Figure 1, b) ). After orthogonal Block Building (see Figure 2, a) ) the TVL representation of this function consist of four vectors (see Figure 2, b) ). There are no more Block Buildings possible. But the applying of Block Changing to this function is possible: the first and the second ternary vector c 0 0 1 1

d 0 1 1 0

a b c d 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 0 0 1 0 0 0 1 0 1 0 1 1 1 0 0 1 1 a) b) Figure 1. The considered in Example 3 function a 1 0

0 0 1 0 0 0

b 1 1 1 0

1 1 1 0 1 0

c 0 1 1

1 1 1 1 1 1

d 1 0 0 1

0 0 0 0 0 b 1 a

a 1 0

b 1 1 1 1 0

c 0 1 0 1 1

d 1 1 0 0 1

a 1 0

b 1 1 1 0

c 0 1 1 1

d 1 0 1

c 0 0 1 1

d 0 1 1 0

0 0 1 0 0 0

1 1 1 0 1 0

1 1 1 1 1 1

a 1 0

0 0 0 0 0 b 1 a

b 1 1 1 0

c 0 1 1

d 1 0 0 1

a) b) Figure 2. Considered function after OBB a 0 1 1 0

b 1 1 1 1 0

c 0 1 1 1 1

d 1 1 0 1

a 0 1 0

b 1 1 1 0

c 0 1 1 1

d 1 1

a) b) c) d) e) f) Figure 3. Considered function after Block Change ( a) – e) ) and Block Building ( f) )

a 0 1

b 1 1

c 0 1 1

d 1 -

from the list are different in two position, when the first one is a “-/0” combination, and the second is a “1/0“ difference (see Figure 3, a) ). During the Block Changing two new ternary vectors will be created (the first and the second vectors on the Figure 3, c) ). Now a next Block Changing between the second and the third vector on the Figure 3, c) will be performed. The result is shown on the Figure 3, e). For a better understanding of Block Changings it is additionally explained on the Figure 3, b) and d). After two Block Changings one new Block Building can be realized. The resulting TVL is shown on the Figure 3, f) and consists of only three vectors. Each ternary element tij is encoded by two bits – aij and bij (see Table 1). Table 1. Encoding of ternary elements Ternary element tij 1 0 -

bij 1 1 0

aij 1 0 0

Each ternary vector ti = { tij , j=1, …, k}, consists also of two parts - A = { aij , j=1, …, k} and B = { bij , j=1, …, k}, where k is the number of variables. Both parts of ternary vector are stored in two machine words and placed in the memory one after another, if k is smaller than or equal to the width of a machine word of the computer (see Figure 4). If the number of Boolean variables is larger than width of the machine word in bits, we need an even number of machine words to store one ternary vector. This number is represented by the variable typ, therefore A and B parts will consist of typ/2 components Am and Bm correspondingly, stored as shown in Figure 5. Width of a machine word ai0 ai1 ...

aij

...

aik

bi0 bi1 … bij … bik B-part

A-part Figure 4. Storage structure of a ternary vector A1

B1

A2

B2

MW0

MW1

MW2

MW3

...

ATYP/2

BTYP/2

MWTYP-2 MWTYP-1

Figure 5. Storage structure of a ternary vector Using this encoding of the ternary elements, the following Lemmas can be formulated: Lemma 1. (Necessary and sufficient condition for Block Building) Two ternary vectors can be merged into one block if their B-parts are equal and their A-parts are different only in one place. Proof. We consider two ternary vectors that are different in exactly one column, in which the combination 0/1 is present. Using the definition of block building, only such vectors can create a block. Assume their B-parts are not equal. It means that a combination 0/- or 1/- (see Table 1) must occur at least in one column. If A-parts are different in more than one place, then both vectors would have more than one difference. < Lemma 2. (Necessary condition for Block Change) The blocks may be changed only for such two ternary vectors, whose B-parts are different only in one place X. These ternary vectors are called “block changing supposed” (BCS) with position X”. Proof. We consider two ternary vectors that have the difference on two places, where the first one is “0/1” combination, and the second one a “-/0” or a “-/1” combination. Using the definition of block changing, only such vectors can be transformed to other ternary vectors. Assume their B-parts are equal. That means, that only “0/1” combinations are permissible (see Table 1). If B-parts are different more than in one place – there are more than one “-/0” or “-/1” differences between two ternary vectors. < Lemma 3. (Sufficient condition for Block Change) Assume two ternary vectors are BCS vectors with position X. The block changing will be possible only if their A-parts are different in the place Y, Y≠X, and may be different in the X-position too. Proof. Two ternary vectors are BCS vectors with position X, if they have only one difference on the X place in their B-parts. Thus, the vectors have a “-/0” or “-/1” combination in the position X. In the first

case A-parts don’t have a difference. In the second case A -parts differ in the position X too. If A -parts are additionally different in a place Y, Y≠X, where the B-parts don’t have a difference, that means ternary vectors have in the position Y a “0/1” combination. Using the definition of a block changing, only this two ternary vectors can be transformed to other ternary vectors. < Most of the operations needed to check whether two ternary vectors are suitable for a block changing can be calculated for n variables in parallel, if n is smaller than or equal to the width of a machine word. If the number of Boolean variables is larger than the length of a machine word, we have to repeat these operations at most typ/2 times (see Figure 5).

3. Ordered Lists of Ternary Vectors 3.1. Distribution of Ternary Vectors into Classes and Subclasses To order ternary vectors we can use their number of ones. All Ternary vectors with the same number of ones belong to the same class. Each class is labeled by the number of ones #o: C#o = { t | t = (t1, t2, ... , tk) and tj1, tj2, ... , tj#o = 1, all other ti ∈{0, –} }

(1)

Each ternary vector represents a set of Boolean vectors. If the ternary vector includes #d dashes, the number of ones #ob in the Boolean vectors of this set is defined by #o ≤ #ob ≤ (#o + #d) . (2) Because the upper bound depends of the number of dashes #d, we can use this number to create (#d+1) subclasses SC#o#d. C#o = { SC#o#d , #d ∈{0, 1, 2, ... , k-#o} }, #o ∈{0, 1, 2, ... , k}

(3)

SC#o#d = { t | t = ( t1, t2, ... , tk ) and tj1, tj2, ... , tj#o = 1, tm1, tm2, ... , tm#d = ‘–‘, all other ti = 0 }

(4)

We decide on the order in two levels. On the first level we order from lower to higher number of ones #o into classes. On the second level we order the vectors of each class from the higher to the lower number of dashes #d into subclasses. More information on the TV-ordering can be found in [6-8]. As a result, we receive an ordered list of ternary vectors that can be represented as the series of classes and subclasses. The vectors, which belong to the same subclass, are stored as separate TVL's (Sub_TVL). This classification into classes and subclasses may be used to reduce the number of necessary comparisons to find all pairs of vectors that can be used to process a block changing.

3.2. Data Structure

number of dashes

number of ones

For the fast access to the classes and subclasses we 0 1 2 3 4 5 6 create a triangular matrix structure outside of the ordered TVL. The number of rows and columns of this 0 NULL NULL NULL 1 NULL NULL NULL matrix is bounded by k+1, where k is the number of variables. The elements of this array are pointers on 1 3 2 NULL NULL NULL NULL the Sub_TVL’s. The index of a row corresponds to the 4 NULL NULL 2 6 5 number of ones in Sub_TVL of this row. Thus each row of the matrix corresponds to one class. The 3 8 7 NULL NULL column index corresponds to the number of dashes in each Sub_TVL. If some Sub_TVL’s does not exist, 4 11 10 9 NULL is stored in the appropriate array item. 12 NULL 5 For example, in Figure 6 is shown the whole matrix, where a TVL is represented as 12 subclasses 6 NULL Similarly, this structure can also represent a BVL. The matrix for BVL will have pointers to Sub_BVL’s Figure 6. Matrix structure only in the first column, because the Boolean vectors contain no dashes. More information about the presented matrix structure can be found in [7].

3.3. Significant Subclasses for Block Changing As mentioned above, two ternary vectors that can not build a block can be transformed to new vectors if: • they are different in exactly two positions; • in the first position they consist of a “0/1” combination • in the second position exist one of “0/-“ or “1/-” pattern.

These new ternary vectors may be useful in some other new block buildings. Suppose SC#o#d is a subclass from an ordered model of classes and subclasses of ternary vectors. #o is the number of ones of all ternary vectors belonging to this subclass, #d is their number of dashes. The following lemma can be formulated:

Number of dashes

#d #d+1 #o-2 #o-1 #o

1 2 3 4

Lemma 4. For a Subclass SC#o#d there exist only four such subclasses SC#o′#d′, that some vector pairs {tv1 from SC#o#d, tv2 from SC#o′#d′} may be #o+1 transformed to other pairs of ternary vectors (see Figure 7). The number #o+2 of ones #o′ and of dashes #d′ of these subclasses will be specified as follows: #d′ = #d + 1, #o-2 ≤ #o′ ≤ #o+1 Figure 7. Four Block Changing Significant Proof. We consider two different subclasses of ternary vectors: SC#o#d and subclasses SC#o′#d′ SC#o′#d′. Each vector from the first subclass includes #o ones and #d subclass for a SC#o#d dashes. To make the Block Changing possible each vector from the second subclass should contains one more dash. Only then a “0/-“ or “1/-” difference between two ternary vectors can be presented. The number of dashes #d’ of all subclasses, which ternary vectors may participate in the Block Changing is also equal to #d+1. The second necessary condition for a Block Changing is presence of the “0/1” difference. In other positions this ternary vectors should be equal (see Lemma 3). Let the first difference be a “1/-“ difference. If the second difference is a “1/0” combination, #o′ = #o-2 (see Figure 8, case 1). In the case of a “0/1” combination the number of ones is equal: #o′ = #o (see Figure 8, case 3). In the case if the first difference is a “0/-“ difference, and the second difference a “1/0” combination, #o′ = #o-1 (see Figure 8, case 2). If the second difference is equal to “0/1”, the number of ones #o′ is equal to #o+1 (see Figure 8, case 4). The Blocks of the vectors from SC#o#d and SC#o′#d′ subclasses can be changed consequently, only if #d′ = #d + 1, #o-2 ≤ #o′ ≤ #o+1. < According to described in chapter 2 block changing rules, if a block changing between vectors from SC#o#d and SC#o′#d′ was possible, following new ternary vectors will be created:

1 t1 t2 … ti-1 1 ti+1 … tj-1 1 tj+1 … tn-1 tn

p1 p2 … pi-1 0 pi+1 … pj-1 - pj+1 … pn-1 pn

t1 t2 … ti-1 - ti+1 … tj-1 1 tj+1 … tn-1 tn p1 p2 … pi-1 0 pi+1 … pj-1 0 pj+1 … pn-1 pn

ti-1 1 ti+1 … tj-1 0 tj+1 … tn-1 tn 2 pt1 pt2 … 1 2 … pi-1 0 pi+1 … pj-1 - pj+1 … pn-1 pn

t1 t2 … ti-1 - ti+1 … tj-1 0 tj+1 … tn-1 tn p1 p2 … pi-1 0 pi+1 … pj-1 1 pj+1 … pn-1 pn

t1 t2 … ti-1 0 ti+1 … tj-1 1 tj+1 … tn-1 tn

t1 t2 … ti-1 - ti+1 … tj-1 1 tj+1 … tn-1 tn p1 p2 … pi-1 1 pi+1 … pj-1 0 pj+1 … pn-1 pn

t1 t2 … ti-1 0 ti+1 … tj-1 0 tj+1 … tn-1 tn

t1 t2 … ti-1 - ti+1 … tj-1 0 tj+1 … tn-1 tn p1 p2 … pi-1 1 pi+1 … pj-1 1 pj+1 … pn-1 pn

3 p1 p2 … pi-1 1 pi+1 … pj-1 - pj+1 … pn-1 pn 4 p1 p2 … pi-1 1 pi+1 … pj-1 - pj+1 … pn-1 pn Figure 8. Four Block Changing possibilities.

Using described data structure of classes and subclasses new ternary vectors will be stored as shown in Figure 9. The dark subclasses are Block Change participated subclasses. The arrows show the subclass, where the new transformed vectors should be stored. Number of dashes

Number of dashes

Number of ones

#d #d+1

Number of dashes

#d #d+1

Number of dashes

#d #d+1

#d #d+1

#o-2

#o-2

#o-2

#o-2

#o-1

#o-1

#o-1

#o-1

#o

#o

#o

#o

#o+1

#o+1

#o+1

#o+1

#o+2

#o+2

#o+2

#o+2

1 2 3 Figure 9. Storing of ternary vectors received after block changing

4

4. Algorithms 4.1. Orthogonal Block Changing (OBC) Algorithm We consider here two ternary vectors tv1 and TD (tv1, tv2, part, machine word, position) tv2 to check if a block changing is possible. The first ternary vector tv1 should be the vector i = 0; machine word = -1; with less dashes compared with tv2. Note, that part = = A Y N the numbers of dashes is known from the k=0 k=1 column index of the subclasses. condition = tv1[i + k] ⊕ + tv2[i + k] According to lemma 2 we should check at first condition != 0 if this vectors are amenable of a block Y N changing, that means their B-parts are different machine word != -1 i=i+2 only in one place. The difference testing Y N function (TD) can be used for this purpose (see return FALSE machine word = i; i = i + 2 Figure 10). while ( i < number of mashine words ) The first two parameters of this function are position = FIRST_BIT the considered ternary vectors. The parameter condition = tv1[machine word +k] + ⊕ tv2[machine word +k] part marks, which parts of ternary vectors while ( position AND condition = = 0 ) should be checked up for a difference: A or B. position = position >> 1 As results, the TD-algorithm (see Figure 10) condition ⊕ + position != 0 returns: the number of the machine word, that Y N contains the difference, and position of the return FALSE return TRUE difference inside this word. If there are more Figure 10. Difference Testing algorithm than one differences between the defined vector parts - the function returns “false”. If tv1 and tv2 are BCS vectors with position1, according to lemma 3 it should be next decided if the Aparts of the considered ternary vectors are different beside the found position1, and the difference 0/1 is in only one position. In order to do this we remove the A-part difference in the position1. The TD-function will be then used again. If its result is true and position2 is found, the block changing will be performed and two new ternary vectors will be created: in the position2 of word2 of tv1 a dash is created, and in the position1 of word1 of tv2 an opposite element of tv1(word1, position1) is assign (see Figure 11).

OBC(tv1, tv2) TD(tv1, tv2, B, mashine word1, position1) == TRUE Y

N

temp_tv = tv1

return FALSE

temp_tv[mashine word1] = tv1[mashine word1] AND ~position1 temp_tv[mashine word1+1] = tv1[mashine word1+ 1] AND ~position1 D(temp_tv,tv2,A,mashine word2,position2)==TRUE Y

N

tv1[mashine word2] = tv1[mashine word2] AND ~position2

return FALSE

tv1[mashine word2+1] = tv1[mashine word2+1] AND ~position2 tv2[mashine word1+1] = tv2[mashine word1+1] ⊕ + position1 ( tv1[mashine word1] AND position1) = = 0 Y

N

tv2[mashine word1] = tv2[mashine word1]⊕+ position1 return TRUE

Figure 11. Orthogonal Block Change algorithm

4.2. Orthogonal Block Building (OBB) algorithms To minimize the number of rows in a TVL the orthogonal Block Building is used: if two orthogonal ternary vectors (two lines) of a TVL differ in exactly one column, in which the combination 0/1 is present, both TV’s can be combined into one TV. We check whether two ternary vectors tv1 and tv2 can build a block using the OBB (tv1, tv2) algorithm. As mentioned in Lemma 1, we compare at first B-parts of vectors that must be equal. If the B -parts are equal, the A -parts will be compared, and should be different only in one column. If both conditions are

fulfilled, the block building between tv1 OBB (tv1, tv2) and tv2 is possible and the new_vect will w1=0; w = -1; test=true be composed. This vector contains a dash ( tv1[w1+1] ⊕ tv2[w1+1] == 0) in the column, where tv1 and tv2 have the Y N 0/1 combination. Figure 11 shows the var_bb = tv1[w1] ⊕ tv2[w1] test = false var_bb ! = 0 /\ w ! = -1 block scheme of this algorithm. Y N For a complete block building it is var_bb != 0 test = false necessary to find all pairs of ternary Y N w = w1 vectors that can be used for block w1 = w1+2 building. There are different algorithms w1> 1 more block. var_bb=var_bb ⊕ pos Each vector tv1 from tvl is compared with var_bb == 0 Y N all the next standing vectors tv2. It is new_vect[w+1] = tv1[w+1] ⊕ pos test = false checked whether tv1 and tv2 can create a new_vect[w] = tv1[w] /\ new_vect[w+1] new_vect = NULL block using algorithm OBB(tv1, tv2). If block building was possible, new_vect is Figure 12. Test of block building between two vectors tv 1 saved in the original list tvl. If vector tv1 and tv and building a new_vect algorithm 2 cannot be combined with any vectors tv2 from tvl, it will be compared with all vectors from help_tvl. If again no block building was possible, tv1 is saved on the end of help_tvl. The algorithm is repeated, until tv1 is not the last vector in tvl. At the end, help_tvl consist only vectors, which cannot build a block.

4.3 Orthogonal Block Change & Block Building (OBCBB) Algorithm A Block Change & Block Building algorithm consist of two parts: a Block Change part and a Block Building part. To process a Block Changing in a TVL it is necessary to find all pairs of ternary vectors, which have a property for a block changing. After that a Block Building algorithm will be realized. We consider in this paper two different ways to perform a Block Change & Block Building. Method 1. This algorithm was proposed in [2] OBCBB(TVL) and is part of the XBOOLE system. number = number of vectors in TVL Each vector tv1 from tvl is compared tv1 = first vector from TVL with all next standing vectors tv2. If for tv1 and tv2 a block changing is tv1 ! = last vector in TVL possible, the algorithm OBC (tv1, tv2) tv2 = next vector after tv1 transforms the incoming vectors and end = FALSE returns true. Changed vectors are OBC(tv1, tv2) stored on the places of original tv2 ! = last vector in TVL ternary vectors. Otherwise the Y N algorithm returns false. tv2 =next vector of TVL end = TRUE After all pairs of ternary vectors from NOT end tvl were checked for a block changing tv1 = next vector of TVL and all possible block changings were OBB(TVL) processed, the Orthogonal Block Building algorithm (OBB) (described new number = number of vectors in TVL in detail in [5]) is called. It search for new number < number all pairs of ternary vectors, which can build a block and merge each of such Figure 13. OBCBB algorithm used in XBOOLE system pairs to a single vector. If at least one new block was build during this cycle of algorithm, the OBCBB algorithm will be repeated. If no more block buildings after block changing is possible, the algorithm stops (see Figure 13).

number of ones

number of dashes Method 2. In Figure 15 we show the block schema of our new 0 1 2 3 4 5 6 algorithm, which takes into account the ordered data structure, described in section 3. According to Lemma NULL NULL NULL 0 NULL NULL NULL 3, only ternary vectors from Sub_TVLs belonging to the neighbor column with one more dash than the NULL NULL NULL NULL 1 current Sub_TVL and having the numbers of ones NULL NULL 2 #o′, #o-2 ≤ #o′ ≤ #o+1 are useful for the block changing procedure. NULL NULL 3 Our block change & block building algorithm starts with Sub_TVL(row, column) where row is the last 4 row in matrix and column is the first column in this row. We check whether this Sub_TVL and the NULL 5 corresponding Sub_TVL(row+ step, column+1), 6 NULL -2