:orphan: # MatPartitioningSetPartitionWeights Sets the weights for each partition. ## Synopsis ``` #include "petscmat.h" PetscErrorCode MatPartitioningSetPartitionWeights(MatPartitioning part, const PetscReal weights[]) ``` Logically Collective ## Input Parameters - ***part -*** the partitioning context - ***weights -*** An array of size nparts that is used to specify the fraction of vertex weight that should be distributed to each sub-domain for the balance constraint. If all of the sub-domains are to be of the same size, then each of the nparts elements should be set to a value of 1/nparts. Note that the sum of all of the weights should be one. ## Note The array weights is freed by PETSc so the user should not free the array. In C/C++ the array must be obtained with a call to `PetscMalloc()`, not malloc(). ## See Also [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningSetVertexWeights()`, `MatPartitioningCreate()`, `MatPartitioningSetType()`, `MatPartitioningSetVertexWeights()` ## Level beginner ## Location src/mat/partition/partition.c --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/partition/partition.c) [Index of all MatOrderings routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)