Skip to content

Conversation

@2400032275
Copy link

Fixes #2039

Updated the QR decomposition function to support complex64 data type in addition to float32 and float64.

Due Diligence

  • General:
  • Implementation:
    • unit tests: all split configurations tested
    • unit tests: multiple dtypes tested
    • NEW unit tests: MPS tested (1 MPI process, 1 GPU)
    • benchmarks: created for new functionality
    • benchmarks: performance improved or maintained
    • documentation updated where needed

Description

Issue/s resolved: #

Changes proposed:

Type of change

Memory requirements

Performance

Does this change modify the behaviour of other functions? If so, which?

yes / no

Updated the QR decomposition function to support complex64 data type in addition to float32 and float64.
Fixed syntax errors from incorrect placement of complex64 in the dtype check. Changed 'if A.dtype not in [float32, float64], complex64:' to correct syntax 'if A.dtype not in [float32, float64, complex64]:'. Removed extraneous ', complex64' text from lines 100-102 that were incorrectly added.
@github-actions
Copy link
Contributor

Thank you for the PR!

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

Thank you for the PR!

@mrfh92
Copy link
Collaborator

mrfh92 commented Dec 1, 2025

@2400032275 thanks for taking up this issue 👍. I have two suggestions if you want to complete this PR:

  • So far, you have added support for complex64 (the complex counterpart of float32), but complex128 (the complex double precision) is still excluded
  • In order to test whether QR really works with the additional datatypes you would need to add corresponding tests in heat/core/linalg/tests/test_qr.py, where in lines 14 and 81 the datatypes that are used for tests are defined.

If you need any help, feel free to ask :)

@github-project-automation github-project-automation bot moved this to Todo in Roadmap Dec 2, 2025
@JuanPedroGHM JuanPedroGHM added this to the 1.7.0 milestone Dec 2, 2025
@ClaudiaComito ClaudiaComito modified the milestones: 1.7.0, 1.8.0 Jan 5, 2026
Copy link
Collaborator

@brownbaerchen brownbaerchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have two ways of proceeding

  • Remove any type checking and just leave it to torch to decide what it accepts for serial factorization
  • Use the general type check with issubdtype

If the first one works, I would prefer that, but I am not sure. So maybe stick with the latter.

I definitely agree that this cannot be merged without being tested.

procs_to_merge = A.comm.size

if A.dtype not in [float32, float64]:
if A.dtype not in [float32, float64, complex64]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better check would be

from ..types import issubdtype, floating, complex
if not issubdtype(A.dtype, floating) and not issubdtype(A.dtype, complex):

which would automatically work with all precision versions of these types. In particular, ones that will be added in the future.

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Roadmap Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Make linalg.qr work with complex values

5 participants