示例#1
0
int main(int argc, char** argv) {
  cout << "> Creating sm <" << endl;
  SparseMatrix<int> sm;
  cin >> sm;
  cout << sm << endl;
  sm.Output(cout);

  SparseMatrix<int> tsm;
  sm.Transpose(tsm);
  cout << tsm << endl;
  tsm.Output(cout);

  //-------------------------------------------------------
  cout << "> Creating sm2 <" << endl;
  SparseMatrix<int> sm2;
  cin >> sm2;
  cout << sm2 << endl;
  sm2.Output(cout);

  SparseMatrix<int> sm3;
  sm.Add(sm2, sm3);
  cout << sm3 << endl;
  sm3.Output(cout);

  return 0;
}
示例#2
0
文件: ex10p.cpp 项目: YPCC/mfem
Operator &BackwardEulerOperator::GetGradient(const Vector &k) const
{
   delete Jacobian;
   SparseMatrix *localJ = Add(1.0, M->SpMat(), dt, S->SpMat());
   add(*v, dt, k, w);
   add(*x, dt, w, z);
   localJ->Add(dt*dt, H->GetLocalGradient(z));
   Jacobian = M->ParallelAssemble(localJ);
   delete localJ;
   return *Jacobian;
}