Summary of the invention
The technical problem to be solved in the present invention is just: the technical problem existed for prior art, the invention provides a kind of algorithm simple, be easy to realize, perfectly can solve the nothing summation collision INTEGER MATRICES production method for Conbined public or double key field of INTEGER MATRICES summation collision problem.
For solving the problems of the technologies described above, the technical scheme that the present invention proposes is: a kind of nothing summation collision INTEGER MATRICES production method for Conbined public or double key field, for given arbitrary 2
h× 2
krank matrix, line number is 0 to 2
h-1, row number are 0 to 2
k-1, structure comprises the steps: without summation collision INTEGER MATRICES
S1. represent each element in described matrix with bigit, and described bigit is divided into low level district, meta district and high-order district by bit, the low level district of each element in described matrix comprises L
lindividual bit, meta district comprises L
mindividual bit, high-order district comprises L
hindividual bit;
S2. construct the value in described bigit low level district, make in low level district be 1 number of bits account for the preset percentage of low level district number of bits, and for two elements any in described matrix, the value in its low level district is all not identical;
S3. construct the value in described bigit meta district, make the value of the lowest bit position in described meta district be 1, the value of all the other bits is 0;
S4. construct the value in the high-order district of described bigit, make the value in the high-order district of any two elements in described matrix all not identical;
S5. in described matrix, each binary number is the value of described matrix element, obtains without summation collision INTEGER MATRICES.
As a further improvement on the present invention, the number of bits in described low level district meets such as formula shown in (1),
L
l≥2×(h+k)(1)
In formula (1), L
lfor the number of bits in low level district, h is the values of powers of described matrix line number, and k is the values of powers of described matrix columns.
As a further improvement on the present invention, the concrete steps of described step S2 comprise:
S2.1. by integer 0 to 2
h+k-1 is expressed as the binary number comprising h+k bit, and by this 2
h+kindividual bigit inserts described matrix 2 at random
h+kin high h+k the bit in individual element low level district;
S2.2. obtaining height h+k, each element low level district bit intermediate value in described matrix is successively the number of bits of 1, and the low L in low level district
linsert 1 of right quantity at random in the individual bit of-(h+k), make described low level district intermediate value be 1 number of bits meet described preset percentage.
As a further improvement on the present invention, described low level district intermediate value is the number of bits preset percentage that accounts for low level district number of bits of 1 is 48% to 52%.
As a further improvement on the present invention, the number of bits in described meta district such as formula shown in (2),
L
m≥h+1(2)
In formula (2), L
mfor the bit number in meta district, h is the values of powers of described matrix line number.
As a further improvement on the present invention, the number of bits in described high-order district meets such as formula shown in (3),
L
h≥(k+1)×2
h(3)
In formula (3), L
hfor the number of bits in high-order district, h is the values of powers of described matrix line number, and k is the values of powers of described matrix columns.
As a further improvement on the present invention, the concrete steps of described step S4 comprise:
S4.1. for the arbitrary row of described matrix, the individual bit not identical with the bit selected by other row of optional k+1 from described high-order district, and from 1 to 2
k+1appoint in-1 and get 2
kthe value of each bit also with the binary number representation of k+1 bit, is inserted a selected k+1 bit from low level a to high position by individual mutually different number successively;
S4.2. the bit do not chosen in described high-order district is all inserted 0.
As a further improvement on the present invention, in described step S4.1, the concrete steps of the described individual bit not identical with the bit selected by other row of optional k+1 from described high-order district are: for the i-th row of described matrix, select (k+1) × i of high-order district to (k+1) × (i+1)-1 k+1 bit altogether.
As a further improvement on the present invention, the number of bits in described high-order district meets such as formula shown in (4),
L
h≥(k+2)×2
h(4)
In formula (4), L
hfor the number of bits in high-order district, h is the values of powers of described matrix line number, and k is the values of powers of described matrix columns;
Described high-order district is successively divided into fill area, tectonic province and random district from height to low by bit, the number of bits of described tectonic province such as formula shown in (5),
L
g=k+1,(5)
In formula (5), L
gfor the number of bits of described tectonic province, k is the values of powers of described matrix columns;
The number of bits in described random district such as formula shown in (6),
L
ri=L
g×i+i=(k+2)×i(6)
In formula (6), L
rifor the number of bits in described random district, L
gfor described tectonic province number of bits, i is the line number of this element in described matrix;
The value in described matrix with any two element tectonic provinces of identical line number is all not identical.
As a further improvement on the present invention, the concrete steps of described step S4 comprise:
S4.1a. for described matrix i-th row, from 1 to 2
k+1appoint in-1 and get 2
kindividual mutually different binary number d
j(j ∈ (0,2
k-1)), and by d
jvalue assignment give the tectonic province of described matrix, shown in (7),
g
ij=d
j(7)
In formula (7), g
ijfor line number in described matrix is that i arranges number tectonic province binary number being the element of j, d
jfor two of selected jth number is entered to represent;
S4.2a. when
when being greater than 0, be 0 by the highest order value in random for described matrix district, other position can value be 0 or 1 arbitrarily;
S4.3a. each bit in described fill area is all inserted 0.
Compared with prior art, the invention has the advantages that: the summation collision problem that the invention solves insurmountable INTEGER MATRICES always to there is algorithm simple, be easy to the advantage realized.
Embodiment
Below in conjunction with Figure of description and concrete preferred embodiment, the invention will be further described, but protection range not thereby limiting the invention.
As shown in Figure 1, a kind of production method without summation collision INTEGER MATRICES for Conbined public or double key field, for given arbitrary 2
h× 2
krank matrix, line number is 0 to 2
h-1, row number are 0 to 2
k-1, without summation collision INTEGER MATRICES, structure comprises the steps: that S1. is with each element in bigit representing matrix, and bigit is divided into low level district, meta district and high-order district by bit, and the low level district of each element in matrix comprises L
lindividual bit, meta district comprises L
mindividual bit, high-order district comprises L
hindividual bit; S2. construct the value in bigit low level district, make in low level district be 1 number of bits account for the preset percentage of low level district number of bits, and for two elements any in matrix, the value in its low level district is all not identical; S3. construct the value in bigit meta district, make the value of the lowest bit position in meta district be 1, the value of all the other bits is 0; S4. construct the value in the high-order district of bigit, make the value in the high-order district of any two elements in matrix all not identical; S5. in matrix, each binary number is the value of matrix element, obtains without summation collision INTEGER MATRICES.
In the present embodiment, what need structure is 2 of h=3, a k=7 without summation collision INTEGER MATRICES
3× 2
7rank matrix, comprise 8 × 128=1024 element altogether, each element wherein all represents with bigit, as shown in Figure 2, and this bigit is carried out block by bit be divided into low level district, meta district and high-order district, the value of each bit of blockette structure bigit, the final INTEGER MATRICES generated without summation collision, reduces the difficulty of structure without summation collision INTEGER MATRICES, makes the construction algorithm of matrix more simple.
Wherein, the number of bits in low level district meets such as formula shown in (1),
L
l≥2×(h+k)(1)
In formula (1), L
lfor the number of bits in low level district, h is the values of powers of matrix line number, and k is the values of powers of matrix columns.
In the present embodiment, the concrete steps constructing low level district are: S2.1. is by integer 0 to 2
h+k-1 is expressed as the binary number comprising h+k bit, and by this 2
h+kindividual bigit inserts matrix 2 at random
h+kin high h+k the bit in individual element low level district; S2.2. obtaining height h+k, each element low level district bit intermediate value in matrix is successively the number of bits of 1, and the low L in low level district
linsert 1 of right quantity at random in the individual bit of-(h+k), make low level district intermediate value be 1 number of bits meet preset percentage.
The present embodiment is needed to the matrix of structure, low level district at least comprises 2 (3+7)=20 bit, the binary number that 0 ~ 1023 these 1024 integers are write as 10 bits is filled at random high 10 bits in the low level district of 1024 elements of INTEGER MATRICES, less than the number of 10 bits when being write as binary system, then to a high position by 0, make it the form of satisfied 10 bits, as for decimal integer 2, binary representation is 10, during with the binary representation of 10 bits, needing to mend 0 to being in 8 high-order bits, being write as the form of 0000000010.Select to fill out 0 or 1 to other bits in the low level district of element each in matrix, and make for any one element in this matrix, its low level district intermediate value is that the number of the bit of 1 accounts for 48% to 52% of low level district number of bits, preferably 50%.In the present embodiment, the percentage preset is 50%, as in certain element low level district in this matrix, being in 10 high-order bits is 0000000010, namely decimal number is 2, so for other bit in this element low level district, need to select arbitrarily 8 bits to insert 1, all the other 2 bits insert 0, then the binary form in this element low level district is 00000000101111111100, it can certainly be other form, as 00000000100011111111, or other arbitrary form, demand fulfillment low level district be 1 bit account for 50% of low level district number of bits.The result of such structure meets two elements any in matrix, and the value in its low level district is all not identical, and namely low level district has a bit difference at least.
In the present embodiment, the number of bits in meta district such as formula shown in (2),
L
m≥h+1(2)
In formula (2), L
mfor the bit number in meta district, h is the values of powers of matrix line number.
Namely meta district at least comprises 4 bits, and the bit value of meta district lowest order is 1, and all the other each bits are 0, namely in matrix all elements meta district be 0001 form.
In the present embodiment, different makes can be adopted to high-order district bit, make the value in the high-order district of any two elements in matrix all not identical.
The first high-order district bit make, the number of bits in high-order district meets such as formula shown in (3),
L
h≥(k+1)×2
h(3)
In formula (3), L
hfor the number of bits in high-order district, h is the values of powers of matrix line number, and k is the values of powers of matrix columns.Namely the number of bits in the high-order district of the present embodiment is at least (k+1) × 2
h=(7+1) × 2
3=64.
The present embodiment concrete steps be: S4.1. for the arbitrary row of matrix, the bit that optional k+1 is identical with the bit selected by other row from high-order district, and from 1 to 2
k+1appoint in-1 and get 2
kthe value of each bit also with the binary number representation of k+1 bit, is inserted a selected k+1 bit from low level a to high position by individual mutually different number successively; S4.2. the bit do not chosen in high-order district is all inserted 0.Namely for any a line of this matrix, the bit of the bit selected in high-order district all from other arbitrarily selected by row is different,
In the make in this high-order district, not considering that higher bit position is the situation of invalid 0, setting high-order district as comprising (k+1) × 2
h=(7+1) × 2
3the bigit of=64 bits.For these 64 bits set selection marker respectively, in an initial condition, the selection marker of each bit is and does not select state, for any a line in this matrix, from 64 bits in high-order district, select arbitrarily k+1=7+1=8 to be masked as does not select status bits as structure position, and is set to by the mark of these 8 bits and selects state.And from 1 to 2
k+1-1=2
8appoint in-1=255 and get 2
k=2
7=128 mutually different numbers, namely each selected number corresponds to each element in this row of matrix.Each selected number is represented with the form of the binary number of 8 bits, to the binary number less than 8 bits, 0 is mended to a high position.One of them number as selected is 4, its binary form is 100, then the form of 8 bits is 00000100, the value of these 8 bits is inserted in 8 selected bits from low level to a high position successively, and all the other unselected bits are all filled out 0, namely complete the structure to high-order district.
In order to reduce the complexity of algorithm further, the present embodiment selects the bit in high-order district in accordance with the following steps: for the i-th row of matrix, selects (k+1) × i of high-order district to (k+1) × (i+1)-1 k+1 bit altogether.In the present embodiment, from 1 to 2
7+1choose arbitrarily 128 integers in-1=255, and represent with the binary form of 8 bits, to the binary number less than 8 bits, 0 is filled into a high position, make it the form of satisfied 8 bits.In the present embodiment, for the 0th row of this matrix, selection 1 to 128 totally 128 integers, and by these 128 integers with the binary form of 8 bits, as entered integer 3 for selected ten, binary system is 11, the form of 8 bits of being write as is 00000011, and the binary number of selected 1 to 128 8 bits is inserted in 128 elements of this row successively, i.e. the 0th element of the 0th row, 0th bit in high-order district is to the 7th bit, the binary number inserted is 00000001, all the other bits all fill out 0, 1st element of this row, 0th bit in high-order district is to the 7th bit, the binary number inserted is 00000010, all the other bits all fill out 0, the rest may be inferred, complete the structure in the high-order district of the whole element of one's own profession.In like manner, the structure in the high-order district of each element in other row of this matrix can be completed successively.To end, completed the low level district of each element in this matrix, the structure in meta district and high-order district, represented by these three districts two carry out the value counted, and each element is (k+1) × 2
hthe binary number of+h+1+2 × (h+k) individual bit, is the value of this element.
Due to any 2
hthat the identical binary number of individual number of bits is added and, at most than bit many h position of addend.For the matrix that the present embodiment constructs, appoint at every row and get element and be added, its low level district and at most than number of bits many h position in former low level district, due in the present embodiment, the lowest order in meta district is 1, and all the other h positions are zero, therefore, when suing for peace, the carry that low level district is added can only affect meta district at most, and can not have an impact to the bit in high-order district.High-order district again due to any two elements of matrix is all not identical, and therefore, as long as the ranks value when twice value is incomplete same, it is identical scarcely with value, namely obtains thus without summation collision INTEGER MATRICES.
The present embodiment the second high-order district bit make: the number of bits in described high-order district meets such as formula shown in (4),
L
h≥(k+2)×2
h(4)
In formula (4), L
hfor the number of bits in high-order district, h is the values of powers of described matrix line number, and k is the values of powers of described matrix columns;
As shown in Figure 3, high-order district is successively divided into fill area, tectonic province and random district from height to low by bit, the number of bits of tectonic province such as formula shown in (5),
L
g=k+1,(5)
In formula (5), L
gfor the number of bits of tectonic province, k is the values of powers of matrix columns;
The number of bits in random district such as formula shown in (6),
L
ri=L
g×i+i=(k+2)×i(6)
In formula (6),
for the number of bits in random district, L
gfor tectonic province number of bits, i is this element line number in a matrix; The value in matrix with any two element tectonic provinces of identical line number is all not identical.
The concrete steps of step S4 comprise: S4.1a. for matrix i-th row, from 1 to 2
k+1appoint in-1 and get 2
kindividual mutually different binary number d
j(j ∈ (0,2
k-1)), and by d
jvalue assignment to the tectonic province of matrix, shown in (7),
g
ij=d
j(7)
In formula (7), g
ijfor line number in matrix is that i arranges number tectonic province binary number being the element of j, d
jfor the binary representation of selected jth number; S4.2a. L is worked as
riwhen being greater than 0, be 0 by the highest order value in random for matrix district, other position can value be 0 or 1 arbitrarily; S4.3a. each bit in fill area is all inserted 0.
The present embodiment the second high-order district make, for 2
3× 2
7the matrix on rank, high-order district is successively divided into fill area, tectonic province and random district from height to low by bit, tectonic province comprises 8 bits, and the number of bits in fill area and random district is what change, for the different elements in matrix, because the line number of this element is different, its fill area is not identical with the number of bits in random district yet, and for the i-th row in matrix, the number of bits in random district is (7+2) × i, except tectonic province and random district, all the other bits are fill area.As the 0th row of matrix, the number of bits in random district is 0, does not namely have random district, only has the tectonic province of fill area, the 0th of high-order district is tectonic province to the 7th, 8th is fill area to, the 1st row of matrix, and the number of bits in random district is 9, namely from low level to a high position the 0th of high-order district is random district to the 8th, 9th is tectonic province to the 16th, and the rest may be inferred, and the every a line for matrix divides corresponding tectonic province and random district.When the number of bits in random district is not 0, namely except the 0th row of matrix, the highest order value in random district is 0, and other position can get arbitrarily 0 or get 1.
For tectonic province, from 1 to 2
k+1-1=2
8appoint in-1=255 and get 2
k=2
7=128 mutually different numbers, namely each selected number corresponds to each element in this row of matrix.Each selected number is represented with the form of the binary number of 8 bits, to the binary number less than 8 bits, 0 is mended to a high position.One of them decimal number as selected is 4, and its binary form is 100, then the form of 8 bits is 00000100, and the value of these 8 bits is inserted tectonic province successively, namely completes the structure to tectonic province bit.
For fill area, only need to fill out 0 on each bit, make for arbitrary element in this matrix, the bit of its binary number is all identical.
The make in the high-order district of the second, because high-order district also includes random district, so by the second high-order district make construct without summation collision INTEGER MATRICES with construct than the first make without summation collision INTEGER MATRICES when for Conbined public or double key, there is stronger fail safe.
Above-mentioned just preferred embodiment of the present invention, not does any pro forma restriction to the present invention.Although the present invention discloses as above with preferred embodiment, but and be not used to limit the present invention.Therefore, every content not departing from technical solution of the present invention, according to the technology of the present invention essence to any simple modification made for any of the above embodiments, equivalent variations and modification, all should drop in the scope of technical solution of the present invention protection.