Skip to main content
`Ctrl`+`K`

# PCSPAISetBlockSize

set the block size for the `PCSPAI` preconditioner

## Synopsis

    PetscErrorCode PCSPAISetBlockSize(PC pc, PetscInt block_size1)

## Input Parameters

- pc - the preconditioner

- block_size1 - block size (default 1)

## Notes

A block size of 1 treats A as a matrix of scalar elements. A block size of s > 1 treats A as a matrix of sxs blocks. A block size of 0 treats A as a matrix with variable sized blocks, which are determined by searching for dense square diagonal blocks in A. This can be very effective for finite-element matrices.

SPAI will convert A to block form, use a block version of the preconditioner algorithm, and then convert the result back to scalar form.

In many cases the a block-size parameter other than 1 can lead to very significant improvement in performance.

## Developer Note

This preconditioner could use the matrix block size as the default block size to use

## See Also

KSP: Linear System Solvers, `PCSPAI`, `PCSetType()`

## Level

intermediate

## Location

src/ksp/pc/impls/spai/ispai.c

## Implementations

PCSPAISetBlockSize_SPAI() in src/ksp/pc/impls/spai/impl/iispai.c

Index of all PC routines
Table of Contents for all manual pages
Index of all manual pages