Function CreateW

Function Documentation

PetscErrorCode CreateW(MPI_Comm COMM, PetscScalar *local_weights, PetscInt local_nrow, PetscInt local_row0, PetscInt global_nrow, Mat *W)

Creates a diagonal matrix with the weights as the entries.

Parameters
  • COMM: The MPI communicator, PETSC_COMM_SELF.A
  • *local_weights: Passed into this function to get built into W.
  • local_nrow: Number of rows for this rank
  • local_row0: The starting row for this rank.
  • global_nrow: The total length of the weights vector (N). W is NxN.
  • *W: The matrix created by this function.