|
Ublas : |
Subject: [ublas] Is coordinate_matrix element assignment/insertion broken in 1.42?
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2010-02-25 14:20:37
My apologies if I am missing something obvious, but it seems to me that
coordinate matrix is fundamentally broken. I am using Intel 11.1 on Windows
See the following test:
ublas::coordinate_matrix<double> matrix_mask(3, 3, 4);
matrix_mask(1,1) = 2.1;
matrix_mask(0,1) = 1.1;
matrix_mask(2,2) = 4.1;
matrix_mask(0,0) = 0.1;
std::cout << "Matrix1:\n" <<
matrix_mask << endl;
auto index1_data = matrix_mask.index1_data();
auto index2_data = matrix_mask.index2_data();
auto value_data = matrix_mask.value_data();
std::copy(index1_data.begin(), index1_data.end(),
std::ostream_iterator<double>(cout, "\n"));
std::copy(index2_data.begin(), index2_data.end(),
std::ostream_iterator<double>(cout, "\n"));
std::copy(value_data.begin(), value_data.end(),
std::ostream_iterator<double>(cout, "\n"));
cout << endl;
This yields:
Matrix1:
[3,3]((0.1,2.2,0),(0,0,0),(0,0,4.1))
......note the missing (1,1) value and maybe
that (1,1) and maybe has been added to (0,0)
And the following are the storage pointer data:
rows_indices:
0
0
2
3.45282e+009
columns_indices:
0
1
2
3.45282e+009
value_data:
0.1
2.2
4.1
-6.27744e+066
...The incorrect values happen when I use mat.insert_element(...) as well.
And things seem to look weird and inconsistent if I insert the elements in a
different order.
Thanks,
Jesse