Skip to content

briochemc/HyperDualMatrixTools.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HyperDualMatrixTools.jl

DOI Build Status Coverage Status License: MIT

This package provides an overloaded factorize and \ that work with hyperdual-valued arrays.

It uses the hyper dual type defined by the HyperDualNumbers.jl package. The idea is that for a hyperdual-valued matrix

,

its inverse is given by

.

Therefore, only the inverse of is required to evaluate the inverse of . This package makes available a HyperDualFactors type which containts the factors of and the non-real parts of , and overloads factorize to create an instance of HyperDualFactors, which can then be called with \ to efficiently solve hyperdual-valued linear systems of the type .

This package should be useful for autodifferentiation of functions that use \. Note that this package is the equivalent of the DualMatrixTools.jl package, but for hyperdual numbers instead of dual numbers.

Usage

  • Create your hyperdual-valued matrix M:

    julia> M = A + ε₁ * B + ε₂ * C + ε₁ε₂ * D
  • Factorize M:

    julia> Mf = factorize(M)
  • Apply \ to solve systems of the type M * x = b

    julia> x = Mf \ b

Advanced usage

In the context of iterative processes with multiple factorizations and forward and back substitutions, you may want to propagate hyperdual-valued numbers while leveraging (potentially) the fact the real part of the matrices to be factorized remains the same throughout. This package provides an in-place factorize, with a flag to update (or not) the factors. Usage is straightforward. By default, factorize does not update the factors

julia> factorize(Mf, M) # only Mf.B, Mf.C, and Mf.D is updated

If you want to update the real-valued factors too, use

julia> factorize(Mf, M, update_factors=true) # The factors in Mf.Af are also updated

Citation

If you use this package, please cite it! You can export the citation by first clicking on the DOI badge at the top, which links to the Zenodo record of the package, and then clicking on the citation format you want in the "Export" box at the bottom of the page.

About

A little Julia module to allow factorization and backslash to work with hyperdual-valued arrays and sparse arrays.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages