-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1558 from pymor/irka-init-fix
IRKA initialization fixes
- Loading branch information
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This file is part of the pyMOR project (https://www.pymor.org). | ||
# Copyright pyMOR developers and contributors. All rights reserved. | ||
# License: BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This file is part of the pyMOR project (https://www.pymor.org). | ||
# Copyright pyMOR developers and contributors. All rights reserved. | ||
# License: BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause) | ||
|
||
import numpy as np | ||
|
||
from pymor.models.iosys import LTIModel | ||
from pymor.reductors.h2 import IRKAReductor | ||
|
||
|
||
def test_irka(): | ||
A = np.array([[-1, 0], [0, -2]]) | ||
B = np.array([[1], [2]]) | ||
C = np.array([[2, 1]]) | ||
fom = LTIModel.from_matrices(A, B, C) | ||
irka = IRKAReductor(fom) | ||
|
||
rom = irka.reduce(1) | ||
assert isinstance(rom, LTIModel) and rom.order == 1 | ||
|
||
rom = irka.reduce(np.array([1])) | ||
assert isinstance(rom, LTIModel) and rom.order == 1 | ||
|
||
rom = irka.reduce({'sigma': np.array([1]), | ||
'b': np.array([[1]]), | ||
'c': np.array([[1]])}) | ||
assert isinstance(rom, LTIModel) and rom.order == 1 | ||
|
||
rom = irka.reduce(LTIModel.from_matrices(np.array([[-1]]), | ||
np.array([[1]]), | ||
np.array([[1]]))) | ||
assert isinstance(rom, LTIModel) and rom.order == 1 |