// ConsoleApplication1.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include #include #include #include //#include //using namespace arma; using namespace std; using namespace Eigen; int main(int argc, char* argv[]) { cout << cos(30) << endl; cout << cos(45) << endl; cout << cos(60) << endl; cout << pow(1, 3) << endl; cout << pow(2, 3) << endl; Eigen::MatrixXd a = Eigen::MatrixXd::Ones(6, 3); // 随机初始化矩阵 Eigen::MatrixXd b = Eigen::MatrixXd::Ones(6,3).array()*2; Eigen::Vector3d p(3, 1, 2); double start = clock(); Eigen::MatrixXd c = (a.array()/b.array());// .rowwise().sum(); double endd = clock(); double thisTime = (double)(endd - start) / CLOCKS_PER_SEC; cout << thisTime << endl; cout << c.rows() << "," << c.cols() << endl; cout << c(Eigen::all, { 0,1}) << endl; system("PAUSE"); return 0; } // 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单 // 调试程序: F5 或调试 >“开始调试”菜单 // 入门使用技巧: // 1. 使用解决方案资源管理器窗口添加/管理文件 // 2. 使用团队资源管理器窗口连接到源代码管理 // 3. 使用输出窗口查看生成输出和其他消息 // 4. 使用错误列表窗口查看错误 // 5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目 // 6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件