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

linalg: hermitian #896

Merged
merged 6 commits into from
Dec 26, 2024
Merged

linalg: hermitian #896

merged 6 commits into from
Dec 26, 2024

Conversation

perazz
Copy link
Contributor

@perazz perazz commented Nov 22, 2024

Address #883: compute the Hermitian version of a rank-2 matrix.
I agree that having a hermitian helper function is inline with stdlib already offering several others, including is_hermitian.

Fortran uses verbs (transpose), so there is no direct equivalent. I believe another possible name for this function may be just hermite(A), but probably hermitian is more in sync with is_hermitian.

Proposed implementation

  • A_h = hermitian(A)

Key facts

  • For complex matrices, the function returns the conjugate transpose (conjg(transpose(a))).
  • For real or integer matrices, the function returns the transpose (transpose(a)).

Prior art

  • SciPy: A.H (H operator)
  • NumPy: A.H (H operator)

cc: @jvdp1 @jalvesz @loiseaujc

Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

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

Thank you @perazz . Nice and clean implementation.

doc/specs/stdlib_linalg.md Outdated Show resolved Hide resolved
src/stdlib_linalg.fypp Outdated Show resolved Hide resolved
perazz and others added 2 commits December 21, 2024 15:07
Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>
Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>
@perazz
Copy link
Contributor Author

perazz commented Dec 26, 2024

Thank you @jvdp1 @jalvesz, I will merge this as there have been no further comments.

@perazz perazz merged commit 095219e into fortran-lang:master Dec 26, 2024
15 checks passed
@perazz perazz deleted the hermitian branch December 26, 2024 08:45
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.

3 participants