Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable symbolic Hessian-vector product #77

Closed
rzyu45 opened this issue May 22, 2024 · 0 comments · Fixed by #87
Closed

Enable symbolic Hessian-vector product #77

rzyu45 opened this issue May 22, 2024 · 0 comments · Fixed by #87
Assignees
Labels
enhancement New feature or request

Comments

@rzyu45
Copy link
Member

rzyu45 commented May 22, 2024

In some solvers, we need the derivative

$$\frac{\partial }{\partial y}\left(J(y)z\right)=H(y)\otimes z$$

where the Hessian tensor

$$H(y)=\left(\frac{\partial \nabla g_i(y)^\mathrm{T}}{y_j}\right)_{ij}.$$

We can avoid calculating the Hessian tensor by first multiplying out the Jac blocks so that we have

$$J(y)z= \begin{bmatrix} \sum_iJ_{1i}z_i\\\ \sum_iJ_{2i}z_i\\\ \cdots\\\ \sum_iJ_{ni}z_i \end{bmatrix}$$

Then we can obtain $\frac{\partial }{\partial y}\left(J(y)z\right)$ by deriving derivatives with respect to the right hand side.

With the new jac block class added in #76, the jac-vector product shall be divided into three categories:

  1. if jac block is a matrix, then we have $J_{ij}$@ $z_i$;
  2. if jac block is a diagonal matrix, then we have $\mathrm{diag}(J_{ij})$* $z_j$, where $\mathrm{diag}(J_{ij})$ is the vector of the diagonal entries of $J_{ij}$.
  3. if jac block is a column vector, the we have $J_{ij}$* $z_j$.
@rzyu45 rzyu45 added the enhancement New feature or request label May 22, 2024
@rzyu45 rzyu45 self-assigned this May 22, 2024
@rzyu45 rzyu45 linked a pull request Aug 5, 2024 that will close this issue
rzyu45 added a commit to rzyu45/Solverz-dev that referenced this issue Aug 6, 2024
@rzyu54 rzyu54 closed this as completed in 862ac52 Aug 6, 2024
rzyu54 added a commit that referenced this issue Aug 7, 2024
* Enable sicnm and Hessian-vector product (#91)

* To deploy docs only in the default repo

* To deploy docs only in the default repo

* feat: add inline hvp

* feat: fix hvp initializer

* test: add the hvp test.

* feat: add the module printer of hvp

* test: add hvp module generator tests

* fix: to sort jac blocks in lecico order

* fix: simplify the `dae.M` property

Deprecate expr in variable slice

* feat: add the sicnm solver

* fix: resolve typos in sicnm

* fix: resolve typos in scinm

* fix: resolve sicnm typos

* ENH: try spsolve_triangular() in scipy 1.14.0

* feat: add octave code printers

'Mat_Mul', 'Diag' and `Sign`

* feat: add heaviside func

* feat: add event detection in scinm

* feat: add `ln`

* EHN: improve stats of sicnm and nr

* EHN: improve `lm.stats`

* EHN: improve `cnr.stats`

* feat: add __repr__ of `sol` class

* Update doc-deploy.yml

* To deploy docs only in the default repo

* Update doc-deploy.yml

* Update doc-deploy.yml

* update workflow trigger

* Update doc-deploy.yml

* fix: prepare Solverz for numpy 2.0

* fix: resolve issues arose from scipy compabaility

* remove matplotlib requirement

* fix: deprecate explicit call of matplotlib

* Revert "remove matplotlib requirement"

This reverts commit 00bdfd7.

* fix: update fdaesolver

* fix: resolve #79

* doc: add docstring of `sicnm()`

Resolves #86

* docs: add `HVP` in gettingstarted.md

Resolve #77.

* docs: fix typos

---------

Co-authored-by: Ruizhi Yu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant