Matrix A = createMatrix(comm);
populateMatrix(A);
DenseVector bl = new DenseVector(localLength[rank]);
DistVector b_dist = new DistVector(x.size(), comm, bl);
DistVector x_dist = b_dist.copy();
int[] n = getRowOwnerships(A);
for (int i = n[rank]; i < n[rank + 1]; ++i)
b_dist.set(i, getVectorEntry(i));
IterativeSolver solver = createSolver(b_dist);
IterationMonitor monitor = new DefaultIterationMonitor(1000, 1e-50,
1e-12, 1e+5);
monitor.setNormType(norm);
solver.setIterationMonitor(monitor);
try {
solver.solve(A, b_dist, x_dist);
} catch (IterativeSolverNotConvergedException e) {
// This will just lead to an error later on
}
for (int i = n[rank]; i < n[rank + 1]; ++i)
output[i] = x_dist.get(i);
}