Reputation: 2096
Here is the code
for (j = 0; j < n_sign; j++)
{
line = new List<double>();
for (i = 0; i < n_vec; i++)
{
if (data_gap[i][j] != gap)
line.Add(data_gap[i][j]);
else
{
grad.Add(0);
List<int> point = new List<int>();
point.Add(i);
point.Add(j);
gaps.Add(point);
}
}
List<double> mm = new List<double>();
mm.Add(line.Min());
mm.Add(line.Max());
minmax.Add(mm);
for (i = 0; i < n_vec; i++)
{
if (data_gap[i][j] == gap)
data[i][j] = line[rand.Next(line.Count)];
}
}
I can't understand, why after this function the values of data_gap change to the values of data! data_gap has been created this way
data_gap = new List<List<double>>(data);
so it seems to be a unique object...
Upvotes: 0
Views: 128
Reputation: 888185
data_gap
contains the same inner lists as data
.
You need to copy each inner list as well.
Upvotes: 8