CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
37 lines
1.8 KiB
Fortran
37 lines
1.8 KiB
Fortran
! RUN: %python %S/test_folding.py %s %flang_fc1
|
|
! Tests folding of NORM2(), F'2023 16.9.153
|
|
module m
|
|
! Examples from the standard
|
|
logical, parameter :: test_ex1 = norm2([3.,4.]) == 5.
|
|
real, parameter :: ex2(2,2) = reshape([1.,3.,2.,4.],[2,2])
|
|
real, parameter :: ex2_norm2_1(2) = norm2(ex2, dim=1)
|
|
real, parameter :: ex2_1(2) = [3.162277698516845703125,4.472136020660400390625]
|
|
logical, parameter :: test_ex2_1 = all(ex2_norm2_1 == ex2_1)
|
|
real, parameter :: ex2_norm2_2(2) = norm2(ex2, dim=2)
|
|
real, parameter :: ex2_2(2) = [2.2360680103302001953125,5.]
|
|
logical, parameter :: test_ex2_2 = all(ex2_norm2_2 == ex2_2)
|
|
! 0 3 6 9
|
|
! 1 4 7 10
|
|
! 2 5 8 11
|
|
integer, parameter :: dp = kind(0.d0)
|
|
real(dp), parameter :: a(3,4) = &
|
|
reshape([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], shape(a))
|
|
real(dp), parameter :: nAll = norm2(a)
|
|
real(dp), parameter :: check_nAll = 11._dp * sqrt(sum((a/11._dp)**2))
|
|
logical, parameter :: test_all = nAll == check_nAll
|
|
real(dp), parameter :: norms1(4) = norm2(a, dim=1)
|
|
real(dp), parameter :: check_norms1(4) = [ &
|
|
2.236067977499789805051477742381393909454345703125_8, &
|
|
7.07106781186547550532850436866283416748046875_8, &
|
|
1.2206555615733702069292121450416743755340576171875e1_8, &
|
|
1.7378147196982769884243680280633270740509033203125e1_8 ]
|
|
logical, parameter :: test_norms1 = all(norms1 == check_norms1)
|
|
real(dp), parameter :: norms2(3) = norm2(a, dim=2)
|
|
real(dp), parameter :: check_norms2(3) = [ &
|
|
1.1224972160321822656214862945489585399627685546875e1_8, &
|
|
1.28840987267251261272349438513629138469696044921875e1_8, &
|
|
1.4628738838327791427218471653759479522705078125e1_8 ]
|
|
logical, parameter :: test_norms2 = all(norms2 == check_norms2)
|
|
logical, parameter :: test_normZ = norm2([0.,0.,0.]) == 0.
|
|
end
|