Skip to content

Alignment of complex numbers#2756

Merged
bkamins merged 9 commits intoJuliaData:mainfrom
ronisbr:complex_numbers
May 16, 2021
Merged

Alignment of complex numbers#2756
bkamins merged 9 commits intoJuliaData:mainfrom
ronisbr:complex_numbers

Conversation

@ronisbr
Copy link
Copy Markdown
Member

@ronisbr ronisbr commented May 10, 2021

Hi!

This PR should fix #2754 . However, it adds somewhat complex regexes, which can decrease performance, and have some corner case that I did not think of. Thus, I need help testing this algorithm :)

@ronisbr ronisbr changed the title Complex numbers Alignment of complex numbers May 10, 2021
@bkamins bkamins added this to the 1.x milestone May 10, 2021
@ronisbr
Copy link
Copy Markdown
Member Author

ronisbr commented May 10, 2021

Oops, I need to fix an overflow in the tests.

@strickek
Copy link
Copy Markdown

In "very_big_column_name_4" there should also be a test case with negative real part.
I think the '|' in the REGEX of alignment_regex_complex (line 200) can be deleted (no need to match for this Char).

@ronisbr
Copy link
Copy Markdown
Member Author

ronisbr commented May 11, 2021

In "very_big_column_name_4" there should also be a test case with negative real part.
I think the '|' in the REGEX of alignment_regex_complex (line 200) can be deleted (no need to match for this Char).

Good catch! I have updated the code. Let's see if the test passes.

@bkamins
Copy link
Copy Markdown
Member

bkamins commented May 11, 2021

@nalimilan - can you please have a quick look if you agree with the rules used?

Copy link
Copy Markdown
Member

@nalimilan nalimilan left a comment

Choose a reason for hiding this comment

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

Makes sense. Just a few style comments.

(Ideally I would say that in addition to aligning on the sign of the imaginary parts, the real parts should be aligned like real numbers, and imaginary parts should be aligned like real numbers, but Base doesn't do this either since that would require adding spaces in the middle of the number...)

ronisbr and others added 2 commits May 14, 2021 22:01
@ronisbr
Copy link
Copy Markdown
Member Author

ronisbr commented May 15, 2021

(Ideally I would say that in addition to aligning on the sign of the imaginary parts, the real parts should be aligned like real numbers, and imaginary parts should be aligned like real numbers, but Base doesn't do this either since that would require adding spaces in the middle of the number...)

Yes, this would be good but involve some changes in PrettyTables.jl. What we need to implement is the support for multiple anchors, so that we can have multiple alignments. It is not an easy task.

I think I resolved all @nalimilan's comments!

@bkamins
Copy link
Copy Markdown
Member

bkamins commented May 15, 2021

It is not an easy task.

This is what I would imagine. I would leave it for later. I think we have more pivotal functionalities (like HTML/LaTeX support) that should get a higher priority.

@bkamins
Copy link
Copy Markdown
Member

bkamins commented May 16, 2021

@ronisbr - OK to merge?

@ronisbr
Copy link
Copy Markdown
Member Author

ronisbr commented May 16, 2021

Yes!

@bkamins bkamins merged commit 85da3d7 into JuliaData:main May 16, 2021
@bkamins
Copy link
Copy Markdown
Member

bkamins commented May 16, 2021

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display complex numbers - alignment

4 participants