Class ParamKoopman
It represents a mapping \(K: \mathrm{span}(\Psi) \times U \rightarrow \mathrm{span}(\Psi)\), which is a finite-dimensional approximation of the parametric Koopman operator.
API Documentation¶
size
property
¶
Returns the size of the Koopman matrix.
Returns:
Type | Description |
---|---|
int
|
The row/column size of the Koopman matrix. |
__call__(x, u)
¶
Applies the Koopman operator to the input tensor x
using the parameter tensor u
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input tensor of shape \((N, N_\psi)\). |
required |
u
|
Tensor
|
The parameter tensor of shape \((1, N_u)\) or \((N, N_u)\). If |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The result of applying the Koopman operator, with the same batch size
as |
__init__(size_K, network)
¶
Initialize the ParamKoopman instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
size_K
|
int
|
The size of the Koopman matrix. |
required |
network
|
Module
|
The network to generate the Koopman operator. |
required |
eval()
¶
Sets the network to evaluation mode.
load(path)
¶
Loads the model state and size from a specified file path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
The file path from which to load the model data. |
required |
parameters()
¶
Retrieve the parameters of the network.
Returns:
Type | Description |
---|---|
Iterator[Parameter]
|
An iterator over the parameters of the network. |
save(path)
¶
Saves the current state of the network to a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
The file path where the state dictionary and size will be saved. |
required |
step(x, u)
¶
Computes the next step in the system given the current state and parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The current state of the system. |
required |
u
|
Tensor
|
The control input to the system. |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The next state of the system after applying the Koopman. |
train()
¶
Sets the network to training mode.