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

bug in the sum BlockLinearOperator + ZeroOperator #453

Open
e-moral-sanchez opened this issue Dec 6, 2024 · 1 comment · May be fixed by #473
Open

bug in the sum BlockLinearOperator + ZeroOperator #453

e-moral-sanchez opened this issue Dec 6, 2024 · 1 comment · May be fixed by #473
Assignees
Labels
linalg Linear algebra Next Release Must be in next release

Comments

@e-moral-sanchez
Copy link
Contributor

When a BlockLinearOperator with at least one block that is not a ZeroOperator is summed with a ZeroOperator, the following error appears:

'ZeroOperator' object has no attribute 'set_backend'
  File "/psydac/psydac/linalg/block.py", line 1257, in set_backend
    b.set_backend(backend)

With the inverse order (summing ZeroOperator + BlockLinearOperator) there is no error.

@yguclu yguclu added bug Something isn't working linalg Linear algebra labels Feb 12, 2025
@e-moral-sanchez
Copy link
Contributor Author

e-moral-sanchez commented Feb 19, 2025

Minimal example:

from sympde.topology                import Cube, Derham, elements_of
from sympde.calculus                import dot
from sympde.expr                    import integral, BilinearForm
from psydac.api.discretization      import discretize
from psydac.api.settings            import PSYDAC_BACKENDS
from psydac.linalg.utilities import array_to_psydac
from psydac.linalg.block import BlockLinearOperator, BlockVector, BlockVectorSpace
from psydac.linalg.basic import IdentityOperator, ZeroOperator

domain = Cube()
derham = Derham(domain)

domain_h = discretize(domain, ncells=[5,5,5], periodic=[False, False, False], comm=None)
derham_h = discretize(derham, domain_h, degree=[1,1,1])
        

E, F = elements_of(derham.V1, names='E, F')
m1 = BilinearForm((E, F), integral(domain, dot(E, F)))
M1 = discretize(m1, domain_h, (derham_h.V1, derham_h.V1), backend=PSYDAC_BACKENDS['pyccel-gcc']).assemble()

V1xV1_h_vector_space = BlockVectorSpace(derham_h.V1.vector_space, derham_h.V1.vector_space)

Z1 = ZeroOperator(derham_h.V1.vector_space, derham_h.V1.vector_space)

op1 = BlockLinearOperator(V1xV1_h_vector_space, V1xV1_h_vector_space, 
                                                blocks=[[Z1, Z1], [Z1,  Z1 + M1]]) #passes

op2 = BlockLinearOperator(V1xV1_h_vector_space, V1xV1_h_vector_space, 
                                                blocks=[[Z1, Z1], [Z1,  M1 +  Z1]]) #fails

@yguclu yguclu added Next Release Must be in next release and removed bug Something isn't working labels Mar 11, 2025
@jowezarek jowezarek linked a pull request Mar 13, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linalg Linear algebra Next Release Must be in next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants