Skip to content

Conversation

@mgorny
Copy link
Contributor

@mgorny mgorny commented Nov 7, 2025

Description

Implement the support for the _Fcomplex and _Dcomplex types used by MSVC in place of the standard C99 complex types. This is necessary to make LAPACK build out of the box with MSVC, since it does not implement the default C99 types.

See: https://learn.microsoft.com/en-us/cpp/c-runtime-library/complex-math-support

I went for the simplest implementation possible, limiting the changes to swapping the default types used when MSVC is used as the compiler, also when lapack_config.h is not used. I haven't added a LAPACK_COMPLEX_* ifdef for it, but I can do that if you prefer.

Checklist

  • The documentation has been updated.
  • If the PR solves a specific issue, it is set to be closed on merge.

Implement the support for the `_Fcomplex` and `_Dcomplex` types used
by MSVC in place of the standard C99 complex types.  This is necessary
to make LAPACK build out of the box with MSVC, since it does not
implement the default C99 types.

See: https://learn.microsoft.com/en-us/cpp/c-runtime-library/complex-math-support

I went for the simplest implementation possible, limiting the changes
to swapping the default types used when MSVC is used as the compiler,
also when `lapack_config.h` is not used.  I haven't added
a `LAPACK_COMPLEX_*` ifdef for it, but I can do that if you prefer.

Signed-off-by: Michał Górny <mgorny@quansight.com>
Copy link
Contributor

@langou langou left a comment

Choose a reason for hiding this comment

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

Sounds good to me. Thanks!

One comment:

  • Fcomplex with F for float
  • Dcomplex with D for double

Another option might have been

  • Ccomplex (as in CGEMM for example)
  • Zcomplex (as in ZGEMM for example)

I do not have a strong opinion and I am happy to go with the preference of the author of the PR.

@mgorny
Copy link
Contributor Author

mgorny commented Nov 7, 2025

I don't understand your comment. These are the types MSVC defines. I don't have control over their names.

@langou
Copy link
Contributor

langou commented Nov 7, 2025

Ah OK. That's great then. Thanks for explaining.

@langou langou merged commit d502606 into Reference-LAPACK:master Nov 7, 2025
12 checks passed
@mgorny mgorny deleted the msvc-complex branch November 7, 2025 20:40
@mgorny
Copy link
Contributor Author

mgorny commented Nov 7, 2025

Thank you!

miinso added a commit to miinso/rules_fortran that referenced this pull request Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants