Mathematical Modeling in the Textile Industry

A mathematical model, describing some different weaving structures, is made in this article. The terms self-mirror and rotation-stable weaving structure are initiated here. There are used the properties and operations in the set of the binary matrices and an equivalence relation in this set. Some combinatorial problems about finding the cardinal number and the elements of the factor set according to this relation is discussed. We propose an algorithm, which solves these problems. The presentation of an arbitrary binary matrix using sequence of nonnegative integers is discussed. It is shown that the presentation of binary matrices using ordered n-tuples of natural numbers makes the algorithms faster and saves a lot of memory. Implementing these ideas a computer program, which receives all of the examined objects, is created. In the paper we use object-oriented programming using the syntax and the semantic of C++ programming language. Some advantages in the use of bitwise operations are shown. The results we have received are used to describe the topology of the different weaving structures.


Introduction.
It is well known [2,12,15], that the interweaving of the fibres in certain weaving structure can be coded using square binary (or (0,1), or boolean) matrix, i.e. all elements of this matrix are 0 or 1. The fabric represented by this matrix exists if and only if in each row and in each column of the matrix there is at least one 1 and at least one 0. Two different matrices correspond to one and the same weaving structure if and only if the first matrix is receive from the second by several cycle moves of the first row or column to the last place.
Let n be a positive integer. Let us denote by B n the set of all n ×n binary matrices,and let us denote by Q n the set of all n × n binary matrices which have at least one 0 and atleast one 1 in every row and every column. It is obvious, that Q n  B n . About the necessary definitions and denotes in the theory of matrices we refer to [7] and [10]. It is not difficult to see, that (1) If A = (a i j )  B n , then A = (a j i ) , 1  i, j  n denotes the transposed matrix A .
We are interested in the subset P n  Q n of all permutation matrices, i.e. binary matrices which have a single 1 in every row and every column. It is well known [10] that the set P n together with the operation multiplication of matrices is a group, isomorphic to the symmetric group S n where the set (2) is made of all one to one maps of the elements of the set {1,2,.., n} to itself. If M = (m k l )  P n and the corresponding element in this isomorphism is this means that nd all other elements of M are equal to 0 is satisfied by definition for arbitrary As it is well-known [10], if we multiply a n × n matrix A from the right with a permutation matrix then this is the same as the changing places of the columns of A. In this case, if the corresponding element of in the above-described isomorphism is then after the multiplication we get a matrix with k th column of B equal to i k th column of Analogously when we want to exchange the places of rows we multiply A from the left with M T Identity element of the group Pn is the identity matrix En, all elements in the leading diagonal are equal to 1 and all elements are equal to 0 everywhere else. The identity element of the group Sn is the element We say, that the binary n × n matrices A and B are equivalent and we write A ~ B , if one matrix is obtained by the other after several consecutive cycle moves of the first row or column to the last place. In other words, if A, B  Q n and A ~ B, then with the help of these matrices we code one and the same weaving structure. It is obvious, that the relation ~ is a equivalence relation in the set B n . The equivalence class according to the relation ~ with the matrix A we denote A , and the sets of equivalence classes in B n and Q n (factor sets) according to ~ with B n and Q n . We consider that B n and Q are described if there is a random representative of each equivalence class.
The equivalence classes of B n by the equivalence relation ~ are a particular kind of double coset [1,8,11]. They make use of substitutions group theory and linear representation of finite groups theory [8]. The elements of Q n we call interweavings. In that case the number n is called repeating of the interweaving. These terms are borrowed from the textile industry. It is naturally to arise a lot of combinatorial problems, which take place in practice in the weaving industry, connected with the different subsets of Q n , i.e. with the different classes of interweavings. Some of these classes we examine in the present work.

Some interesting classes of interweavings.
It is easy to see, that if Interweavings which representatives are elements of the set P n of all permutational matrices are called primary interweavings. A formula and an algorithm to calculate the number of all primary interweavings with a arbitrary repetition n are shown in [12,13]. We examine the matrix (3)

Bulletin of Mathematical Sciences and Applications Vol. 1
Where and all other elements of P are equal to 0 At the above described isomorphism of the group of permutation matrices with the symmetric group, the matrix P corresponds to the element (4) It is not difficult to see that is identity matrix.
(5) Let A B n and let And It is easy to prove (see [10]), that the first row of B is equal to the second row of A , the second row of B is equal to the third row of A and so on, the last row of B is equal to the first row of A, i.e. the matrix B is created by the matrix A by moving the first row to the last place, and the other rows are moved one level upper.
Analogously we convince that C is made from A by moving the last column to the first place, and the other column move one position to the right.
Have in mind what is above-described, it is easy to prove the following: Except the well-known from the linear algebra operation matrix transposition, here we take more similar matrix operations. Let (6) If A is a square binary matrix, represented by the formula (6), then by definition (7) 18 BMSA Volume 1 i. e. A S is created from A as the last column of A becomes the first, the column before lastsecond and so on, the first column becomes last. In other words, if A = (a i j ) , then It is obvious, that We say, that the matrix is a mirror image of the matrix It is easy to see, that if the matrix A is a mirror image of the matrix B, then B is a mirror image of A, i.e. the relation ''mirror image'' is symmetric.
Therefore, the relation ''mirror image'' is not reflexive and is not transitive.
We examine the matrix (8) where for each and . According to the abovedescribed isomorphism of the group of permutational matrices with symmetric group, the matrix S corresponds with the element (9) Obviously S is a symmetric matrix, i.e. S T = S . We check directly, that S 2 = E . Is not difficult to see, that (10) is satisfied for each A  B n Lemma 2 If P and S are the matrices given by the formulas (3) and (8), then (11) for each l = 0,1,2,..., n -1.
Proof. Let us denote by  and  the operations addition and subtraction in the ring Z n = {1,2,, n  0} of the residue classes by modulo n . In order to have accordance with the marks of the elements of S n and as 0  n (mod n) , then the zero element in Z n we denote n (instead of 0). If  S n and  S n are elements corresponding to the matrices P  P n and S  P n by the isomorphism of the groups P n and S n described by the formulas (4), (9), (3) and (8), then for each t = 1,2,..., n there are:

Bulletin of Mathematical Sciences and Applications Vol. 1
We will prove by induction, that for each positive integer l is true: (14) When l = 1 , the proposition follows from (12). Let the equation (t) l = t l be true. Then we get and it follows that the equation (14) is true for every natural number l .
Using the equations (12), (13) и (14) we continuously get: The last equation is true, because 2n  n  0 (mod n) .We see, that (t) l  = (t) nl for every t = 1,2,, n and therefore l  =  nl , Then having in mind the isomorphism of the groups S n and P n it follows that the assertion of the lemma is true.

Theorem 1 If A ~ A S and B ~ A then B ~ B S .
Proof. Since B ~ A , then according to the lemma 1 there exist k, l {1,2,, n}, such that B = P k AP l . Applying lemma 2 we get BS = P k AP l S = P k ASP n-l , and then follows, that BS ~ AS , Theorem 1 gives us a reason to make the following definition: Let us denote the set including all self-mirrored interweavings with repetition n.
For arbitrary A  B n we define the operation (15) In other words the matrix A R is received by rotating the matrix A by 90  counter clockwise. Obviously,

Lemma 3 If P is a binary matrix, defined by the formula (3), then
Proof. If , then by definition for each Then for each there is and it is the unique 1 in i th row of the matrix . Therefore, where E n is the identity matrix. We multiply from the left the two sides of the last equation with P n1 and have in mind, that P n = E n then we get P n-1 PP T = P n-1 E n and then finally we get, that P T = P n1

Theorem 2
Theorem 2 gives us the right to give the following definition: Proof. B ~ A , hence according to the lemma 1 there exist natural numbers k and l , as B = P k AP l Then, when we apply lemma 2 and lemma 3 we get B R = SB T = Therefore, Theorem 2 gives us the right to give the following definition:

Definition 2 Let A  Q n . If A ~ A R then we say that A is a representative of rotation stable interweaving
Let denote the set of all rotation stable interweavings with repetition n The rotation stable interweavings play important role in practice.This means, that if a fabric is weaved which weaving structure is coded with a matrix, representative of rotation stable interweaving, then this fabric will have the same physical and mechanical characteristics except of course the color) after a rotation by 90 o

A Representation of Binary Matrices
In [14] is described a representation of the elements of B n using ordered n -tuples of natural numbers , where . The one to one corresponding is based on the binary presentation of the natural numbers. It is not difficult to see that using this representation, this leads to making a fast and saving memory algorithms. Having in mind this we will create an algorithm, which will find just one representative of each equivalence

Bulletin of Mathematical Sciences and Applications Vol. 1
class to the factor sets It will be the minimal element of the equivalence class with regard to the lexicographic order. As a consequence we will get an algorithm to solve the combinatoric problem to find the number of the equivalence classes in the sets by the relation ~ with given natural number n The matrices P and S given by the formulas (3) and (8) are coded using ordered n -tuples as it follows: In programming languages C, C++ and Java [4,5,6] the number x = 2 k is calculated using a single operation bitwise shift left '' << '' with the statement x = 1 << k; Let are matrices of B n . Here and everywhere below, we will consider the semantic and syntax of C++ language and the first index will be 0, i.e i, i, j {0,1,2,, n 1}We examine the following operations in B n , defined according to our aim as follows:   It is not difficult to see that the introduced above binary operations are associative.

B n and the above-described operations form the algebra
Here and in the whole article the term algebra means abstract algebra considering the definition given in [3], and namely set equipped with various operations, assumed to satisfy some specified system of axiomatic laws. It is naturally we to put the linear order, and more precisely the lexicographic order in 4 The algebra and bitwise operations.
The use of bitwise operations is a well-working method, used in C/C++ and Java programming languages [4,5,6]. Our aim is to show that the presentation of the binary matrices using ordered ntuple of nonnegative integers and the bitwise operations make the realization of a better C++ class compared with the standard presentation of the binary matrices Let x, y and z are three integer variables, for which w bits are needed. Let x and y are initialized and let z = xy where α is one of the operators bitwise conjunction (bitwise AND) &, bitwise disjunction (bitwise OR) | or bitwise exclusive OR ^ . For each i = 0,1,, n 1 the new contents of the i bit in z will be as it is presented in table 1 In case z = ~x, if the i bit of ix x is 0, then the i bit of z becomes 1, and if the i bit of x is 1, then the i bit of z becomes 0, i = 0, i = 0,1,, w 1.
If k is a nonnegative integer, then the statement z = x << k (bitwise shift left) will write in the (i  k ) -th bit of z the value of the k -th bit of x , where i = 0,1,, w  k 1 , and the first k bits of will be filled by zeroes. This operation is equivalent to a multiplication of x by 2 k . The statement z = x >> k (bitwise shift right) work similarly.  (Bn_tuple &); } Furthermore, for our purposes, the class Bn_tuple may be used for solving a number of tasks in the field of computer algebra [9]. To evaluate the effectiveness and speed of the algorithms, which use objects of the Algebra it is necessary to evaluate the algorithms, which realize the operations & &, P!, t ()and the operation '' < '' comparing two elements. In that sense we describe in details just these methods, realizing the above mentioned operations. To create these methods we use bitwise operations: bitwise conjunction &, bitwise disjunction | , bitwise exclusive or ^ and bitwise negation ~, using these operations we raise the effectiveness and make the algorithms work faster. We suppose that the experienced programmer can easily create the other methods. Using the same model we can predefine the other relational operators: '' <= '', '' > '', '' >= '', '' == '' and ''!= ''. If the dimensions of the two matrices, we compare, are not equal, then the relation '' < '' is not defined and the result we get is the negative number -1. if (B.get_n() != n) cout<<"unallowable value\n"; else while ((get_row(p)==B.get_row(p))&&(p<n-1 )) p++; if (get_row(p)<B.get_row(p) ) return 1; else return 0; } When we predefine operators & & , || and *, if the dimensions of the two operands are not equal, then we receive the zero matrix of order the same as the first operand. But this result is not correct. We can say something more: in this case the operation is not defined, i.e. the result of the operation function is not correct and we have to be very careful in such situations. The situation is the same about the entered linear order, i.e. although the lexicographic order can be put for the words with different length, we examine by definition only the matrices of one and the same order. The result we receive when we compare the matrices with different dimensions is not correct. We give suitable massages in this situations.
It is easy to convince that the following proposition is true: (v) Initialization of an object of the class Bn_tuple requires O(n) standard operations.  If the binary matrix A is represented using the ordered n -tuple of integers, then to check whether A belongs to the set Q n  B n we can use the following obvious assertion:

Lemma 4
Let A  B n be represented by the ordered n -tuple k 1  Let the unique 1 in the jth column of ∈ be on the s th place, i.e. = 1 = 0 ℎ ≠ . Then by definition and Therefore, = for each , ∈ {1,2, … , Analogously can be proved, that B * A = BA .  Lemma 6 Let A  B n be represented using ordered n -tuple k 1 , k 2 ,, k n and let A be a minimal element of the equivalence class corresponding to the lexicographic order in Then k 1 ≤ k t for each t = 2,3,..., n .
operating memory. For every integer matrix are necessary O(n 2 ) *sizeof (int) bytes of the operating memory. Finally we saw that initialization of an object of the class Bn_tuple requires O(n) standard operations whereas to initialize a n × n integer matrix O(n 2 ) standard operations are necessary. This proved the usefulness of the use of bitwise operations in programming.
Applying the above ideas, a computer program that receives some different weaving structures is created. The work results of this program taking some values of n are generalized in the table 2. When n  6 there are got too large values (see formula (1)) and to avoid ''overloading'' it is ecessary to be used some special programming techniques [9] which is not the task in this work.