V
Ved
Hi all,
I have posted this message in perl.beginers,but didnt get any reply so
am posting here.
I have two set of data which I need to comapre.
The data set is actually a 16x16 Matrix.
Till now I am reading one row at a time by manually changing the
@comp_vhdl0, @comp_vhdl1.... till @comp_vhdl15 and so on.
I want:
1) this to be done using some loop (or some other better method) and
then write it to a file in 16x16 matrix form.
2) After that I want to compare the corresponding values and write the
results in a Marix form( say 1 if match occurs and 0 when mismatch). So
result looks like this
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
...........
...........
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Thanks
Ved
#########################################################################
use strict;
use warnings;
##############This is the data of C based#########
my @VHDL = qw{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-2.02344 0.200195 2.41211 0.200195 0.200195 0.200195 0.200195 -1.98242
-2.15234 1.69141 -0.200195 -2.37109 -2.19336 0.200195 -0.200195
-1.99121
-2.00879 -0.200195 2.66309 -0.200195 -0.200195 0.200195 0.200195
1.97363 2.28125 -2.4043 0.200195 2.00977 -2.3916 -0.200195 0.200195
-2.39063
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
0.200195 0.200195 2.77832 2.30469 -2.88184 -0.200195 2.25977 2.15625
-0.200195 -0.200195 2.92676 -0.200195 1.65234 -0.200195 -0.200195
-2.17383
0.200195 1.69824 0.200195 0.200195 0.200195 0.200195 0.200195 2.19727
0.200195 0.200195 0.200195 0.200195 1.19336 0.200195 2.10645 0.200195
-1.32227 1.76563 0.295898 1.73633 0.630859 -0.200195 0.598633 0.263672
0.200195 0.200195 -2.4248 0.325195 0.200195 1.79785 0.844727 -0.331055
0.200195 0.200195 1.60547 1.51758 2.00684 0.200195 1.45215 1.09961
0.200195 0.200195 1.94141 0.200195 1.11621 0.200195 0.200195 0.200195
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
-0.200195 -1.40918 -2.75 0.200195 0.200195 1.92188 -0.200195 -2.81641
0.200195 -0.200195 0.200195 -0.200195 2.36719 -1.53906 -1.98828
-1.80859
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
0.200195 0.200195 1.65234 0.200195 1.38477 0.200195 0.200195 0.200195
0.200195 1.86719 0.833984 1.40723 0.200195 1.77344 1.50098 1.75098
12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12
0.200195 1.0127 1.63477 0.200195 0.200195 1.45801 0.200195
1.05664 0.200195 0.200195 0.200195 0.200195 0.822266 1.41309 1.05762
1.22266
1.88379 -0.420898 0.200195 0.200195 2.06445 0.200195 2.02734 0.200195
0.200195 0.200195 0.200195 -0.326172 1.64258 -0.200195 0.200195
-0.498047
0.200195 0.134766 2.88281 2.35352 0.200195 -0.833984 2.23438 0.200195
0.200195 -1.36328 0.200195 -1.48242 0.200195 0.200195 0.200195
0.0957031
};
my @comp_vhdl0 = (@VHDL[0..15] );
my @comp_vhdl1 = (@VHDL[16..31] );
my @comp_vhdl2 = (@VHDL[32..47] );
my @comp_vhdl3 = (@VHDL[48..63] );
my @comp_vhdl4 = (@VHDL[64..79] );
my @comp_vhdl5 = (@VHDL[80..95] );
my @comp_vhdl6 = (@VHDL[96..111] );
my @comp_vhdl7 = (@VHDL[112..127] );
my @comp_vhdl8 = (@VHDL[128..143] );
my @comp_vhdl9 = (@VHDL[144..159] );
my @comp_vhdl10 = (@VHDL[160..175] );
my @comp_vhdl11 = (@VHDL[176..191] );
my @comp_vhdl12 = (@VHDL[192..207] );
my @comp_vhdl13 = (@VHDL[208..223] );
my @comp_vhdl14 = (@VHDL[224..239] );
my @comp_vhdl15 = (@VHDL[240..255] );
###################################################################################
my @C_based = (
1.138591,1.183786,0.200000,0.200000,1.198204,0.200000,-0.613121,-0.200000,-0.200000,-0.200000,0.200000,-1.189029,-1.203447,1.133348,-0.200000,-0.719774,
-2.023139,0.200000,2.411942,0.200000,0.200000,0.200000,0.200000,-1.981950,-2.151612,1.691232,-0.200000,-2.370753,-2.192801,0.200000,-0.200000,-1.991014,
-2.008857,-0.200000,2.663373,-0.200000,-0.200000,0.200000,0.200000,1.974150,2.281423,-2.405243,0.200000,2.010572,-2.392522,-0.200000,0.200000,-2.390807,
-0.200000,1.527274,-0.734813,0.466545,0.200000,1.456119,-0.444938,-0.200000,0.200000,-0.287225,0.200000,-1.745994,-0.200000,0.200000,-0.200000,1.298406,
0.200000,0.200000,2.777764,2.304864,-2.881801,-0.200000,2.259995,2.155958,-0.200000,-0.200000,2.926670,-0.200000,1.652072,-0.200000,-0.200000,-2.173321,
-0.436979,-0.200000,-0.020078,1.338447,0.346164,-0.110893,0.067381,0.200000,0.566935,-0.845718,-1.240543,0.158196,0.200000,-0.021704,-0.200000,0.010798,
-1.322957,1.766136,0.295488,1.736133,0.630994,-0.200000,0.599127,0.263621,0.200000,0.200000,-2.425058,0.325491,0.200000,1.798003,0.844670,-0.330976,
0.200000,0.200000,1.606202,1.518020,2.007253,-0.200000,1.452384,1.099996,-0.200000,-0.200000,1.941617,0.200000,1.116969,0.200000,-0.200000,1.668842,
0.200000,0.200000,-0.200000,0.200000,0.200000,-0.200000,2.086547,0.200000,-2.706524,-0.200000,0.200000,0.200000,0.200000,-0.200000,2.094820,-0.788359,
-0.200000,-1.408251,-2.749608,0.200000,0.200000,1.921136,-0.200000,-2.815982,0.200000,-0.200000,0.200000,-0.200000,2.366698,-1.538226,-1.987510,-1.808497,
-0.200000,-0.200000,-0.708628,0.131886,0.835285,-0.200000,0.426959,0.342368,0.200000,-0.200000,-0.163459,-0.200000,-0.445128,-0.200000,0.200000,-0.605868,
-0.200000,0.200000,1.652488,0.200000,1.384796,0.200000,0.200000,-0.200000,-0.200000,1.867092,0.834221,1.407785,-0.200000,1.773533,1.501344,1.750544,
0.882552,0.006716,-0.112803,-0.847193,-0.389230,0.046970,-0.887447,-1.867069,-0.665406,-0.200000,-0.200000,-0.200000,0.011611,-0.200000,-0.013422,-0.486606,
-0.200000,1.013352,1.636039,-0.200000,-0.200000,1.458950,0.200000,1.057427,0.200000,-0.200000,0.200000,0.200000,0.823218,1.414111,1.058191,1.223977,
-0.200000,0.437802,-0.111540,-1.372958,-0.200000,-0.069171,-0.200000,-0.074538,0.177407,0.214409,-0.358118,0.542903,-0.200000,0.504278,0.466197,0.257091,
0.200000,-0.229100,1.100052,-1.265568,0.200000,-1.198302,1.748236,0.200000,-0.200000,1.363818,-0.200000,-1.846486,0.200000,0.200000,0.200000,0.378457,
);
my @comp0 = (@C_based[0..15] );
my @comp1 = (@C_based[16..31] );
my @comp2 = (@C_based[32..47] );
my @comp3 = (@C_based[48..63] );
my @comp4 = (@C_based[64..79] );
my @comp5 = (@C_based[80..95] );
my @comp6 = (@C_based[96..111] );
my @comp7 = (@C_based[112..127] );
my @comp8 = (@C_based[128..143] );
my @comp9 = (@C_based[144..159] );
my @comp10 = (@C_based[160..175] );
my @comp11 = (@C_based[176..191] );
my @comp12 = (@C_based[192..207] );
my @comp13 = (@C_based[208..223] );
my @comp14 = (@C_based[224..239] );
my @comp15 = (@C_based[240..255] );
#######################################################
my $format = "The VHDL items are: \n". ("%20f" x @comp_vhdl15 );
printf $format, @comp_vhdl15 ;
my $format = "The C items are: \n". ("%20f" x @comp15 );
printf $format, @comp15 ;
I have posted this message in perl.beginers,but didnt get any reply so
am posting here.
I have two set of data which I need to comapre.
The data set is actually a 16x16 Matrix.
Till now I am reading one row at a time by manually changing the
@comp_vhdl0, @comp_vhdl1.... till @comp_vhdl15 and so on.
I want:
1) this to be done using some loop (or some other better method) and
then write it to a file in 16x16 matrix form.
2) After that I want to compare the corresponding values and write the
results in a Marix form( say 1 if match occurs and 0 when mismatch). So
result looks like this
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
...........
...........
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Thanks
Ved
#########################################################################
use strict;
use warnings;
##############This is the data of C based#########
my @VHDL = qw{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-2.02344 0.200195 2.41211 0.200195 0.200195 0.200195 0.200195 -1.98242
-2.15234 1.69141 -0.200195 -2.37109 -2.19336 0.200195 -0.200195
-1.99121
-2.00879 -0.200195 2.66309 -0.200195 -0.200195 0.200195 0.200195
1.97363 2.28125 -2.4043 0.200195 2.00977 -2.3916 -0.200195 0.200195
-2.39063
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
0.200195 0.200195 2.77832 2.30469 -2.88184 -0.200195 2.25977 2.15625
-0.200195 -0.200195 2.92676 -0.200195 1.65234 -0.200195 -0.200195
-2.17383
0.200195 1.69824 0.200195 0.200195 0.200195 0.200195 0.200195 2.19727
0.200195 0.200195 0.200195 0.200195 1.19336 0.200195 2.10645 0.200195
-1.32227 1.76563 0.295898 1.73633 0.630859 -0.200195 0.598633 0.263672
0.200195 0.200195 -2.4248 0.325195 0.200195 1.79785 0.844727 -0.331055
0.200195 0.200195 1.60547 1.51758 2.00684 0.200195 1.45215 1.09961
0.200195 0.200195 1.94141 0.200195 1.11621 0.200195 0.200195 0.200195
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
-0.200195 -1.40918 -2.75 0.200195 0.200195 1.92188 -0.200195 -2.81641
0.200195 -0.200195 0.200195 -0.200195 2.36719 -1.53906 -1.98828
-1.80859
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
0.200195 0.200195 1.65234 0.200195 1.38477 0.200195 0.200195 0.200195
0.200195 1.86719 0.833984 1.40723 0.200195 1.77344 1.50098 1.75098
12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12
0.200195 1.0127 1.63477 0.200195 0.200195 1.45801 0.200195
1.05664 0.200195 0.200195 0.200195 0.200195 0.822266 1.41309 1.05762
1.22266
1.88379 -0.420898 0.200195 0.200195 2.06445 0.200195 2.02734 0.200195
0.200195 0.200195 0.200195 -0.326172 1.64258 -0.200195 0.200195
-0.498047
0.200195 0.134766 2.88281 2.35352 0.200195 -0.833984 2.23438 0.200195
0.200195 -1.36328 0.200195 -1.48242 0.200195 0.200195 0.200195
0.0957031
};
my @comp_vhdl0 = (@VHDL[0..15] );
my @comp_vhdl1 = (@VHDL[16..31] );
my @comp_vhdl2 = (@VHDL[32..47] );
my @comp_vhdl3 = (@VHDL[48..63] );
my @comp_vhdl4 = (@VHDL[64..79] );
my @comp_vhdl5 = (@VHDL[80..95] );
my @comp_vhdl6 = (@VHDL[96..111] );
my @comp_vhdl7 = (@VHDL[112..127] );
my @comp_vhdl8 = (@VHDL[128..143] );
my @comp_vhdl9 = (@VHDL[144..159] );
my @comp_vhdl10 = (@VHDL[160..175] );
my @comp_vhdl11 = (@VHDL[176..191] );
my @comp_vhdl12 = (@VHDL[192..207] );
my @comp_vhdl13 = (@VHDL[208..223] );
my @comp_vhdl14 = (@VHDL[224..239] );
my @comp_vhdl15 = (@VHDL[240..255] );
###################################################################################
my @C_based = (
1.138591,1.183786,0.200000,0.200000,1.198204,0.200000,-0.613121,-0.200000,-0.200000,-0.200000,0.200000,-1.189029,-1.203447,1.133348,-0.200000,-0.719774,
-2.023139,0.200000,2.411942,0.200000,0.200000,0.200000,0.200000,-1.981950,-2.151612,1.691232,-0.200000,-2.370753,-2.192801,0.200000,-0.200000,-1.991014,
-2.008857,-0.200000,2.663373,-0.200000,-0.200000,0.200000,0.200000,1.974150,2.281423,-2.405243,0.200000,2.010572,-2.392522,-0.200000,0.200000,-2.390807,
-0.200000,1.527274,-0.734813,0.466545,0.200000,1.456119,-0.444938,-0.200000,0.200000,-0.287225,0.200000,-1.745994,-0.200000,0.200000,-0.200000,1.298406,
0.200000,0.200000,2.777764,2.304864,-2.881801,-0.200000,2.259995,2.155958,-0.200000,-0.200000,2.926670,-0.200000,1.652072,-0.200000,-0.200000,-2.173321,
-0.436979,-0.200000,-0.020078,1.338447,0.346164,-0.110893,0.067381,0.200000,0.566935,-0.845718,-1.240543,0.158196,0.200000,-0.021704,-0.200000,0.010798,
-1.322957,1.766136,0.295488,1.736133,0.630994,-0.200000,0.599127,0.263621,0.200000,0.200000,-2.425058,0.325491,0.200000,1.798003,0.844670,-0.330976,
0.200000,0.200000,1.606202,1.518020,2.007253,-0.200000,1.452384,1.099996,-0.200000,-0.200000,1.941617,0.200000,1.116969,0.200000,-0.200000,1.668842,
0.200000,0.200000,-0.200000,0.200000,0.200000,-0.200000,2.086547,0.200000,-2.706524,-0.200000,0.200000,0.200000,0.200000,-0.200000,2.094820,-0.788359,
-0.200000,-1.408251,-2.749608,0.200000,0.200000,1.921136,-0.200000,-2.815982,0.200000,-0.200000,0.200000,-0.200000,2.366698,-1.538226,-1.987510,-1.808497,
-0.200000,-0.200000,-0.708628,0.131886,0.835285,-0.200000,0.426959,0.342368,0.200000,-0.200000,-0.163459,-0.200000,-0.445128,-0.200000,0.200000,-0.605868,
-0.200000,0.200000,1.652488,0.200000,1.384796,0.200000,0.200000,-0.200000,-0.200000,1.867092,0.834221,1.407785,-0.200000,1.773533,1.501344,1.750544,
0.882552,0.006716,-0.112803,-0.847193,-0.389230,0.046970,-0.887447,-1.867069,-0.665406,-0.200000,-0.200000,-0.200000,0.011611,-0.200000,-0.013422,-0.486606,
-0.200000,1.013352,1.636039,-0.200000,-0.200000,1.458950,0.200000,1.057427,0.200000,-0.200000,0.200000,0.200000,0.823218,1.414111,1.058191,1.223977,
-0.200000,0.437802,-0.111540,-1.372958,-0.200000,-0.069171,-0.200000,-0.074538,0.177407,0.214409,-0.358118,0.542903,-0.200000,0.504278,0.466197,0.257091,
0.200000,-0.229100,1.100052,-1.265568,0.200000,-1.198302,1.748236,0.200000,-0.200000,1.363818,-0.200000,-1.846486,0.200000,0.200000,0.200000,0.378457,
);
my @comp0 = (@C_based[0..15] );
my @comp1 = (@C_based[16..31] );
my @comp2 = (@C_based[32..47] );
my @comp3 = (@C_based[48..63] );
my @comp4 = (@C_based[64..79] );
my @comp5 = (@C_based[80..95] );
my @comp6 = (@C_based[96..111] );
my @comp7 = (@C_based[112..127] );
my @comp8 = (@C_based[128..143] );
my @comp9 = (@C_based[144..159] );
my @comp10 = (@C_based[160..175] );
my @comp11 = (@C_based[176..191] );
my @comp12 = (@C_based[192..207] );
my @comp13 = (@C_based[208..223] );
my @comp14 = (@C_based[224..239] );
my @comp15 = (@C_based[240..255] );
#######################################################
my $format = "The VHDL items are: \n". ("%20f" x @comp_vhdl15 );
printf $format, @comp_vhdl15 ;
my $format = "The C items are: \n". ("%20f" x @comp15 );
printf $format, @comp15 ;