Algorithm -cdn.com



Supplementary materialAd hoc algorithm to find a set β that leads to (m-n) linearly independent LI rows of the matrix ALet P be the matrix of the underdetermined linear equation system of dimension [(m-n)n x (m-n)m]. The transformed matrix of P (Ptransf) is obtained by using the Matlab routine “rref” that produces the reduced row echelon form of P. The columns that do not have “1” values on the diagonal are registered. The variables aij that are represented by each of these columns are the free variables, whose assignments (“0” or “1” values) will allow to transform the underdetermined system of equations to a system with the same number of equations and unknowns, and then to obtain the square matrix Q of dimension [(m-n)m x (m-n)m].The algorithm used to assign “0” or “1” values to the free variables aij is schematized in Fig. SM1 and described as follows.Let tB be the counter of the number of successful attempts?(i.e. matrix A linearly independent). The algorithm inputs are the number of attempts to be made (g) and the number of “1” values to be assigned (?). ? can vary between (m-n) and [(m-n)2-(m-n-1)]; the lower value corresponds to the number of invariants to be obtained i.e the number of rows of the desired matrix A; while the higher value is computed by a relation encountered in practice by executing the code of the algorithm, without any theoretical justification. When the number of proposals (np) reaches g, the algorithm retrieves the matrix ψ of size tB x ?. Each row of the matrix ψ represents a successful arrangement of ? “1” values, and each element of a successful arrangement indicates the position of the assigned “1” values in the vector b. If b is the column vector of the independent terms of dimension (m-n)m, the row vector r with (m-n)2 elements is obtained by using the Matlab routine “randperm”. This command returns a random permutation of the integers from 1 to (m-n)2. Then, the first ? elements of r indicate the allocation of the “1” values in the vector b. Then, the vector w of dimension (m-n)m is obtained (w=Q-1?b), which is transformed into the matrix A. This is accomplished by separating w into (m-n) parts; each part contains m elements and forms a row of the matrix A. If the rank of A is (m-n), then the required condition is fulfilled. In that case, the counter tB is increased by one and the proposed distribution of “1” is stored in the matrix ψ. Regardless if the required condition is met or not, np is increased. StartQ, tB = 0g, φnp < g?Endnob = [0](m-n)m x 1r = randperm((m-n)2)φ elements from the last (m-n)2 elements of b are “1” (random)A(1, m) = first m elements of w…A(m-n, m) = last m elements of ww = Q-1 ? bnp=np+1Row tB of matrix ψ = first φ elements of r tB = tB+1yesyesnoψrk=m-nStartQ, tB = 0g, φnp < g?Endnob = [0](m-n)m x 1r = randperm((m-n)2)φ elements from the last (m-n)2 elements of b are “1” (random)A(1, m) = first m elements of w…A(m-n, m) = last m elements of ww = Q-1 ? bnp=np+1Row tB of matrix ψ = first φ elements of r tB = tB+1yesyesnoψrk=m-nFig. SM1. Ad hoc algorithm to find a set β that leads to (m-n) linearly independent (LI) rows of the matrix A As illustrative example, the code of the algorithm corresponding to the case study 3 (section 4.3 of the manuscript) is shown below.------------------------------------------------------------------------------------------------------------------------------clear allclc% Define the existence of the matrix Q of dimension 65x65:Q = zeros(65,65);% Enter the elements of the matrix Q different to 0:Q(1,2)= -1.4925; Q(1,4)= -0.08; Q(1,6)= -0.0057; Q(1,7)= -0.4925; Q(1,10)= 1; Q(2,15)= -1.4925; Q(2,17)= -0.08; Q(2,19)= -0.0057; Q(2,20)= -0.4925; Q(2,23)= 1; Q(3,28)= -1.4925; Q(3,30)= -0.0800; Q(3,32)= -0.0057;Q(3,33)= -0.4925; Q(3,36)= 1; Q(4,41)= -1.4925; Q(4,43)= -0.0800; Q(4,45)= -0.0057;Q(4,46)= -0.4925; Q(4,49)= 1; Q(5,54)= -1.4925; Q(5,56)= -0.0800; Q(5,58)= -0.0057;Q(5,59)= -0.4925;Q(5,62)= 1; Q(6,2)= -1.4925; Q(6,3)= -0.1722; Q(6,4)= -0.080; Q(6,6)= 0.0066; Q(6,10)= 1; Q(7,15)= -1.4925; Q(7,16)= -0.1722; Q(7,17)= -0.080; Q(7,19)= 0.0066; Q(7,23)= 1; Q(8,28)= -1.4925; Q(8,29)= -0.1722; Q(8,30)= -0.080; Q(8,32)= 0.0066; Q(8,36)= 1;Q(9,41)= -1.4925; Q(9,42)= -0.1722; Q(9,43)= -0.080; Q(9,45)= 0.0066; Q(9,49)= 1; Q(10,54)= -1.4925; Q(10,55)= -0.1722; Q(10,56)= -0.080;Q(10,58) = 0.0066; Q(10,62)= 1; Q(11,3)= 4.1667; Q(11,4)= -4.2467; Q(11,6)= -0.6010;Q(11,7)= -18.0417; Q(11,11)= 1; Q(12,16)= 4.1667; Q(12,17)= -4.2467; Q(12,19)= -0.6010; Q(12,20)= -18.0417; Q(12,24)= 1; Q(13,29)= 4.1667; Q(13,30)= -4.2467; Q(13,32)= -0.6010;Q(13,33)= -18.0417; Q(13,37)= 1; Q(14,42)= 4.1667; Q(14,43)= -4.2467; Q(14,45)= -0.6010; Q(14,46)= -18.0417; Q(14,50)= 1;Q(15,55)= 4.1667; Q(15,56)= -4.2467; Q(15,58)= -0.6010; Q(15,59)= -18.0417; Q(15,63)= 1; Q(16,9)= 0.9200; Q(16,10)= -1; Q(16,12)= 0.0800; Q(16,13)= 0.0752; Q(17,22)= 0.9200; Q(17,23)= -1; Q(17,25)= 0.0800; Q(17,26)= 0.0752; Q(18,35)= 0.9200; Q(18,36)= -1; Q(18,38)= 0.0800; Q(18,39)= 0.0752; Q(19,48)= 0.9200; Q(19,49)= -1; Q(19,51)= 0.0800; Q(19,52)= 0.0752; Q(20,61)= 0.9200; Q(20,62)= -1; Q(20,64)= 0.0800; Q(20,65)= 0.0752; Q(21,9)= 0.9200; Q(21,11)= -1; Q(21,12)= 0.0800; Q(21,13)= 0.0752; Q(22,22)= 0.9200; Q(22,24)= -1; Q(22,25)= 0.0800; Q(22,26)= 0.0752; Q(23,35)= 0.9200; Q(23,37)= -1; Q(23,38)= 0.0800; Q(23,39)= 0.0752; Q(24,48)= 0.9200; Q(24,50)= -1; Q(24,51)= 0.0800; Q(24,52)= 0.0752; Q(25,61)= 0.9200; Q(25,63)= -1; Q(25,64)= 0.0800; Q(25,65)= 0.0752; Q(26,4)= 1; Q(26,5)= -1; Q(26,6)= 0.0714; Q(27,17)= 1; Q(27,18)= -1; Q(27,19)= 0.0714;Q(28,30)= 1; Q(28,31)= -1; Q(28,32)= 0.0714; Q(29,43)= 1; Q(29,44)= -1; Q(29,45)= 0.0714; Q(30,56)= 1; Q(30,57)= -1; Q(30,58)= 0.0714; Q(31,2)= 1; Q(31,9)= -1; Q(32,15)= 1; Q(32,22)= -1; Q(33,28)= 1; Q(33,35)=-1; Q(34,41)= 1; Q(34,48)= -1; Q(35,54)= 1; Q(35,61)= -1; Q(36,5)= 1; Q(36,13)= -1;Q(37,18)= 1; Q(37,26)= -1; Q(38,31)= 1; Q(38,39)=-1; Q(39,44)= 1; Q(39,52)= -1; Q(40,57)= 1; Q(40,65)= -1; Q(41,1)= 1; Q(42,6)= 1; Q(43,8)= 1; Q(44,12)= 1; Q(45,13)= 1; Q(46,14)= 1; Q(47,19)= 1; Q(48,21)= 1; Q(49,25)= 1; Q(50,26)= 1; Q(51,27)= 1; Q(52,32)= 1; Q(53,34)= 1; Q(54,38)= 1; Q(55,39)= 1; Q(56,40)= 1; Q(57,45)= 1; Q(58,47)= 1; Q(59,51)= 1; Q(60,52)= 1; Q(61,53)= 1; Q(62,58)= 1; Q(63,60)= 1; Q(64,64)= 1; Q(65,65)= 1;tB = 0; % Counter of the number of successful attempts.phi = 5; % Number of “1” values to be assigned.g = 50000; % Number of attempts to be made.for np = 1:g b = zeros(65,1); % Definition of the vector b. beta = zeros(25,1); % Last 25 elements of the vector b. r = randperm(25); % Returns a row vector r containing a random permutation of the integers from 1 to 25 inclusive (25 assignments in this case). for z = 1:25 for s = 1:phi if z == r(s) beta(z,1) = 1; % If the row number of an element of vector beta coincides with any one of the first phi values of r, this element takes the value of 1. end % if z == r(s) end % for s = 1:phi end % for z = 1:25 b(41:65,1) = beta; % Replace the last 25 elements of vector b with the elements of vector beta. w = Q^-1*b; % Solve the equation system to find the row vector w. % The row vector w becomes the matrix A, i.e. the elements of the row vector w are arranged to form the matrix A. A(1,1:13) = w(1:13)';A(2,1:13) = w(14:26)';A(3,1:13) = w(27:39)';A(4,1:13) = w(40:52)';A(5,1:13) = w(53:65)'; if RANK(A) == 5 psi(tB+1,:) = r(1:phi)'; % If rank of A is 5, i.e the LI condition is satisfied, then a successful proposal is recorded and the counter tB is increased by one. tB = tB+1; end % if RANK(A) == 5 end % for np = 1:g------------------------------------------------------------------------------------------------------------------------------A screen shot demonstrating the code outputs is included next. For example, it can be observed in the “Workspace” panel that 98 successful proposals have been recorded for this particular program execution, of which 15 are shown in the “Variable Editor” panel (positions of the five “1” values in the vector beta). ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download