I understand that when you try to change the shape of 2D vector objects, but I have a strange problem here Have to face. Code section is attached below:
for (int iter = 0; iter & lt; j; iter ++) {cout & lt; & Lt; "Etter" & lt; & Lt; IARAR & lt; & Lt; Endl; Rows_n = rows_n / 2; Cols_n = cols_n / 2; Cout & lt; & Lt; "Sig2" & lt; & Lt; Sig2.size () & lt; & Lt; Endl; Of vector & lt; Vector & lt; Double & gt; & Gt; Ca (rows_n, vector & lt; double & gt; (cols_n)); Of vector & lt; Vector & lt; Double & gt; & Gt; Ch (rows_n, vector & lt; double & gt; (cols_n)); Of vector & lt; Vector & lt; Double & gt; & Gt; CV (rows_n, vector & lt; double & gt; (cols_n)); Of vector & lt; Vector & lt; Double & gt; & Gt; Cd (rows_n, vector & lt; double & gt; (cols_n)); Cout & lt; & Lt; "Ca" & lt; & Lt; CA.size () & lt; & Lt; Endl; ANALYSIS_FB (nm, sig2, ca, ch, cv, cd); Sig2.clear (); Of vector & lt; Vector & lt; Double & gt; & Gt; Sig2 (rows_n, vector & lt; double & gt; (cols_n, 0.0)); Sig2 = CA; {Dwt_output [i] [j] = ca [i] for (; i & lt; i = 0 int rows_n; i ++) {(int j = 0; j & lt; cols_n; j ++) [Ja]; }} For (int i = 0; i & LT; rows_n; i ++) {for (Int J = cols_n; j & LT; cols_n * 2; J ++) {dwt_output [i] [j] = CH [i] [j - cols_n]; }} {Dwt_output [i] [j] =} for {{int j = 0; j & lt; cols_n; j ++} for {int i = rows_n; i & lt; rows_n * 2; i ++} CV [i - rows_n] [j]; }} For (int i = rows_n; I & LT; rows_n * 2; i ++) to {(Int J = cols_n; j & LT; cols_n * 2; J ++) {dwt_output [i] [j ] = Cd [i-rows_n] [j - cols_en]; }} For (int i = 0; i & lt; rows_n; i ++) {for (int j = 0; j & lt; cols_n; j ++) {cout & lt; & Lt; Sig2 [i] [j] & lt; & Lt; ""; } Cout & lt; & Lt; Endl; } CA.clear (); CH.clear (); CV.clear (); CD.clear (); Cout & lt; & Lt; "Sig2e" & lt; & Lt; Sig2.size () & lt; & Lt; Endl; } As you can see this is part of a huge code, but my problem is that the 2D vector disappears after the first iteration of the loop. I am also adding output to the console.
iter 0
sig2 16
CA8
4.49991 10,4998 16,497 22,4996 284995 34.4993 40.4992 46.4991 8.99983 20.9996 32.9994 44.9991 56.9989 68.9987 80.9984 92.9982 13.4997 31.4994 49.4991 67.4987 85.4984 103.498 121.498 139.497 17.9997 41.9992 65.9987 89.9983 113.998 137.997 161.997 185.996 16.4997 38.4993 60.4988 82.4984 104.498 126.498 148.497 170.497 14.9997 34.9993 54.9989 74.9986 94.9982 114.998 134.997 154,997 16,4997 38,4993 60,4988 82,4984 104,498 126,498 148,497 170,497 13,4997 31,4994 49,4991 67,4987 85,4984 103,498 121,498 139,497
sig2e 8 (my notes - the first repetition Rows end with a number of sig2 = 8)
ITER 1 (My note - second change begins)
sig2 0 (My note-sig2's punk As you can see, CG2 takes the value of CA in the first run and reaching the end of the loop. The first size is 8 x 8. For the next recurrence (1 IAR value), the 2D vector becomes an empty vector. To be fair, I am clearing the vector in the first repetition, after which it is defined as a small size, but I still find behavior a little strange. Is there a way around this? Function takes the value of ANALYSIS_FB sig2 and CA, CH, etc. Prices sig2 CA and so on (which dimension the original sig2 in both directions gives is set to half)
Edit :. Thank you for the people to indicate that sig2 was a global as well as local variables. I had hit the wall and this helped me solve the problem. I ended all "clear" tasks and added any additional local variables I'm using sig2 as the only global variable and the program is working to get rid of
You have 2 a global sig2 sig2.clear (); /// You make local sig 2! Of vector & lt; Vector & lt; Double & gt; & Gt; Sig2 (rows_n, vector & lt; double & gt; (cols_n, 0.0));
Comments
Post a Comment