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

Add conjugate transpose function #938

Merged
merged 2 commits into from
Nov 25, 2023

Conversation

kejcao
Copy link
Contributor

@kejcao kejcao commented Nov 23, 2023

This PR adds the missing ConjugateTranspose[] function.

Copy link
Contributor

@Li-Xiang-Ideal Li-Xiang-Ideal left a comment

Choose a reason for hiding this comment

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

You might add appropriate commas and blank lines to pass isort and black check like this:

        return ListExpression(*[ListExpression(*row) for row in result])


class ConjugateTranspose(Builtin):
    """
    <url>
    :Conjugate transpose: https://en.wikipedia.org/wiki/Conjugate_transpose</url> (<url>
    :WMA: https://reference.wolfram.com/language/ref/ConjugateTranspose.html</url>)
    <dl>
      <dt>'ConjugateTranspose[$m$]'
      <dd>gives the conjugate transpose of $m$.
    </dl>
    >> ConjugateTranspose[{{0, I}, {0, 0}}]
     = {{0, 0}, {-I, 0}}
    >> ConjugateTranspose[{{1, 2 I, 3}, {3 + 4 I, 5, I}}]
     = {{1, 3 - 4 I}, {-2 I, 5}, {3, -I}}
    """

    rules = {
        "ConjugateTranspose[m_]": "Conjugate[Transpose[m]]",
    }

    summary_text = "give the conjugate transpose"


class LeviCivitaTensor(Builtin):

@kejcao
Copy link
Contributor Author

kejcao commented Nov 24, 2023

Alright, I fixed it.

@rocky
Copy link
Member

rocky commented Nov 25, 2023

Looks good to me.

Note to self: We might reorganize and add a Matrix Operations

@rocky rocky merged commit 87e39ab into Mathics3:master Nov 25, 2023
11 checks passed
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