Vec Interface
The purpose of the functions on this page is to provide a set of functions that are implemented efficiently for both AbstractVector and PetscVec. In some cases Base functions are extended with new methods for PetscVec, in other cases new functions are created and defined for both AbstractVector and PetscVec. Using these functions enables some amount of generic programming, particularly when an operation is applied to either the local portion of a parallel vector or when an operation is applied uniformly across all processors.
PETSc2.PetscVec — Method.Create a PetscVec, setting both the type and the format. Users can specify either the local or global dimensions
PETSc2.PetscVec — Method.Create a vector of a given size. Users can specify either the global dimension or the local dimension
PETSc2.PetscDestroy — Method.PetscDestroy for AbstractVector. No-op
PETSc2.PetscView — Function.Print non-Petsc vector to a given IO (a Julia IO, not a Petsc IO). Defaults to printing to STDOUT.
Inputs
b: AbstractVector
f: IO, defaults to STDOUT
PETSc2.assembly_begin — Method.PETSc2.assembly_end — Method.PETSc2.diagonal_shift! — Method.Add a given value to all elements of the vector
Inputs
A: AbstractVector
a: number to shift by
PETSc2.fill_zero! — Method.Fill a vector with zeros
Inputs
A: AbstractVector
PETSc2.get_values1! — Method.Method for AbstractVector
PETSc2.get_values1! — Method.Like set_values1! but for retrieving values. Note that Petsc only supports retrieving values from the local part of the vector
Inputs
vec: a vector, can be a julia vector or a Petsc vector.
Inputs/Outputs
idx: indices to retrieve
vals: array to put the values into
PETSc2.length_global — Method.Length of global vector
Inputs
A: AbstractVector
PETSc2.length_local — Method.Length of local part of vector
Inputs
A: AbstractVector
PETSc2.local_indices — Method.Returns a UnitRange containing the (1-based) global indices owned by this process.
Inputs
A: AbstractVector
Outputs
rng: UnitRange
PETSc2.set_values1! — Function.1-based indexing for both regular vectors and Petsc vector
Inputs
vals: values to add/insert into the vector, must be length(idx)
flag: INSERT_VALUES or ADD_VALUES
Inputs/Outputs
vec: the vector, can be a Petsc vector or a julia vector
idx: (global) indices to add/insert vals into
idx is listed as input/output because it may be modified during the function. It will be returned to its original values when the function exits. This is necessary to accomodate Petscs zero-based indexing interface
PETSc2.set_values1! — Method.Method for AbstractVector
PETSc2.size_global — Method.Size of global vector
Inputs
A: AbstractVector
PETSc2.size_local — Method.Size of local part of vector
Inputs
A: AbstractVector
Base.LinAlg.dot — Method.Base.dot
Dot product where the first vector is conjugated. This is is the reverse of VecDot, where the second vector is conjugated
Base.LinAlg.norm — Function.Base.norm
Base.LinAlg.scale! — Method.Base.scale!
Base.copy! — Method.Base.copy!
Base.copy — Method.Base.copy
Base.fill! — Method.Base.fill! for Petsc vectors
Base.maximum — Method.Base.maximum
Base.minimum — Method.Base.minimum
Base.sum — Method.Base.sum