263
263
assert(mxsize.first == 6);
264
264
assert(mxsize.second == 4);
266
mx.set_boolean(5, 5, true);
267
268
mxsize = mx.size();
268
269
assert(mxsize.first == 6);
269
270
assert(mxsize.second == 6);
272
mx.set_numeric(2, 2, 4.2);
273
mx.set_numeric(2, 3, 3.2);
274
mx.set_numeric(2, 4, 2.2);
275
mx.set_numeric(2, 5, 1.2);
272
277
mxsize = mx.size();
273
278
assert(mxsize.first == 3);
698
template<typename _FilledStoreType>
693
699
void mtm_test_iterator_access_filled(size_t rows, size_t cols)
695
701
StackPrinter __stack_printer__("::mtm_test_iterator_access_filled");
696
typedef storage_filled<mx_type> store_type;
702
typedef _FilledStoreType store_type;
698
704
store_type store(rows, cols, matrix_init_element_zero);
700
706
cout << "rows: " << rows << " cols: " << cols << endl;
701
store_type::const_itr_access* itr_access = store.get_const_itr_access();
707
typename store_type::const_itr_access* itr_access = store.get_const_itr_access();
702
708
traverse_itr_access<store_type>(*itr_access);
703
709
delete itr_access;
839
845
assert(itr == itr_end); // not found.
849
* Measure the performance of object instantiation for filled storage.
851
void mtm_perf_test_filled_storage_creation()
853
StackPrinter __stack_printer__("::mtm_perf_test_filled_storage_creation");
854
cout << "measuring performance on matrix object creation." << endl;
855
size_t rowsize = 1000;
856
size_t obj_count = 30000;
857
cout << "row size: " << rowsize << " object count: " << obj_count << endl;
858
for (size_t colsize = 1; colsize <= 3; ++colsize)
860
StackPrinter __stack_printer2__("::mtm_perf_test_filled_storage_creation::group");
861
cout << "column size: " << colsize << endl;
862
for (size_t i = 0; i < obj_count; ++i)
863
mx_type mx(rowsize, colsize, matrix_density_filled_zero);
867
void mtm_perf_test_filled_storage_set_numeric()
869
StackPrinter __stack_printer__("::mtm_perf_test_filled_storage_set_numeric");
870
cout << "measuring performance on matrix object creation and populating it with numeric data." << endl;
871
size_t rowsize = 1000;
872
size_t obj_count = 30000;
873
cout << "row size: " << rowsize << " object count: " << obj_count << endl;
874
for (size_t colsize = 1; colsize <= 3; ++colsize)
876
StackPrinter __stack_printer2__("::mtm_perf_test_filled_storage_set_numeric::group");
877
cout << "column size: " << colsize << endl;
878
for (size_t i = 0; i < obj_count; ++i)
880
mx_type mx(rowsize, colsize, matrix_density_filled_zero);
881
for (size_t row = 0; row < rowsize; ++row)
883
for (size_t col = 0; col < colsize; ++col)
884
mx.set_numeric(row, col, 1.0);
842
890
int main(int argc, char** argv)
862
910
run_tests_on_all_density_types(mtm_test_flag_storage);
864
mtm_test_iterator_access_filled(1, 1);
865
mtm_test_iterator_access_filled(3, 1);
866
mtm_test_iterator_access_filled(1, 3);
867
mtm_test_iterator_access_filled(3, 3);
868
mtm_test_iterator_access_filled(0, 0);
912
mtm_test_iterator_access_filled<storage_filled_nested_array<mx_type> >(1, 1);
913
mtm_test_iterator_access_filled<storage_filled_nested_array<mx_type> >(3, 1);
914
mtm_test_iterator_access_filled<storage_filled_nested_array<mx_type> >(1, 3);
915
mtm_test_iterator_access_filled<storage_filled_nested_array<mx_type> >(3, 3);
916
mtm_test_iterator_access_filled<storage_filled_nested_array<mx_type> >(0, 0);
918
mtm_test_iterator_access_filled<storage_filled_linear<mx_type> >(1, 1);
919
mtm_test_iterator_access_filled<storage_filled_linear<mx_type> >(3, 1);
920
mtm_test_iterator_access_filled<storage_filled_linear<mx_type> >(1, 3);
921
mtm_test_iterator_access_filled<storage_filled_linear<mx_type> >(3, 3);
922
mtm_test_iterator_access_filled<storage_filled_linear<mx_type> >(0, 0);
924
mtm_test_iterator_access_filled<storage_filled_linear_zero<mx_type> >(1, 1);
925
mtm_test_iterator_access_filled<storage_filled_linear_zero<mx_type> >(3, 1);
926
mtm_test_iterator_access_filled<storage_filled_linear_zero<mx_type> >(1, 3);
927
mtm_test_iterator_access_filled<storage_filled_linear_zero<mx_type> >(3, 3);
928
mtm_test_iterator_access_filled<storage_filled_linear_zero<mx_type> >(0, 0);
870
930
mtm_test_iterator_access_sparse();
872
932
mtm_test_const_iterator();
937
mtm_perf_test_filled_storage_creation();
938
mtm_perf_test_filled_storage_set_numeric();
874
941
cout << "Test finished successfully!" << endl;
875
942
return EXIT_SUCCESS;