public SparseBlockMatrix getSearchDirectionMatrix(Vector uk, Vector qk) {
    SparseBlockMatrix BM = new SparseBlockMatrix(3, 3);
    SparseMatrix M = this.getM();
    SparseMatrix A = this.getA(qk);
    SparseMatrix AT = A.copy().trans();
    SparseMatrix C = this.getC(uk);
    SparseMatrix CT = C.copy().trans();
    SparseMatrix R = this.getBR();

    SparseMatrix BM13 = new SparseMatrixRowMajor(M.getRowDim(), R.getColDim());
    SparseMatrix BM22 = new SparseMatrixRowMajor(A.getRowDim(), A.getColDim());
    SparseMatrix BM31 = new SparseMatrixRowMajor(R.getRowDim(), M.getColDim());

    BM.setBlock(1, 1, M);
    BM.setBlock(1, 2, AT);
    BM.setBlock(1, 3, BM13);

    BM.setBlock(2, 1, A);
    BM.setBlock(2, 2, BM22);
    BM.setBlock(2, 3, C);

    BM.setBlock(3, 1, BM31);
    BM.setBlock(3, 2, CT);
    BM.setBlock(3, 3, R);

    return BM;
  }