复杂矩阵微分方程的 odeintw 包背后的理论是什么?

What is the theory behind the odeintw package for complex matrix differential equations?

在下面的大多数复杂矩阵微分方程的答案中,都建议使用 odeintw 包。

我想知道在 odeintw 的代码中进行的操作背后的理论。 比如为什么必须构建带状雅可比矩阵,函数 _complex_to_real_jac、_transform_banded_jac 等函数背后的想法

答案在评论里

A complex matrix space is a real vector space, so a complex matrix can be represented by an array of real numbers preserving this linear structure. All odeintw has to do is to wrap odeint or better the function given to it with this basis transformation, forward and backward.

Now if you want to speed up the computation by providing the Jacobian, it also needs to be translated into the real form. In the method of lines as example you get banded Jacobians, the translation has to keep that property for efficiency reasons.

M-o-L is a common method in solving PDE of the heat or wave equation type. Essentially, it discretizes the space dimension(s) while leaving the time dimension continuous, resulting in a large-dimensional ODE system in time direction. The resulting Jacobians only are non-zero at nearest-neighbor interactions, thus very sparse, and have a banded structure if the discretization is via a regular grid.

The nontrivial part arises when you want to specify the Jacobian via the Dfun argument. The complex Jacobian requires that the right-hand side of the equation be complex differentiable (i.e. holomorphic). For example, the function f(z) = z* (the complex conjugate) is not complex differentiable, so you can't specify a complex Jacobian for the equation dz/dt = z*. You would have to rewrite it as a system of real equations. (This example is in the docstring of odeintw.)

If the right-hand side is complex differentiable, then you can give a complex Jacobian via Dfun.