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

[enh]: Implement 'parity' intrinsic function #3662

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gxyd
Copy link
Contributor

@gxyd gxyd commented Mar 18, 2024

parity_result_dim1 = parity(x, dim=1)
if (parity_result_dim1(1) .neqv. .TRUE.) error stop
if (parity_result_dim1(2) .neqv. .TRUE.) error stop
if (parity_result_dim1(3) .neqv. .FALSE.) error stop
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would've liked to compare all of the elements simultaneously, but it seems like it raises an error:

if (.NOT. ALL(parity(x, dim=1) .neqv. [.TRUE., .TRUE., .FALSE.])) then
    error stop
end if

I believe it's unrelated to my changes, as the individual checks works without error. I didn't try to figure out why the above snippet wouldn't work.

@@ -703,6 +703,7 @@ RUN(NAME intrinsics_184 LABELS gfortran llvm) # selected_char_kind
RUN(NAME intrinsics_185 LABELS gfortran llvm) # verify
RUN(NAME intrinsics_186 LABELS gfortran llvm) # verify
RUN(NAME intrinsics_187 LABELS gfortran llvm) # popcnt
RUN(NAME intrinsics_parity LABELS gfortran llvm)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
RUN(NAME intrinsics_parity LABELS gfortran llvm)
RUN(NAME intrinsics_188 LABELS gfortran llvm) #parity

Let us maintain the convention here

@@ -0,0 +1,18 @@
program intrinsics_parity
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, program file_name

@Pranavchiku Pranavchiku added enhancement Issues or pull request for enhancing existing functionality intrinsic Issue or pull request specific to intrinsic function feature Issue or pull request for adding a new feature and removed enhancement Issues or pull request for enhancing existing functionality labels Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issue or pull request for adding a new feature intrinsic Issue or pull request specific to intrinsic function
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants