| #include "stdafx.h" #include "orsciJWVCL.h"#include "orsciVM.h"
 using namespace orsci;
 using namespace orsci::vmt;
 
 
 int main(){
 cout << "orsci: view()、submat()与矩阵行列的移动、交换、复制和赋值... http://www.orsci.cn" << endl;
 cout << endl;
  mdouble x, y;x.Resize(5, 7);
 x.fill(0, 0, 1);
 cout << "x = " << endl;
 cout << x << endl;
 y.Resize(5, 7);
 y.fill(0, 100, 1);
 cout << "y = " << endl;
 cout << y << endl;
  cout << "使用view()获取矩阵视图.x.view(\"1, 2\", \"0:3\")=" << endl;cout << x.view("1, 2", "0:3") << endl;
  cout << "使用submat()获取子矩阵.x.submat(dyn(2, 3, 2, 1), \"0:3\")=" << endl;cout << x.submat(dyn(2, 3, 2, 1), "0:3") << endl;
  cout << "矩阵行的移动.z = x; z.row_move(3, 0) = " << endl;mdouble z = x;
 z.row_move(3, 0);
 cout << z << endl;
  cout << "矩阵行的交换.z = y; z.col_swap(1, 4) = " << endl;z = y;
 z.col_swap(1, 4);
 cout << z << endl;
  cout << "矩阵的复制: z.row_copy(1, 0) = " << endl;z.row_copy(1, 0);
 cout << z << endl;
  cout << "在两个矩阵中交换:z.swap(2, x, 2) = " << endl;z.row_swap(2, x, 2);
 cout << "now z = " << endl;
 cout << z << endl;
 cout << "now x = " << endl;
 cout << x << endl;
  rowdouble rr;z.row_assignTo(3, rr);
 cout << "z.row_assignTo(3, rr); rr = " << endl;
 cout << rr << endl;
  cout << endl;cout << "说明:row_copy、col_copy、row_swap、col_swap、row_assign、col_assign、row_move、col_move等函数常用。有些函数还可实现两个矩阵中交换、复制等。" << endl;
  cout << endl;cout << "press any key to stop..." << endl;
 char pp;
 cin >> pp;
 return 0;
 }
 |