Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose inter-/histopolation matrices in GlobalProjector, add unit tests #347

Open
wants to merge 29 commits into
base: devel
Choose a base branch
from

Conversation

spossann
Copy link
Collaborator

@spossann spossann commented Oct 12, 2023

Fixes #346.

The inter-/histopolation matrices are now exposed in GlobalProjector.imat_kronecker as a LinearOperator object of type KroneckerStencilMatrix (in the case where both domain and codomain are scalar spaces) or BlockLinearOperator (in the case where at least one space is vector valued).

The unit tests in feec/tests/test_commuting_projections.py have been enhanced: they now also test how close imat_kronecker is to being the right-inverse of the solverattribute (which uses a Kronecker product of 1D linear solvers).

@spossann spossann requested a review from yguclu October 12, 2023 13:42
@spossann
Copy link
Collaborator Author

Hi @yguclu, it seems I cannot see why the latest test failed, do you have an idea? Also, did you have time to think about this PR yet?

psydac/feec/tests/test_commuting_projections.py Outdated Show resolved Hide resolved
psydac/feec/tests/test_commuting_projections.py Outdated Show resolved Hide resolved
@spossann
Copy link
Collaborator Author

Python 3.11 tests passed upon relaunching test, without changes.

@yguclu
Copy link
Member

yguclu commented Dec 5, 2023

@spossann It seems that the code could be simplified with these steps:

  1. Use the function array_to_psydac in module psydac.linalg.utilities to convert the 1D matrices from Numpy arrays to a StencilMatrix format (not distributed);
  2. Create a distributed 3D KroneckerStencilMatrix object from the serial 1D StencilMatrix objects;
  3. If needed, call the method KroneckerStencilMatrix.tostencil() to obtain a distributed 3D StencilMatrix object.

Before making any of these changes, could you please add a parallel test to this PR?

@spossann
Copy link
Collaborator Author

@spossann It seems that the code could be simplified with these steps:

1. Use the function `array_to_psydac` in module `psydac.linalg.utilities` to convert the 1D matrices from Numpy arrays to a `StencilMatrix` format (not distributed);

The function array_to_psydac converts numpy arrays into Stencil/BlockVector only (not Matrix).

spossann and others added 5 commits September 13, 2024 14:48
Co-authored-by: Yaman Güçlü <yaman.guclu@gmail.com>
Change `IdentityLinearOperator` to `IdentityOperator`, and `e0 @ e0` to
`e0.dot(e0)`. Add missing import statement.
…1, this fixes the problem with toarray() which did previously not work for StencilMatrix. Updated indexing in KroneckerStencilMatrix to include shift factors in index calculations. Added back the assert statement in GlobalProjector since the toarray() now works. The kernels still don't work properly for different shifts in the domain and the co-domain, but I believe equivalent changes can be done in the remaining kernels.
yguclu and others added 3 commits October 1, 2024 15:13
- Add compiler flags for GFortran >= 14 on Apple silicon chips
- Add unit test in `test_epyccel_flags.py` to check compiler flags
passed to `epyccel`
- Update GitHub actions used in documentation workflow
NumPy 2.1 deprecates the `newshape` argument of the `reshape` function.
Instead, one should use the positional-only argument `shape`. Every call
in Psydac has been updated accordingly. This closes #432.
Update `apt` index files with `apt-get update` to avoid download error
in CI workflow.
yguclu and others added 6 commits October 1, 2024 15:13
Clarify in the `README.md` file that, although the C backend may be
selected for accelerating the kernel files with Pyccel, this is not
fully working yet. Hence the Fortran backend (which is the default) is
the only one available. A future version of Pyccel will certainly
provide a C backend as capable as the Fortran one. See issue #431.

Co-authored-by: Martin Campos Pinto <campos@ann.jussieu.fr>
The obsolete property `is_block` was never used in Psydac nor in
Struphy, hence we remove it.

---------

Co-authored-by: Yaman Güçlü <yaman.guclu@gmail.com>
Fix the indexing in all kernels in `stencil2coo_kernels.py` so that the
method `toarray` works for `StencilMatrix` objects in 1D/2D/3D with
`shift` larger than 1.

The unit tests for `toarray` in `test_stencil_matrix.py` have been
parametrized to run with `shift` values of 1 and 2.

---------

Co-authored-by: Yaman Güçlü <yaman.guclu@gmail.com>
---------

Co-authored-by: Yaman Güçlü <yaman.guclu@gmail.com>
psydac/feec/tests/test_commuting_projections.py Outdated Show resolved Hide resolved
psydac/feec/tests/test_commuting_projections.py Outdated Show resolved Hide resolved
psydac/feec/tests/test_commuting_projections.py Outdated Show resolved Hide resolved
psydac/feec/tests/test_commuting_projections.py Outdated Show resolved Hide resolved
psydac/feec/tests/test_commuting_projections.py Outdated Show resolved Hide resolved
psydac/feec/tests/test_commuting_projections.py Outdated Show resolved Hide resolved
psydac/feec/tests/test_commuting_projections.py Outdated Show resolved Hide resolved
@max-models
Copy link
Contributor

Pushed with the 3D tests uncommented to ensure they all go through.

psydac/feec/tests/test_commuting_projections.py Outdated Show resolved Hide resolved
psydac/feec/tests/test_commuting_projections.py Outdated Show resolved Hide resolved
@yguclu yguclu added the urgent PR should be merged ASAP label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
urgent PR should be merged ASAP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose inter-/histopolation matrices as BlockLinearOperator in GlobalProjector
5 participants