romtools.vector_space.utils.svd_method_of_snapshots#
Classes
|
Parallel implementation of the method of snapshots for basis construction. |
Similar to SvdMethodOfSnapshots, but call only returns two arguments to be compatible with QR routine. |
- class romtools.vector_space.utils.svd_method_of_snapshots.SvdMethodOfSnapshots(comm)[source]#
Bases:
objectParallel implementation of the method of snapshots for basis construction.
Sample usage:
my_svd = SvdMethodOfSnapshots(comm) U, s, _ = my_svd(snapshots)
where snapshots is the local portion of a distributed memory array.
The standard reduced-basis problem requires solving the optimization problem
\[\boldsymbol \Phi = \underset{ \boldsymbol \Phi_{\ast} \in \mathbb{R}^{N \times K} | \boldsymbol \Phi_{\ast}^T \boldsymbol \Phi_{\ast} = \mathbf{I}}{ \mathrm{arg \; min} } \| \Phi_{\ast} \Phi_{\ast}^T \mathbf{S} - \mathbf{S} \|_2,\]where \(\mathbf{S} \in \mathbb{R}^{N \times N_s}\), with \(N_s\) being the number of snapshots. The standard way to solve this is with the thin SVD. An alternative approach is to use the method of snapshots/kernel trick, see, e.g., https://web.stanford.edu/group/frg/course_work/CME345/CA-CME345-Ch4.pdf. Here, we instead solve the eigenvalue problem
\[\mathbf{S}^T \mathbf{S} \boldsymbol \psi_i = \lambda_i \boldsymbol \psi_i\]for \(i = 1,\ldots,N_s\). It can be shown that the left singular vectors from the SVD of \(\mathbf{S}\) are related to the eigen-vectors of the above by
\[\mathbf{u}_i = \frac{1}{\sqrt{\lambda_i}} \mathbf{S} \boldsymbol \psi_i.\]An advantage of the method of snapshots is that it can be easily parallelized and is efficient if we don’t have many snapshots. We compute \(\mathbf{S}^T \mathbf{S}\) in parallel, and then solve the (typically small) eigenvalue problem in serial.