Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions heat/core/linalg/qr.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ..manipulations import concatenate
from .. import factories
from .. import communication
from ..types import float32, float64
from ..types import float32, float64, complex64

__all__ = ["qr"]

Expand Down Expand Up @@ -94,11 +94,10 @@ def qr(
if procs_to_merge == 0:
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.

raise TypeError(f"Array 'A' must have a datatype of float32 or float64, but has {A.dtype}")

QR = collections.namedtuple("QR", "Q, R")

if A.ndim == 3:
single_proc_qr = torch.vmap(torch.linalg.qr, in_dims=0, out_dims=0)
else:
Expand Down