/**
   * Adjoint equation L_{u} := (q\nabla{\psi},\nabla{\lambda}) + (u-z,\psi)
   *
   * @return
   */
  public SparseVector getResLu(Vector u, Vector lambda, Vector q) {
    // 4.Weak form
    WeakFormLaplace2D weakForm = new WeakFormLaplace2D();
    Function fq = new Vector2Function(q);
    weakForm.setParam(fq, FC.C0, null, null);
    // Right hand side(RHS): f(x) = - (u - z)
    Function z_u = z.S(new Vector2Function(u));
    plotFunction(mesh, z_u, String.format("z_u%02d.dat", this.iterNum));
    weakForm.setF(z_u);

    // 5.Assembly process
    AssemblerScalar assembler = new AssemblerScalar(mesh, weakForm);
    System.out.println("Begin Assemble...");
    assembler.assemble();
    SparseMatrix stiff = assembler.getStiffnessMatrix();
    SparseVector load = assembler.getLoadVector();
    // Boundary condition
    assembler.imposeDirichletCondition(FC.C0);
    System.out.println("Assemble done!");

    if (debug) {
      // 6.Solve linear system
      Solver solver = new Solver();
      Vector lmd_solve = solver.solveCGS(stiff, load);
      plotVector(mesh, lmd_solve, "lambda_solve.dat");
    }

    // Residual
    SparseVector res = new SparseVectorHashMap(lambda.getDim());
    stiff.mult(lambda, res);
    res.add(-1.0, load);
    plotVector(mesh, res, "Res_Lu.dat");

    return res;
  }
  public Vector solveAdjointEquation(Vector u, Vector q) {
    // 4.Weak form
    WeakFormLaplace2D weakForm = new WeakFormLaplace2D();
    Function fq = new Vector2Function(q);
    weakForm.setParam(fq, FC.C0, null, null);
    // Right hand side(RHS): f(x) = - (u - z)
    weakForm.setF(z.S(new Vector2Function(u)));

    // 5.Assembly process
    AssemblerScalar assembler = new AssemblerScalar(mesh, weakForm);
    System.out.println("Begin Assemble...");
    assembler.assemble();
    SparseMatrix stiff = assembler.getStiffnessMatrix();
    SparseVector load = assembler.getLoadVector();
    // Boundary condition
    assembler.imposeDirichletCondition(FC.C0);
    System.out.println("Assemble done!");

    // 6.Solve linear system
    Solver solver = new Solver();
    Vector lmd_solve = solver.solveCGS(stiff, load);

    return lmd_solve;
  }