romtools.vector_space.utils.svd_method_of_snapshots#

Classes

SvdMethodOfSnapshots(comm)

#Parallel implementation of the method of snapshots to mimic the SVD for basis construction Sample usage:

SvdMethodOfSnapshotsForQr(comm)

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: object

#Parallel implementation of the method of snapshots to mimic the SVD for basis construction Sample usage:

mySvd = SvdMethodOfSnapshots(comm) U,s,_ = mySvd(snapshots)

where snapshots is the local portion of a distributed memory array.

The standard reduced-basis problem requires solving the optimization problem .. math:

\boldsymbol \Phi = \underset{ \boldsymbol \Phi_{\*} \in \mathbb{R}^{N \times K} | \boldsymbol
\Phi_{\*}^T \boldsymbol \Phi_{\*} = \mathbf{I}}{ \mathrm{arg \; min} }
\| \Phi_{\*} \Phi_{\*}^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 snapshts/kernel trick, see, e.g., https://web.stanford.edu/group/frg/course_work/CME345/CA-CME345-Ch4.pdf. Here, we instead solve the eigenvalue probelm .. math:

\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 .. math:

\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.

class romtools.vector_space.utils.svd_method_of_snapshots.SvdMethodOfSnapshotsForQr(comm)[source]#

Bases: object

Similar to SvdMethodOfSnapshots, but call only returns two arguments to be compatible with QR routine.