Gridap.Algebra
Gridap.Algebra
— ModuleThe exported names are
AffineOperator
BackslashSolver
BlockArrayCOO
LUSolver
LinearSolver
NLSolver
NewtonRaphsonSolver
NonLinearOperator
NonLinearSolver
NumericalSetup
SparseMatrixCSR
SymSparseMatrixCSR
SymbolicSetup
add_entry!
allocate_coo_vectors
allocate_jacobian
allocate_residual
allocate_residual_and_jacobian
colvals
copy_entries!
create_coo_vectors
fill_entries!
finalize_coo!
get_matrix
get_vector
getindices
getptr
hascolmajororder
hasrowmajororder
is_entry_stored
jacobian
jacobian!
numerical_setup
numerical_setup!
push_coo!
residual
residual!
residual_and_jacobian
residual_and_jacobian!
solve
solve!
sparse_from_coo
sparsecsr
symbolic_setup
symsparsecsr
test_linear_solver
test_non_linear_operator
test_non_linear_solver
zero_initial_guess
Gridap.Algebra.AffineOperator
— Typestruct AffineOperator{A<:AbstractMatrix,B<:AbstractVector} <: NonLinearOperator
matrix::A
vector::B
end
Gridap.Algebra.BackslashSolver
— Typestruct BackslashSolver <: LinearSolver end
Wrapper of the backslash solver available in julia This is typically faster than LU for a single solve
Gridap.Algebra.BlockArrayCOO
— TypeGridap.Algebra.LUSolver
— Typestruct LUSolver <: LinearSolver end
Wrapper of the LU solver available in julia
Gridap.Algebra.LinearSolver
— Typeabstract type LinearSolver <: NonLinearSolver end
Gridap.Algebra.NLSolver
— Typestruct NLSolver <: NonLinearSolver
# private fields
end
The cache generated when using this solver has a field result
that hosts the result object generated by the underlying nlsolve
function. It corresponds to the most latest solve.
Gridap.Algebra.NLSolver
— MethodNLSolver(ls::LinearSolver;kwargs...)
NLSolver(;kwargs...)
Same kwargs as in nlsolve
. If ls
is provided, it is not possible to use the linsolve
kw-argument.
Gridap.Algebra.NewtonRaphsonSolver
— Typestruct NewtonRaphsonSolver <:NonLinearSolver
# Private fields
end
Vanilla Newton-Raphson method
Gridap.Algebra.NonLinearOperator
— Typeabstract type NonLinearOperator <: GridapType end
residual!(b::AbstractVector,op::NonLinearOperator,x::AbstractVector)
jacobian!(A::AbstractMatrix,op::NonLinearOperator,x::AbstractVector)
zero_initial_guess(::Type{T},op::NonLinearOperator) where T
allocate_residual(op::NonLinearOperator,x::AbstractVector)
allocate_jacobian(op::NonLinearOperator,x::AbstractVector)
Gridap.Algebra.NonLinearSolver
— Typeabstract type NonLinearSolver <: GridapType end
Gridap.Algebra.NumericalSetup
— Typeabstract type NumericalSetup <: GridapType end
Gridap.Algebra.SparseMatrixCSR
— Typestruct SparseMatrixCSR{Bi,Tv,Ti<:Integer} <: AbstractSparseMatrix{Tv,Ti}
Matrix type for storing Bi-based sparse matrices in the Compressed Sparse Row format. The standard way of constructing SparseMatrixCSR is through the sparsecsr
function.
Gridap.Algebra.SymSparseMatrixCSR
— Typestruct SymSparseMatrixCSR{T,Ti<:Integer} <: AbstractSparseMatrix{T,Ti}
Matrix type for storing symmetric sparse matrices in the Compressed Sparse Row format. The standard way of constructing SparseMatrixCSR is through the symsparsecsr
function.
Gridap.Algebra.SymbolicSetup
— Typeabstract type SymbolicSetup <: GridapType end
Gridap.Algebra.add_entry!
— Functionadd_entry!(A,v::Number,i::Integer,j::Integer,combine::Function=+)
Add an entry given its position and the operation to perform.
Gridap.Algebra.allocate_coo_vectors
— MethodGridap.Algebra.allocate_jacobian
— Methodallocate_jacobian(op::NonLinearOperator,x::AbstractVector)
Gridap.Algebra.allocate_residual
— Methodallocate_residual(op::NonLinearOperator,x::AbstractVector)
Gridap.Algebra.allocate_residual_and_jacobian
— Methodallocate_residual_and_jacobian(op::NonLinearOperator,x::AbstractVector)
Gridap.Algebra.colvals
— Methodcolvals(S::AbstractSparseMatrix)
Return columns indices or raises an error (Depending on the SparseMatrix type)
Gridap.Algebra.copy_entries!
— MethodGridap.Algebra.create_coo_vectors
— MethodGridap.Algebra.fill_entries!
— Methodfill_entry!(A,v::Number)
Fills an existing sparse matrix A with a given value v.
Gridap.Algebra.finalize_coo!
— Methodfinalize_coo!(::Type{T} where T,I,J,V,m,n)
Check and insert diagonal entries in COO vectors if needed.
Gridap.Algebra.get_matrix
— MethodGridap.Algebra.get_vector
— MethodGridap.Algebra.getindices
— Methodgetindices(S::AbstractSparseMatrix)
Return row indices.
Gridap.Algebra.getptr
— Methodgetptr(S::AbstractSparseMatrix)
Return columns pointer.
Gridap.Algebra.hascolmajororder
— Methodhascolmajororder(::Type{AbstractSparseMatrix})
Check if values are stored in col-major order. Return true.
Gridap.Algebra.hasrowmajororder
— Methodhasrowmajororder(::Type{AbstractSparseMatrix})
Check if values are stored in row-major order. Return false.
Gridap.Algebra.is_entry_stored
— Methodis_entry_stored(::Type{T} where T,i::Integer,j::Integer) -> Bool
Tells if the entry with coordinates [i,j]
will be stored when calling function push_coo!
Gridap.Algebra.jacobian!
— Methodjacobian!(A::AbstractMatrix,op::NonLinearOperator,x::AbstractVector)
Gridap.Algebra.jacobian
— Methodjacobian(op::NonLinearOperator,x::AbstractVector)
Gridap.Algebra.numerical_setup!
— Methodnumerical_setup!(::NumericalSetup,mat::AbstractMatrix)
Gridap.Algebra.numerical_setup
— Methodnumerical_setup(::SymbolicSetup,mat::AbstractMatrix) -> NumericalSetup
Gridap.Algebra.push_coo!
— Methodpush_coo!(::Type{T} where T, I,J,V,ik,jk,vk)
Inserts entries in COO vectors for further building a sparse matrix of type T.
Gridap.Algebra.residual!
— Methodresidual!(b::AbstractVector,op::NonLinearOperator,x::AbstractVector)
Gridap.Algebra.residual
— Methodresidual(op::NonLinearOperator,x::AbstractVector)
Gridap.Algebra.residual_and_jacobian!
— Methodresidual_and_jacobian!(
b::AbstractVector, A::AbstractMatrix,
op::NonLinearOperator, x::AbstractVector)
Gridap.Algebra.residual_and_jacobian
— Methodresidual_and_jacobian(op::NonLinearOperator,x::AbstractVector)
Gridap.Algebra.solve!
— Methodsolve!(
x::AbstractVector,
ls::LinearSolver,
op::AffineOperator,
cache,
newmatrix::Bool)
Gridap.Algebra.solve!
— Methodsolve!(x::AbstractVector,nls::NonLinearSolver,op::NonLinearOperator,cache)
Solve using the cache object from a previous solve.
Gridap.Algebra.solve!
— Methodsolve!(x::AbstractVector,nls::NonLinearSolver,op::NonLinearOperator)
Usage:
cache = solve!(x,nls,op)
The returned cache
object can be used in subsequent solves:
solve!(x,nls,op,cache)
Gridap.Algebra.solve!
— Methodsolve!(x::AbstractVector,::NumericalSetup,b::AbstractVector)
Gridap.Algebra.solve
— Methodsolve(ls::LinearSolver,A::AbstractMatrix,b::AbstractVector)
Gridap.Algebra.solve
— Methodsolve(nls::NonLinearSolver,op::NonLinearOperator)
Creates and uses a zero initial guess.
Gridap.Algebra.sparse_from_coo
— Methodsparse_from_coo(::Type{T} where T,args...)
args...
are the same as for function sparse
Gridap.Algebra.sparsecsr
— Methodsparsecsr(args...)
Same args than sparse
.
Gridap.Algebra.symbolic_setup
— Methodsymbolic_setup(::LinearSolver,mat::AbstractMatrix) -> SymbolicSetup
Gridap.Algebra.symsparsecsr
— Methodsymsparsecsr(args...)
Same args than sparse
.
Gridap.Algebra.test_linear_solver
— Methodtest_linear_solver(
ls::LinearSolver,
A::AbstractMatrix,
b::AbstractVector,
x::AbstractVector)
Gridap.Algebra.test_non_linear_operator
— Functiontest_non_linear_operator(
op::NonLinearOperator,
x::AbstractVector,
b::AbstractVector,
pred=isapprox;
jac=nothing)
Gridap.Algebra.test_non_linear_solver
— Functiontest_non_linear_solver(
nls::NonLinearSolver,
op::NonLinearOperator,
x0::AbstractVector,
x::AbstractVector,
pred::Function=isapprox)
Gridap.Algebra.zero_initial_guess
— Methodzero_initial_guess(op::NonLinearOperator)
Gridap.Algebra.zero_initial_guess
— Methodzero_initial_guess(::Type{T},op::NonLinearOperator) where T
Base.convert
— Methodconvert(::Type{AbstractSparseMatrix}, x::AbstractSparseMatrix)
Convert x to a value of the first type given.
Base.count
— Methodcount(pred, S::AbstractSparseMatrix) -> Integer
Count the number of elements in nonzeros(S) for which predicate pred returns true.
SparseArrays.findnz
— Methodfindnz(S::AbstractSparseMatrix)
Return a tuple (I, J, V) where I and J are the row and column indices of the stored ("structurally non-zero") values in sparse matrix A, and V is a vector of the values.
SparseArrays.nnz
— Methodnnz(S::AbstractSparseMatrix)
Returns the number of stored (filled) elements in a sparse array.
SparseArrays.nonzeros
— Methodnonzeros(S::AbstractSparseMatrix)
Return a vector of the structural nonzero values in sparse array S. This includes zeros that are explicitly stored in the sparse array. The returned vector points directly to the internal nonzero storage of S, and any modifications to the returned vector will mutate S as well.
SparseArrays.nzrange
— Methodnzrange(S::AbstractSparseMatrix, index::Integer) where {Bi}
Return the range of indices to the structural nonzero values of a sparse matrix index (Row or column depending on the compression type).
SparseArrays.rowvals
— Methodrowvals(S::AbstractSparseMatrix)
Return row indices or raises an error (Depending on the SparseMatrix type)