Skylark (Sketching Library)
0.1
|
00001 #include <iostream> 00002 #include "boost/program_options.hpp" 00003 00004 #include "../../config.h" 00005 #include "../../base/svd.hpp" 00006 #include "test_utils.hpp" 00007 00008 00009 namespace po = boost::program_options; 00010 00011 int test_main(int argc, char* argv[]) { 00012 elem::Initialize(argc, argv); 00013 00014 int height; 00015 int width; 00016 00017 // Declare the supported options. 00018 po::options_description desc("Options"); 00019 desc.add_options() 00020 ("help", "help message") 00021 ("height", po::value<int>(&height)->default_value(10), 00022 "height of input matrix") 00023 ("width", po::value<int>(&width)->default_value(6), 00024 "width of input matrix") 00025 ; 00026 00027 po::variables_map vm; 00028 po::store(po::parse_command_line(argc, argv, desc), vm); 00029 po::notify(vm); 00030 00031 if (vm.count("help")) { 00032 std::cout << desc << "\n"; 00033 return 1; 00034 } 00035 00036 if (vm.count("height")) { 00037 std::cout << "Height of input matrix was set to " 00038 << vm["height"].as<int>() << ".\n"; 00039 } 00040 00041 if (vm.count("width")) { 00042 std::cout << "Width of input matrix was set to " 00043 << vm["width"].as<int>() << ".\n"; 00044 } 00045 00046 // Declare distributed matrices 00047 elem::DistMatrix<double> A; 00048 elem::DistMatrix<double, elem::VC, elem::STAR> A_VC_STAR; 00049 elem::DistMatrix<double, elem::STAR, elem::VC> A_STAR_VC; 00050 elem::DistMatrix<double, elem::VR, elem::STAR> A_VR_STAR; 00051 elem::DistMatrix<double, elem::STAR, elem::VR> A_STAR_VR; 00052 00053 elem::Uniform(A, height, width); 00054 A_VC_STAR = A; 00055 A_VR_STAR = A; 00056 Transpose(A, A_STAR_VC); 00057 Transpose(A, A_STAR_VR); 00058 00059 // Call tester for each case 00060 check(A); 00061 check(A_VC_STAR); 00062 check(A_STAR_VC); 00063 check(A_VR_STAR); 00064 check(A_STAR_VR); 00065 00066 elem::Finalize(); 00067 return 0; 00068 }