From dc6cd6e5df68a3a86cd04d07fbbb7a639e215092 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Sun, 2 Aug 2026 01:09:09 +0100 Subject: [PATCH 01/22] codex: add complete BLAS correctness project --- .github/workflows/blas-lapack.yml | 7 +- CHANGELOG.md | 10 +- README.md | 5 + benchmarks/README.md | 3 +- benchmarks/build_time.py | 11 +- docs/developer/repository-structure.md | 5 + docs/developer/source-map.md | 2 + docs/developer/testing-strategy.md | 19 +- .../fortran-test-suite-cleanup-checklist.md | 5 +- .../roadmap/semantic-pyi-wrapper-checklist.md | 4 +- docs/user/examples/blas-wrapper.md | 31 +- docs/user/examples/index.md | 13 +- examples/blas/README.md | 428 +++++++++++++++ examples/blas/conftest.py | 180 +++++++ examples/blas/helpers.py | 220 ++++++++ .../blas/native/caxpy.f | 0 .../blas/native/ccopy.f | 0 .../blas/native/cdotc.f | 0 .../blas/native/cdotu.f | 0 .../blas/native/cgbmv.f | 0 .../blas/native/cgemm.f | 0 .../blas/native/cgemmtr.f | 0 .../blas/native/cgemv.f | 0 .../blas/native/cgerc.f | 0 .../blas/native/cgeru.f | 0 .../blas/native/chbmv.f | 0 .../blas/native/chemm.f | 0 .../blas/native/chemv.f | 0 .../blas/native/cher.f | 0 .../blas/native/cher2.f | 0 .../blas/native/cher2k.f | 0 .../blas/native/cherk.f | 0 .../blas/native/chpmv.f | 0 .../blas/native/chpr.f | 0 .../blas/native/chpr2.f | 0 .../blas/native/crotg.f90 | 0 .../blas/native/cscal.f | 0 .../blas/native/csrot.f | 0 .../blas/native/csscal.f | 0 .../blas/native/cswap.f | 0 .../blas/native/csymm.f | 0 .../blas/native/csyr2k.f | 0 .../blas/native/csyrk.f | 0 .../blas/native/ctbmv.f | 0 .../blas/native/ctbsv.f | 0 .../blas/native/ctpmv.f | 0 .../blas/native/ctpsv.f | 0 .../blas/native/ctrmm.f | 0 .../blas/native/ctrmv.f | 0 .../blas/native/ctrsm.f | 0 .../blas/native/ctrsv.f | 0 .../blas/native/dasum.f | 0 .../blas/native/daxpy.f | 0 .../blas/native/dcabs1.f | 0 .../blas/native/dcopy.f | 0 .../blas/native/ddot.f | 0 .../blas/native/dgbmv.f | 0 .../blas/native/dgemm.f | 0 .../blas/native/dgemmtr.f | 0 .../blas/native/dgemv.f | 0 .../blas/native/dger.f | 0 .../blas/native/dnrm2.f90 | 0 .../blas/native/drot.f | 0 .../blas/native/drotg.f90 | 0 .../blas/native/drotm.f | 0 .../blas/native/drotmg.f | 0 .../blas/native/dsbmv.f | 0 .../blas/native/dscal.f | 0 .../blas/native/dsdot.f | 0 .../blas/native/dspmv.f | 0 .../blas/native/dspr.f | 0 .../blas/native/dspr2.f | 0 .../blas/native/dswap.f | 0 .../blas/native/dsymm.f | 0 .../blas/native/dsymv.f | 0 .../blas/native/dsyr.f | 0 .../blas/native/dsyr2.f | 0 .../blas/native/dsyr2k.f | 0 .../blas/native/dsyrk.f | 0 .../blas/native/dtbmv.f | 0 .../blas/native/dtbsv.f | 0 .../blas/native/dtpmv.f | 0 .../blas/native/dtpsv.f | 0 .../blas/native/dtrmm.f | 0 .../blas/native/dtrmv.f | 0 .../blas/native/dtrsm.f | 0 .../blas/native/dtrsv.f | 0 .../blas/native/dzasum.f | 0 .../blas/native/dznrm2.f90 | 0 .../blas/native/icamax.f | 0 .../blas/native/idamax.f | 0 .../blas/native/isamax.f | 0 .../blas/native/izamax.f | 0 .../blas/native/lsame.f | 0 .../blas/native/sasum.f | 0 .../blas/native/saxpy.f | 0 .../blas/native/scabs1.f | 0 .../blas/native/scasum.f | 0 .../blas/native/scnrm2.f90 | 0 .../blas/native/scopy.f | 0 .../blas/native/sdot.f | 0 .../blas/native/sdsdot.f | 0 .../blas/native/sgbmv.f | 0 .../blas/native/sgemm.f | 0 .../blas/native/sgemmtr.f | 0 .../blas/native/sgemv.f | 0 .../blas/native/sger.f | 0 .../blas/native/snrm2.f90 | 0 .../blas/native/srot.f | 0 .../blas/native/srotg.f90 | 0 .../blas/native/srotm.f | 0 .../blas/native/srotmg.f | 0 .../blas/native/ssbmv.f | 0 .../blas/native/sscal.f | 0 .../blas/native/sspmv.f | 0 .../blas/native/sspr.f | 0 .../blas/native/sspr2.f | 0 .../blas/native/sswap.f | 0 .../blas/native/ssymm.f | 0 .../blas/native/ssymv.f | 0 .../blas/native/ssyr.f | 0 .../blas/native/ssyr2.f | 0 .../blas/native/ssyr2k.f | 0 .../blas/native/ssyrk.f | 0 .../blas/native/stbmv.f | 0 .../blas/native/stbsv.f | 0 .../blas/native/stpmv.f | 0 .../blas/native/stpsv.f | 0 .../blas/native/strmm.f | 0 .../blas/native/strmv.f | 0 .../blas/native/strsm.f | 0 .../blas/native/strsv.f | 0 .../blas/native/xerbla.f | 0 .../blas/native/xerbla_array.f | 0 .../blas/native/zaxpy.f | 0 .../blas/native/zcopy.f | 0 .../blas/native/zdotc.f | 0 .../blas/native/zdotu.f | 0 .../blas/native/zdrot.f | 0 .../blas/native/zdscal.f | 0 .../blas/native/zgbmv.f | 0 .../blas/native/zgemm.f | 0 .../blas/native/zgemmtr.f | 0 .../blas/native/zgemv.f | 0 .../blas/native/zgerc.f | 0 .../blas/native/zgeru.f | 0 .../blas/native/zhbmv.f | 0 .../blas/native/zhemm.f | 0 .../blas/native/zhemv.f | 0 .../blas/native/zher.f | 0 .../blas/native/zher2.f | 0 .../blas/native/zher2k.f | 0 .../blas/native/zherk.f | 0 .../blas/native/zhpmv.f | 0 .../blas/native/zhpr.f | 0 .../blas/native/zhpr2.f | 0 .../blas/native/zrotg.f90 | 0 .../blas/native/zscal.f | 0 .../blas/native/zswap.f | 0 .../blas/native/zsymm.f | 0 .../blas/native/zsyr2k.f | 0 .../blas/native/zsyrk.f | 0 .../blas/native/ztbmv.f | 0 .../blas/native/ztbsv.f | 0 .../blas/native/ztpmv.f | 0 .../blas/native/ztpsv.f | 0 .../blas/native/ztrmm.f | 0 .../blas/native/ztrmv.f | 0 .../blas/native/ztrsm.f | 0 .../blas/native/ztrsv.f | 0 examples/blas/routine_inventory.py | 213 ++++++++ examples/blas/test_auxiliary.py | 148 ++++++ examples/blas/test_level1_complex.py | 406 +++++++++++++++ examples/blas/test_level1_real.py | 483 +++++++++++++++++ examples/blas/test_level2_banded.py | 493 ++++++++++++++++++ examples/blas/test_level2_general.py | 303 +++++++++++ examples/blas/test_level2_hermitian.py | 175 +++++++ examples/blas/test_level2_packed.py | 451 ++++++++++++++++ examples/blas/test_level2_symmetric.py | 153 ++++++ examples/blas/test_level2_triangular.py | 173 ++++++ examples/blas/test_level3_general.py | 432 +++++++++++++++ examples/blas/test_level3_hermitian.py | 229 ++++++++ examples/blas/test_level3_symmetric.py | 407 +++++++++++++++ examples/blas/test_level3_triangular.py | 207 ++++++++ examples/blas/test_routine_coverage.py | 116 +++++ prik/wrapper_codegen/c/binding.py | 17 +- prik/wrapper_codegen/generator.py | 53 ++ prik/wrapper_codegen/plan.py | 1 + prik/wrapper_codegen/planner.py | 77 +++ tests/README.md | 10 +- .../fortran/test_language_ownership.py | 9 +- tests/fortran/README.md | 9 +- .../test_dense_array_shape_lowering.py | 21 +- .../real_libraries/test_full_libraries.py | 8 +- .../architecture/test_test_suite_layout.py | 2 + tests/shared/docs/test_examples.py | 16 +- 196 files changed, 5491 insertions(+), 64 deletions(-) create mode 100644 examples/blas/README.md create mode 100644 examples/blas/conftest.py create mode 100644 examples/blas/helpers.py rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/caxpy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ccopy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cdotc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cdotu.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cgbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cgemm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cgemmtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cgemv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cgerc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cgeru.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/chbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/chemm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/chemv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cher.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cher2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cher2k.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cherk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/chpmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/chpr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/chpr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/crotg.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cscal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/csrot.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/csscal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/cswap.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/csymm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/csyr2k.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/csyrk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ctbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ctbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ctpmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ctpsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ctrmm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ctrmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ctrsm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ctrsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dasum.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/daxpy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dcabs1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dcopy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ddot.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dgbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dgemm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dgemmtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dgemv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dger.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dnrm2.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/drot.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/drotg.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/drotm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/drotmg.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dsbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dscal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dsdot.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dspmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dspr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dspr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dswap.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dsymm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dsymv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dsyr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dsyr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dsyr2k.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dsyrk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dtbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dtbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dtpmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dtpsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dtrmm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dtrmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dtrsm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dtrsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dzasum.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/dznrm2.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/icamax.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/idamax.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/isamax.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/izamax.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/lsame.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sasum.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/saxpy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/scabs1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/scasum.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/scnrm2.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/scopy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sdot.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sdsdot.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sgbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sgemm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sgemmtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sgemv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sger.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/snrm2.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/srot.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/srotg.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/srotm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/srotmg.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ssbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sscal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sspmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sspr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sspr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/sswap.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ssymm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ssymv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ssyr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ssyr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ssyr2k.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ssyrk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/stbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/stbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/stpmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/stpsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/strmm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/strmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/strsm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/strsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/xerbla.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/xerbla_array.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zaxpy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zcopy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zdotc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zdotu.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zdrot.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zdscal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zgbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zgemm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zgemmtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zgemv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zgerc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zgeru.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zhbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zhemm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zhemv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zher.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zher2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zher2k.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zherk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zhpmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zhpr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zhpr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zrotg.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zscal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zswap.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zsymm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zsyr2k.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/zsyrk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ztbmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ztbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ztpmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ztpsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ztrmm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ztrmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ztrsm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/blas/native/ztrsv.f (100%) create mode 100644 examples/blas/routine_inventory.py create mode 100644 examples/blas/test_auxiliary.py create mode 100644 examples/blas/test_level1_complex.py create mode 100644 examples/blas/test_level1_real.py create mode 100644 examples/blas/test_level2_banded.py create mode 100644 examples/blas/test_level2_general.py create mode 100644 examples/blas/test_level2_hermitian.py create mode 100644 examples/blas/test_level2_packed.py create mode 100644 examples/blas/test_level2_symmetric.py create mode 100644 examples/blas/test_level2_triangular.py create mode 100644 examples/blas/test_level3_general.py create mode 100644 examples/blas/test_level3_hermitian.py create mode 100644 examples/blas/test_level3_symmetric.py create mode 100644 examples/blas/test_level3_triangular.py create mode 100644 examples/blas/test_routine_coverage.py diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index 4e9cf5eab..6f0dca02f 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -54,7 +54,12 @@ jobs: uses: actions/cache@v4 with: path: ${{ runner.temp }}/prik-real-library-native - key: real-libraries-${{ runner.os }}-gfortran13-${{ hashFiles('tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/**', 'tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/**') }} + key: real-libraries-${{ runner.os }}-gfortran13-${{ hashFiles('examples/blas/native/**', 'tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/**') }} + - name: Run complete BLAS correctness example + env: + PYTHONPATH: . + HYPOTHESIS_PROFILE: ci + run: python -m pytest -q examples/blas - name: Run full BLAS and LAPACK wrapper tests env: PYTHONPATH: . diff --git a/CHANGELOG.md b/CHANGELOG.md index b6bd7e4ee..a84ea377a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,15 @@ release tags add a leading `v` to the package version. ## Unreleased -- No user-visible changes yet. +- Added a complete runnable Reference BLAS correctness example covering all 155 + discovered routines through PRIK, independent mathematical expectations, and + f2py differential comparisons. +- Moved the repository's authoritative Reference BLAS sources to + `examples/blas/native/` for shared use by the example, integration tests, + LAPACK CI build, and build comparison tooling. +- Fixed dependency-safe Python argument conversion ordering for wrappers whose + array extents depend on later native scalar arguments, including padded BLAS + leading dimensions. ## 0.1.0 — 2026-08-01 diff --git a/README.md b/README.md index 01f65520a..1343e5572 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,11 @@ PRIK_C_DOCS_END --> [Read the documentation](https://pynumlab.github.io/prik/) for installation, the user guide, examples, and reference material. +For a complete real-library example, see the +[155-routine BLAS correctness project](examples/blas/README.md), which builds +the same Reference BLAS sources with PRIK and f2py and checks both against +independent numerical expectations. + The complete example below builds with one command: ```bash diff --git a/benchmarks/README.md b/benchmarks/README.md index c53d54f71..ec5c046d6 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -15,7 +15,8 @@ after the timer stops. Both tools use their normal dependency-aware compiler concurrency. The workloads are: - the one-source, five-procedure module used by the runtime suite; and -- the repository's 155-source reference BLAS fixture, with all 155 routines +- the repository's authoritative 155-source Reference BLAS project under + `examples/blas/native/`, with all 155 routines required in each generated extension. One untimed warm-up precedes six measured clean builds of each workload by diff --git a/benchmarks/build_time.py b/benchmarks/build_time.py index a468460a7..5117595e8 100644 --- a/benchmarks/build_time.py +++ b/benchmarks/build_time.py @@ -24,16 +24,7 @@ REPOSITORY_ROOT = Path(__file__).resolve().parents[1] BENCHMARK_ROOT = Path(__file__).resolve().parent RESULTS_ROOT = BENCHMARK_ROOT / "results" -BLAS_SOURCE_ROOT = ( - REPOSITORY_ROOT - / "tests" - / "fortran" - / "building_shared_library" - / "end_to_end" - / "real_libraries" - / "blas" - / "native" -) +BLAS_SOURCE_ROOT = REPOSITORY_ROOT / "examples" / "blas" / "native" FORTRAN_SUFFIXES = frozenset({".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"}) DEVELOPMENT_FLAGS = "-O0" OPTIMIZED_FLAGS = "-O3 -march=native -mtune=native" diff --git a/docs/developer/repository-structure.md b/docs/developer/repository-structure.md index c3f07d536..c3933b342 100644 --- a/docs/developer/repository-structure.md +++ b/docs/developer/repository-structure.md @@ -29,6 +29,7 @@ artifacts used by tests. Navigate by ownership boundary first, then by file. | `prik/binding_support/` | Bundled header-only native support copied into generated wrapper builds. | | `prik/naming/` | Unified public-name and generated-symbol policy. | | `prik/utilities/` | Small shared Python utilities. | +| `examples/blas/` | Complete runnable Reference BLAS correctness project and the repository's single authoritative full BLAS source set under `native/`. | | `benchmarks/` | Local prik/f2py correctness and performance comparison harness. Benchmark sources and scripts are maintained; native builds and result files are generated locally. | | `tools/generate_performance_docs.py` | Validates paired runtime and clean-build `pyperf` results and generates the bounded public Performance snapshot and both charts. | @@ -54,6 +55,7 @@ through `prik/__init__.py`. | `tests/fortran/infrastructure/` | Internal cross-feature policy, wrapper-generation, compiler, and runtime frameworks with no honest public-capability owner. | | `tests/c/` | C input-language parsing, preprocessing, probe, semantic, CLI, and fixture evidence. | | `tests/shared/` | Language-neutral product architecture, documentation, naming, tools, type mapping, and utility checks. | +| `examples/blas/test_*.py` | Dedicated real-library correctness documentation: explicit independent and PRIK/f2py differential validation for every Reference BLAS routine. | | Control command output | [Control CLI output](recipes/control-cli-output.md) | | Use inspection APIs from Python | [Use Python inspection APIs](recipes/use-python-inspection-apis.md) | | Pass compiler and preprocessing options | [Use compiler preprocessing options](recipes/compiler-preprocessing.md) | +| Build and validate the complete Reference BLAS | [BLAS wrapper](blas-wrapper.md) | ## Planned Project Examples -- [BLAS wrapper](blas-wrapper.md) - [LAPACK wrapper](lapack-wrapper.md) - [ODE solver](ode-solver.md) - [CFD mini-example](cfd-mini-example.md) @@ -46,6 +47,6 @@ PRIK_C_DOCS_END --> ## TODO -- TODO: Add runnable checked examples one at a time. +- TODO: Add further runnable checked examples one at a time. - TODO: Keep examples with unavailable runtime support marked not yet implemented. diff --git a/examples/blas/README.md b/examples/blas/README.md new file mode 100644 index 000000000..5441cd207 --- /dev/null +++ b/examples/blas/README.md @@ -0,0 +1,428 @@ +# Complete Reference BLAS correctness example + +This directory is a runnable, correctness-only example of building the complete +Reference BLAS with both PRIK and NumPy's f2py. It validates every one of the +155 callable routines discovered in the 155 source files. The tests compare +both wrappers with an independent mathematical result and then with each other; +f2py is useful differential evidence, but it is not the behavioral oracle. + +The authoritative source set is [`native/`](native/). It is the repository's +only copy of the full BLAS sources and is also consumed by the full-library +integration test, the LAPACK CI build, and the build comparison tooling. + +## Provenance and license + +The sources are the Reference BLAS distributed by the University of Tennessee +through [Netlib BLAS](https://www.netlib.org/blas/). The repository imported +this corpus in commit `9113acde1f7d30af4c3eb3d90bb9f9da422639f2` on 2026-05-02; +this change relocates those bytes without modifying or duplicating them. Their +upstream provenance notices are retained in the files. No separate license file +was present beside the imported corpus. The +[Netlib BLAS FAQ](https://www.netlib.org/blas/faq.html#1_5) describes BLAS as +freely available, permits commercial use, and asks users to acknowledge Netlib +and the authors. Consult that upstream statement when redistributing the native +sources; this example's Python test code remains covered by the repository +license. + +## Reproduce the two builds + +The session fixtures use the following effective commands. Both commands +receive the same sorted absolute source list and `-O0`; all artifacts stay in a +temporary directory. + +```bash +REPOSITORY_ROOT="$(pwd)" +BUILD_ROOT="$(mktemp -d)" +mapfile -t BLAS_SOURCES < <(find "$REPOSITORY_ROOT/examples/blas/native" -maxdepth 1 -type f \( -name '*.f' -o -name '*.f90' \) -print | sort) +mkdir -p "$BUILD_ROOT/prik" "$BUILD_ROOT/f2py" +cd "$BUILD_ROOT/prik" +python3 -m prik "${BLAS_SOURCES[@]}" --out prik_reference_blas --out-dir "$BUILD_ROOT/prik/generated" --compiler "$(command -v gfortran)" --jobs 8 --native-compile-flags=-O0 --wrapper-fortran-flags=-O0 --wrapper-c-flags=-O0 +``` + +```bash +cd "$BUILD_ROOT/f2py" +python3 -m numpy.f2py -c -m f2py_reference_blas "${BLAS_SOURCES[@]}" --build-dir "$BUILD_ROOT/f2py/generated" --f77flags=-O0 --f90flags=-O0 --opt=-O0 +``` + +Import the modules from their build directories: + +```python +import sys + +sys.path.insert(0, f"{BUILD_ROOT}/prik") +sys.path.insert(0, f"{BUILD_ROOT}/f2py") +import prik_reference_blas +import f2py_reference_blas +``` + +For normal use, let pytest create, report, and clean those directories: + +```bash +python3 -m pytest -q examples/blas +python3 -m pytest -q examples/blas/test_level1_real.py +python3 -m pytest -q examples/blas/test_level1_real.py::test_daxpy +python3 -m pytest -q examples/blas -k dgemm +``` + +## What each test proves + +Numerical tests normally establish all three relationships: + +```text +PRIK result == independent expected result +f2py result == independent expected result +PRIK result == f2py result +``` + +Small explicit formulas are preferred. Matrix cases first reconstruct the +logical matrix from the declared storage and then calculate the operation. +Solve routines additionally use residuals. Input-only arrays are copied and +checked exactly; output arrays are checked with dtype-aware tolerances; unused +triangles, band rows, leading-dimension padding, and stride gaps retain their +NaN or finite sentinels exactly. + +`assert_allclose_for_dtype` starts from machine epsilon for the real component +of `float32`, `float64`, `complex64`, or `complex128`, then scales the tolerance +by the reduction or multiplication length and expected magnitude. Integers, +native indexes, shapes, dtypes, and untouched storage use exact checks. NumPy +matrix operations are concise secondary calculations in some cases; explicit +scalar formulas and residual identities keep the independent oracle from +being merely another BLAS call. + +### Increments and indexes + +A BLAS vector is represented by its full storage plus `N` and `INCX`/`INCY`. +For positive increments the first logical element is storage index zero. For a +negative increment the native starting index is `(N - 1) * -INCX`; subsequent +logical positions add the signed increment. Tests cover `1`, values greater +than one, and negative increments while checking all gaps. + +`ISAMAX`, `IDAMAX`, `ICAMAX`, and `IZAMAX` expose the native one-based BLAS +index through both wrappers. Their tests independently identify the maximum +and assert the one-based value; no automatic Python zero-basing is assumed. + +### Matrix storage + +The PRIK calls preserve the native argument order, including explicit leading +dimensions. f2py infers leading dimensions and moves them to optional keyword +arguments. Tests allocate non-minimal Fortran-order matrices and prove that +padding is not modified. + +General routines cover no-transpose, transpose, and conjugate-transpose. +Symmetric, Hermitian, and triangular cases reconstruct only the selected upper +or lower triangle; the unused triangle contains NaNs. Hermitian reconstruction +conjugates the reflected entries and ignores stored diagonal imaginary parts. +Unit-diagonal triangular cases put NaNs on the stored diagonal and validate the +operation against a logical diagonal of ones. Level 3 triangular tests cover +both left and right multiplication and solve residuals. + +Packed helpers implement the column-major BLAS packed order before reconstructing +the full logical matrix. Banded helpers use the BLAS row mapping for general, +symmetric, Hermitian, and triangular band storage. The tests reconstruct the +logical matrix before calculating the independent expectation and preserve +unused band rows exactly. + +## Representative tests (source verified) + +These examples are copied verbatim from the real tests. Documentation tests +select the named function from its source AST and fail if a displayed example +diverges. + +### DAXPY + + +```python +def test_daxpy(prik_blas, f2py_blas): + alpha = np.float64(-1.5) + x = np.array([2.0, -4.0, 1.0], dtype=np.float64) + original_y = np.array([3.0, 5.0, -2.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_scalars = prik_blas.daxpy(np.int32(3), alpha, prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_result = f2py_blas.daxpy(np.int32(3), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected_y = alpha * x + original_y + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_y, f2py_y) + assert prik_scalars == (np.int32(3), alpha, np.int32(1), np.int32(1)) + assert f2py_result is None + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) +``` + +### DDOT + + +```python +def test_ddot(prik_blas, f2py_blas): + x = np.array([1.0, -2.0, 4.0], dtype=np.float64) + y = np.array([3.0, 5.0, -1.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_value, n, incx, incy = prik_blas.ddot(np.int32(3), prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_value = f2py_blas.ddot(np.int32(3), f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected = np.float64(1.0 * 3.0 + (-2.0) * 5.0 + 4.0 * (-1.0)) + assert_allclose_for_dtype(prik_value, expected, operation_size=3) + assert_allclose_for_dtype(f2py_value, expected, operation_size=3) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=3) + assert (n, incx, incy) == (np.int32(3), np.int32(1), np.int32(1)) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) +``` + +### DGEMV + + +```python +def test_dgemv_no_transpose(prik_blas, f2py_blas): + alpha, beta = np.float64(2.0), np.float64(-1.0) + matrix = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [91.0, 92.0]], dtype=np.float64) + x = np.array([5.0, -2.0], dtype=np.float64) + original_y = np.array([7.0, 11.0], dtype=np.float64) + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_scalars = prik_blas.dgemv( + "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1) + ) + # f2py places its inferred optional leading dimension after the native arrays. + f2py_result = f2py_blas.dgemv( + b"N", np.int32(2), np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3) + ) + + product = np.array([1.0 * 5.0 + 2.0 * (-2.0), 3.0 * 5.0 + 4.0 * (-2.0)]) + expected_y = alpha * product + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert prik_scalars == (2, 2, alpha, 3, 1, beta, 1) + assert f2py_result is None + assert_storage_unchanged(prik_a, matrix) + assert_storage_unchanged(f2py_a, matrix) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) +``` + +### DGEMM + + +```python +def test_dgemm(prik_blas, f2py_blas): + alpha, beta = np.float64(2.0), np.float64(-0.5) + a = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [91.0, 92.0]], dtype=np.float64) + b = np.asfortranarray([[5.0, 6.0], [7.0, 8.0], [93.0, 94.0]], dtype=np.float64) + original_c = np.asfortranarray([[9.0, 10.0], [11.0, 12.0], [95.0, 96.0]], dtype=np.float64) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_scalars = prik_blas.dgemm( + "N", + "N", + np.int32(2), + np.int32(2), + np.int32(2), + alpha, + prik_a, + np.int32(3), + prik_b, + np.int32(3), + beta, + prik_c, + np.int32(3), + ) + # f2py moves its inferred optional leading dimensions to keyword arguments. + f2py_result = f2py_blas.dgemm( + b"N", + b"N", + np.int32(2), + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(3), + ldb=np.int32(3), + ldc=np.int32(3), + ) + + product = np.array( + [[1.0 * 5.0 + 2.0 * 7.0, 1.0 * 6.0 + 2.0 * 8.0], [3.0 * 5.0 + 4.0 * 7.0, 3.0 * 6.0 + 4.0 * 8.0]], + dtype=np.float64, + ) + expected_active = alpha * product + beta * original_c[:2, :] + assert_allclose_for_dtype(prik_c[:2, :], expected_active, operation_size=2) + assert_allclose_for_dtype(f2py_c[:2, :], expected_active, operation_size=2) + assert_allclose_for_dtype(prik_c[:2, :], f2py_c[:2, :], operation_size=2) + np.testing.assert_array_equal(prik_c[2, :], original_c[2, :], strict=True) + np.testing.assert_array_equal(f2py_c[2, :], original_c[2, :], strict=True) + assert prik_scalars == (2, 2, 2, alpha, 3, 3, beta, 3) + assert f2py_result is None + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) +``` + +### DTRSV + + +```python +def test_dtrsv_upper_nonunit(prik_blas, f2py_blas): + original_a = np.asfortranarray([[2.0, -1.0], [np.nan, 3.0], [91.0, 92.0]], dtype=np.float64) + expected_solution = np.array([4.0, -2.0], dtype=np.float64) + logical_a = triangular_from_triangle(original_a, 2, "U", unit_diagonal=False) + original_b = logical_a.T @ expected_solution + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.dtrsv("U", "T", "N", np.int32(2), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.dtrsv(b"U", b"T", b"N", np.int32(2), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + assert_allclose_for_dtype(logical_a.T @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a.T @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) +``` + +### CHEMV (complex Hermitian) + + +```python +def test_chemv(prik_blas, f2py_blas): + alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(0.25j) + original_a = np.asfortranarray( + [[2.0 + 77.0j, 1.0 - 2.0j], [np.nan + 1.0j * np.nan, 3.0 - 88.0j], [91.0j, 92.0j]], dtype=np.complex64 + ) + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex64) + original_y = np.array([4.0 - 2.0j, 5.0 + 3.0j], dtype=np.complex64) + logical_a = hermitian_from_triangle(original_a, 2, "U") + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.chemv("U", np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1)) + f2py_blas.chemv(b"U", np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3)) + + expected_y = alpha * logical_a @ x + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) +``` + +### SGBMV (general band) + + +```python +def test_sgbmv(prik_blas, f2py_blas): + alpha, beta = np.float32(1.5), np.float32(-0.5) + original_a = np.asfortranarray([[91.0, -1.0], [2.0, 3.0], [4.0, 92.0], [93.0, 94.0]], dtype=np.float32) + x = np.array([2.0, -3.0], dtype=np.float32) + original_y = np.array([4.0, 5.0], dtype=np.float32) + logical_a = general_from_band(original_a, 2, 2, 1, 1) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.sgbmv( + "N", + np.int32(2), + np.int32(2), + np.int32(1), + np.int32(1), + alpha, + prik_a, + np.int32(4), + prik_x, + np.int32(1), + beta, + prik_y, + np.int32(1), + ) + f2py_blas.sgbmv( + b"N", + np.int32(2), + np.int32(2), + np.int32(1), + np.int32(1), + alpha, + f2py_a, + f2py_x, + np.int32(1), + beta, + f2py_y, + np.int32(1), + lda=np.int32(4), + ) + + expected_y = alpha * logical_a @ x + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) +``` + +## Coverage and known API differences + +`routine_inventory.py` classifies all routines by BLAS level and storage +family. `test_routine_coverage.py` parses the source files and fails on a +missing/extra classification, missing PRIK or f2py export, absent explicitly +named test, duplicate test name, routine-level skip, or unaudited outcome. + +Current audited counts: + +| Outcome | Count | +| --- | ---: | +| Native source files | 155 | +| Discovered callable routines | 155 | +| PRIK exports and independently validated routines | 155 | +| f2py exports | 155 | +| Full independent plus differential success | 149 | +| Proven f2py scalar-writeback limitations | 6 | +| Unsupported routines | 0 | +| Environmentally skipped routines | 0 | + +The six f2py limitations are `srotg`, `drotg`, `crotg`, `zrotg`, `srotmg`, and +`drotmg`. From these unannotated Reference BLAS sources, f2py treats the scalar +writeback arguments as input-only. PRIK's scalar results are independently +validated; f2py's observable return or `PARAM` mutation is still recorded. +These are f2py projection limitations, not skipped PRIK checks. + +PRIK uses Python `str` for native character arguments while f2py uses `bytes`. +PRIK returns detached scalar arguments alongside function/subroutine results; +f2py generally returns only a function result and returns `None` for +subroutines. `LSAME` is a Python `bool` through PRIK and an integer truth value +through f2py. Tests keep both calls visible wherever these APIs differ. + +## Diagnose a failure + +Keep a named temporary directory and display build output: + +```bash +python3 -m pytest -vv -s examples/blas -k dgemm --basetemp=/tmp/prik-blas-debug +``` + +Build failures include the compiler identity, complete command, stdout, and +stderr. For numerical failures, run the single named test and inspect the +visible inputs, wrapper calls, independent expectation, and preservation +assertions in that function. The suite performs no timing collection and makes +no performance claims. diff --git a/examples/blas/conftest.py b/examples/blas/conftest.py new file mode 100644 index 000000000..ec0110f3b --- /dev/null +++ b/examples/blas/conftest.py @@ -0,0 +1,180 @@ +"""Build the complete reference BLAS once per pytest session with both tools.""" + +from __future__ import annotations + +from dataclasses import dataclass +import importlib +import os +from pathlib import Path +import shlex +import shutil +import subprocess +import sys + +import pytest + + +EXAMPLE_ROOT = Path(__file__).resolve().parent +REPOSITORY_ROOT = EXAMPLE_ROOT.parents[1] +NATIVE_ROOT = EXAMPLE_ROOT / "native" +FORTRAN_SUFFIXES = frozenset({".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"}) +BLAS_SOURCES = tuple( + sorted(path for path in NATIVE_ROOT.iterdir() if path.is_file() and path.suffix.lower() in FORTRAN_SUFFIXES) +) +BUILD_FLAGS = "-O0" + + +@dataclass(frozen=True) +class BuiltBLAS: + """One imported wrapper plus the information needed to diagnose its build.""" + + module: object + module_name: str + workdir: Path + command: tuple[str, ...] + compiler_identity: str + stdout: str + stderr: str + + +def _compiler() -> str: + compiler = shutil.which("gfortran") + if compiler is None: + pytest.skip("GNU Fortran is required to build the reference BLAS example") + return compiler + + +def _compiler_identity(compiler: str) -> str: + result = subprocess.run( # nosec B603 - fixed local compiler identity probe + (compiler, "--version"), + capture_output=True, + text=True, + check=False, + ) + first_line = result.stdout.splitlines()[0] if result.stdout else compiler + return f"{Path(compiler).resolve()}: {first_line}" + + +def _build_environment(compiler: str) -> dict[str, str]: + environment = dict(os.environ) + environment.update( + { + "CFLAGS": BUILD_FLAGS, + "FC": compiler, + "F77": compiler, + "F90": compiler, + "FFLAGS": BUILD_FLAGS, + "F90FLAGS": BUILD_FLAGS, + "PYTHONPATH": os.pathsep.join(filter(None, (str(REPOSITORY_ROOT), environment.get("PYTHONPATH")))), + } + ) + return environment + + +def _run_build(command: tuple[str, ...], workdir: Path, compiler: str) -> subprocess.CompletedProcess[str]: + result = subprocess.run( # nosec B603 - command is assembled from repository sources and fixed tools + command, + cwd=workdir, + env=_build_environment(compiler), + capture_output=True, + text=True, + check=False, + ) + if result.returncode: + pytest.fail( + "Reference BLAS build failed\n" + f"compiler: {_compiler_identity(compiler)}\n" + f"command: {shlex.join(command)}\n" + f"stdout:\n{result.stdout or ''}\n" + f"stderr:\n{result.stderr or ''}" + ) + return result + + +def _import_built_module(module_name: str, workdir: Path): + sys.modules.pop(module_name, None) + sys.path.insert(0, str(workdir)) + try: + return importlib.import_module(module_name) + finally: + sys.path.remove(str(workdir)) + + +@pytest.fixture(scope="session") +def prik_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltBLAS: + """Build and import the complete source set through PRIK once.""" + compiler = _compiler() + workdir = tmp_path_factory.mktemp("prik-reference-blas") + module_name = "prik_reference_blas" + jobs = max(1, min(os.cpu_count() or 1, 8)) + command = ( + sys.executable, + "-m", + "prik", + *(str(source) for source in BLAS_SOURCES), + "--out", + module_name, + "--out-dir", + str(workdir / "generated"), + "--compiler", + compiler, + "--jobs", + str(jobs), + f"--native-compile-flags={BUILD_FLAGS}", + f"--wrapper-fortran-flags={BUILD_FLAGS}", + f"--wrapper-c-flags={BUILD_FLAGS}", + ) + result = _run_build(command, workdir, compiler) + return BuiltBLAS( + module=_import_built_module(module_name, workdir), + module_name=module_name, + workdir=workdir, + command=command, + compiler_identity=_compiler_identity(compiler), + stdout=result.stdout, + stderr=result.stderr, + ) + + +@pytest.fixture(scope="session") +def f2py_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltBLAS: + """Build and import the identical complete source set through f2py once.""" + compiler = _compiler() + workdir = tmp_path_factory.mktemp("f2py-reference-blas") + module_name = "f2py_reference_blas" + command = ( + sys.executable, + "-m", + "numpy.f2py", + "-c", + "-m", + module_name, + *(str(source) for source in BLAS_SOURCES), + "--build-dir", + str(workdir / "generated"), + f"--f77flags={BUILD_FLAGS}", + f"--f90flags={BUILD_FLAGS}", + f"--opt={BUILD_FLAGS}", + ) + result = _run_build(command, workdir, compiler) + return BuiltBLAS( + module=_import_built_module(module_name, workdir), + module_name=module_name, + workdir=workdir, + command=command, + compiler_identity=_compiler_identity(compiler), + stdout=result.stdout, + stderr=result.stderr, + ) + + +@pytest.fixture(scope="session") +def prik_blas(prik_build: BuiltBLAS): + """Return the session-scoped PRIK module.""" + return prik_build.module + + +@pytest.fixture(scope="session") +def f2py_blas(f2py_build: BuiltBLAS): + """Return the session-scoped f2py module.""" + return f2py_build.module diff --git a/examples/blas/helpers.py b/examples/blas/helpers.py new file mode 100644 index 000000000..eb6f149a8 --- /dev/null +++ b/examples/blas/helpers.py @@ -0,0 +1,220 @@ +"""Small numerical and storage helpers used by the readable BLAS tests.""" + +from __future__ import annotations + +import numpy as np + + +def assert_allclose_for_dtype(actual, expected, *, operation_size: int = 1) -> None: + """Compare floating values with dtype- and accumulation-aware tolerances.""" + actual_array = np.asarray(actual) + expected_array = np.asarray(expected) + dtype = np.result_type(actual_array.dtype, expected_array.dtype) + real_dtype = np.empty((), dtype=dtype).real.dtype + epsilon = np.finfo(real_dtype).eps + scale = max(1, operation_size) + magnitude = max(1.0, float(np.max(np.abs(expected_array), initial=0.0))) + np.testing.assert_allclose( + actual_array, + expected_array, + rtol=epsilon * 8 * scale, + atol=epsilon * 8 * scale * magnitude, + ) + + +def logical_indices(n: int, increment: int) -> np.ndarray: + """Return zero-based storage positions visited by a native BLAS vector.""" + if n <= 0: + return np.array([], dtype=np.intp) + start = 0 if increment > 0 else (n - 1) * (-increment) + return start + np.arange(n, dtype=np.intp) * increment + + +def logical_vector(storage: np.ndarray, n: int, increment: int) -> np.ndarray: + """Copy the logical BLAS vector represented by storage and an increment.""" + return storage[logical_indices(n, increment)].copy() + + +def assert_storage_unchanged(actual: np.ndarray, original: np.ndarray) -> None: + """Require exact preservation, including NaNs and sentinel padding.""" + np.testing.assert_array_equal(actual, original, strict=True) + + +def with_logical_vector( + original: np.ndarray, + values: np.ndarray, + n: int, + increment: int, +) -> np.ndarray: + """Return storage with only the logical BLAS vector positions replaced.""" + expected = original.copy() + expected[logical_indices(n, increment)] = values + return expected + + +def symmetric_from_triangle(storage: np.ndarray, n: int, uplo: str) -> np.ndarray: + """Reconstruct a logical symmetric matrix without reading the unused triangle.""" + active = storage[:n, :n] + triangle = np.triu(active) if uplo.upper() == "U" else np.tril(active) + return triangle + triangle.T - np.diag(np.diag(triangle)) + + +def hermitian_from_triangle(storage: np.ndarray, n: int, uplo: str) -> np.ndarray: + """Reconstruct a Hermitian matrix and discard stored diagonal imaginary parts.""" + active = storage[:n, :n] + triangle = np.triu(active) if uplo.upper() == "U" else np.tril(active) + diagonal = np.diag(np.real(np.diag(triangle))).astype(storage.dtype) + return triangle + triangle.conj().T - np.diag(np.diag(triangle)) - np.diag(np.diag(triangle).conj()) + diagonal + + +def triangular_from_triangle( + storage: np.ndarray, + n: int, + uplo: str, + *, + unit_diagonal: bool, +) -> np.ndarray: + """Reconstruct a triangular matrix without inspecting unused or unit diagonal data.""" + active = storage[:n, :n] + if uplo.upper() == "U": + triangle = np.triu(active, k=1 if unit_diagonal else 0) + else: + triangle = np.tril(active, k=-1 if unit_diagonal else 0) + if unit_diagonal: + triangle = triangle + np.eye(n, dtype=storage.dtype) + return triangle + + +def packed_from_triangle(matrix: np.ndarray, uplo: str) -> np.ndarray: + """Pack one matrix triangle in the column-major BLAS packed format.""" + n = matrix.shape[0] + if uplo.upper() == "U": + values = [matrix[row, column] for column in range(n) for row in range(column + 1)] + else: + values = [matrix[row, column] for column in range(n) for row in range(column, n)] + return np.asarray(values, dtype=matrix.dtype) + + +def symmetric_from_packed(packed: np.ndarray, n: int, uplo: str) -> np.ndarray: + """Reconstruct a symmetric matrix from packed BLAS storage.""" + triangle = np.zeros((n, n), dtype=packed.dtype) + index = 0 + if uplo.upper() == "U": + for column in range(n): + for row in range(column + 1): + triangle[row, column] = packed[index] + index += 1 + else: + for column in range(n): + for row in range(column, n): + triangle[row, column] = packed[index] + index += 1 + return triangle + triangle.T - np.diag(np.diag(triangle)) + + +def hermitian_from_packed(packed: np.ndarray, n: int, uplo: str) -> np.ndarray: + """Reconstruct a Hermitian matrix from packed BLAS storage.""" + triangle = np.zeros((n, n), dtype=packed.dtype) + index = 0 + if uplo.upper() == "U": + for column in range(n): + for row in range(column + 1): + triangle[row, column] = packed[index] + index += 1 + else: + for column in range(n): + for row in range(column, n): + triangle[row, column] = packed[index] + index += 1 + diagonal = np.diag(np.real(np.diag(triangle))).astype(packed.dtype) + return triangle + triangle.conj().T - np.diag(np.diag(triangle)) - np.diag(np.diag(triangle).conj()) + diagonal + + +def triangular_from_packed( + packed: np.ndarray, + n: int, + uplo: str, + *, + unit_diagonal: bool, +) -> np.ndarray: + """Reconstruct a triangular matrix from packed BLAS storage.""" + triangle = np.zeros((n, n), dtype=packed.dtype) + index = 0 + if uplo.upper() == "U": + for column in range(n): + for row in range(column + 1): + if not unit_diagonal or row != column: + triangle[row, column] = packed[index] + index += 1 + else: + for column in range(n): + for row in range(column, n): + if not unit_diagonal or row != column: + triangle[row, column] = packed[index] + index += 1 + if unit_diagonal: + triangle += np.eye(n, dtype=packed.dtype) + return triangle + + +def general_from_band(storage: np.ndarray, m: int, n: int, kl: int, ku: int) -> np.ndarray: + """Reconstruct an m-by-n matrix from general band storage.""" + matrix = np.zeros((m, n), dtype=storage.dtype) + for column in range(n): + for row in range(max(0, column - ku), min(m, column + kl + 1)): + matrix[row, column] = storage[ku + row - column, column] + return matrix + + +def symmetric_from_band(storage: np.ndarray, n: int, k: int, uplo: str) -> np.ndarray: + """Reconstruct a symmetric matrix from symmetric band storage.""" + triangle = np.zeros((n, n), dtype=storage.dtype) + if uplo.upper() == "U": + for column in range(n): + for row in range(max(0, column - k), column + 1): + triangle[row, column] = storage[k + row - column, column] + else: + for column in range(n): + for row in range(column, min(n, column + k + 1)): + triangle[row, column] = storage[row - column, column] + return triangle + triangle.T - np.diag(np.diag(triangle)) + + +def hermitian_from_band(storage: np.ndarray, n: int, k: int, uplo: str) -> np.ndarray: + """Reconstruct a Hermitian matrix from Hermitian band storage.""" + triangle = np.zeros((n, n), dtype=storage.dtype) + if uplo.upper() == "U": + for column in range(n): + for row in range(max(0, column - k), column + 1): + triangle[row, column] = storage[k + row - column, column] + else: + for column in range(n): + for row in range(column, min(n, column + k + 1)): + triangle[row, column] = storage[row - column, column] + diagonal = np.diag(np.real(np.diag(triangle))).astype(storage.dtype) + return triangle + triangle.conj().T - np.diag(np.diag(triangle)) - np.diag(np.diag(triangle).conj()) + diagonal + + +def triangular_from_band( + storage: np.ndarray, + n: int, + k: int, + uplo: str, + *, + unit_diagonal: bool, +) -> np.ndarray: + """Reconstruct a triangular matrix from triangular band storage.""" + triangle = np.zeros((n, n), dtype=storage.dtype) + if uplo.upper() == "U": + for column in range(n): + for row in range(max(0, column - k), column + 1): + if not unit_diagonal or row != column: + triangle[row, column] = storage[k + row - column, column] + else: + for column in range(n): + for row in range(column, min(n, column + k + 1)): + if not unit_diagonal or row != column: + triangle[row, column] = storage[row - column, column] + if unit_diagonal: + triangle += np.eye(n, dtype=storage.dtype) + return triangle diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/caxpy.f b/examples/blas/native/caxpy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/caxpy.f rename to examples/blas/native/caxpy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ccopy.f b/examples/blas/native/ccopy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ccopy.f rename to examples/blas/native/ccopy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cdotc.f b/examples/blas/native/cdotc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cdotc.f rename to examples/blas/native/cdotc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cdotu.f b/examples/blas/native/cdotu.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cdotu.f rename to examples/blas/native/cdotu.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgbmv.f b/examples/blas/native/cgbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgbmv.f rename to examples/blas/native/cgbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgemm.f b/examples/blas/native/cgemm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgemm.f rename to examples/blas/native/cgemm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgemmtr.f b/examples/blas/native/cgemmtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgemmtr.f rename to examples/blas/native/cgemmtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgemv.f b/examples/blas/native/cgemv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgemv.f rename to examples/blas/native/cgemv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgerc.f b/examples/blas/native/cgerc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgerc.f rename to examples/blas/native/cgerc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgeru.f b/examples/blas/native/cgeru.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cgeru.f rename to examples/blas/native/cgeru.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chbmv.f b/examples/blas/native/chbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chbmv.f rename to examples/blas/native/chbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chemm.f b/examples/blas/native/chemm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chemm.f rename to examples/blas/native/chemm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chemv.f b/examples/blas/native/chemv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chemv.f rename to examples/blas/native/chemv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cher.f b/examples/blas/native/cher.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cher.f rename to examples/blas/native/cher.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cher2.f b/examples/blas/native/cher2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cher2.f rename to examples/blas/native/cher2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cher2k.f b/examples/blas/native/cher2k.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cher2k.f rename to examples/blas/native/cher2k.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cherk.f b/examples/blas/native/cherk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cherk.f rename to examples/blas/native/cherk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chpmv.f b/examples/blas/native/chpmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chpmv.f rename to examples/blas/native/chpmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chpr.f b/examples/blas/native/chpr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chpr.f rename to examples/blas/native/chpr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chpr2.f b/examples/blas/native/chpr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/chpr2.f rename to examples/blas/native/chpr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/crotg.f90 b/examples/blas/native/crotg.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/crotg.f90 rename to examples/blas/native/crotg.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cscal.f b/examples/blas/native/cscal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cscal.f rename to examples/blas/native/cscal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/csrot.f b/examples/blas/native/csrot.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/csrot.f rename to examples/blas/native/csrot.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/csscal.f b/examples/blas/native/csscal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/csscal.f rename to examples/blas/native/csscal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cswap.f b/examples/blas/native/cswap.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/cswap.f rename to examples/blas/native/cswap.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/csymm.f b/examples/blas/native/csymm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/csymm.f rename to examples/blas/native/csymm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/csyr2k.f b/examples/blas/native/csyr2k.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/csyr2k.f rename to examples/blas/native/csyr2k.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/csyrk.f b/examples/blas/native/csyrk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/csyrk.f rename to examples/blas/native/csyrk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctbmv.f b/examples/blas/native/ctbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctbmv.f rename to examples/blas/native/ctbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctbsv.f b/examples/blas/native/ctbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctbsv.f rename to examples/blas/native/ctbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctpmv.f b/examples/blas/native/ctpmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctpmv.f rename to examples/blas/native/ctpmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctpsv.f b/examples/blas/native/ctpsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctpsv.f rename to examples/blas/native/ctpsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctrmm.f b/examples/blas/native/ctrmm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctrmm.f rename to examples/blas/native/ctrmm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctrmv.f b/examples/blas/native/ctrmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctrmv.f rename to examples/blas/native/ctrmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctrsm.f b/examples/blas/native/ctrsm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctrsm.f rename to examples/blas/native/ctrsm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctrsv.f b/examples/blas/native/ctrsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ctrsv.f rename to examples/blas/native/ctrsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dasum.f b/examples/blas/native/dasum.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dasum.f rename to examples/blas/native/dasum.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/daxpy.f b/examples/blas/native/daxpy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/daxpy.f rename to examples/blas/native/daxpy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dcabs1.f b/examples/blas/native/dcabs1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dcabs1.f rename to examples/blas/native/dcabs1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dcopy.f b/examples/blas/native/dcopy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dcopy.f rename to examples/blas/native/dcopy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ddot.f b/examples/blas/native/ddot.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ddot.f rename to examples/blas/native/ddot.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dgbmv.f b/examples/blas/native/dgbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dgbmv.f rename to examples/blas/native/dgbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dgemm.f b/examples/blas/native/dgemm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dgemm.f rename to examples/blas/native/dgemm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dgemmtr.f b/examples/blas/native/dgemmtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dgemmtr.f rename to examples/blas/native/dgemmtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dgemv.f b/examples/blas/native/dgemv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dgemv.f rename to examples/blas/native/dgemv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dger.f b/examples/blas/native/dger.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dger.f rename to examples/blas/native/dger.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dnrm2.f90 b/examples/blas/native/dnrm2.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dnrm2.f90 rename to examples/blas/native/dnrm2.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/drot.f b/examples/blas/native/drot.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/drot.f rename to examples/blas/native/drot.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/drotg.f90 b/examples/blas/native/drotg.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/drotg.f90 rename to examples/blas/native/drotg.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/drotm.f b/examples/blas/native/drotm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/drotm.f rename to examples/blas/native/drotm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/drotmg.f b/examples/blas/native/drotmg.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/drotmg.f rename to examples/blas/native/drotmg.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsbmv.f b/examples/blas/native/dsbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsbmv.f rename to examples/blas/native/dsbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dscal.f b/examples/blas/native/dscal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dscal.f rename to examples/blas/native/dscal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsdot.f b/examples/blas/native/dsdot.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsdot.f rename to examples/blas/native/dsdot.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dspmv.f b/examples/blas/native/dspmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dspmv.f rename to examples/blas/native/dspmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dspr.f b/examples/blas/native/dspr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dspr.f rename to examples/blas/native/dspr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dspr2.f b/examples/blas/native/dspr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dspr2.f rename to examples/blas/native/dspr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dswap.f b/examples/blas/native/dswap.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dswap.f rename to examples/blas/native/dswap.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsymm.f b/examples/blas/native/dsymm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsymm.f rename to examples/blas/native/dsymm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsymv.f b/examples/blas/native/dsymv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsymv.f rename to examples/blas/native/dsymv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsyr.f b/examples/blas/native/dsyr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsyr.f rename to examples/blas/native/dsyr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsyr2.f b/examples/blas/native/dsyr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsyr2.f rename to examples/blas/native/dsyr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsyr2k.f b/examples/blas/native/dsyr2k.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsyr2k.f rename to examples/blas/native/dsyr2k.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsyrk.f b/examples/blas/native/dsyrk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dsyrk.f rename to examples/blas/native/dsyrk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtbmv.f b/examples/blas/native/dtbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtbmv.f rename to examples/blas/native/dtbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtbsv.f b/examples/blas/native/dtbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtbsv.f rename to examples/blas/native/dtbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtpmv.f b/examples/blas/native/dtpmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtpmv.f rename to examples/blas/native/dtpmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtpsv.f b/examples/blas/native/dtpsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtpsv.f rename to examples/blas/native/dtpsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtrmm.f b/examples/blas/native/dtrmm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtrmm.f rename to examples/blas/native/dtrmm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtrmv.f b/examples/blas/native/dtrmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtrmv.f rename to examples/blas/native/dtrmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtrsm.f b/examples/blas/native/dtrsm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtrsm.f rename to examples/blas/native/dtrsm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtrsv.f b/examples/blas/native/dtrsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dtrsv.f rename to examples/blas/native/dtrsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dzasum.f b/examples/blas/native/dzasum.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dzasum.f rename to examples/blas/native/dzasum.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dznrm2.f90 b/examples/blas/native/dznrm2.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/dznrm2.f90 rename to examples/blas/native/dznrm2.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/icamax.f b/examples/blas/native/icamax.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/icamax.f rename to examples/blas/native/icamax.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/idamax.f b/examples/blas/native/idamax.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/idamax.f rename to examples/blas/native/idamax.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/isamax.f b/examples/blas/native/isamax.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/isamax.f rename to examples/blas/native/isamax.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/izamax.f b/examples/blas/native/izamax.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/izamax.f rename to examples/blas/native/izamax.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/lsame.f b/examples/blas/native/lsame.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/lsame.f rename to examples/blas/native/lsame.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sasum.f b/examples/blas/native/sasum.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sasum.f rename to examples/blas/native/sasum.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/saxpy.f b/examples/blas/native/saxpy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/saxpy.f rename to examples/blas/native/saxpy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/scabs1.f b/examples/blas/native/scabs1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/scabs1.f rename to examples/blas/native/scabs1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/scasum.f b/examples/blas/native/scasum.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/scasum.f rename to examples/blas/native/scasum.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/scnrm2.f90 b/examples/blas/native/scnrm2.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/scnrm2.f90 rename to examples/blas/native/scnrm2.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/scopy.f b/examples/blas/native/scopy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/scopy.f rename to examples/blas/native/scopy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sdot.f b/examples/blas/native/sdot.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sdot.f rename to examples/blas/native/sdot.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sdsdot.f b/examples/blas/native/sdsdot.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sdsdot.f rename to examples/blas/native/sdsdot.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sgbmv.f b/examples/blas/native/sgbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sgbmv.f rename to examples/blas/native/sgbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sgemm.f b/examples/blas/native/sgemm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sgemm.f rename to examples/blas/native/sgemm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sgemmtr.f b/examples/blas/native/sgemmtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sgemmtr.f rename to examples/blas/native/sgemmtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sgemv.f b/examples/blas/native/sgemv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sgemv.f rename to examples/blas/native/sgemv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sger.f b/examples/blas/native/sger.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sger.f rename to examples/blas/native/sger.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/snrm2.f90 b/examples/blas/native/snrm2.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/snrm2.f90 rename to examples/blas/native/snrm2.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/srot.f b/examples/blas/native/srot.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/srot.f rename to examples/blas/native/srot.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/srotg.f90 b/examples/blas/native/srotg.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/srotg.f90 rename to examples/blas/native/srotg.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/srotm.f b/examples/blas/native/srotm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/srotm.f rename to examples/blas/native/srotm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/srotmg.f b/examples/blas/native/srotmg.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/srotmg.f rename to examples/blas/native/srotmg.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssbmv.f b/examples/blas/native/ssbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssbmv.f rename to examples/blas/native/ssbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sscal.f b/examples/blas/native/sscal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sscal.f rename to examples/blas/native/sscal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sspmv.f b/examples/blas/native/sspmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sspmv.f rename to examples/blas/native/sspmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sspr.f b/examples/blas/native/sspr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sspr.f rename to examples/blas/native/sspr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sspr2.f b/examples/blas/native/sspr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sspr2.f rename to examples/blas/native/sspr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sswap.f b/examples/blas/native/sswap.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/sswap.f rename to examples/blas/native/sswap.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssymm.f b/examples/blas/native/ssymm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssymm.f rename to examples/blas/native/ssymm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssymv.f b/examples/blas/native/ssymv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssymv.f rename to examples/blas/native/ssymv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssyr.f b/examples/blas/native/ssyr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssyr.f rename to examples/blas/native/ssyr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssyr2.f b/examples/blas/native/ssyr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssyr2.f rename to examples/blas/native/ssyr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssyr2k.f b/examples/blas/native/ssyr2k.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssyr2k.f rename to examples/blas/native/ssyr2k.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssyrk.f b/examples/blas/native/ssyrk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ssyrk.f rename to examples/blas/native/ssyrk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/stbmv.f b/examples/blas/native/stbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/stbmv.f rename to examples/blas/native/stbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/stbsv.f b/examples/blas/native/stbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/stbsv.f rename to examples/blas/native/stbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/stpmv.f b/examples/blas/native/stpmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/stpmv.f rename to examples/blas/native/stpmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/stpsv.f b/examples/blas/native/stpsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/stpsv.f rename to examples/blas/native/stpsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/strmm.f b/examples/blas/native/strmm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/strmm.f rename to examples/blas/native/strmm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/strmv.f b/examples/blas/native/strmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/strmv.f rename to examples/blas/native/strmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/strsm.f b/examples/blas/native/strsm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/strsm.f rename to examples/blas/native/strsm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/strsv.f b/examples/blas/native/strsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/strsv.f rename to examples/blas/native/strsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/xerbla.f b/examples/blas/native/xerbla.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/xerbla.f rename to examples/blas/native/xerbla.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/xerbla_array.f b/examples/blas/native/xerbla_array.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/xerbla_array.f rename to examples/blas/native/xerbla_array.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zaxpy.f b/examples/blas/native/zaxpy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zaxpy.f rename to examples/blas/native/zaxpy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zcopy.f b/examples/blas/native/zcopy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zcopy.f rename to examples/blas/native/zcopy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zdotc.f b/examples/blas/native/zdotc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zdotc.f rename to examples/blas/native/zdotc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zdotu.f b/examples/blas/native/zdotu.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zdotu.f rename to examples/blas/native/zdotu.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zdrot.f b/examples/blas/native/zdrot.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zdrot.f rename to examples/blas/native/zdrot.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zdscal.f b/examples/blas/native/zdscal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zdscal.f rename to examples/blas/native/zdscal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgbmv.f b/examples/blas/native/zgbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgbmv.f rename to examples/blas/native/zgbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgemm.f b/examples/blas/native/zgemm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgemm.f rename to examples/blas/native/zgemm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgemmtr.f b/examples/blas/native/zgemmtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgemmtr.f rename to examples/blas/native/zgemmtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgemv.f b/examples/blas/native/zgemv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgemv.f rename to examples/blas/native/zgemv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgerc.f b/examples/blas/native/zgerc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgerc.f rename to examples/blas/native/zgerc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgeru.f b/examples/blas/native/zgeru.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zgeru.f rename to examples/blas/native/zgeru.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhbmv.f b/examples/blas/native/zhbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhbmv.f rename to examples/blas/native/zhbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhemm.f b/examples/blas/native/zhemm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhemm.f rename to examples/blas/native/zhemm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhemv.f b/examples/blas/native/zhemv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhemv.f rename to examples/blas/native/zhemv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zher.f b/examples/blas/native/zher.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zher.f rename to examples/blas/native/zher.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zher2.f b/examples/blas/native/zher2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zher2.f rename to examples/blas/native/zher2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zher2k.f b/examples/blas/native/zher2k.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zher2k.f rename to examples/blas/native/zher2k.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zherk.f b/examples/blas/native/zherk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zherk.f rename to examples/blas/native/zherk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhpmv.f b/examples/blas/native/zhpmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhpmv.f rename to examples/blas/native/zhpmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhpr.f b/examples/blas/native/zhpr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhpr.f rename to examples/blas/native/zhpr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhpr2.f b/examples/blas/native/zhpr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zhpr2.f rename to examples/blas/native/zhpr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zrotg.f90 b/examples/blas/native/zrotg.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zrotg.f90 rename to examples/blas/native/zrotg.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zscal.f b/examples/blas/native/zscal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zscal.f rename to examples/blas/native/zscal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zswap.f b/examples/blas/native/zswap.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zswap.f rename to examples/blas/native/zswap.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zsymm.f b/examples/blas/native/zsymm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zsymm.f rename to examples/blas/native/zsymm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zsyr2k.f b/examples/blas/native/zsyr2k.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zsyr2k.f rename to examples/blas/native/zsyr2k.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zsyrk.f b/examples/blas/native/zsyrk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/zsyrk.f rename to examples/blas/native/zsyrk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztbmv.f b/examples/blas/native/ztbmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztbmv.f rename to examples/blas/native/ztbmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztbsv.f b/examples/blas/native/ztbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztbsv.f rename to examples/blas/native/ztbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztpmv.f b/examples/blas/native/ztpmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztpmv.f rename to examples/blas/native/ztpmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztpsv.f b/examples/blas/native/ztpsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztpsv.f rename to examples/blas/native/ztpsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztrmm.f b/examples/blas/native/ztrmm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztrmm.f rename to examples/blas/native/ztrmm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztrmv.f b/examples/blas/native/ztrmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztrmv.f rename to examples/blas/native/ztrmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztrsm.f b/examples/blas/native/ztrsm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztrsm.f rename to examples/blas/native/ztrsm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztrsv.f b/examples/blas/native/ztrsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/blas/native/ztrsv.f rename to examples/blas/native/ztrsv.f diff --git a/examples/blas/routine_inventory.py b/examples/blas/routine_inventory.py new file mode 100644 index 000000000..48291db8e --- /dev/null +++ b/examples/blas/routine_inventory.py @@ -0,0 +1,213 @@ +"""Authoritative classification and coverage expectations for reference BLAS.""" + +from __future__ import annotations + + +ROUTINE_GROUPS: dict[str, tuple[str, ...]] = { + "BLAS Level 1 real": ( + "sasum", + "dasum", + "saxpy", + "daxpy", + "scopy", + "dcopy", + "sdot", + "ddot", + "sdsdot", + "dsdot", + "snrm2", + "dnrm2", + "srot", + "drot", + "srotg", + "drotg", + "srotm", + "drotm", + "srotmg", + "drotmg", + "sscal", + "dscal", + "sswap", + "dswap", + "isamax", + "idamax", + ), + "BLAS Level 1 complex": ( + "scasum", + "dzasum", + "caxpy", + "zaxpy", + "ccopy", + "zcopy", + "cdotc", + "zdotc", + "cdotu", + "zdotu", + "scnrm2", + "dznrm2", + "crotg", + "zrotg", + "cscal", + "zscal", + "csscal", + "zdscal", + "csrot", + "zdrot", + "cswap", + "zswap", + "icamax", + "izamax", + ), + "BLAS Level 2 general": ( + "sgemv", + "dgemv", + "cgemv", + "zgemv", + "sger", + "dger", + "cgeru", + "zgeru", + "cgerc", + "zgerc", + ), + "BLAS Level 2 symmetric": ( + "ssymv", + "dsymv", + "ssyr", + "dsyr", + "ssyr2", + "dsyr2", + ), + "BLAS Level 2 Hermitian": ( + "chemv", + "zhemv", + "cher", + "zher", + "cher2", + "zher2", + ), + "BLAS Level 2 triangular": ( + "strmv", + "dtrmv", + "ctrmv", + "ztrmv", + "strsv", + "dtrsv", + "ctrsv", + "ztrsv", + ), + "BLAS Level 2 packed": ( + "sspmv", + "dspmv", + "sspr", + "dspr", + "sspr2", + "dspr2", + "chpmv", + "zhpmv", + "chpr", + "zhpr", + "chpr2", + "zhpr2", + "stpmv", + "dtpmv", + "ctpmv", + "ztpmv", + "stpsv", + "dtpsv", + "ctpsv", + "ztpsv", + ), + "BLAS Level 2 banded": ( + "sgbmv", + "dgbmv", + "cgbmv", + "zgbmv", + "ssbmv", + "dsbmv", + "chbmv", + "zhbmv", + "stbmv", + "dtbmv", + "ctbmv", + "ztbmv", + "stbsv", + "dtbsv", + "ctbsv", + "ztbsv", + ), + "BLAS Level 3 general": ( + "sgemm", + "dgemm", + "cgemm", + "zgemm", + "sgemmtr", + "dgemmtr", + "cgemmtr", + "zgemmtr", + ), + "BLAS Level 3 symmetric": ( + "ssymm", + "dsymm", + "csymm", + "zsymm", + "ssyrk", + "dsyrk", + "csyrk", + "zsyrk", + "ssyr2k", + "dsyr2k", + "csyr2k", + "zsyr2k", + ), + "BLAS Level 3 Hermitian": ( + "chemm", + "zhemm", + "cherk", + "zherk", + "cher2k", + "zher2k", + ), + "BLAS Level 3 triangular": ( + "strmm", + "dtrmm", + "ctrmm", + "ztrmm", + "strsm", + "dtrsm", + "ctrsm", + "ztrsm", + ), + "Auxiliary and error reporting": ( + "scabs1", + "dcabs1", + "lsame", + "xerbla", + "xerbla_array", + ), +} + +ALL_ROUTINES = tuple(routine for routines in ROUTINE_GROUPS.values() for routine in routines) +PRIK_TESTED_ROUTINES = frozenset(ALL_ROUTINES) + +# f2py infers these scalar arguments as input-only from the unannotated reference +# sources. The native calls run, but updated scalar values are not projected back +# to Python. Their tests validate PRIK completely and compare any observable f2py +# array mutation. +F2PY_LIMITATIONS: dict[str, str] = { + "srotg": "f2py returns None and exposes none of the four updated scalar arguments", + "drotg": "f2py returns None and exposes none of the four updated scalar arguments", + "crotg": "f2py returns None and exposes none of the four updated scalar arguments", + "zrotg": "f2py returns None and exposes none of the four updated scalar arguments", + "srotmg": "f2py exposes PARAM mutation but not the updated D1, D2, and X1 scalars", + "drotmg": "f2py exposes PARAM mutation but not the updated D1, D2, and X1 scalars", +} + +DIFFERENTIALLY_TESTED_ROUTINES = frozenset(ALL_ROUTINES) - F2PY_LIMITATIONS.keys() + +UNSUPPORTED_ROUTINES: dict[str, str] = {} +PERMANENTLY_SKIPPED_ROUTINES: dict[str, str] = {} + +EXPLICIT_TEST_NAMES = {routine: f"test_{routine}" for routine in ALL_ROUTINES} +EXPLICIT_TEST_NAMES["dgemv"] = "test_dgemv_no_transpose" +EXPLICIT_TEST_NAMES["dtrsv"] = "test_dtrsv_upper_nonunit" diff --git a/examples/blas/test_auxiliary.py b/examples/blas/test_auxiliary.py new file mode 100644 index 000000000..f2488e500 --- /dev/null +++ b/examples/blas/test_auxiliary.py @@ -0,0 +1,148 @@ +"""Checks for the reference BLAS auxiliary and error-reporting routines.""" + +from __future__ import annotations + +import os +import subprocess +import sys + +import numpy as np +import pytest + +from helpers import assert_allclose_for_dtype + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_scabs1(prik_blas, f2py_blas): + value = np.complex64(-3.0 + 4.0j) + + prik_result, prik_value = prik_blas.scabs1(value) + f2py_result = f2py_blas.scabs1(value) + + expected = np.float32(abs(value.real) + abs(value.imag)) + assert_allclose_for_dtype(prik_result, expected) + assert_allclose_for_dtype(f2py_result, expected) + assert_allclose_for_dtype(prik_result, f2py_result) + assert prik_value == value + assert prik_result.dtype == np.dtype(np.float32) + + +def test_dcabs1(prik_blas, f2py_blas): + value = np.complex128(-3.0 + 4.0j) + + prik_result, prik_value = prik_blas.dcabs1(value) + f2py_result = f2py_blas.dcabs1(value) + + expected = np.float64(abs(value.real) + abs(value.imag)) + assert_allclose_for_dtype(prik_result, expected) + assert_allclose_for_dtype(f2py_result, expected) + assert_allclose_for_dtype(prik_result, f2py_result) + assert prik_value == value + assert isinstance(prik_result, float) + + +def test_lsame(prik_blas, f2py_blas): + prik_equal = prik_blas.lsame("n", "N") + f2py_equal = f2py_blas.lsame(b"n", b"N") + prik_different = prik_blas.lsame("N", "T") + f2py_different = f2py_blas.lsame(b"N", b"T") + + assert prik_equal is True + assert f2py_equal == 1 + assert bool(prik_equal) == bool(f2py_equal) + assert prik_different is False + assert f2py_different == 0 + assert bool(prik_different) == bool(f2py_different) + + +def test_xerbla(prik_build, f2py_build): + prik_environment = dict(os.environ) + prik_environment["PYTHONPATH"] = os.pathsep.join( + filter(None, (str(prik_build.workdir), prik_environment.get("PYTHONPATH"))) + ) + f2py_environment = dict(os.environ) + f2py_environment["PYTHONPATH"] = os.pathsep.join( + filter(None, (str(f2py_build.workdir), f2py_environment.get("PYTHONPATH"))) + ) + + prik_result = subprocess.run( # nosec B603 - fixed interpreter and test program + ( + sys.executable, + "-c", + "import numpy as np, prik_reference_blas as blas; blas.xerbla('DTEST ', np.int32(3))", + ), + env=prik_environment, + capture_output=True, + text=True, + check=False, + ) + f2py_result = subprocess.run( # nosec B603 - fixed interpreter and test program + ( + sys.executable, + "-c", + "import numpy as np, f2py_reference_blas as blas; blas.xerbla(b'DTEST ', np.int32(3))", + ), + env=f2py_environment, + capture_output=True, + text=True, + check=False, + ) + + expected_message = "On entry to DTEST parameter number 3 had an illegal value" + assert prik_result.returncode == 0 + assert f2py_result.returncode == 0 + assert expected_message in prik_result.stdout + assert expected_message in f2py_result.stdout + assert prik_result.stdout == f2py_result.stdout + assert prik_result.stderr == "" + assert f2py_result.stderr == "" + + +def test_xerbla_array(prik_build, f2py_build): + prik_environment = dict(os.environ) + prik_environment["PYTHONPATH"] = os.pathsep.join( + filter(None, (str(prik_build.workdir), prik_environment.get("PYTHONPATH"))) + ) + f2py_environment = dict(os.environ) + f2py_environment["PYTHONPATH"] = os.pathsep.join( + filter(None, (str(f2py_build.workdir), f2py_environment.get("PYTHONPATH"))) + ) + + prik_result = subprocess.run( # nosec B603 - fixed interpreter and test program + ( + sys.executable, + "-c", + "import numpy as np, prik_reference_blas as blas; " + "name=np.frombuffer(b'DTEST ', dtype='S1').copy(); " + "blas.xerbla_array(name, np.int32(6), np.int32(4))", + ), + env=prik_environment, + capture_output=True, + text=True, + check=False, + ) + # f2py infers SRNAME_LEN and therefore exposes it as an optional keyword. + f2py_result = subprocess.run( # nosec B603 - fixed interpreter and test program + ( + sys.executable, + "-c", + "import numpy as np, f2py_reference_blas as blas; " + "name=np.frombuffer(b'DTEST ', dtype='S1').copy(); " + "blas.xerbla_array(name, np.int32(4), srname_len=np.int32(6))", + ), + env=f2py_environment, + capture_output=True, + text=True, + check=False, + ) + + expected_message = "On entry to DTEST parameter number 4 had an illegal value" + assert prik_result.returncode == 0 + assert f2py_result.returncode == 0 + assert expected_message in prik_result.stdout + assert expected_message in f2py_result.stdout + assert prik_result.stdout == f2py_result.stdout + assert prik_result.stderr == "" + assert f2py_result.stderr == "" diff --git a/examples/blas/test_level1_complex.py b/examples/blas/test_level1_complex.py new file mode 100644 index 000000000..105e2b8f7 --- /dev/null +++ b/examples/blas/test_level1_complex.py @@ -0,0 +1,406 @@ +"""Readable independent and differential checks for complex BLAS Level 1.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import ( + assert_allclose_for_dtype, + assert_storage_unchanged, + logical_vector, + with_logical_vector, +) + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_caxpy(prik_blas, f2py_blas): + alpha = np.complex64(1.5 - 0.5j) + x = np.array([1.0 + 2.0j, -2.0 + 1.0j, 0.5 - 3.0j], dtype=np.complex64) + original_y = np.array([3.0 - 1.0j, 2.0 + 4.0j, -5.0 + 0.5j], dtype=np.complex64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_scalars = prik_blas.caxpy(np.int32(3), alpha, prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_result = f2py_blas.caxpy(np.int32(3), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected_y = alpha * x + original_y + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_y, f2py_y) + assert prik_scalars == (np.int32(3), alpha, np.int32(1), np.int32(1)) + assert f2py_result is None + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_zaxpy(prik_blas, f2py_blas): + alpha = np.complex128(-0.25 + 2.0j) + x = np.array([2.0 - 1.0j, 3.0 + 0.5j, -1.0 + 4.0j], dtype=np.complex128) + original_y = np.array([1.0 + 3.0j, -2.0 + 1.0j, 5.0 - 0.5j], dtype=np.complex128) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_scalars = prik_blas.zaxpy(np.int32(3), alpha, prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_result = f2py_blas.zaxpy(np.int32(3), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected_y = alpha * x + original_y + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_y, f2py_y) + assert prik_scalars == (np.int32(3), alpha, np.int32(1), np.int32(1)) + assert f2py_result is None + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_scasum(prik_blas, f2py_blas): + x = np.array([1.0 - 2.0j, 90.0j, -3.0 + 4.0j], dtype=np.complex64) + prik_x, f2py_x = x.copy(), x.copy() + + prik_value, *_ = prik_blas.scasum(np.int32(2), prik_x, np.int32(2)) + f2py_value = f2py_blas.scasum(np.int32(2), f2py_x, np.int32(2)) + + expected = np.float32(1.0 + 2.0 + 3.0 + 4.0) + assert_allclose_for_dtype(prik_value, expected, operation_size=2) + assert_allclose_for_dtype(f2py_value, expected, operation_size=2) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=2) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dzasum(prik_blas, f2py_blas): + x = np.array([1.5 - 2.5j, -3.0 + 4.0j], dtype=np.complex128) + prik_x, f2py_x = x.copy(), x.copy() + + prik_value, *_ = prik_blas.dzasum(np.int32(2), prik_x, np.int32(1)) + f2py_value = f2py_blas.dzasum(np.int32(2), f2py_x, np.int32(1)) + + expected = np.float64(1.5 + 2.5 + 3.0 + 4.0) + assert_allclose_for_dtype(prik_value, expected, operation_size=2) + assert_allclose_for_dtype(f2py_value, expected, operation_size=2) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=2) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_ccopy(prik_blas, f2py_blas): + x = np.array([1.0 + 2.0j, 90.0j, -3.0 + 4.0j], dtype=np.complex64) + original_y = np.array([5.0 - 1.0j, 80.0j, 6.0 + 2.0j], dtype=np.complex64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.ccopy(np.int32(2), prik_x, np.int32(2), prik_y, np.int32(2)) + f2py_blas.ccopy(np.int32(2), f2py_x, np.int32(2), f2py_y, np.int32(2)) + + expected_y = with_logical_vector(original_y, logical_vector(x, 2, 2), 2, 2) + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_y, f2py_y) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_zcopy(prik_blas, f2py_blas): + x = np.array([1.0 + 2.0j, -3.0 + 4.0j], dtype=np.complex128) + original_y = np.array([5.0 - 1.0j, 6.0 + 2.0j], dtype=np.complex128) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.zcopy(np.int32(2), prik_x, np.int32(-1), prik_y, np.int32(1)) + f2py_blas.zcopy(np.int32(2), f2py_x, np.int32(-1), f2py_y, np.int32(1)) + + expected_y = x[::-1] + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_y, f2py_y) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_cdotc(prik_blas, f2py_blas): + x = np.array([1.0 + 2.0j, -3.0 + 1.0j], dtype=np.complex64) + y = np.array([2.0 - 1.0j, 4.0 + 3.0j], dtype=np.complex64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_value, *_ = prik_blas.cdotc(np.int32(2), prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_value = f2py_blas.cdotc(np.int32(2), f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected = np.conj(x[0]) * y[0] + np.conj(x[1]) * y[1] + assert_allclose_for_dtype(prik_value, expected, operation_size=2) + assert_allclose_for_dtype(f2py_value, expected, operation_size=2) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=2) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_zdotc(prik_blas, f2py_blas): + x = np.array([1.0 + 2.0j, 90.0j, -3.0 + 1.0j], dtype=np.complex128) + y = np.array([2.0 - 1.0j, 4.0 + 3.0j], dtype=np.complex128) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_value, *_ = prik_blas.zdotc(np.int32(2), prik_x, np.int32(2), prik_y, np.int32(1)) + f2py_value = f2py_blas.zdotc(np.int32(2), f2py_x, np.int32(2), f2py_y, np.int32(1)) + + expected = np.conj(x[0]) * y[0] + np.conj(x[2]) * y[1] + assert_allclose_for_dtype(prik_value, expected, operation_size=2) + assert_allclose_for_dtype(f2py_value, expected, operation_size=2) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=2) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_cdotu(prik_blas, f2py_blas): + x = np.array([1.0 + 2.0j, -3.0 + 1.0j], dtype=np.complex64) + y = np.array([2.0 - 1.0j, 4.0 + 3.0j], dtype=np.complex64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_value, *_ = prik_blas.cdotu(np.int32(2), prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_value = f2py_blas.cdotu(np.int32(2), f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected = x[0] * y[0] + x[1] * y[1] + assert_allclose_for_dtype(prik_value, expected, operation_size=2) + assert_allclose_for_dtype(f2py_value, expected, operation_size=2) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=2) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_zdotu(prik_blas, f2py_blas): + x = np.array([1.0 + 2.0j, -3.0 + 1.0j], dtype=np.complex128) + y = np.array([2.0 - 1.0j, 4.0 + 3.0j], dtype=np.complex128) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_value, *_ = prik_blas.zdotu(np.int32(2), prik_x, np.int32(-1), prik_y, np.int32(1)) + f2py_value = f2py_blas.zdotu(np.int32(2), f2py_x, np.int32(-1), f2py_y, np.int32(1)) + + expected = x[1] * y[0] + x[0] * y[1] + assert_allclose_for_dtype(prik_value, expected, operation_size=2) + assert_allclose_for_dtype(f2py_value, expected, operation_size=2) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=2) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_scnrm2(prik_blas, f2py_blas): + x = np.array([3.0 + 0.0j, 90.0j, 0.0 + 4.0j], dtype=np.complex64) + prik_x, f2py_x = x.copy(), x.copy() + + prik_value, *_ = prik_blas.scnrm2(np.int32(2), prik_x, np.int32(2)) + f2py_value = f2py_blas.scnrm2(np.int32(2), f2py_x, np.int32(2)) + + expected = np.float32(np.sqrt(3.0**2 + 4.0**2)) + assert_allclose_for_dtype(prik_value, expected, operation_size=2) + assert_allclose_for_dtype(f2py_value, expected, operation_size=2) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=2) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dznrm2(prik_blas, f2py_blas): + x = np.array([1.0 + 2.0j, -3.0 + 4.0j], dtype=np.complex128) + prik_x, f2py_x = x.copy(), x.copy() + + prik_value, *_ = prik_blas.dznrm2(np.int32(2), prik_x, np.int32(1)) + f2py_value = f2py_blas.dznrm2(np.int32(2), f2py_x, np.int32(1)) + + expected = np.float64(np.sqrt(1.0**2 + 2.0**2 + 3.0**2 + 4.0**2)) + assert_allclose_for_dtype(prik_value, expected, operation_size=4) + assert_allclose_for_dtype(f2py_value, expected, operation_size=4) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=4) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_crotg(prik_blas, f2py_blas): + a, b = np.complex64(3.0 + 1.0j), np.complex64(4.0 - 2.0j) + + result, _, c, s = prik_blas.crotg(a, b, np.float32(0.0), np.complex64(0.0j)) + f2py_result = f2py_blas.crotg(a, b, np.float32(0.0), np.complex64(0.0j)) + + assert_allclose_for_dtype(c * a + s * b, result, operation_size=2) + assert_allclose_for_dtype(-np.conj(s) * a + c * b, np.complex64(0.0j), operation_size=2) + assert_allclose_for_dtype(c * c + abs(s) ** 2, np.float32(1.0), operation_size=2) + assert f2py_result is None + + +def test_zrotg(prik_blas, f2py_blas): + a, b = np.complex128(3.0 + 1.0j), np.complex128(4.0 - 2.0j) + + result, _, c, s = prik_blas.zrotg(a, b, np.float64(0.0), np.complex128(0.0j)) + f2py_result = f2py_blas.zrotg(a, b, np.float64(0.0), np.complex128(0.0j)) + + assert_allclose_for_dtype(c * a + s * b, result, operation_size=2) + assert_allclose_for_dtype(-np.conj(s) * a + c * b, np.complex128(0.0j), operation_size=2) + assert_allclose_for_dtype(c * c + abs(s) ** 2, np.float64(1.0), operation_size=2) + assert f2py_result is None + + +def test_cscal(prik_blas, f2py_blas): + alpha = np.complex64(1.0 - 2.0j) + original = np.array([2.0 + 1.0j, -3.0 + 4.0j], dtype=np.complex64) + prik_x, f2py_x = original.copy(), original.copy() + + prik_blas.cscal(np.int32(2), alpha, prik_x, np.int32(1)) + f2py_blas.cscal(np.int32(2), alpha, f2py_x, np.int32(1)) + + expected = alpha * original + assert_allclose_for_dtype(prik_x, expected) + assert_allclose_for_dtype(f2py_x, expected) + assert_allclose_for_dtype(prik_x, f2py_x) + + +def test_zscal(prik_blas, f2py_blas): + alpha = np.complex128(-0.5 + 1.5j) + original = np.array([2.0 + 1.0j, 90.0j, -3.0 + 4.0j], dtype=np.complex128) + prik_x, f2py_x = original.copy(), original.copy() + + prik_blas.zscal(np.int32(2), alpha, prik_x, np.int32(2)) + f2py_blas.zscal(np.int32(2), alpha, f2py_x, np.int32(2)) + + expected = with_logical_vector(original, alpha * original[::2], 2, 2) + assert_allclose_for_dtype(prik_x, expected) + assert_allclose_for_dtype(f2py_x, expected) + assert_allclose_for_dtype(prik_x, f2py_x) + + +def test_csscal(prik_blas, f2py_blas): + alpha = np.float32(-2.0) + original = np.array([2.0 + 1.0j, -3.0 + 4.0j], dtype=np.complex64) + prik_x, f2py_x = original.copy(), original.copy() + + prik_blas.csscal(np.int32(2), alpha, prik_x, np.int32(1)) + f2py_blas.csscal(np.int32(2), alpha, f2py_x, np.int32(1)) + + expected = alpha * original + assert_allclose_for_dtype(prik_x, expected) + assert_allclose_for_dtype(f2py_x, expected) + assert_allclose_for_dtype(prik_x, f2py_x) + + +def test_zdscal(prik_blas, f2py_blas): + alpha = np.float64(0.25) + original = np.array([2.0 + 1.0j, -3.0 + 4.0j], dtype=np.complex128) + prik_x, f2py_x = original.copy(), original.copy() + + prik_blas.zdscal(np.int32(2), alpha, prik_x, np.int32(1)) + f2py_blas.zdscal(np.int32(2), alpha, f2py_x, np.int32(1)) + + expected = alpha * original + assert_allclose_for_dtype(prik_x, expected) + assert_allclose_for_dtype(f2py_x, expected) + assert_allclose_for_dtype(prik_x, f2py_x) + + +def test_csrot(prik_blas, f2py_blas): + c, s = np.float32(0.6), np.float32(0.8) + x = np.array([1.0 + 2.0j, -2.0 + 1.0j], dtype=np.complex64) + y = np.array([3.0 - 1.0j, 4.0 + 2.0j], dtype=np.complex64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.csrot(np.int32(2), prik_x, np.int32(1), prik_y, np.int32(1), c, s) + f2py_blas.csrot(np.int32(2), f2py_x, np.int32(1), f2py_y, np.int32(1), c, s) + + expected_x = c * x + s * y + expected_y = c * y - s * x + assert_allclose_for_dtype(prik_x, expected_x) + assert_allclose_for_dtype(f2py_x, expected_x) + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + + +def test_zdrot(prik_blas, f2py_blas): + c, s = np.float64(0.8), np.float64(-0.6) + x = np.array([1.0 + 2.0j, -2.0 + 1.0j], dtype=np.complex128) + y = np.array([3.0 - 1.0j, 4.0 + 2.0j], dtype=np.complex128) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.zdrot(np.int32(2), prik_x, np.int32(1), prik_y, np.int32(1), c, s) + f2py_blas.zdrot(np.int32(2), f2py_x, np.int32(1), f2py_y, np.int32(1), c, s) + + expected_x = c * x + s * y + expected_y = c * y - s * x + assert_allclose_for_dtype(prik_x, expected_x) + assert_allclose_for_dtype(f2py_x, expected_x) + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + + +def test_cswap(prik_blas, f2py_blas): + x = np.array([1.0 + 2.0j, 90.0j, -2.0 + 1.0j], dtype=np.complex64) + y = np.array([3.0 - 1.0j, 80.0j, 4.0 + 2.0j], dtype=np.complex64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.cswap(np.int32(2), prik_x, np.int32(2), prik_y, np.int32(2)) + f2py_blas.cswap(np.int32(2), f2py_x, np.int32(2), f2py_y, np.int32(2)) + + expected_x = with_logical_vector(x, y[::2], 2, 2) + expected_y = with_logical_vector(y, x[::2], 2, 2) + assert_allclose_for_dtype(prik_x, expected_x) + assert_allclose_for_dtype(f2py_x, expected_x) + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + + +def test_zswap(prik_blas, f2py_blas): + x = np.array([1.0 + 2.0j, -2.0 + 1.0j], dtype=np.complex128) + y = np.array([3.0 - 1.0j, 4.0 + 2.0j], dtype=np.complex128) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.zswap(np.int32(2), prik_x, np.int32(-1), prik_y, np.int32(1)) + f2py_blas.zswap(np.int32(2), f2py_x, np.int32(-1), f2py_y, np.int32(1)) + + expected_x = y[::-1] + expected_y = x[::-1] + assert_allclose_for_dtype(prik_x, expected_x) + assert_allclose_for_dtype(f2py_x, expected_x) + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + + +def test_icamax(prik_blas, f2py_blas): + x = np.array([1.0 + 1.0j, -4.0 + 5.0j, 3.0 - 2.0j], dtype=np.complex64) + prik_x, f2py_x = x.copy(), x.copy() + + prik_index, *_ = prik_blas.icamax(np.int32(3), prik_x, np.int32(1)) + f2py_index = f2py_blas.icamax(np.int32(3), f2py_x, np.int32(1)) + + expected_native_one_based_index = 2 + assert prik_index == expected_native_one_based_index + assert f2py_index == expected_native_one_based_index + assert prik_index == f2py_index + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_izamax(prik_blas, f2py_blas): + x = np.array([1.0 + 1.0j, 90.0j, -4.0 + 5.0j, 80.0j, 3.0 - 2.0j], dtype=np.complex128) + prik_x, f2py_x = x.copy(), x.copy() + + prik_index, *_ = prik_blas.izamax(np.int32(3), prik_x, np.int32(2)) + f2py_index = f2py_blas.izamax(np.int32(3), f2py_x, np.int32(2)) + + expected_native_one_based_index = 2 + assert prik_index == expected_native_one_based_index + assert f2py_index == expected_native_one_based_index + assert prik_index == f2py_index + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) diff --git a/examples/blas/test_level1_real.py b/examples/blas/test_level1_real.py new file mode 100644 index 000000000..fa4087d57 --- /dev/null +++ b/examples/blas/test_level1_real.py @@ -0,0 +1,483 @@ +"""Readable independent and differential checks for real BLAS Level 1.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import ( + assert_allclose_for_dtype, + assert_storage_unchanged, + logical_vector, + with_logical_vector, +) + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_saxpy(prik_blas, f2py_blas): + alpha = np.float32(2.5) + x = np.array([1.0, -2.0, 3.0], dtype=np.float32) + original_y = np.array([10.0, 20.0, -5.0], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_scalars = prik_blas.saxpy(np.int32(3), alpha, prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_result = f2py_blas.saxpy(np.int32(3), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected_y = alpha * x + original_y + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_y, f2py_y) + assert prik_scalars == (np.int32(3), alpha, np.int32(1), np.int32(1)) + assert f2py_result is None + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_daxpy(prik_blas, f2py_blas): + alpha = np.float64(-1.5) + x = np.array([2.0, -4.0, 1.0], dtype=np.float64) + original_y = np.array([3.0, 5.0, -2.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_scalars = prik_blas.daxpy(np.int32(3), alpha, prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_result = f2py_blas.daxpy(np.int32(3), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected_y = alpha * x + original_y + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_y, f2py_y) + assert prik_scalars == (np.int32(3), alpha, np.int32(1), np.int32(1)) + assert f2py_result is None + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_ddot(prik_blas, f2py_blas): + x = np.array([1.0, -2.0, 4.0], dtype=np.float64) + y = np.array([3.0, 5.0, -1.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_value, n, incx, incy = prik_blas.ddot(np.int32(3), prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_value = f2py_blas.ddot(np.int32(3), f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected = np.float64(1.0 * 3.0 + (-2.0) * 5.0 + 4.0 * (-1.0)) + assert_allclose_for_dtype(prik_value, expected, operation_size=3) + assert_allclose_for_dtype(f2py_value, expected, operation_size=3) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=3) + assert (n, incx, incy) == (np.int32(3), np.int32(1), np.int32(1)) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_sasum(prik_blas, f2py_blas): + x = np.array([-1.0, 99.0, 2.5, 98.0, -3.0], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + + prik_value, *_ = prik_blas.sasum(np.int32(3), prik_x, np.int32(2)) + f2py_value = f2py_blas.sasum(np.int32(3), f2py_x, np.int32(2)) + + expected = np.float32(abs(-1.0) + abs(2.5) + abs(-3.0)) + assert_allclose_for_dtype(prik_value, expected, operation_size=3) + assert_allclose_for_dtype(f2py_value, expected, operation_size=3) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=3) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dasum(prik_blas, f2py_blas): + x = np.array([-1.5, 2.0, -4.25], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + + prik_value, *_ = prik_blas.dasum(np.int32(3), prik_x, np.int32(1)) + f2py_value = f2py_blas.dasum(np.int32(3), f2py_x, np.int32(1)) + + expected = np.float64(1.5 + 2.0 + 4.25) + assert_allclose_for_dtype(prik_value, expected, operation_size=3) + assert_allclose_for_dtype(f2py_value, expected, operation_size=3) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=3) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_scopy(prik_blas, f2py_blas): + x = np.array([1.0, 90.0, 2.0, 91.0, 3.0], dtype=np.float32) + original_y = np.array([-1.0, 80.0, -2.0, 81.0, -3.0], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.scopy(np.int32(3), prik_x, np.int32(2), prik_y, np.int32(2)) + f2py_blas.scopy(np.int32(3), f2py_x, np.int32(2), f2py_y, np.int32(2)) + + expected_y = with_logical_vector(original_y, logical_vector(x, 3, 2), 3, 2) + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_y, f2py_y) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dcopy(prik_blas, f2py_blas): + x = np.array([1.0, 2.0, 3.0], dtype=np.float64) + original_y = np.array([7.0, 8.0, 9.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.dcopy(np.int32(3), prik_x, np.int32(-1), prik_y, np.int32(1)) + f2py_blas.dcopy(np.int32(3), f2py_x, np.int32(-1), f2py_y, np.int32(1)) + + expected_y = np.array([3.0, 2.0, 1.0], dtype=np.float64) + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_y, f2py_y) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_sdot(prik_blas, f2py_blas): + x = np.array([1.0, 99.0, -2.0, 98.0, 3.0], dtype=np.float32) + y = np.array([4.0, 5.0, -1.0], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_value, *_ = prik_blas.sdot(np.int32(3), prik_x, np.int32(2), prik_y, np.int32(1)) + f2py_value = f2py_blas.sdot(np.int32(3), f2py_x, np.int32(2), f2py_y, np.int32(1)) + + expected = np.float32(1.0 * 4.0 + (-2.0) * 5.0 + 3.0 * (-1.0)) + assert_allclose_for_dtype(prik_value, expected, operation_size=3) + assert_allclose_for_dtype(f2py_value, expected, operation_size=3) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=3) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_sdsdot(prik_blas, f2py_blas): + bias = np.float32(1.25) + x = np.array([1.0, -2.0, 3.0], dtype=np.float32) + y = np.array([4.0, 0.5, -1.0], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_value, *_ = prik_blas.sdsdot(np.int32(3), bias, prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_value = f2py_blas.sdsdot(np.int32(3), bias, f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected = np.float32(np.float64(bias) + 1.0 * 4.0 + (-2.0) * 0.5 + 3.0 * (-1.0)) + assert_allclose_for_dtype(prik_value, expected, operation_size=3) + assert_allclose_for_dtype(f2py_value, expected, operation_size=3) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=3) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_dsdot(prik_blas, f2py_blas): + x = np.array([1.0e10, 1.0, -1.0e10], dtype=np.float32) + y = np.ones(3, dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_value, *_ = prik_blas.dsdot(np.int32(3), prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_value = f2py_blas.dsdot(np.int32(3), f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected = np.float64(np.float64(x[0]) + np.float64(x[1]) + np.float64(x[2])) + assert_allclose_for_dtype(prik_value, expected, operation_size=3) + assert_allclose_for_dtype(f2py_value, expected, operation_size=3) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=3) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_snrm2(prik_blas, f2py_blas): + x = np.array([3.0, 99.0, 4.0], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + + prik_value, *_ = prik_blas.snrm2(np.int32(2), prik_x, np.int32(2)) + f2py_value = f2py_blas.snrm2(np.int32(2), f2py_x, np.int32(2)) + + expected = np.float32(np.sqrt(np.float32(3.0**2 + 4.0**2))) + assert_allclose_for_dtype(prik_value, expected, operation_size=2) + assert_allclose_for_dtype(f2py_value, expected, operation_size=2) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=2) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dnrm2(prik_blas, f2py_blas): + x = np.array([2.0, -3.0, 6.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + + prik_value, *_ = prik_blas.dnrm2(np.int32(3), prik_x, np.int32(1)) + f2py_value = f2py_blas.dnrm2(np.int32(3), f2py_x, np.int32(1)) + + expected = np.float64(np.sqrt(2.0**2 + (-3.0) ** 2 + 6.0**2)) + assert_allclose_for_dtype(prik_value, expected, operation_size=3) + assert_allclose_for_dtype(f2py_value, expected, operation_size=3) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=3) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_srot(prik_blas, f2py_blas): + c, s = np.float32(0.6), np.float32(0.8) + x = np.array([1.0, 2.0], dtype=np.float32) + y = np.array([3.0, 4.0], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.srot(np.int32(2), prik_x, np.int32(1), prik_y, np.int32(1), c, s) + f2py_blas.srot(np.int32(2), f2py_x, np.int32(1), f2py_y, np.int32(1), c, s) + + expected_x = c * x + s * y + expected_y = c * y - s * x + assert_allclose_for_dtype(prik_x, expected_x) + assert_allclose_for_dtype(f2py_x, expected_x) + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_x, f2py_x) + assert_allclose_for_dtype(prik_y, f2py_y) + + +def test_drot(prik_blas, f2py_blas): + c, s = np.float64(0.8), np.float64(-0.6) + x = np.array([1.0, 90.0, 2.0], dtype=np.float64) + y = np.array([3.0, 80.0, 4.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.drot(np.int32(2), prik_x, np.int32(2), prik_y, np.int32(2), c, s) + f2py_blas.drot(np.int32(2), f2py_x, np.int32(2), f2py_y, np.int32(2), c, s) + + expected_x = with_logical_vector(x, c * x[::2] + s * y[::2], 2, 2) + expected_y = with_logical_vector(y, c * y[::2] - s * x[::2], 2, 2) + assert_allclose_for_dtype(prik_x, expected_x) + assert_allclose_for_dtype(f2py_x, expected_x) + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_x, f2py_x) + assert_allclose_for_dtype(prik_y, f2py_y) + + +def test_srotg(prik_blas, f2py_blas): + a, b = np.float32(3.0), np.float32(4.0) + + prik_a, prik_b, c, s = prik_blas.srotg(a, b, np.float32(0.0), np.float32(0.0)) + f2py_result = f2py_blas.srotg(a, b, np.float32(0.0), np.float32(0.0)) + + assert_allclose_for_dtype(prik_a, np.float32(5.0)) + assert_allclose_for_dtype(prik_b, np.float32(5.0 / 3.0)) + assert_allclose_for_dtype(c * a + s * b, prik_a, operation_size=2) + assert_allclose_for_dtype(-s * a + c * b, np.float32(0.0), operation_size=2) + assert f2py_result is None + + +def test_drotg(prik_blas, f2py_blas): + a, b = np.float64(3.0), np.float64(4.0) + + prik_a, prik_b, c, s = prik_blas.drotg(a, b, np.float64(0.0), np.float64(0.0)) + f2py_result = f2py_blas.drotg(a, b, np.float64(0.0), np.float64(0.0)) + + assert_allclose_for_dtype(prik_a, np.float64(5.0)) + assert_allclose_for_dtype(prik_b, np.float64(5.0 / 3.0)) + assert_allclose_for_dtype(c * a + s * b, prik_a, operation_size=2) + assert_allclose_for_dtype(-s * a + c * b, np.float64(0.0), operation_size=2) + assert f2py_result is None + + +def test_srotm(prik_blas, f2py_blas): + x = np.array([1.0, 2.0], dtype=np.float32) + y = np.array([3.0, 4.0], dtype=np.float32) + param = np.array([-1.0, 2.0, 0.5, -0.25, 3.0], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_param, f2py_param = param.copy(), param.copy() + + prik_blas.srotm(np.int32(2), prik_x, np.int32(1), prik_y, np.int32(1), prik_param) + f2py_blas.srotm(np.int32(2), f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_param) + + expected_x = param[1] * x + param[3] * y + expected_y = param[2] * x + param[4] * y + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_storage_unchanged(prik_param, param) + assert_storage_unchanged(f2py_param, param) + + +def test_drotm(prik_blas, f2py_blas): + x = np.array([1.0, 2.0], dtype=np.float64) + y = np.array([3.0, 4.0], dtype=np.float64) + param = np.array([-1.0, 2.0, 0.5, -0.25, 3.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_param, f2py_param = param.copy(), param.copy() + + prik_blas.drotm(np.int32(2), prik_x, np.int32(1), prik_y, np.int32(1), prik_param) + f2py_blas.drotm(np.int32(2), f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_param) + + expected_x = param[1] * x + param[3] * y + expected_y = param[2] * x + param[4] * y + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_storage_unchanged(prik_param, param) + assert_storage_unchanged(f2py_param, param) + + +def test_srotmg(prik_blas, f2py_blas): + prik_param = np.zeros(5, dtype=np.float32) + f2py_param = np.zeros(5, dtype=np.float32) + + prik_values = prik_blas.srotmg(np.float32(1.0), np.float32(2.0), np.float32(3.0), np.float32(4.0), prik_param) + f2py_result = f2py_blas.srotmg(np.float32(1.0), np.float32(2.0), np.float32(3.0), np.float32(4.0), f2py_param) + + expected_values = np.array([1.5609756, 0.7804878, 5.125, 4.0], dtype=np.float32) + expected_param = np.array([1.0, 0.375, 0.0, 0.0, 0.75], dtype=np.float32) + assert_allclose_for_dtype(prik_values, expected_values, operation_size=2) + assert_allclose_for_dtype(prik_param, expected_param) + assert_allclose_for_dtype(f2py_param, expected_param) + assert_allclose_for_dtype(prik_param, f2py_param) + assert f2py_result is None + + +def test_drotmg(prik_blas, f2py_blas): + prik_param = np.zeros(5, dtype=np.float64) + f2py_param = np.zeros(5, dtype=np.float64) + + prik_values = prik_blas.drotmg(np.float64(1.0), np.float64(2.0), np.float64(3.0), np.float64(4.0), prik_param) + f2py_result = f2py_blas.drotmg(np.float64(1.0), np.float64(2.0), np.float64(3.0), np.float64(4.0), f2py_param) + + expected_values = np.array([1.5609756097560976, 0.7804878048780488, 5.125, 4.0]) + expected_param = np.array([1.0, 0.375, 0.0, 0.0, 0.75]) + assert_allclose_for_dtype(prik_values, expected_values, operation_size=2) + assert_allclose_for_dtype(prik_param, expected_param) + assert_allclose_for_dtype(f2py_param, expected_param) + assert_allclose_for_dtype(prik_param, f2py_param) + assert f2py_result is None + + +def test_sscal(prik_blas, f2py_blas): + alpha = np.float32(-2.0) + original = np.array([3.0], dtype=np.float32) + prik_x, f2py_x = original.copy(), original.copy() + + prik_blas.sscal(np.int32(1), alpha, prik_x, np.int32(1)) + f2py_blas.sscal(np.int32(1), alpha, f2py_x, np.int32(1)) + + expected = alpha * original + assert_allclose_for_dtype(prik_x, expected) + assert_allclose_for_dtype(f2py_x, expected) + assert_allclose_for_dtype(prik_x, f2py_x) + + +def test_dscal(prik_blas, f2py_blas): + alpha = np.float64(0.5) + original = np.array([2.0, 90.0, -4.0], dtype=np.float64) + prik_x, f2py_x = original.copy(), original.copy() + + prik_blas.dscal(np.int32(2), alpha, prik_x, np.int32(2)) + f2py_blas.dscal(np.int32(2), alpha, f2py_x, np.int32(2)) + + expected = with_logical_vector(original, alpha * original[::2], 2, 2) + assert_allclose_for_dtype(prik_x, expected) + assert_allclose_for_dtype(f2py_x, expected) + assert_allclose_for_dtype(prik_x, f2py_x) + + +def test_sswap(prik_blas, f2py_blas): + x = np.array([1.0, 90.0, 2.0], dtype=np.float32) + y = np.array([3.0, 80.0, 4.0], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.sswap(np.int32(2), prik_x, np.int32(2), prik_y, np.int32(2)) + f2py_blas.sswap(np.int32(2), f2py_x, np.int32(2), f2py_y, np.int32(2)) + + expected_x = with_logical_vector(x, y[::2], 2, 2) + expected_y = with_logical_vector(y, x[::2], 2, 2) + assert_allclose_for_dtype(prik_x, expected_x) + assert_allclose_for_dtype(f2py_x, expected_x) + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + + +def test_dswap(prik_blas, f2py_blas): + x = np.array([1.0, 2.0, 3.0], dtype=np.float64) + y = np.array([4.0, 5.0, 6.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.dswap(np.int32(3), prik_x, np.int32(-1), prik_y, np.int32(1)) + f2py_blas.dswap(np.int32(3), f2py_x, np.int32(-1), f2py_y, np.int32(1)) + + expected_x = np.array([6.0, 5.0, 4.0]) + expected_y = np.array([3.0, 2.0, 1.0]) + assert_allclose_for_dtype(prik_x, expected_x) + assert_allclose_for_dtype(f2py_x, expected_x) + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + + +def test_isamax(prik_blas, f2py_blas): + x = np.array([1.0, -7.0, 3.0], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + + prik_index, *_ = prik_blas.isamax(np.int32(3), prik_x, np.int32(1)) + f2py_index = f2py_blas.isamax(np.int32(3), f2py_x, np.int32(1)) + + expected_native_one_based_index = 2 + assert prik_index == expected_native_one_based_index + assert f2py_index == expected_native_one_based_index + assert prik_index == f2py_index + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_idamax(prik_blas, f2py_blas): + x = np.array([1.0, 90.0, -8.0, 91.0, 3.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + + prik_index, *_ = prik_blas.idamax(np.int32(3), prik_x, np.int32(2)) + f2py_index = f2py_blas.idamax(np.int32(3), f2py_x, np.int32(2)) + + expected_native_one_based_index = 2 + assert prik_index == expected_native_one_based_index + assert f2py_index == expected_native_one_based_index + assert prik_index == f2py_index + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_daxpy_alpha_zero_preserves_y(prik_blas, f2py_blas): + x = np.array([1.0, 2.0], dtype=np.float64) + original_y = np.array([3.0, 4.0], dtype=np.float64) + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.daxpy(np.int32(2), np.float64(0.0), x.copy(), np.int32(1), prik_y, np.int32(1)) + f2py_blas.daxpy(np.int32(2), np.float64(0.0), x.copy(), np.int32(1), f2py_y, np.int32(1)) + + assert_storage_unchanged(prik_y, original_y) + assert_storage_unchanged(f2py_y, original_y) + + +def test_sdot_empty_input(prik_blas, f2py_blas): + x = np.array([91.0], dtype=np.float32) + y = np.array([92.0], dtype=np.float32) + + prik_value, *_ = prik_blas.sdot(np.int32(0), x.copy(), np.int32(1), y.copy(), np.int32(1)) + f2py_value = f2py_blas.sdot(np.int32(0), x.copy(), np.int32(1), y.copy(), np.int32(1)) + + assert_allclose_for_dtype(prik_value, np.float32(0.0)) + assert_allclose_for_dtype(f2py_value, np.float32(0.0)) diff --git a/examples/blas/test_level2_banded.py b/examples/blas/test_level2_banded.py new file mode 100644 index 000000000..1d836f195 --- /dev/null +++ b/examples/blas/test_level2_banded.py @@ -0,0 +1,493 @@ +"""Readable independent and differential checks for banded BLAS Level 2.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import ( + assert_allclose_for_dtype, + assert_storage_unchanged, + general_from_band, + hermitian_from_band, + symmetric_from_band, + triangular_from_band, +) + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_sgbmv(prik_blas, f2py_blas): + alpha, beta = np.float32(1.5), np.float32(-0.5) + original_a = np.asfortranarray([[91.0, -1.0], [2.0, 3.0], [4.0, 92.0], [93.0, 94.0]], dtype=np.float32) + x = np.array([2.0, -3.0], dtype=np.float32) + original_y = np.array([4.0, 5.0], dtype=np.float32) + logical_a = general_from_band(original_a, 2, 2, 1, 1) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.sgbmv( + "N", + np.int32(2), + np.int32(2), + np.int32(1), + np.int32(1), + alpha, + prik_a, + np.int32(4), + prik_x, + np.int32(1), + beta, + prik_y, + np.int32(1), + ) + f2py_blas.sgbmv( + b"N", + np.int32(2), + np.int32(2), + np.int32(1), + np.int32(1), + alpha, + f2py_a, + f2py_x, + np.int32(1), + beta, + f2py_y, + np.int32(1), + lda=np.int32(4), + ) + + expected_y = alpha * logical_a @ x + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dgbmv(prik_blas, f2py_blas): + alpha, beta = np.float64(-2.0), np.float64(1.0) + original_a = np.asfortranarray([[91.0, -1.0], [2.0, 3.0], [4.0, 92.0], [93.0, 94.0]], dtype=np.float64) + x = np.array([2.0, -3.0], dtype=np.float64) + original_y = np.array([4.0, 5.0], dtype=np.float64) + logical_a = general_from_band(original_a, 2, 2, 1, 1) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.dgbmv( + "T", + np.int32(2), + np.int32(2), + np.int32(1), + np.int32(1), + alpha, + prik_a, + np.int32(4), + prik_x, + np.int32(1), + beta, + prik_y, + np.int32(1), + ) + f2py_blas.dgbmv( + b"T", + np.int32(2), + np.int32(2), + np.int32(1), + np.int32(1), + alpha, + f2py_a, + f2py_x, + np.int32(1), + beta, + f2py_y, + np.int32(1), + lda=np.int32(4), + ) + + expected_y = alpha * logical_a.T @ x + original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_cgbmv(prik_blas, f2py_blas): + alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(0.25j) + original_a = np.asfortranarray( + [[91.0j, -1.0 + 2.0j], [2.0 + 1.0j, 3.0 - 1.0j], [4.0 + 0.5j, 92.0j], [93.0j, 94.0j]], dtype=np.complex64 + ) + x = np.array([2.0 + 1.0j, -3.0 + 0.5j], dtype=np.complex64) + original_y = np.array([4.0 - 1.0j, 5.0 + 2.0j], dtype=np.complex64) + logical_a = general_from_band(original_a, 2, 2, 1, 1) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.cgbmv( + "N", + np.int32(2), + np.int32(2), + np.int32(1), + np.int32(1), + alpha, + prik_a, + np.int32(4), + prik_x, + np.int32(1), + beta, + prik_y, + np.int32(1), + ) + f2py_blas.cgbmv( + b"N", + np.int32(2), + np.int32(2), + np.int32(1), + np.int32(1), + alpha, + f2py_a, + f2py_x, + np.int32(1), + beta, + f2py_y, + np.int32(1), + lda=np.int32(4), + ) + + expected_y = alpha * logical_a @ x + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_zgbmv(prik_blas, f2py_blas): + alpha, beta = np.complex128(-0.5 + 0.25j), np.complex128(1.0) + original_a = np.asfortranarray( + [[91.0j, -1.0 + 2.0j], [2.0 + 1.0j, 3.0 - 1.0j], [4.0 + 0.5j, 92.0j], [93.0j, 94.0j]], dtype=np.complex128 + ) + x = np.array([2.0 + 1.0j, -3.0 + 0.5j], dtype=np.complex128) + original_y = np.array([4.0 - 1.0j, 5.0 + 2.0j], dtype=np.complex128) + logical_a = general_from_band(original_a, 2, 2, 1, 1) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.zgbmv( + "C", + np.int32(2), + np.int32(2), + np.int32(1), + np.int32(1), + alpha, + prik_a, + np.int32(4), + prik_x, + np.int32(1), + beta, + prik_y, + np.int32(1), + ) + f2py_blas.zgbmv( + b"C", + np.int32(2), + np.int32(2), + np.int32(1), + np.int32(1), + alpha, + f2py_a, + f2py_x, + np.int32(1), + beta, + f2py_y, + np.int32(1), + lda=np.int32(4), + ) + + expected_y = alpha * logical_a.conj().T @ x + original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_ssbmv(prik_blas, f2py_blas): + alpha, beta = np.float32(1.5), np.float32(-0.5) + original_a = np.asfortranarray([[91.0, -1.0], [2.0, 3.0], [93.0, 94.0]], dtype=np.float32) + x = np.array([2.0, -3.0], dtype=np.float32) + original_y = np.array([4.0, 5.0], dtype=np.float32) + logical_a = symmetric_from_band(original_a, 2, 1, "U") + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.ssbmv( + "U", np.int32(2), np.int32(1), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1) + ) + f2py_blas.ssbmv( + b"U", np.int32(2), np.int32(1), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3) + ) + + expected_y = alpha * logical_a @ x + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dsbmv(prik_blas, f2py_blas): + alpha, beta = np.float64(-2.0), np.float64(1.0) + original_a = np.asfortranarray([[2.0, 3.0], [-1.0, 92.0], [93.0, 94.0]], dtype=np.float64) + x = np.array([2.0, -3.0], dtype=np.float64) + original_y = np.array([4.0, 5.0], dtype=np.float64) + logical_a = symmetric_from_band(original_a, 2, 1, "L") + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.dsbmv( + "L", np.int32(2), np.int32(1), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1) + ) + f2py_blas.dsbmv( + b"L", np.int32(2), np.int32(1), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3) + ) + + expected_y = alpha * logical_a @ x + original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_chbmv(prik_blas, f2py_blas): + alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(0.25j) + original_a = np.asfortranarray( + [[91.0j, -1.0 + 2.0j], [2.0 + 77.0j, 3.0 - 88.0j], [93.0j, 94.0j]], dtype=np.complex64 + ) + x = np.array([2.0 + 1.0j, -3.0 + 0.5j], dtype=np.complex64) + original_y = np.array([4.0 - 1.0j, 5.0 + 2.0j], dtype=np.complex64) + logical_a = hermitian_from_band(original_a, 2, 1, "U") + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.chbmv( + "U", np.int32(2), np.int32(1), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1) + ) + f2py_blas.chbmv( + b"U", np.int32(2), np.int32(1), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3) + ) + + expected_y = alpha * logical_a @ x + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_zhbmv(prik_blas, f2py_blas): + alpha, beta = np.complex128(-0.5 + 0.25j), np.complex128(1.0) + original_a = np.asfortranarray( + [[2.0 + 77.0j, 3.0 - 88.0j], [-1.0 - 2.0j, 92.0j], [93.0j, 94.0j]], dtype=np.complex128 + ) + x = np.array([2.0 + 1.0j, -3.0 + 0.5j], dtype=np.complex128) + original_y = np.array([4.0 - 1.0j, 5.0 + 2.0j], dtype=np.complex128) + logical_a = hermitian_from_band(original_a, 2, 1, "L") + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.zhbmv( + "L", np.int32(2), np.int32(1), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1) + ) + f2py_blas.zhbmv( + b"L", np.int32(2), np.int32(1), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3) + ) + + expected_y = alpha * logical_a @ x + original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_stbmv(prik_blas, f2py_blas): + original_a = np.asfortranarray([[91.0, -1.0], [2.0, 3.0], [93.0, 94.0]], dtype=np.float32) + original_x = np.array([4.0, -2.0], dtype=np.float32) + logical_a = triangular_from_band(original_a, 2, 1, "U", unit_diagonal=False) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.stbmv("U", "N", "N", np.int32(2), np.int32(1), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.stbmv(b"U", b"N", b"N", np.int32(2), np.int32(1), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + expected_x = logical_a @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_dtbmv(prik_blas, f2py_blas): + original_a = np.asfortranarray([[np.nan, np.nan], [-1.0, 92.0], [93.0, 94.0]], dtype=np.float64) + original_x = np.array([4.0, -2.0], dtype=np.float64) + logical_a = triangular_from_band(original_a, 2, 1, "L", unit_diagonal=True) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.dtbmv("L", "T", "U", np.int32(2), np.int32(1), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.dtbmv(b"L", b"T", b"U", np.int32(2), np.int32(1), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + expected_x = logical_a.T @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_ctbmv(prik_blas, f2py_blas): + original_a = np.asfortranarray([[91.0j, -1.0 + 2.0j], [2.0 + 1.0j, 3.0 - 1.0j], [93.0j, 94.0j]], dtype=np.complex64) + original_x = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex64) + logical_a = triangular_from_band(original_a, 2, 1, "U", unit_diagonal=False) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.ctbmv("U", "C", "N", np.int32(2), np.int32(1), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.ctbmv(b"U", b"C", b"N", np.int32(2), np.int32(1), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + expected_x = logical_a.conj().T @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_ztbmv(prik_blas, f2py_blas): + nan = np.nan + 1.0j * np.nan + original_a = np.asfortranarray([[nan, nan], [-1.0 + 2.0j, 92.0j], [93.0j, 94.0j]], dtype=np.complex128) + original_x = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex128) + logical_a = triangular_from_band(original_a, 2, 1, "L", unit_diagonal=True) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.ztbmv("L", "N", "U", np.int32(2), np.int32(1), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.ztbmv(b"L", b"N", b"U", np.int32(2), np.int32(1), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + expected_x = logical_a @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_stbsv(prik_blas, f2py_blas): + original_a = np.asfortranarray([[91.0, -1.0], [2.0, 3.0], [93.0, 94.0]], dtype=np.float32) + expected_solution = np.array([4.0, -2.0], dtype=np.float32) + logical_a = triangular_from_band(original_a, 2, 1, "U", unit_diagonal=False) + original_b = logical_a @ expected_solution + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.stbsv("U", "N", "N", np.int32(2), np.int32(1), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.stbsv(b"U", b"N", b"N", np.int32(2), np.int32(1), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + assert_allclose_for_dtype(logical_a @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_dtbsv(prik_blas, f2py_blas): + original_a = np.asfortranarray([[np.nan, np.nan], [-1.0, 92.0], [93.0, 94.0]], dtype=np.float64) + expected_solution = np.array([4.0, -2.0], dtype=np.float64) + logical_a = triangular_from_band(original_a, 2, 1, "L", unit_diagonal=True) + original_b = logical_a.T @ expected_solution + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.dtbsv("L", "T", "U", np.int32(2), np.int32(1), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.dtbsv(b"L", b"T", b"U", np.int32(2), np.int32(1), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + assert_allclose_for_dtype(logical_a.T @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a.T @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_ctbsv(prik_blas, f2py_blas): + original_a = np.asfortranarray([[91.0j, -1.0 + 2.0j], [2.0 + 1.0j, 3.0 - 1.0j], [93.0j, 94.0j]], dtype=np.complex64) + expected_solution = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex64) + logical_a = triangular_from_band(original_a, 2, 1, "U", unit_diagonal=False) + original_b = logical_a.conj().T @ expected_solution + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.ctbsv("U", "C", "N", np.int32(2), np.int32(1), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.ctbsv(b"U", b"C", b"N", np.int32(2), np.int32(1), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + assert_allclose_for_dtype(logical_a.conj().T @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a.conj().T @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_ztbsv(prik_blas, f2py_blas): + original_a = np.asfortranarray( + [[2.0 + 1.0j, 3.0 - 1.0j], [-1.0 + 2.0j, 92.0j], [93.0j, 94.0j]], dtype=np.complex128 + ) + expected_solution = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex128) + logical_a = triangular_from_band(original_a, 2, 1, "L", unit_diagonal=False) + original_b = logical_a @ expected_solution + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.ztbsv("L", "N", "N", np.int32(2), np.int32(1), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.ztbsv(b"L", b"N", b"N", np.int32(2), np.int32(1), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + assert_allclose_for_dtype(logical_a @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) diff --git a/examples/blas/test_level2_general.py b/examples/blas/test_level2_general.py new file mode 100644 index 000000000..93600aaee --- /dev/null +++ b/examples/blas/test_level2_general.py @@ -0,0 +1,303 @@ +"""Readable independent and differential checks for general BLAS Level 2.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import assert_allclose_for_dtype, assert_storage_unchanged + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_dgemv_no_transpose(prik_blas, f2py_blas): + alpha, beta = np.float64(2.0), np.float64(-1.0) + matrix = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [91.0, 92.0]], dtype=np.float64) + x = np.array([5.0, -2.0], dtype=np.float64) + original_y = np.array([7.0, 11.0], dtype=np.float64) + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_scalars = prik_blas.dgemv( + "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1) + ) + # f2py places its inferred optional leading dimension after the native arrays. + f2py_result = f2py_blas.dgemv( + b"N", np.int32(2), np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3) + ) + + product = np.array([1.0 * 5.0 + 2.0 * (-2.0), 3.0 * 5.0 + 4.0 * (-2.0)]) + expected_y = alpha * product + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert prik_scalars == (2, 2, alpha, 3, 1, beta, 1) + assert f2py_result is None + assert_storage_unchanged(prik_a, matrix) + assert_storage_unchanged(f2py_a, matrix) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dgemv_transpose(prik_blas, f2py_blas): + alpha, beta = np.float64(1.0), np.float64(0.0) + matrix = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [93.0, 94.0]], dtype=np.float64) + x = np.array([5.0, -2.0], dtype=np.float64) + original_y = np.array([17.0, 19.0], dtype=np.float64) + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.dgemv( + "T", np.int32(2), np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1) + ) + f2py_blas.dgemv( + b"T", np.int32(2), np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3) + ) + + expected_y = np.array([1.0 * 5.0 + 3.0 * (-2.0), 2.0 * 5.0 + 4.0 * (-2.0)]) + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, matrix) + assert_storage_unchanged(f2py_a, matrix) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_sgemv(prik_blas, f2py_blas): + alpha, beta = np.float32(1.5), np.float32(0.5) + matrix = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [91.0, 92.0]], dtype=np.float32) + x = np.array([2.0, -1.0], dtype=np.float32) + original_y = np.array([5.0, 6.0], dtype=np.float32) + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.sgemv( + "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1) + ) + f2py_blas.sgemv( + b"N", np.int32(2), np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3) + ) + + expected = alpha * np.array([1.0 * 2.0 + 2.0 * -1.0, 3.0 * 2.0 + 4.0 * -1.0]) + beta * original_y + assert_allclose_for_dtype(prik_y, expected, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, matrix) + assert_storage_unchanged(f2py_a, matrix) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_cgemv(prik_blas, f2py_blas): + alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(-1.0j) + matrix = np.asfortranarray( + [[1.0 + 1.0j, 2.0 - 1.0j], [3.0 + 0.5j, 4.0 + 2.0j], [91.0j, 92.0j]], + dtype=np.complex64, + ) + x = np.array([2.0 - 1.0j, -1.0 + 0.5j], dtype=np.complex64) + original_y = np.array([5.0 + 1.0j, 6.0 - 2.0j], dtype=np.complex64) + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.cgemv( + "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1) + ) + f2py_blas.cgemv( + b"N", np.int32(2), np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3) + ) + + expected = ( + alpha * np.array([matrix[0, 0] * x[0] + matrix[0, 1] * x[1], matrix[1, 0] * x[0] + matrix[1, 1] * x[1]]) + + beta * original_y + ) + assert_allclose_for_dtype(prik_y, expected, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, matrix) + assert_storage_unchanged(f2py_a, matrix) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_zgemv(prik_blas, f2py_blas): + alpha, beta = np.complex128(1.0 + 0.25j), np.complex128(0.0j) + matrix = np.asfortranarray( + [[1.0 + 1.0j, 2.0 - 1.0j], [3.0 + 0.5j, 4.0 + 2.0j], [91.0j, 92.0j]], + dtype=np.complex128, + ) + x = np.array([2.0 - 1.0j, -1.0 + 0.5j], dtype=np.complex128) + original_y = np.array([5.0 + 1.0j, 6.0 - 2.0j], dtype=np.complex128) + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.zgemv( + "C", np.int32(2), np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1) + ) + f2py_blas.zgemv( + b"C", np.int32(2), np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3) + ) + + expected = alpha * np.array( + [ + np.conj(matrix[0, 0]) * x[0] + np.conj(matrix[1, 0]) * x[1], + np.conj(matrix[0, 1]) * x[0] + np.conj(matrix[1, 1]) * x[1], + ] + ) + assert_allclose_for_dtype(prik_y, expected, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, matrix) + assert_storage_unchanged(f2py_a, matrix) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_sger(prik_blas, f2py_blas): + alpha = np.float32(2.0) + x = np.array([1.0, -2.0], dtype=np.float32) + y = np.array([3.0, 4.0], dtype=np.float32) + original = np.asfortranarray([[5.0, 6.0], [7.0, 8.0], [91.0, 92.0]], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_a, f2py_a = original.copy(order="F"), original.copy(order="F") + + prik_blas.sger(np.int32(2), np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_a, np.int32(3)) + f2py_blas.sger(np.int32(2), np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_a, lda=np.int32(3)) + + expected = original[:2, :] + alpha * x[:, None] * y[None, :] + assert_allclose_for_dtype(prik_a[:2, :], expected) + assert_allclose_for_dtype(f2py_a[:2, :], expected) + assert_allclose_for_dtype(prik_a[:2, :], f2py_a[:2, :]) + np.testing.assert_array_equal(prik_a[2, :], original[2, :], strict=True) + np.testing.assert_array_equal(f2py_a[2, :], original[2, :], strict=True) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_dger(prik_blas, f2py_blas): + alpha = np.float64(-0.5) + x = np.array([1.0, -2.0], dtype=np.float64) + y = np.array([3.0, 4.0], dtype=np.float64) + original = np.asfortranarray([[5.0, 6.0], [7.0, 8.0], [91.0, 92.0]], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_a, f2py_a = original.copy(order="F"), original.copy(order="F") + + prik_blas.dger(np.int32(2), np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_a, np.int32(3)) + f2py_blas.dger(np.int32(2), np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_a, lda=np.int32(3)) + + expected = original[:2, :] + alpha * x[:, None] * y[None, :] + assert_allclose_for_dtype(prik_a[:2, :], expected) + assert_allclose_for_dtype(f2py_a[:2, :], expected) + assert_allclose_for_dtype(prik_a[:2, :], f2py_a[:2, :]) + np.testing.assert_array_equal(prik_a[2, :], original[2, :], strict=True) + np.testing.assert_array_equal(f2py_a[2, :], original[2, :], strict=True) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_cgeru(prik_blas, f2py_blas): + alpha = np.complex64(1.0 - 0.5j) + x = np.array([1.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex64) + y = np.array([3.0 - 1.0j, 4.0 + 2.0j], dtype=np.complex64) + original = np.asfortranarray([[5.0j, 6.0], [7.0, 8.0j], [91.0j, 92.0j]], dtype=np.complex64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_a, f2py_a = original.copy(order="F"), original.copy(order="F") + + prik_blas.cgeru(np.int32(2), np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_a, np.int32(3)) + f2py_blas.cgeru(np.int32(2), np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_a, lda=np.int32(3)) + + expected = original[:2, :] + alpha * x[:, None] * y[None, :] + assert_allclose_for_dtype(prik_a[:2, :], expected) + assert_allclose_for_dtype(f2py_a[:2, :], expected) + assert_allclose_for_dtype(prik_a[:2, :], f2py_a[:2, :]) + np.testing.assert_array_equal(prik_a[2, :], original[2, :], strict=True) + np.testing.assert_array_equal(f2py_a[2, :], original[2, :], strict=True) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_zgeru(prik_blas, f2py_blas): + alpha = np.complex128(-0.25 + 0.75j) + x = np.array([1.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex128) + y = np.array([3.0 - 1.0j, 4.0 + 2.0j], dtype=np.complex128) + original = np.asfortranarray([[5.0j, 6.0], [7.0, 8.0j], [91.0j, 92.0j]], dtype=np.complex128) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_a, f2py_a = original.copy(order="F"), original.copy(order="F") + + prik_blas.zgeru(np.int32(2), np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_a, np.int32(3)) + f2py_blas.zgeru(np.int32(2), np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_a, lda=np.int32(3)) + + expected = original[:2, :] + alpha * x[:, None] * y[None, :] + assert_allclose_for_dtype(prik_a[:2, :], expected) + assert_allclose_for_dtype(f2py_a[:2, :], expected) + assert_allclose_for_dtype(prik_a[:2, :], f2py_a[:2, :]) + np.testing.assert_array_equal(prik_a[2, :], original[2, :], strict=True) + np.testing.assert_array_equal(f2py_a[2, :], original[2, :], strict=True) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_cgerc(prik_blas, f2py_blas): + alpha = np.complex64(1.0 - 0.5j) + x = np.array([1.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex64) + y = np.array([3.0 - 1.0j, 4.0 + 2.0j], dtype=np.complex64) + original = np.asfortranarray([[5.0j, 6.0], [7.0, 8.0j], [91.0j, 92.0j]], dtype=np.complex64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_a, f2py_a = original.copy(order="F"), original.copy(order="F") + + prik_blas.cgerc(np.int32(2), np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_a, np.int32(3)) + f2py_blas.cgerc(np.int32(2), np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_a, lda=np.int32(3)) + + expected = original[:2, :] + alpha * x[:, None] * np.conj(y)[None, :] + assert_allclose_for_dtype(prik_a[:2, :], expected) + assert_allclose_for_dtype(f2py_a[:2, :], expected) + assert_allclose_for_dtype(prik_a[:2, :], f2py_a[:2, :]) + np.testing.assert_array_equal(prik_a[2, :], original[2, :], strict=True) + np.testing.assert_array_equal(f2py_a[2, :], original[2, :], strict=True) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_zgerc(prik_blas, f2py_blas): + alpha = np.complex128(-0.25 + 0.75j) + x = np.array([1.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex128) + y = np.array([3.0 - 1.0j, 4.0 + 2.0j], dtype=np.complex128) + original = np.asfortranarray([[5.0j, 6.0], [7.0, 8.0j], [91.0j, 92.0j]], dtype=np.complex128) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_a, f2py_a = original.copy(order="F"), original.copy(order="F") + + prik_blas.zgerc(np.int32(2), np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_a, np.int32(3)) + f2py_blas.zgerc(np.int32(2), np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_a, lda=np.int32(3)) + + expected = original[:2, :] + alpha * x[:, None] * np.conj(y)[None, :] + assert_allclose_for_dtype(prik_a[:2, :], expected) + assert_allclose_for_dtype(f2py_a[:2, :], expected) + assert_allclose_for_dtype(prik_a[:2, :], f2py_a[:2, :]) + np.testing.assert_array_equal(prik_a[2, :], original[2, :], strict=True) + np.testing.assert_array_equal(f2py_a[2, :], original[2, :], strict=True) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) diff --git a/examples/blas/test_level2_hermitian.py b/examples/blas/test_level2_hermitian.py new file mode 100644 index 000000000..8d4b2d16b --- /dev/null +++ b/examples/blas/test_level2_hermitian.py @@ -0,0 +1,175 @@ +"""Readable independent and differential checks for Hermitian BLAS Level 2.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import assert_allclose_for_dtype, assert_storage_unchanged, hermitian_from_triangle + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_chemv(prik_blas, f2py_blas): + alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(0.25j) + original_a = np.asfortranarray( + [[2.0 + 77.0j, 1.0 - 2.0j], [np.nan + 1.0j * np.nan, 3.0 - 88.0j], [91.0j, 92.0j]], dtype=np.complex64 + ) + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex64) + original_y = np.array([4.0 - 2.0j, 5.0 + 3.0j], dtype=np.complex64) + logical_a = hermitian_from_triangle(original_a, 2, "U") + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.chemv("U", np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1)) + f2py_blas.chemv(b"U", np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3)) + + expected_y = alpha * logical_a @ x + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_zhemv(prik_blas, f2py_blas): + alpha, beta = np.complex128(-0.5 + 0.25j), np.complex128(1.0) + original_a = np.asfortranarray( + [[2.0 + 77.0j, np.nan + 1.0j * np.nan], [1.0 + 2.0j, 3.0 - 88.0j], [91.0j, 92.0j]], dtype=np.complex128 + ) + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex128) + original_y = np.array([4.0 - 2.0j, 5.0 + 3.0j], dtype=np.complex128) + logical_a = hermitian_from_triangle(original_a, 2, "L") + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.zhemv("L", np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1)) + f2py_blas.zhemv(b"L", np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3)) + + expected_y = alpha * logical_a @ x + original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_cher(prik_blas, f2py_blas): + alpha = np.float32(0.75) + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex64) + original_a = np.asfortranarray( + [[3.0 + 9.0j, 1.0 - 2.0j], [np.nan + 1.0j * np.nan, 4.0 - 8.0j], [91.0j, 92.0j]], dtype=np.complex64 + ) + prik_x, f2py_x = x.copy(), x.copy() + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + + prik_blas.cher("U", np.int32(2), alpha, prik_x, np.int32(1), prik_a, np.int32(3)) + f2py_blas.cher(b"U", np.int32(2), alpha, f2py_x, np.int32(1), f2py_a, lda=np.int32(3)) + + expected_a = hermitian_from_triangle(original_a, 2, "U") + alpha * x[:, None] * np.conj(x[None, :]) + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_a[:2, :2][upper], expected_a[upper]) + assert_allclose_for_dtype(f2py_a[:2, :2][upper], expected_a[upper]) + assert_allclose_for_dtype(prik_a[:2, :2][upper], f2py_a[:2, :2][upper]) + assert np.all(np.imag(np.diag(prik_a[:2, :2])) == 0.0) + assert np.all(np.imag(np.diag(f2py_a[:2, :2])) == 0.0) + np.testing.assert_array_equal(prik_a[np.tril_indices(2, -1)], original_a[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_a[np.tril_indices(2, -1)], original_a[np.tril_indices(2, -1)]) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_zher(prik_blas, f2py_blas): + alpha = np.float64(-0.25) + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex128) + original_a = np.asfortranarray( + [[3.0 + 9.0j, np.nan + 1.0j * np.nan], [1.0 + 2.0j, 4.0 - 8.0j], [91.0j, 92.0j]], dtype=np.complex128 + ) + prik_x, f2py_x = x.copy(), x.copy() + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + + prik_blas.zher("L", np.int32(2), alpha, prik_x, np.int32(1), prik_a, np.int32(3)) + f2py_blas.zher(b"L", np.int32(2), alpha, f2py_x, np.int32(1), f2py_a, lda=np.int32(3)) + + expected_a = hermitian_from_triangle(original_a, 2, "L") + alpha * x[:, None] * np.conj(x[None, :]) + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_a[:2, :2][lower], expected_a[lower]) + assert_allclose_for_dtype(f2py_a[:2, :2][lower], expected_a[lower]) + assert_allclose_for_dtype(prik_a[:2, :2][lower], f2py_a[:2, :2][lower]) + assert np.all(np.imag(np.diag(prik_a[:2, :2])) == 0.0) + assert np.all(np.imag(np.diag(f2py_a[:2, :2])) == 0.0) + np.testing.assert_array_equal(prik_a[np.triu_indices(2, 1)], original_a[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_a[np.triu_indices(2, 1)], original_a[np.triu_indices(2, 1)]) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_cher2(prik_blas, f2py_blas): + alpha = np.complex64(0.5 - 0.25j) + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex64) + y = np.array([-3.0 + 0.5j, 4.0 - 2.0j], dtype=np.complex64) + original_a = np.asfortranarray( + [[3.0 + 9.0j, 1.0 - 2.0j], [np.nan + 1.0j * np.nan, 4.0 - 8.0j], [91.0j, 92.0j]], dtype=np.complex64 + ) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + + prik_blas.cher2("U", np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_a, np.int32(3)) + f2py_blas.cher2(b"U", np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_a, lda=np.int32(3)) + + logical_a = hermitian_from_triangle(original_a, 2, "U") + expected_a = ( + logical_a + alpha * x[:, None] * np.conj(y[None, :]) + np.conj(alpha) * y[:, None] * np.conj(x[None, :]) + ) + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_a[:2, :2][upper], expected_a[upper], operation_size=2) + assert_allclose_for_dtype(f2py_a[:2, :2][upper], expected_a[upper], operation_size=2) + assert_allclose_for_dtype(prik_a[:2, :2][upper], f2py_a[:2, :2][upper], operation_size=2) + assert np.all(np.imag(np.diag(prik_a[:2, :2])) == 0.0) + assert np.all(np.imag(np.diag(f2py_a[:2, :2])) == 0.0) + np.testing.assert_array_equal(prik_a[np.tril_indices(2, -1)], original_a[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_a[np.tril_indices(2, -1)], original_a[np.tril_indices(2, -1)]) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_zher2(prik_blas, f2py_blas): + alpha = np.complex128(-0.75 + 0.5j) + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex128) + y = np.array([-3.0 + 0.5j, 4.0 - 2.0j], dtype=np.complex128) + original_a = np.asfortranarray( + [[3.0 + 9.0j, np.nan + 1.0j * np.nan], [1.0 + 2.0j, 4.0 - 8.0j], [91.0j, 92.0j]], dtype=np.complex128 + ) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + + prik_blas.zher2("L", np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_a, np.int32(3)) + f2py_blas.zher2(b"L", np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_a, lda=np.int32(3)) + + logical_a = hermitian_from_triangle(original_a, 2, "L") + expected_a = ( + logical_a + alpha * x[:, None] * np.conj(y[None, :]) + np.conj(alpha) * y[:, None] * np.conj(x[None, :]) + ) + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_a[:2, :2][lower], expected_a[lower], operation_size=2) + assert_allclose_for_dtype(f2py_a[:2, :2][lower], expected_a[lower], operation_size=2) + assert_allclose_for_dtype(prik_a[:2, :2][lower], f2py_a[:2, :2][lower], operation_size=2) + assert np.all(np.imag(np.diag(prik_a[:2, :2])) == 0.0) + assert np.all(np.imag(np.diag(f2py_a[:2, :2])) == 0.0) + np.testing.assert_array_equal(prik_a[np.triu_indices(2, 1)], original_a[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_a[np.triu_indices(2, 1)], original_a[np.triu_indices(2, 1)]) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) diff --git a/examples/blas/test_level2_packed.py b/examples/blas/test_level2_packed.py new file mode 100644 index 000000000..5d99707f4 --- /dev/null +++ b/examples/blas/test_level2_packed.py @@ -0,0 +1,451 @@ +"""Readable independent and differential checks for packed BLAS Level 2.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import ( + assert_allclose_for_dtype, + assert_storage_unchanged, + hermitian_from_packed, + packed_from_triangle, + symmetric_from_packed, + triangular_from_packed, +) + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_sspmv(prik_blas, f2py_blas): + alpha, beta = np.float32(1.5), np.float32(-0.5) + ap = packed_from_triangle(np.array([[2.0, -1.0], [91.0, 3.0]], dtype=np.float32), "U") + x = np.array([2.0, -3.0], dtype=np.float32) + original_y = np.array([4.0, 5.0], dtype=np.float32) + logical_a = symmetric_from_packed(ap, 2, "U") + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.sspmv("U", np.int32(2), alpha, prik_ap, prik_x, np.int32(1), beta, prik_y, np.int32(1)) + f2py_blas.sspmv(b"U", np.int32(2), alpha, f2py_ap, f2py_x, np.int32(1), beta, f2py_y, np.int32(1)) + + expected_y = alpha * logical_a @ x + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dspmv(prik_blas, f2py_blas): + alpha, beta = np.float64(-2.0), np.float64(1.0) + ap = packed_from_triangle(np.array([[2.0, 91.0], [-1.0, 3.0]], dtype=np.float64), "L") + x = np.array([2.0, -3.0], dtype=np.float64) + original_y = np.array([4.0, 5.0], dtype=np.float64) + logical_a = symmetric_from_packed(ap, 2, "L") + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.dspmv("L", np.int32(2), alpha, prik_ap, prik_x, np.int32(1), beta, prik_y, np.int32(1)) + f2py_blas.dspmv(b"L", np.int32(2), alpha, f2py_ap, f2py_x, np.int32(1), beta, f2py_y, np.int32(1)) + + expected_y = alpha * logical_a @ x + original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_sspr(prik_blas, f2py_blas): + alpha = np.float32(0.75) + original_ap = packed_from_triangle(np.array([[3.0, 1.0], [91.0, 4.0]], dtype=np.float32), "U") + x = np.array([2.0, -1.0], dtype=np.float32) + logical_a = symmetric_from_packed(original_ap, 2, "U") + prik_ap, f2py_ap = original_ap.copy(), original_ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + + prik_blas.sspr("U", np.int32(2), alpha, prik_x, np.int32(1), prik_ap) + f2py_blas.sspr(b"U", np.int32(2), alpha, f2py_x, np.int32(1), f2py_ap) + + expected_ap = packed_from_triangle(logical_a + alpha * x[:, None] * x[None, :], "U") + assert_allclose_for_dtype(prik_ap, expected_ap) + assert_allclose_for_dtype(f2py_ap, expected_ap) + assert_allclose_for_dtype(prik_ap, f2py_ap) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dspr(prik_blas, f2py_blas): + alpha = np.float64(-0.5) + original_ap = packed_from_triangle(np.array([[3.0, 91.0], [1.0, 4.0]], dtype=np.float64), "L") + x = np.array([2.0, -1.0], dtype=np.float64) + logical_a = symmetric_from_packed(original_ap, 2, "L") + prik_ap, f2py_ap = original_ap.copy(), original_ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + + prik_blas.dspr("L", np.int32(2), alpha, prik_x, np.int32(1), prik_ap) + f2py_blas.dspr(b"L", np.int32(2), alpha, f2py_x, np.int32(1), f2py_ap) + + expected_ap = packed_from_triangle(logical_a + alpha * x[:, None] * x[None, :], "L") + assert_allclose_for_dtype(prik_ap, expected_ap) + assert_allclose_for_dtype(f2py_ap, expected_ap) + assert_allclose_for_dtype(prik_ap, f2py_ap) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_sspr2(prik_blas, f2py_blas): + alpha = np.float32(0.25) + original_ap = packed_from_triangle(np.array([[3.0, 1.0], [91.0, 4.0]], dtype=np.float32), "U") + x = np.array([2.0, -1.0], dtype=np.float32) + y = np.array([-3.0, 4.0], dtype=np.float32) + logical_a = symmetric_from_packed(original_ap, 2, "U") + prik_ap, f2py_ap = original_ap.copy(), original_ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.sspr2("U", np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_ap) + f2py_blas.sspr2(b"U", np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_ap) + + expected = logical_a + alpha * (x[:, None] * y[None, :] + y[:, None] * x[None, :]) + expected_ap = packed_from_triangle(expected, "U") + assert_allclose_for_dtype(prik_ap, expected_ap, operation_size=2) + assert_allclose_for_dtype(f2py_ap, expected_ap, operation_size=2) + assert_allclose_for_dtype(prik_ap, f2py_ap, operation_size=2) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_dspr2(prik_blas, f2py_blas): + alpha = np.float64(-0.75) + original_ap = packed_from_triangle(np.array([[3.0, 91.0], [1.0, 4.0]], dtype=np.float64), "L") + x = np.array([2.0, -1.0], dtype=np.float64) + y = np.array([-3.0, 4.0], dtype=np.float64) + logical_a = symmetric_from_packed(original_ap, 2, "L") + prik_ap, f2py_ap = original_ap.copy(), original_ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.dspr2("L", np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_ap) + f2py_blas.dspr2(b"L", np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_ap) + + expected = logical_a + alpha * (x[:, None] * y[None, :] + y[:, None] * x[None, :]) + expected_ap = packed_from_triangle(expected, "L") + assert_allclose_for_dtype(prik_ap, expected_ap, operation_size=2) + assert_allclose_for_dtype(f2py_ap, expected_ap, operation_size=2) + assert_allclose_for_dtype(prik_ap, f2py_ap, operation_size=2) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_chpmv(prik_blas, f2py_blas): + alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(0.25j) + ap = packed_from_triangle(np.array([[2.0 + 77.0j, 1.0 - 2.0j], [91.0j, 3.0 - 88.0j]], dtype=np.complex64), "U") + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex64) + original_y = np.array([4.0 - 2.0j, 5.0 + 3.0j], dtype=np.complex64) + logical_a = hermitian_from_packed(ap, 2, "U") + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.chpmv("U", np.int32(2), alpha, prik_ap, prik_x, np.int32(1), beta, prik_y, np.int32(1)) + f2py_blas.chpmv(b"U", np.int32(2), alpha, f2py_ap, f2py_x, np.int32(1), beta, f2py_y, np.int32(1)) + + expected_y = alpha * logical_a @ x + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_zhpmv(prik_blas, f2py_blas): + alpha, beta = np.complex128(-0.5 + 0.25j), np.complex128(1.0) + ap = packed_from_triangle(np.array([[2.0 + 77.0j, 91.0j], [1.0 + 2.0j, 3.0 - 88.0j]], dtype=np.complex128), "L") + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex128) + original_y = np.array([4.0 - 2.0j, 5.0 + 3.0j], dtype=np.complex128) + logical_a = hermitian_from_packed(ap, 2, "L") + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.zhpmv("L", np.int32(2), alpha, prik_ap, prik_x, np.int32(1), beta, prik_y, np.int32(1)) + f2py_blas.zhpmv(b"L", np.int32(2), alpha, f2py_ap, f2py_x, np.int32(1), beta, f2py_y, np.int32(1)) + + expected_y = alpha * logical_a @ x + original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_chpr(prik_blas, f2py_blas): + alpha = np.float32(0.75) + original_ap = packed_from_triangle( + np.array([[3.0 + 9.0j, 1.0 - 2.0j], [91.0j, 4.0 - 8.0j]], dtype=np.complex64), "U" + ) + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex64) + logical_a = hermitian_from_packed(original_ap, 2, "U") + prik_ap, f2py_ap = original_ap.copy(), original_ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + + prik_blas.chpr("U", np.int32(2), alpha, prik_x, np.int32(1), prik_ap) + f2py_blas.chpr(b"U", np.int32(2), alpha, f2py_x, np.int32(1), f2py_ap) + + expected_ap = packed_from_triangle(logical_a + alpha * x[:, None] * np.conj(x[None, :]), "U") + assert_allclose_for_dtype(prik_ap, expected_ap) + assert_allclose_for_dtype(f2py_ap, expected_ap) + assert_allclose_for_dtype(prik_ap, f2py_ap) + assert np.all(np.imag(prik_ap[[0, 2]]) == 0.0) + assert np.all(np.imag(f2py_ap[[0, 2]]) == 0.0) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_zhpr(prik_blas, f2py_blas): + alpha = np.float64(-0.25) + original_ap = packed_from_triangle( + np.array([[3.0 + 9.0j, 91.0j], [1.0 + 2.0j, 4.0 - 8.0j]], dtype=np.complex128), "L" + ) + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex128) + logical_a = hermitian_from_packed(original_ap, 2, "L") + prik_ap, f2py_ap = original_ap.copy(), original_ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + + prik_blas.zhpr("L", np.int32(2), alpha, prik_x, np.int32(1), prik_ap) + f2py_blas.zhpr(b"L", np.int32(2), alpha, f2py_x, np.int32(1), f2py_ap) + + expected_ap = packed_from_triangle(logical_a + alpha * x[:, None] * np.conj(x[None, :]), "L") + assert_allclose_for_dtype(prik_ap, expected_ap) + assert_allclose_for_dtype(f2py_ap, expected_ap) + assert_allclose_for_dtype(prik_ap, f2py_ap) + assert np.all(np.imag(prik_ap[[0, 2]]) == 0.0) + assert np.all(np.imag(f2py_ap[[0, 2]]) == 0.0) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_chpr2(prik_blas, f2py_blas): + alpha = np.complex64(0.5 - 0.25j) + original_ap = packed_from_triangle( + np.array([[3.0 + 9.0j, 1.0 - 2.0j], [91.0j, 4.0 - 8.0j]], dtype=np.complex64), "U" + ) + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex64) + y = np.array([-3.0 + 0.5j, 4.0 - 2.0j], dtype=np.complex64) + logical_a = hermitian_from_packed(original_ap, 2, "U") + prik_ap, f2py_ap = original_ap.copy(), original_ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.chpr2("U", np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_ap) + f2py_blas.chpr2(b"U", np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_ap) + + expected = logical_a + alpha * x[:, None] * np.conj(y[None, :]) + np.conj(alpha) * y[:, None] * np.conj(x[None, :]) + expected_ap = packed_from_triangle(expected, "U") + assert_allclose_for_dtype(prik_ap, expected_ap, operation_size=2) + assert_allclose_for_dtype(f2py_ap, expected_ap, operation_size=2) + assert_allclose_for_dtype(prik_ap, f2py_ap, operation_size=2) + assert np.all(np.imag(prik_ap[[0, 2]]) == 0.0) + assert np.all(np.imag(f2py_ap[[0, 2]]) == 0.0) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_zhpr2(prik_blas, f2py_blas): + alpha = np.complex128(-0.75 + 0.5j) + original_ap = packed_from_triangle( + np.array([[3.0 + 9.0j, 91.0j], [1.0 + 2.0j, 4.0 - 8.0j]], dtype=np.complex128), "L" + ) + x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex128) + y = np.array([-3.0 + 0.5j, 4.0 - 2.0j], dtype=np.complex128) + logical_a = hermitian_from_packed(original_ap, 2, "L") + prik_ap, f2py_ap = original_ap.copy(), original_ap.copy() + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_blas.zhpr2("L", np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_ap) + f2py_blas.zhpr2(b"L", np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_ap) + + expected = logical_a + alpha * x[:, None] * np.conj(y[None, :]) + np.conj(alpha) * y[:, None] * np.conj(x[None, :]) + expected_ap = packed_from_triangle(expected, "L") + assert_allclose_for_dtype(prik_ap, expected_ap, operation_size=2) + assert_allclose_for_dtype(f2py_ap, expected_ap, operation_size=2) + assert_allclose_for_dtype(prik_ap, f2py_ap, operation_size=2) + assert np.all(np.imag(prik_ap[[0, 2]]) == 0.0) + assert np.all(np.imag(f2py_ap[[0, 2]]) == 0.0) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_stpmv(prik_blas, f2py_blas): + ap = packed_from_triangle(np.array([[2.0, -1.0], [91.0, 3.0]], dtype=np.float32), "U") + original_x = np.array([4.0, -2.0], dtype=np.float32) + logical_a = triangular_from_packed(ap, 2, "U", unit_diagonal=False) + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.stpmv("U", "N", "N", np.int32(2), prik_ap, prik_x, np.int32(1)) + f2py_blas.stpmv(b"U", b"N", b"N", np.int32(2), f2py_ap, f2py_x, np.int32(1)) + + expected_x = logical_a @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) + + +def test_dtpmv(prik_blas, f2py_blas): + ap = packed_from_triangle(np.array([[np.nan, 91.0], [-1.0, np.nan]], dtype=np.float64), "L") + original_x = np.array([4.0, -2.0], dtype=np.float64) + logical_a = triangular_from_packed(ap, 2, "L", unit_diagonal=True) + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.dtpmv("L", "T", "U", np.int32(2), prik_ap, prik_x, np.int32(1)) + f2py_blas.dtpmv(b"L", b"T", b"U", np.int32(2), f2py_ap, f2py_x, np.int32(1)) + + expected_x = logical_a.T @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) + + +def test_ctpmv(prik_blas, f2py_blas): + ap = packed_from_triangle(np.array([[2.0 + 1.0j, -1.0 + 2.0j], [91.0j, 3.0 - 1.0j]], dtype=np.complex64), "U") + original_x = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex64) + logical_a = triangular_from_packed(ap, 2, "U", unit_diagonal=False) + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.ctpmv("U", "C", "N", np.int32(2), prik_ap, prik_x, np.int32(1)) + f2py_blas.ctpmv(b"U", b"C", b"N", np.int32(2), f2py_ap, f2py_x, np.int32(1)) + + expected_x = logical_a.conj().T @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) + + +def test_ztpmv(prik_blas, f2py_blas): + nan = np.nan + 1.0j * np.nan + ap = packed_from_triangle(np.array([[nan, 91.0j], [-1.0 + 2.0j, nan]], dtype=np.complex128), "L") + original_x = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex128) + logical_a = triangular_from_packed(ap, 2, "L", unit_diagonal=True) + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.ztpmv("L", "N", "U", np.int32(2), prik_ap, prik_x, np.int32(1)) + f2py_blas.ztpmv(b"L", b"N", b"U", np.int32(2), f2py_ap, f2py_x, np.int32(1)) + + expected_x = logical_a @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) + + +def test_stpsv(prik_blas, f2py_blas): + ap = packed_from_triangle(np.array([[2.0, -1.0], [91.0, 3.0]], dtype=np.float32), "U") + expected_solution = np.array([4.0, -2.0], dtype=np.float32) + logical_a = triangular_from_packed(ap, 2, "U", unit_diagonal=False) + original_b = logical_a @ expected_solution + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.stpsv("U", "N", "N", np.int32(2), prik_ap, prik_x, np.int32(1)) + f2py_blas.stpsv(b"U", b"N", b"N", np.int32(2), f2py_ap, f2py_x, np.int32(1)) + + assert_allclose_for_dtype(logical_a @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) + + +def test_dtpsv(prik_blas, f2py_blas): + ap = packed_from_triangle(np.array([[np.nan, 91.0], [-1.0, np.nan]], dtype=np.float64), "L") + expected_solution = np.array([4.0, -2.0], dtype=np.float64) + logical_a = triangular_from_packed(ap, 2, "L", unit_diagonal=True) + original_b = logical_a.T @ expected_solution + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.dtpsv("L", "T", "U", np.int32(2), prik_ap, prik_x, np.int32(1)) + f2py_blas.dtpsv(b"L", b"T", b"U", np.int32(2), f2py_ap, f2py_x, np.int32(1)) + + assert_allclose_for_dtype(logical_a.T @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a.T @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) + + +def test_ctpsv(prik_blas, f2py_blas): + ap = packed_from_triangle(np.array([[2.0 + 1.0j, -1.0 + 2.0j], [91.0j, 3.0 - 1.0j]], dtype=np.complex64), "U") + expected_solution = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex64) + logical_a = triangular_from_packed(ap, 2, "U", unit_diagonal=False) + original_b = logical_a.conj().T @ expected_solution + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.ctpsv("U", "C", "N", np.int32(2), prik_ap, prik_x, np.int32(1)) + f2py_blas.ctpsv(b"U", b"C", b"N", np.int32(2), f2py_ap, f2py_x, np.int32(1)) + + assert_allclose_for_dtype(logical_a.conj().T @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a.conj().T @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) + + +def test_ztpsv(prik_blas, f2py_blas): + ap = packed_from_triangle(np.array([[2.0 + 1.0j, 91.0j], [-1.0 + 2.0j, 3.0 - 1.0j]], dtype=np.complex128), "L") + expected_solution = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex128) + logical_a = triangular_from_packed(ap, 2, "L", unit_diagonal=False) + original_b = logical_a @ expected_solution + prik_ap, f2py_ap = ap.copy(), ap.copy() + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.ztpsv("L", "N", "N", np.int32(2), prik_ap, prik_x, np.int32(1)) + f2py_blas.ztpsv(b"L", b"N", b"N", np.int32(2), f2py_ap, f2py_x, np.int32(1)) + + assert_allclose_for_dtype(logical_a @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_ap, ap) + assert_storage_unchanged(f2py_ap, ap) diff --git a/examples/blas/test_level2_symmetric.py b/examples/blas/test_level2_symmetric.py new file mode 100644 index 000000000..d540e146a --- /dev/null +++ b/examples/blas/test_level2_symmetric.py @@ -0,0 +1,153 @@ +"""Readable independent and differential checks for symmetric BLAS Level 2.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import assert_allclose_for_dtype, assert_storage_unchanged, symmetric_from_triangle + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_ssymv(prik_blas, f2py_blas): + alpha, beta = np.float32(1.5), np.float32(-0.5) + original_a = np.asfortranarray([[2.0, -1.0], [np.nan, 3.0], [91.0, 92.0]], dtype=np.float32) + x = np.array([2.0, -3.0], dtype=np.float32) + original_y = np.array([4.0, 5.0], dtype=np.float32) + logical_a = symmetric_from_triangle(original_a, 2, "U") + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.ssymv("U", np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1)) + f2py_blas.ssymv(b"U", np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3)) + + expected_y = alpha * logical_a @ x + beta * original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dsymv(prik_blas, f2py_blas): + alpha, beta = np.float64(-2.0), np.float64(1.0) + original_a = np.asfortranarray([[2.0, np.nan], [-1.0, 3.0], [91.0, 92.0]], dtype=np.float64) + x = np.array([2.0, -3.0], dtype=np.float64) + original_y = np.array([4.0, 5.0], dtype=np.float64) + logical_a = symmetric_from_triangle(original_a, 2, "L") + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_blas.dsymv("L", np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1)) + f2py_blas.dsymv(b"L", np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3)) + + expected_y = alpha * logical_a @ x + original_y + assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) + assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) + assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_ssyr(prik_blas, f2py_blas): + alpha = np.float32(0.75) + x = np.array([2.0, -1.0], dtype=np.float32) + original_a = np.asfortranarray([[3.0, 1.0], [np.nan, 4.0], [91.0, 92.0]], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + + prik_blas.ssyr("U", np.int32(2), alpha, prik_x, np.int32(1), prik_a, np.int32(3)) + f2py_blas.ssyr(b"U", np.int32(2), alpha, f2py_x, np.int32(1), f2py_a, lda=np.int32(3)) + + expected_a = original_a[:2, :2] + alpha * x[:, None] * x[None, :] + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_a[:2, :2][upper], expected_a[upper]) + assert_allclose_for_dtype(f2py_a[:2, :2][upper], expected_a[upper]) + assert_allclose_for_dtype(prik_a[:2, :2][upper], f2py_a[:2, :2][upper]) + np.testing.assert_array_equal(prik_a[np.tril_indices(2, -1)], original_a[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_a[np.tril_indices(2, -1)], original_a[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(prik_a[2, :], original_a[2, :]) + np.testing.assert_array_equal(f2py_a[2, :], original_a[2, :]) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_dsyr(prik_blas, f2py_blas): + alpha = np.float64(-0.5) + x = np.array([2.0, -1.0], dtype=np.float64) + original_a = np.asfortranarray([[3.0, np.nan], [1.0, 4.0], [91.0, 92.0]], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + + prik_blas.dsyr("L", np.int32(2), alpha, prik_x, np.int32(1), prik_a, np.int32(3)) + f2py_blas.dsyr(b"L", np.int32(2), alpha, f2py_x, np.int32(1), f2py_a, lda=np.int32(3)) + + expected_a = original_a[:2, :2] + alpha * x[:, None] * x[None, :] + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_a[:2, :2][lower], expected_a[lower]) + assert_allclose_for_dtype(f2py_a[:2, :2][lower], expected_a[lower]) + assert_allclose_for_dtype(prik_a[:2, :2][lower], f2py_a[:2, :2][lower]) + np.testing.assert_array_equal(prik_a[np.triu_indices(2, 1)], original_a[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_a[np.triu_indices(2, 1)], original_a[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(prik_a[2, :], original_a[2, :]) + np.testing.assert_array_equal(f2py_a[2, :], original_a[2, :]) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + + +def test_ssyr2(prik_blas, f2py_blas): + alpha = np.float32(0.25) + x = np.array([2.0, -1.0], dtype=np.float32) + y = np.array([-3.0, 4.0], dtype=np.float32) + original_a = np.asfortranarray([[3.0, 1.0], [np.nan, 4.0], [91.0, 92.0]], dtype=np.float32) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + + prik_blas.ssyr2("U", np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_a, np.int32(3)) + f2py_blas.ssyr2(b"U", np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_a, lda=np.int32(3)) + + expected_a = original_a[:2, :2] + alpha * (x[:, None] * y[None, :] + y[:, None] * x[None, :]) + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_a[:2, :2][upper], expected_a[upper]) + assert_allclose_for_dtype(f2py_a[:2, :2][upper], expected_a[upper]) + assert_allclose_for_dtype(prik_a[:2, :2][upper], f2py_a[:2, :2][upper]) + np.testing.assert_array_equal(prik_a[np.tril_indices(2, -1)], original_a[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_a[np.tril_indices(2, -1)], original_a[np.tril_indices(2, -1)]) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) + + +def test_dsyr2(prik_blas, f2py_blas): + alpha = np.float64(-0.75) + x = np.array([2.0, -1.0], dtype=np.float64) + y = np.array([-3.0, 4.0], dtype=np.float64) + original_a = np.asfortranarray([[3.0, np.nan], [1.0, 4.0], [91.0, 92.0]], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + + prik_blas.dsyr2("L", np.int32(2), alpha, prik_x, np.int32(1), prik_y, np.int32(1), prik_a, np.int32(3)) + f2py_blas.dsyr2(b"L", np.int32(2), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1), f2py_a, lda=np.int32(3)) + + expected_a = original_a[:2, :2] + alpha * (x[:, None] * y[None, :] + y[:, None] * x[None, :]) + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_a[:2, :2][lower], expected_a[lower]) + assert_allclose_for_dtype(f2py_a[:2, :2][lower], expected_a[lower]) + assert_allclose_for_dtype(prik_a[:2, :2][lower], f2py_a[:2, :2][lower]) + np.testing.assert_array_equal(prik_a[np.triu_indices(2, 1)], original_a[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_a[np.triu_indices(2, 1)], original_a[np.triu_indices(2, 1)]) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) diff --git a/examples/blas/test_level2_triangular.py b/examples/blas/test_level2_triangular.py new file mode 100644 index 000000000..3f8986493 --- /dev/null +++ b/examples/blas/test_level2_triangular.py @@ -0,0 +1,173 @@ +"""Readable independent and differential checks for triangular BLAS Level 2.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import assert_allclose_for_dtype, assert_storage_unchanged, triangular_from_triangle + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_strmv(prik_blas, f2py_blas): + original_a = np.asfortranarray([[2.0, -1.0], [np.nan, 3.0], [91.0, 92.0]], dtype=np.float32) + original_x = np.array([4.0, -2.0], dtype=np.float32) + logical_a = triangular_from_triangle(original_a, 2, "U", unit_diagonal=False) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.strmv("U", "N", "N", np.int32(2), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.strmv(b"U", b"N", b"N", np.int32(2), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + expected_x = logical_a @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_dtrmv(prik_blas, f2py_blas): + original_a = np.asfortranarray([[np.nan, np.nan], [-1.0, np.nan], [91.0, 92.0]], dtype=np.float64) + original_x = np.array([4.0, -2.0], dtype=np.float64) + logical_a = triangular_from_triangle(original_a, 2, "L", unit_diagonal=True) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.dtrmv("L", "T", "U", np.int32(2), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.dtrmv(b"L", b"T", b"U", np.int32(2), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + expected_x = logical_a.T @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_ctrmv(prik_blas, f2py_blas): + original_a = np.asfortranarray( + [[2.0 + 1.0j, -1.0 + 2.0j], [np.nan + 1.0j * np.nan, 3.0 - 1.0j], [91.0j, 92.0j]], dtype=np.complex64 + ) + original_x = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex64) + logical_a = triangular_from_triangle(original_a, 2, "U", unit_diagonal=False) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.ctrmv("U", "C", "N", np.int32(2), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.ctrmv(b"U", b"C", b"N", np.int32(2), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + expected_x = logical_a.conj().T @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_ztrmv(prik_blas, f2py_blas): + original_a = np.asfortranarray( + [[np.nan + 1.0j * np.nan, np.nan + 1.0j * np.nan], [-1.0 + 2.0j, np.nan + 1.0j * np.nan], [91.0j, 92.0j]], + dtype=np.complex128, + ) + original_x = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex128) + logical_a = triangular_from_triangle(original_a, 2, "L", unit_diagonal=True) + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_blas.ztrmv("L", "N", "U", np.int32(2), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.ztrmv(b"L", b"N", b"U", np.int32(2), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + expected_x = logical_a @ original_x + assert_allclose_for_dtype(prik_x, expected_x, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_x, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_strsv(prik_blas, f2py_blas): + original_a = np.asfortranarray([[2.0, -1.0], [np.nan, 3.0], [91.0, 92.0]], dtype=np.float32) + expected_solution = np.array([4.0, -2.0], dtype=np.float32) + logical_a = triangular_from_triangle(original_a, 2, "U", unit_diagonal=False) + original_b = logical_a @ expected_solution + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.strsv("U", "N", "N", np.int32(2), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.strsv(b"U", b"N", b"N", np.int32(2), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + assert_allclose_for_dtype(logical_a @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_dtrsv_upper_nonunit(prik_blas, f2py_blas): + original_a = np.asfortranarray([[2.0, -1.0], [np.nan, 3.0], [91.0, 92.0]], dtype=np.float64) + expected_solution = np.array([4.0, -2.0], dtype=np.float64) + logical_a = triangular_from_triangle(original_a, 2, "U", unit_diagonal=False) + original_b = logical_a.T @ expected_solution + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.dtrsv("U", "T", "N", np.int32(2), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.dtrsv(b"U", b"T", b"N", np.int32(2), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + assert_allclose_for_dtype(logical_a.T @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a.T @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_ctrsv(prik_blas, f2py_blas): + original_a = np.asfortranarray( + [[np.nan + 1.0j * np.nan, np.nan + 1.0j * np.nan], [-1.0 + 2.0j, np.nan + 1.0j * np.nan], [91.0j, 92.0j]], + dtype=np.complex64, + ) + expected_solution = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex64) + logical_a = triangular_from_triangle(original_a, 2, "L", unit_diagonal=True) + original_b = logical_a.conj().T @ expected_solution + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.ctrsv("L", "C", "U", np.int32(2), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.ctrsv(b"L", b"C", b"U", np.int32(2), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + assert_allclose_for_dtype(logical_a.conj().T @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a.conj().T @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) + + +def test_ztrsv(prik_blas, f2py_blas): + original_a = np.asfortranarray( + [[2.0 + 1.0j, np.nan + 1.0j * np.nan], [-1.0 + 2.0j, 3.0 - 1.0j], [91.0j, 92.0j]], dtype=np.complex128 + ) + expected_solution = np.array([4.0 + 1.0j, -2.0 + 0.5j], dtype=np.complex128) + logical_a = triangular_from_triangle(original_a, 2, "L", unit_diagonal=False) + original_b = logical_a @ expected_solution + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_x, f2py_x = original_b.copy(), original_b.copy() + + prik_blas.ztrsv("L", "N", "N", np.int32(2), prik_a, np.int32(3), prik_x, np.int32(1)) + f2py_blas.ztrsv(b"L", b"N", b"N", np.int32(2), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) + + assert_allclose_for_dtype(logical_a @ prik_x, original_b, operation_size=2) + assert_allclose_for_dtype(logical_a @ f2py_x, original_b, operation_size=2) + assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) + assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) + assert_storage_unchanged(prik_a, original_a) + assert_storage_unchanged(f2py_a, original_a) diff --git a/examples/blas/test_level3_general.py b/examples/blas/test_level3_general.py new file mode 100644 index 000000000..203bf4b61 --- /dev/null +++ b/examples/blas/test_level3_general.py @@ -0,0 +1,432 @@ +"""Readable independent and differential checks for general BLAS Level 3.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import assert_allclose_for_dtype, assert_storage_unchanged + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_dgemm(prik_blas, f2py_blas): + alpha, beta = np.float64(2.0), np.float64(-0.5) + a = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [91.0, 92.0]], dtype=np.float64) + b = np.asfortranarray([[5.0, 6.0], [7.0, 8.0], [93.0, 94.0]], dtype=np.float64) + original_c = np.asfortranarray([[9.0, 10.0], [11.0, 12.0], [95.0, 96.0]], dtype=np.float64) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_scalars = prik_blas.dgemm( + "N", + "N", + np.int32(2), + np.int32(2), + np.int32(2), + alpha, + prik_a, + np.int32(3), + prik_b, + np.int32(3), + beta, + prik_c, + np.int32(3), + ) + # f2py moves its inferred optional leading dimensions to keyword arguments. + f2py_result = f2py_blas.dgemm( + b"N", + b"N", + np.int32(2), + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(3), + ldb=np.int32(3), + ldc=np.int32(3), + ) + + product = np.array( + [[1.0 * 5.0 + 2.0 * 7.0, 1.0 * 6.0 + 2.0 * 8.0], [3.0 * 5.0 + 4.0 * 7.0, 3.0 * 6.0 + 4.0 * 8.0]], + dtype=np.float64, + ) + expected_active = alpha * product + beta * original_c[:2, :] + assert_allclose_for_dtype(prik_c[:2, :], expected_active, operation_size=2) + assert_allclose_for_dtype(f2py_c[:2, :], expected_active, operation_size=2) + assert_allclose_for_dtype(prik_c[:2, :], f2py_c[:2, :], operation_size=2) + np.testing.assert_array_equal(prik_c[2, :], original_c[2, :], strict=True) + np.testing.assert_array_equal(f2py_c[2, :], original_c[2, :], strict=True) + assert prik_scalars == (2, 2, 2, alpha, 3, 3, beta, 3) + assert f2py_result is None + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_sgemm(prik_blas, f2py_blas): + alpha, beta = np.float32(1.5), np.float32(0.0) + a = np.asfortranarray([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32) + b = np.asfortranarray([[5.0, 6.0], [7.0, 8.0]], dtype=np.float32) + original_c = np.asfortranarray([[9.0, 10.0], [11.0, 12.0]], dtype=np.float32) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.sgemm( + "N", + "N", + np.int32(2), + np.int32(2), + np.int32(2), + alpha, + prik_a, + np.int32(2), + prik_b, + np.int32(2), + beta, + prik_c, + np.int32(2), + ) + f2py_blas.sgemm( + b"N", + b"N", + np.int32(2), + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a @ b) + assert_allclose_for_dtype(prik_c, expected_c, operation_size=2) + assert_allclose_for_dtype(f2py_c, expected_c, operation_size=2) + assert_allclose_for_dtype(prik_c, f2py_c, operation_size=2) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_cgemm(prik_blas, f2py_blas): + alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(1.0) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex64) + b = np.asfortranarray([[5.0 + 2.0j, 6.0], [7.0 - 1.0j, 8.0 + 1.0j]], dtype=np.complex64) + original_c = np.asfortranarray([[9.0j, 10.0], [11.0, 12.0j]], dtype=np.complex64) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.cgemm( + "N", + "C", + np.int32(2), + np.int32(2), + np.int32(2), + alpha, + prik_a, + np.int32(2), + prik_b, + np.int32(2), + beta, + prik_c, + np.int32(2), + ) + f2py_blas.cgemm( + b"N", + b"C", + np.int32(2), + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a @ b.conj().T) + original_c + assert_allclose_for_dtype(prik_c, expected_c, operation_size=2) + assert_allclose_for_dtype(f2py_c, expected_c, operation_size=2) + assert_allclose_for_dtype(prik_c, f2py_c, operation_size=2) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_zgemm(prik_blas, f2py_blas): + alpha, beta = np.complex128(-0.5 + 0.25j), np.complex128(-1.0j) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex128) + b = np.asfortranarray([[5.0 + 2.0j, 6.0], [7.0 - 1.0j, 8.0 + 1.0j]], dtype=np.complex128) + original_c = np.asfortranarray([[9.0j, 10.0], [11.0, 12.0j]], dtype=np.complex128) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.zgemm( + "T", + "N", + np.int32(2), + np.int32(2), + np.int32(2), + alpha, + prik_a, + np.int32(2), + prik_b, + np.int32(2), + beta, + prik_c, + np.int32(2), + ) + f2py_blas.zgemm( + b"T", + b"N", + np.int32(2), + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a.T @ b) + beta * original_c + assert_allclose_for_dtype(prik_c, expected_c, operation_size=2) + assert_allclose_for_dtype(f2py_c, expected_c, operation_size=2) + assert_allclose_for_dtype(prik_c, f2py_c, operation_size=2) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_sgemmtr(prik_blas, f2py_blas): + alpha, beta = np.float32(1.5), np.float32(-0.5) + a = np.asfortranarray([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32) + b = np.asfortranarray([[5.0, 6.0], [7.0, 8.0]], dtype=np.float32) + original_c = np.asfortranarray([[9.0, 10.0], [np.nan, 12.0]], dtype=np.float32) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.sgemmtr( + "U", + "N", + "N", + np.int32(2), + np.int32(2), + alpha, + prik_a, + np.int32(2), + prik_b, + np.int32(2), + beta, + prik_c, + np.int32(2), + ) + f2py_blas.sgemmtr( + b"U", + b"N", + b"N", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a @ b) + beta * original_c + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_c[upper], expected_c[upper], operation_size=2) + assert_allclose_for_dtype(f2py_c[upper], expected_c[upper], operation_size=2) + assert_allclose_for_dtype(prik_c[upper], f2py_c[upper], operation_size=2) + np.testing.assert_array_equal(prik_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_dgemmtr(prik_blas, f2py_blas): + alpha, beta = np.float64(-0.75), np.float64(1.0) + a = np.asfortranarray([[1.0, 2.0], [3.0, 4.0]], dtype=np.float64) + b = np.asfortranarray([[5.0, 6.0], [7.0, 8.0]], dtype=np.float64) + original_c = np.asfortranarray([[9.0, np.nan], [11.0, 12.0]], dtype=np.float64) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.dgemmtr( + "L", + "T", + "N", + np.int32(2), + np.int32(2), + alpha, + prik_a, + np.int32(2), + prik_b, + np.int32(2), + beta, + prik_c, + np.int32(2), + ) + f2py_blas.dgemmtr( + b"L", + b"T", + b"N", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a.T @ b) + original_c + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_c[lower], expected_c[lower], operation_size=2) + assert_allclose_for_dtype(f2py_c[lower], expected_c[lower], operation_size=2) + assert_allclose_for_dtype(prik_c[lower], f2py_c[lower], operation_size=2) + np.testing.assert_array_equal(prik_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_cgemmtr(prik_blas, f2py_blas): + alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(0.25j) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex64) + b = np.asfortranarray([[5.0 + 2.0j, 6.0], [7.0 - 1.0j, 8.0 + 1.0j]], dtype=np.complex64) + original_c = np.asfortranarray([[9.0j, 10.0], [np.nan + 1.0j * np.nan, 12.0j]], dtype=np.complex64) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.cgemmtr( + "U", + "N", + "C", + np.int32(2), + np.int32(2), + alpha, + prik_a, + np.int32(2), + prik_b, + np.int32(2), + beta, + prik_c, + np.int32(2), + ) + f2py_blas.cgemmtr( + b"U", + b"N", + b"C", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a @ b.conj().T) + beta * original_c + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_c[upper], expected_c[upper], operation_size=2) + assert_allclose_for_dtype(f2py_c[upper], expected_c[upper], operation_size=2) + assert_allclose_for_dtype(prik_c[upper], f2py_c[upper], operation_size=2) + np.testing.assert_array_equal(prik_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_zgemmtr(prik_blas, f2py_blas): + alpha, beta = np.complex128(-0.5 + 0.25j), np.complex128(1.0) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex128) + b = np.asfortranarray([[5.0 + 2.0j, 6.0], [7.0 - 1.0j, 8.0 + 1.0j]], dtype=np.complex128) + original_c = np.asfortranarray([[9.0j, np.nan + 1.0j * np.nan], [11.0, 12.0j]], dtype=np.complex128) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.zgemmtr( + "L", + "C", + "N", + np.int32(2), + np.int32(2), + alpha, + prik_a, + np.int32(2), + prik_b, + np.int32(2), + beta, + prik_c, + np.int32(2), + ) + f2py_blas.zgemmtr( + b"L", + b"C", + b"N", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a.conj().T @ b) + original_c + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_c[lower], expected_c[lower], operation_size=2) + assert_allclose_for_dtype(f2py_c[lower], expected_c[lower], operation_size=2) + assert_allclose_for_dtype(prik_c[lower], f2py_c[lower], operation_size=2) + np.testing.assert_array_equal(prik_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) diff --git a/examples/blas/test_level3_hermitian.py b/examples/blas/test_level3_hermitian.py new file mode 100644 index 000000000..c70fb4c4e --- /dev/null +++ b/examples/blas/test_level3_hermitian.py @@ -0,0 +1,229 @@ +"""Readable independent and differential checks for Hermitian BLAS Level 3.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import assert_allclose_for_dtype, assert_storage_unchanged, hermitian_from_triangle + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_chemm(prik_blas, f2py_blas): + alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(0.25j) + a = np.asfortranarray([[2.0 + 77.0j, -1.0 + 2.0j], [np.nan + 1.0j * np.nan, 3.0 - 88.0j]], dtype=np.complex64) + b = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex64) + original_c = np.asfortranarray([[5.0j, 6.0], [7.0, 8.0j]], dtype=np.complex64) + logical_a = hermitian_from_triangle(a, 2, "U") + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.chemm( + "L", "U", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.chemm( + b"L", + b"U", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * logical_a @ b + beta * original_c + assert_allclose_for_dtype(prik_c, expected_c, operation_size=2) + assert_allclose_for_dtype(f2py_c, expected_c, operation_size=2) + assert_allclose_for_dtype(prik_c, f2py_c, operation_size=2) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_zhemm(prik_blas, f2py_blas): + alpha, beta = np.complex128(-0.5 + 0.25j), np.complex128(1.0) + a = np.asfortranarray([[2.0 + 77.0j, np.nan + 1.0j * np.nan], [-1.0 - 2.0j, 3.0 - 88.0j]], dtype=np.complex128) + b = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex128) + original_c = np.asfortranarray([[5.0j, 6.0], [7.0, 8.0j]], dtype=np.complex128) + logical_a = hermitian_from_triangle(a, 2, "L") + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.zhemm( + "R", "L", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.zhemm( + b"R", + b"L", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * b @ logical_a + original_c + assert_allclose_for_dtype(prik_c, expected_c, operation_size=2) + assert_allclose_for_dtype(f2py_c, expected_c, operation_size=2) + assert_allclose_for_dtype(prik_c, f2py_c, operation_size=2) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_cherk(prik_blas, f2py_blas): + alpha, beta = np.float32(1.5), np.float32(-0.5) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex64) + original_c = np.asfortranarray( + [[5.0 + 77.0j, 6.0 - 2.0j], [np.nan + 1.0j * np.nan, 8.0 - 88.0j]], dtype=np.complex64 + ) + logical_c = hermitian_from_triangle(original_c, 2, "U") + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.cherk("U", "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), beta, prik_c, np.int32(2)) + f2py_blas.cherk(b"U", b"N", np.int32(2), np.int32(2), alpha, f2py_a, beta, f2py_c, lda=np.int32(2), ldc=np.int32(2)) + + expected_c = alpha * (a @ a.conj().T) + beta * logical_c + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_c[upper], expected_c[upper], operation_size=2) + assert_allclose_for_dtype(f2py_c[upper], expected_c[upper], operation_size=2) + assert_allclose_for_dtype(prik_c[upper], f2py_c[upper], operation_size=2) + assert np.all(np.imag(np.diag(prik_c)) == 0.0) + assert np.all(np.imag(np.diag(f2py_c)) == 0.0) + np.testing.assert_array_equal(prik_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_zherk(prik_blas, f2py_blas): + alpha, beta = np.float64(-0.75), np.float64(1.0) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex128) + original_c = np.asfortranarray( + [[5.0 + 77.0j, np.nan + 1.0j * np.nan], [6.0 + 2.0j, 8.0 - 88.0j]], dtype=np.complex128 + ) + logical_c = hermitian_from_triangle(original_c, 2, "L") + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.zherk("L", "C", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), beta, prik_c, np.int32(2)) + f2py_blas.zherk(b"L", b"C", np.int32(2), np.int32(2), alpha, f2py_a, beta, f2py_c, lda=np.int32(2), ldc=np.int32(2)) + + expected_c = alpha * (a.conj().T @ a) + logical_c + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_c[lower], expected_c[lower], operation_size=2) + assert_allclose_for_dtype(f2py_c[lower], expected_c[lower], operation_size=2) + assert_allclose_for_dtype(prik_c[lower], f2py_c[lower], operation_size=2) + assert np.all(np.imag(np.diag(prik_c)) == 0.0) + assert np.all(np.imag(np.diag(f2py_c)) == 0.0) + np.testing.assert_array_equal(prik_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_cher2k(prik_blas, f2py_blas): + alpha, beta = np.complex64(0.5 - 0.25j), np.float32(-0.5) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex64) + b = np.asfortranarray([[5.0 + 2.0j, 6.0], [7.0 - 1.0j, 8.0 + 1.0j]], dtype=np.complex64) + original_c = np.asfortranarray( + [[9.0 + 77.0j, 10.0 - 2.0j], [np.nan + 1.0j * np.nan, 12.0 - 88.0j]], dtype=np.complex64 + ) + logical_c = hermitian_from_triangle(original_c, 2, "U") + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.cher2k( + "U", "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.cher2k( + b"U", + b"N", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a @ b.conj().T) + np.conj(alpha) * (b @ a.conj().T) + beta * logical_c + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_c[upper], expected_c[upper], operation_size=4) + assert_allclose_for_dtype(f2py_c[upper], expected_c[upper], operation_size=4) + assert_allclose_for_dtype(prik_c[upper], f2py_c[upper], operation_size=4) + assert np.all(np.imag(np.diag(prik_c)) == 0.0) + assert np.all(np.imag(np.diag(f2py_c)) == 0.0) + np.testing.assert_array_equal(prik_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_zher2k(prik_blas, f2py_blas): + alpha, beta = np.complex128(-0.75 + 0.5j), np.float64(1.0) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex128) + b = np.asfortranarray([[5.0 + 2.0j, 6.0], [7.0 - 1.0j, 8.0 + 1.0j]], dtype=np.complex128) + original_c = np.asfortranarray( + [[9.0 + 77.0j, np.nan + 1.0j * np.nan], [10.0 + 2.0j, 12.0 - 88.0j]], dtype=np.complex128 + ) + logical_c = hermitian_from_triangle(original_c, 2, "L") + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.zher2k( + "L", "C", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.zher2k( + b"L", + b"C", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a.conj().T @ b) + np.conj(alpha) * (b.conj().T @ a) + logical_c + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_c[lower], expected_c[lower], operation_size=4) + assert_allclose_for_dtype(f2py_c[lower], expected_c[lower], operation_size=4) + assert_allclose_for_dtype(prik_c[lower], f2py_c[lower], operation_size=4) + assert np.all(np.imag(np.diag(prik_c)) == 0.0) + assert np.all(np.imag(np.diag(f2py_c)) == 0.0) + np.testing.assert_array_equal(prik_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) diff --git a/examples/blas/test_level3_symmetric.py b/examples/blas/test_level3_symmetric.py new file mode 100644 index 000000000..00510c915 --- /dev/null +++ b/examples/blas/test_level3_symmetric.py @@ -0,0 +1,407 @@ +"""Readable independent and differential checks for symmetric BLAS Level 3.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import assert_allclose_for_dtype, assert_storage_unchanged, symmetric_from_triangle + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_ssymm(prik_blas, f2py_blas): + alpha, beta = np.float32(1.5), np.float32(-0.5) + a = np.asfortranarray([[2.0, -1.0], [np.nan, 3.0]], dtype=np.float32) + b = np.asfortranarray([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32) + original_c = np.asfortranarray([[5.0, 6.0], [7.0, 8.0]], dtype=np.float32) + logical_a = symmetric_from_triangle(a, 2, "U") + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.ssymm( + "L", "U", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.ssymm( + b"L", + b"U", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * logical_a @ b + beta * original_c + assert_allclose_for_dtype(prik_c, expected_c, operation_size=2) + assert_allclose_for_dtype(f2py_c, expected_c, operation_size=2) + assert_allclose_for_dtype(prik_c, f2py_c, operation_size=2) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_dsymm(prik_blas, f2py_blas): + alpha, beta = np.float64(-2.0), np.float64(1.0) + a = np.asfortranarray([[2.0, np.nan], [-1.0, 3.0]], dtype=np.float64) + b = np.asfortranarray([[1.0, 2.0], [3.0, 4.0]], dtype=np.float64) + original_c = np.asfortranarray([[5.0, 6.0], [7.0, 8.0]], dtype=np.float64) + logical_a = symmetric_from_triangle(a, 2, "L") + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.dsymm( + "R", "L", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.dsymm( + b"R", + b"L", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * b @ logical_a + original_c + assert_allclose_for_dtype(prik_c, expected_c, operation_size=2) + assert_allclose_for_dtype(f2py_c, expected_c, operation_size=2) + assert_allclose_for_dtype(prik_c, f2py_c, operation_size=2) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_csymm(prik_blas, f2py_blas): + alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(0.25j) + a = np.asfortranarray([[2.0 + 1.0j, -1.0 + 2.0j], [np.nan + 1.0j * np.nan, 3.0 - 1.0j]], dtype=np.complex64) + b = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex64) + original_c = np.asfortranarray([[5.0j, 6.0], [7.0, 8.0j]], dtype=np.complex64) + logical_a = symmetric_from_triangle(a, 2, "U") + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.csymm( + "L", "U", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.csymm( + b"L", + b"U", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * logical_a @ b + beta * original_c + assert_allclose_for_dtype(prik_c, expected_c, operation_size=2) + assert_allclose_for_dtype(f2py_c, expected_c, operation_size=2) + assert_allclose_for_dtype(prik_c, f2py_c, operation_size=2) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_zsymm(prik_blas, f2py_blas): + alpha, beta = np.complex128(-0.5 + 0.25j), np.complex128(1.0) + a = np.asfortranarray([[2.0 + 1.0j, np.nan + 1.0j * np.nan], [-1.0 + 2.0j, 3.0 - 1.0j]], dtype=np.complex128) + b = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex128) + original_c = np.asfortranarray([[5.0j, 6.0], [7.0, 8.0j]], dtype=np.complex128) + logical_a = symmetric_from_triangle(a, 2, "L") + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.zsymm( + "R", "L", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.zsymm( + b"R", + b"L", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * b @ logical_a + original_c + assert_allclose_for_dtype(prik_c, expected_c, operation_size=2) + assert_allclose_for_dtype(f2py_c, expected_c, operation_size=2) + assert_allclose_for_dtype(prik_c, f2py_c, operation_size=2) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_ssyrk(prik_blas, f2py_blas): + alpha, beta = np.float32(1.5), np.float32(-0.5) + a = np.asfortranarray([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32) + original_c = np.asfortranarray([[5.0, 6.0], [np.nan, 8.0]], dtype=np.float32) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.ssyrk("U", "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), beta, prik_c, np.int32(2)) + f2py_blas.ssyrk(b"U", b"N", np.int32(2), np.int32(2), alpha, f2py_a, beta, f2py_c, lda=np.int32(2), ldc=np.int32(2)) + + expected_c = alpha * (a @ a.T) + beta * original_c + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_c[upper], expected_c[upper], operation_size=2) + assert_allclose_for_dtype(f2py_c[upper], expected_c[upper], operation_size=2) + assert_allclose_for_dtype(prik_c[upper], f2py_c[upper], operation_size=2) + np.testing.assert_array_equal(prik_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_dsyrk(prik_blas, f2py_blas): + alpha, beta = np.float64(-0.75), np.float64(1.0) + a = np.asfortranarray([[1.0, 2.0], [3.0, 4.0]], dtype=np.float64) + original_c = np.asfortranarray([[5.0, np.nan], [7.0, 8.0]], dtype=np.float64) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.dsyrk("L", "T", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), beta, prik_c, np.int32(2)) + f2py_blas.dsyrk(b"L", b"T", np.int32(2), np.int32(2), alpha, f2py_a, beta, f2py_c, lda=np.int32(2), ldc=np.int32(2)) + + expected_c = alpha * (a.T @ a) + original_c + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_c[lower], expected_c[lower], operation_size=2) + assert_allclose_for_dtype(f2py_c[lower], expected_c[lower], operation_size=2) + assert_allclose_for_dtype(prik_c[lower], f2py_c[lower], operation_size=2) + np.testing.assert_array_equal(prik_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_csyrk(prik_blas, f2py_blas): + alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(0.25j) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex64) + original_c = np.asfortranarray([[5.0j, 6.0], [np.nan + 1.0j * np.nan, 8.0j]], dtype=np.complex64) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.csyrk("U", "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), beta, prik_c, np.int32(2)) + f2py_blas.csyrk(b"U", b"N", np.int32(2), np.int32(2), alpha, f2py_a, beta, f2py_c, lda=np.int32(2), ldc=np.int32(2)) + + expected_c = alpha * (a @ a.T) + beta * original_c + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_c[upper], expected_c[upper], operation_size=2) + assert_allclose_for_dtype(f2py_c[upper], expected_c[upper], operation_size=2) + assert_allclose_for_dtype(prik_c[upper], f2py_c[upper], operation_size=2) + np.testing.assert_array_equal(prik_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_zsyrk(prik_blas, f2py_blas): + alpha, beta = np.complex128(-0.5 + 0.25j), np.complex128(1.0) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex128) + original_c = np.asfortranarray([[5.0j, np.nan + 1.0j * np.nan], [7.0, 8.0j]], dtype=np.complex128) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.zsyrk("L", "T", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), beta, prik_c, np.int32(2)) + f2py_blas.zsyrk(b"L", b"T", np.int32(2), np.int32(2), alpha, f2py_a, beta, f2py_c, lda=np.int32(2), ldc=np.int32(2)) + + expected_c = alpha * (a.T @ a) + original_c + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_c[lower], expected_c[lower], operation_size=2) + assert_allclose_for_dtype(f2py_c[lower], expected_c[lower], operation_size=2) + assert_allclose_for_dtype(prik_c[lower], f2py_c[lower], operation_size=2) + np.testing.assert_array_equal(prik_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_ssyr2k(prik_blas, f2py_blas): + alpha, beta = np.float32(0.75), np.float32(-0.5) + a = np.asfortranarray([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32) + b = np.asfortranarray([[5.0, 6.0], [7.0, 8.0]], dtype=np.float32) + original_c = np.asfortranarray([[9.0, 10.0], [np.nan, 12.0]], dtype=np.float32) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.ssyr2k( + "U", "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.ssyr2k( + b"U", + b"N", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a @ b.T + b @ a.T) + beta * original_c + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_c[upper], expected_c[upper], operation_size=4) + assert_allclose_for_dtype(f2py_c[upper], expected_c[upper], operation_size=4) + assert_allclose_for_dtype(prik_c[upper], f2py_c[upper], operation_size=4) + np.testing.assert_array_equal(prik_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_dsyr2k(prik_blas, f2py_blas): + alpha, beta = np.float64(-0.25), np.float64(1.0) + a = np.asfortranarray([[1.0, 2.0], [3.0, 4.0]], dtype=np.float64) + b = np.asfortranarray([[5.0, 6.0], [7.0, 8.0]], dtype=np.float64) + original_c = np.asfortranarray([[9.0, np.nan], [11.0, 12.0]], dtype=np.float64) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.dsyr2k( + "L", "T", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.dsyr2k( + b"L", + b"T", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a.T @ b + b.T @ a) + original_c + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_c[lower], expected_c[lower], operation_size=4) + assert_allclose_for_dtype(f2py_c[lower], expected_c[lower], operation_size=4) + assert_allclose_for_dtype(prik_c[lower], f2py_c[lower], operation_size=4) + np.testing.assert_array_equal(prik_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_csyr2k(prik_blas, f2py_blas): + alpha, beta = np.complex64(0.5 - 0.25j), np.complex64(0.25j) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex64) + b = np.asfortranarray([[5.0 + 2.0j, 6.0], [7.0 - 1.0j, 8.0 + 1.0j]], dtype=np.complex64) + original_c = np.asfortranarray([[9.0j, 10.0], [np.nan + 1.0j * np.nan, 12.0j]], dtype=np.complex64) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.csyr2k( + "U", "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.csyr2k( + b"U", + b"N", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a @ b.T + b @ a.T) + beta * original_c + upper = np.triu_indices(2) + assert_allclose_for_dtype(prik_c[upper], expected_c[upper], operation_size=4) + assert_allclose_for_dtype(f2py_c[upper], expected_c[upper], operation_size=4) + assert_allclose_for_dtype(prik_c[upper], f2py_c[upper], operation_size=4) + np.testing.assert_array_equal(prik_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + np.testing.assert_array_equal(f2py_c[np.tril_indices(2, -1)], original_c[np.tril_indices(2, -1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) + + +def test_zsyr2k(prik_blas, f2py_blas): + alpha, beta = np.complex128(-0.75 + 0.5j), np.complex128(1.0) + a = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j]], dtype=np.complex128) + b = np.asfortranarray([[5.0 + 2.0j, 6.0], [7.0 - 1.0j, 8.0 + 1.0j]], dtype=np.complex128) + original_c = np.asfortranarray([[9.0j, np.nan + 1.0j * np.nan], [11.0, 12.0j]], dtype=np.complex128) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") + + prik_blas.zsyr2k( + "L", "T", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(2), beta, prik_c, np.int32(2) + ) + f2py_blas.zsyr2k( + b"L", + b"T", + np.int32(2), + np.int32(2), + alpha, + f2py_a, + f2py_b, + beta, + f2py_c, + lda=np.int32(2), + ldb=np.int32(2), + ldc=np.int32(2), + ) + + expected_c = alpha * (a.T @ b + b.T @ a) + original_c + lower = np.tril_indices(2) + assert_allclose_for_dtype(prik_c[lower], expected_c[lower], operation_size=4) + assert_allclose_for_dtype(f2py_c[lower], expected_c[lower], operation_size=4) + assert_allclose_for_dtype(prik_c[lower], f2py_c[lower], operation_size=4) + np.testing.assert_array_equal(prik_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + np.testing.assert_array_equal(f2py_c[np.triu_indices(2, 1)], original_c[np.triu_indices(2, 1)]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + assert_storage_unchanged(prik_b, b) + assert_storage_unchanged(f2py_b, b) diff --git a/examples/blas/test_level3_triangular.py b/examples/blas/test_level3_triangular.py new file mode 100644 index 000000000..4934f05ba --- /dev/null +++ b/examples/blas/test_level3_triangular.py @@ -0,0 +1,207 @@ +"""Readable independent and differential checks for triangular BLAS Level 3.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from helpers import assert_allclose_for_dtype, assert_storage_unchanged, triangular_from_triangle + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_strmm(prik_blas, f2py_blas): + alpha = np.float32(1.5) + a = np.asfortranarray([[2.0, -1.0], [np.nan, 3.0]], dtype=np.float32) + original_b = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [91.0, 92.0]], dtype=np.float32) + logical_a = triangular_from_triangle(a, 2, "U", unit_diagonal=False) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = original_b.copy(order="F"), original_b.copy(order="F") + + prik_blas.strmm("L", "U", "N", "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(3)) + f2py_blas.strmm( + b"L", b"U", b"N", b"N", np.int32(2), np.int32(2), alpha, f2py_a, f2py_b, lda=np.int32(2), ldb=np.int32(3) + ) + + expected_b = alpha * logical_a @ original_b[:2, :] + assert_allclose_for_dtype(prik_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(f2py_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], f2py_b[:2, :], operation_size=2) + np.testing.assert_array_equal(prik_b[2, :], original_b[2, :]) + np.testing.assert_array_equal(f2py_b[2, :], original_b[2, :]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_dtrmm(prik_blas, f2py_blas): + alpha = np.float64(-0.5) + a = np.asfortranarray([[np.nan, np.nan], [-1.0, np.nan]], dtype=np.float64) + original_b = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [91.0, 92.0]], dtype=np.float64) + logical_a = triangular_from_triangle(a, 2, "L", unit_diagonal=True) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = original_b.copy(order="F"), original_b.copy(order="F") + + prik_blas.dtrmm("R", "L", "T", "U", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(3)) + f2py_blas.dtrmm( + b"R", b"L", b"T", b"U", np.int32(2), np.int32(2), alpha, f2py_a, f2py_b, lda=np.int32(2), ldb=np.int32(3) + ) + + expected_b = alpha * original_b[:2, :] @ logical_a.T + assert_allclose_for_dtype(prik_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(f2py_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], f2py_b[:2, :], operation_size=2) + np.testing.assert_array_equal(prik_b[2, :], original_b[2, :]) + np.testing.assert_array_equal(f2py_b[2, :], original_b[2, :]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_ctrmm(prik_blas, f2py_blas): + alpha = np.complex64(1.0 - 0.5j) + a = np.asfortranarray([[2.0 + 1.0j, -1.0 + 2.0j], [np.nan + 1.0j * np.nan, 3.0 - 1.0j]], dtype=np.complex64) + original_b = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j], [91.0j, 92.0j]], dtype=np.complex64) + logical_a = triangular_from_triangle(a, 2, "U", unit_diagonal=False) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = original_b.copy(order="F"), original_b.copy(order="F") + + prik_blas.ctrmm("L", "U", "C", "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(3)) + f2py_blas.ctrmm( + b"L", b"U", b"C", b"N", np.int32(2), np.int32(2), alpha, f2py_a, f2py_b, lda=np.int32(2), ldb=np.int32(3) + ) + + expected_b = alpha * logical_a.conj().T @ original_b[:2, :] + assert_allclose_for_dtype(prik_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(f2py_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], f2py_b[:2, :], operation_size=2) + np.testing.assert_array_equal(prik_b[2, :], original_b[2, :]) + np.testing.assert_array_equal(f2py_b[2, :], original_b[2, :]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_ztrmm(prik_blas, f2py_blas): + alpha = np.complex128(-0.5 + 0.25j) + nan = np.nan + 1.0j * np.nan + a = np.asfortranarray([[nan, nan], [-1.0 + 2.0j, nan]], dtype=np.complex128) + original_b = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j], [91.0j, 92.0j]], dtype=np.complex128) + logical_a = triangular_from_triangle(a, 2, "L", unit_diagonal=True) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = original_b.copy(order="F"), original_b.copy(order="F") + + prik_blas.ztrmm("R", "L", "N", "U", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(3)) + f2py_blas.ztrmm( + b"R", b"L", b"N", b"U", np.int32(2), np.int32(2), alpha, f2py_a, f2py_b, lda=np.int32(2), ldb=np.int32(3) + ) + + expected_b = alpha * original_b[:2, :] @ logical_a + assert_allclose_for_dtype(prik_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(f2py_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], f2py_b[:2, :], operation_size=2) + np.testing.assert_array_equal(prik_b[2, :], original_b[2, :]) + np.testing.assert_array_equal(f2py_b[2, :], original_b[2, :]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_strsm(prik_blas, f2py_blas): + alpha = np.float32(1.5) + a = np.asfortranarray([[2.0, -1.0], [np.nan, 3.0]], dtype=np.float32) + original_b = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [91.0, 92.0]], dtype=np.float32) + logical_a = triangular_from_triangle(a, 2, "U", unit_diagonal=False) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = original_b.copy(order="F"), original_b.copy(order="F") + + prik_blas.strsm("L", "U", "N", "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(3)) + f2py_blas.strsm( + b"L", b"U", b"N", b"N", np.int32(2), np.int32(2), alpha, f2py_a, f2py_b, lda=np.int32(2), ldb=np.int32(3) + ) + + expected_b = np.linalg.solve(logical_a, alpha * original_b[:2, :]) + assert_allclose_for_dtype(logical_a @ prik_b[:2, :], alpha * original_b[:2, :], operation_size=2) + assert_allclose_for_dtype(logical_a @ f2py_b[:2, :], alpha * original_b[:2, :], operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(f2py_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], f2py_b[:2, :], operation_size=2) + np.testing.assert_array_equal(prik_b[2, :], original_b[2, :]) + np.testing.assert_array_equal(f2py_b[2, :], original_b[2, :]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_dtrsm(prik_blas, f2py_blas): + alpha = np.float64(-0.5) + a = np.asfortranarray([[np.nan, np.nan], [-1.0, np.nan]], dtype=np.float64) + original_b = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [91.0, 92.0]], dtype=np.float64) + logical_a = triangular_from_triangle(a, 2, "L", unit_diagonal=True) + op_a = logical_a.T + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = original_b.copy(order="F"), original_b.copy(order="F") + + prik_blas.dtrsm("R", "L", "T", "U", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(3)) + f2py_blas.dtrsm( + b"R", b"L", b"T", b"U", np.int32(2), np.int32(2), alpha, f2py_a, f2py_b, lda=np.int32(2), ldb=np.int32(3) + ) + + expected_b = np.linalg.solve(op_a.T, (alpha * original_b[:2, :]).T).T + assert_allclose_for_dtype(prik_b[:2, :] @ op_a, alpha * original_b[:2, :], operation_size=2) + assert_allclose_for_dtype(f2py_b[:2, :] @ op_a, alpha * original_b[:2, :], operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(f2py_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], f2py_b[:2, :], operation_size=2) + np.testing.assert_array_equal(prik_b[2, :], original_b[2, :]) + np.testing.assert_array_equal(f2py_b[2, :], original_b[2, :]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_ctrsm(prik_blas, f2py_blas): + alpha = np.complex64(1.0 - 0.5j) + a = np.asfortranarray([[2.0 + 1.0j, -1.0 + 2.0j], [np.nan + 1.0j * np.nan, 3.0 - 1.0j]], dtype=np.complex64) + original_b = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j], [91.0j, 92.0j]], dtype=np.complex64) + logical_a = triangular_from_triangle(a, 2, "U", unit_diagonal=False) + op_a = logical_a.conj().T + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = original_b.copy(order="F"), original_b.copy(order="F") + + prik_blas.ctrsm("L", "U", "C", "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(3)) + f2py_blas.ctrsm( + b"L", b"U", b"C", b"N", np.int32(2), np.int32(2), alpha, f2py_a, f2py_b, lda=np.int32(2), ldb=np.int32(3) + ) + + expected_b = np.linalg.solve(op_a, alpha * original_b[:2, :]) + assert_allclose_for_dtype(op_a @ prik_b[:2, :], alpha * original_b[:2, :], operation_size=2) + assert_allclose_for_dtype(op_a @ f2py_b[:2, :], alpha * original_b[:2, :], operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(f2py_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], f2py_b[:2, :], operation_size=2) + np.testing.assert_array_equal(prik_b[2, :], original_b[2, :]) + np.testing.assert_array_equal(f2py_b[2, :], original_b[2, :]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) + + +def test_ztrsm(prik_blas, f2py_blas): + alpha = np.complex128(-0.5 + 0.25j) + nan = np.nan + 1.0j * np.nan + a = np.asfortranarray([[nan, nan], [-1.0 + 2.0j, nan]], dtype=np.complex128) + original_b = np.asfortranarray([[1.0 + 1.0j, 2.0], [3.0 - 1.0j, 4.0 + 0.5j], [91.0j, 92.0j]], dtype=np.complex128) + logical_a = triangular_from_triangle(a, 2, "L", unit_diagonal=True) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = original_b.copy(order="F"), original_b.copy(order="F") + + prik_blas.ztrsm("R", "L", "N", "U", np.int32(2), np.int32(2), alpha, prik_a, np.int32(2), prik_b, np.int32(3)) + f2py_blas.ztrsm( + b"R", b"L", b"N", b"U", np.int32(2), np.int32(2), alpha, f2py_a, f2py_b, lda=np.int32(2), ldb=np.int32(3) + ) + + expected_b = np.linalg.solve(logical_a.T, (alpha * original_b[:2, :]).T).T + assert_allclose_for_dtype(prik_b[:2, :] @ logical_a, alpha * original_b[:2, :], operation_size=2) + assert_allclose_for_dtype(f2py_b[:2, :] @ logical_a, alpha * original_b[:2, :], operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(f2py_b[:2, :], expected_b, operation_size=2) + assert_allclose_for_dtype(prik_b[:2, :], f2py_b[:2, :], operation_size=2) + np.testing.assert_array_equal(prik_b[2, :], original_b[2, :]) + np.testing.assert_array_equal(f2py_b[2, :], original_b[2, :]) + assert_storage_unchanged(prik_a, a) + assert_storage_unchanged(f2py_a, a) diff --git a/examples/blas/test_routine_coverage.py b/examples/blas/test_routine_coverage.py new file mode 100644 index 000000000..95712fb9c --- /dev/null +++ b/examples/blas/test_routine_coverage.py @@ -0,0 +1,116 @@ +"""Fail closed when the reference source set, inventory, exports, or tests drift.""" + +from __future__ import annotations + +import ast +from pathlib import Path + +import pytest + +from conftest import BLAS_SOURCES, EXAMPLE_ROOT +from prik.parsers.fortran.parser import parse_fortran_file +from routine_inventory import ( + ALL_ROUTINES, + DIFFERENTIALLY_TESTED_ROUTINES, + EXPLICIT_TEST_NAMES, + F2PY_LIMITATIONS, + PERMANENTLY_SKIPPED_ROUTINES, + PRIK_TESTED_ROUTINES, + ROUTINE_GROUPS, + UNSUPPORTED_ROUTINES, +) + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + +TEST_MODULES = ( + "test_level1_real.py", + "test_level1_complex.py", + "test_level2_general.py", + "test_level2_symmetric.py", + "test_level2_hermitian.py", + "test_level2_triangular.py", + "test_level2_packed.py", + "test_level2_banded.py", + "test_level3_general.py", + "test_level3_symmetric.py", + "test_level3_hermitian.py", + "test_level3_triangular.py", + "test_auxiliary.py", +) + + +def _source_routines() -> tuple[str, ...]: + routines: list[str] = [] + for source in BLAS_SOURCES: + parsed = parse_fortran_file(source.read_text(encoding="utf-8"), filename=source.name) + routines.extend(procedure.name.lower() for procedure in parsed.procedures) + return tuple(routines) + + +def _explicit_test_functions() -> dict[str, tuple[Path, ast.FunctionDef]]: + functions: dict[str, tuple[Path, ast.FunctionDef]] = {} + for filename in TEST_MODULES: + path = EXAMPLE_ROOT / filename + tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path)) + for node in tree.body: + if isinstance(node, ast.FunctionDef) and node.name.startswith("test_"): + assert node.name not in functions, f"duplicate explicitly named test: {node.name}" + functions[node.name] = (path, node) + return functions + + +def test_source_routines_match_the_classified_inventory(): + source_routines = _source_routines() + assert len(BLAS_SOURCES) == 155 + assert len(source_routines) == 155 + assert len(source_routines) == len(set(source_routines)), "source routine names must be unique" + assert len(ALL_ROUTINES) == len(set(ALL_ROUTINES)), "each routine must have exactly one classification" + assert set(source_routines) == set(ALL_ROUTINES) + assert sum(len(routines) for routines in ROUTINE_GROUPS.values()) == 155 + + +def test_prik_exports_every_source_routine(prik_blas): + missing = sorted(routine for routine in ALL_ROUTINES if not callable(getattr(prik_blas, routine, None))) + assert missing == [] + + +def test_f2py_exports_every_expected_routine(f2py_blas): + missing = sorted(routine for routine in ALL_ROUTINES if not callable(getattr(f2py_blas, routine, None))) + assert missing == [] + + +def test_every_routine_has_one_visible_explicit_test(): + functions = _explicit_test_functions() + expected_names = set(EXPLICIT_TEST_NAMES.values()) + missing = sorted(expected_names - functions.keys()) + assert missing == [] + + for routine, test_name in EXPLICIT_TEST_NAMES.items(): + path, node = functions[test_name] + segment = ast.get_source_segment(path.read_text(encoding="utf-8"), node) + assert segment is not None + assert routine in segment, f"{test_name} does not visibly exercise {routine}" + assert "prik" in segment, f"{test_name} does not visibly invoke or validate PRIK" + assert "f2py" in segment, f"{test_name} does not visibly invoke or document f2py" + assert "pytest.skip" not in segment, f"{test_name} silently skips {routine}" + decorator_names = {ast.unparse(decorator) for decorator in node.decorator_list} + assert not any("skip" in decorator for decorator in decorator_names), f"{test_name} skips {routine}" + + +def test_every_routine_has_exactly_one_audited_outcome(): + outcomes = { + "differential success": set(DIFFERENTIALLY_TESTED_ROUTINES), + "proven f2py limitation": set(F2PY_LIMITATIONS), + "unsupported": set(UNSUPPORTED_ROUTINES), + "environmental skip": set(PERMANENTLY_SKIPPED_ROUTINES), + } + for routine in ALL_ROUTINES: + states = [state for state, routines in outcomes.items() if routine in routines] + assert len(states) == 1, f"{routine} has outcome states {states}" + + classified = set().union(*outcomes.values()) + assert classified == set(ALL_ROUTINES) + assert set(ALL_ROUTINES) == PRIK_TESTED_ROUTINES + assert UNSUPPORTED_ROUTINES == {} + assert PERMANENTLY_SKIPPED_ROUTINES == {} diff --git a/prik/wrapper_codegen/c/binding.py b/prik/wrapper_codegen/c/binding.py index 8ceb5e6fc..12493be32 100644 --- a/prik/wrapper_codegen/c/binding.py +++ b/prik/wrapper_codegen/c/binding.py @@ -13,7 +13,6 @@ SetterAction, ) from prik.semantics.wrapper_policy import ( - ArgumentConversionPhase, ArgumentHandoffMode, CallbackABIKind, CallbackResultAction, @@ -5993,16 +5992,12 @@ def _derived_alias_preflight_nodes( ) def _binding_conversion_order(self, plan: FunctionPlan) -> tuple[ArgumentTransferPlan, ...]: - """Apply the completed argument conversion schedule.""" - return tuple( - sorted( - plan.arguments, - key=lambda argument: ( - argument.binding.conversion_phase is ArgumentConversionPhase.DEFERRED_REPLACEMENT, - argument.python_position, - ), - ) - ) + """Apply the dependency-safe argument conversion schedule from the plan.""" + arguments = {argument.owner_path: argument for argument in plan.arguments} + try: + return tuple(arguments[owner_path] for owner_path in plan.binding.argument_conversion_order) + except KeyError as error: + raise ValueError(f"Unknown binding argument conversion owner {error.args[0]!r}") from None def _visit_ArgumentTransferPlan( self, diff --git a/prik/wrapper_codegen/generator.py b/prik/wrapper_codegen/generator.py index 13491a2b5..62493b75c 100644 --- a/prik/wrapper_codegen/generator.py +++ b/prik/wrapper_codegen/generator.py @@ -1014,6 +1014,7 @@ def _function_diagnostics(self, plan: FunctionPlan) -> tuple[WrapperPlanDiagnost ), *self._duplicate_role_diagnostics(plan), *self._available_role_diagnostics(plan), + *self._binding_conversion_order_diagnostics(plan), *self._function_output_diagnostics(plan), *self._string_result_aggregation_diagnostics(plan), *self._status_error_diagnostics(plan), @@ -1034,6 +1035,58 @@ def _function_diagnostics(self, plan: FunctionPlan) -> tuple[WrapperPlanDiagnost diagnostics.extend(self._string_writeback_diagnostics(plan)) return tuple(diagnostics) + def _binding_conversion_order_diagnostics( + self, + plan: FunctionPlan, + ) -> tuple[WrapperPlanDiagnostic, ...]: + """Require complete dependency-safe binding conversion ownership.""" + order = plan.binding.argument_conversion_order + owners = tuple(argument.owner_path for argument in plan.arguments) + diagnostics = [] + if Counter(order) != Counter(owners): + diagnostics.append(self._diagnostic(plan.owner_path, "invalid-binding-conversion-order", order)) + return tuple(diagnostics) + + positions = {owner: position for position, owner in enumerate(order)} + role_owners = {argument.binding.handoff_role: argument.owner_path for argument in plan.arguments} + diagnostics.extend(self._late_binding_extent_conversion_diagnostics(plan, positions, role_owners)) + return tuple(diagnostics) + + def _late_binding_extent_conversion_diagnostics( + self, + plan: FunctionPlan, + positions: dict[str, int], + role_owners: dict[str, str], + ) -> tuple[WrapperPlanDiagnostic, ...]: + """Reject a planned array conversion scheduled before a used extent.""" + diagnostics = [] + for argument in plan.arguments: + for dependency in self._binding_extent_dependency_owners(argument, role_owners): + if dependency != argument.owner_path and positions[dependency] > positions[argument.owner_path]: + diagnostics.append( + self._diagnostic( + argument.owner_path, + "late-binding-extent-conversion", + dependency, + ) + ) + return tuple(diagnostics) + + @staticmethod + def _binding_extent_dependency_owners( + argument: ArgumentTransferPlan, + role_owners: dict[str, str], + ) -> tuple[str, ...]: + """Return planned owners referenced by one array's extent roles.""" + if argument.array is None: + return () + return tuple( + role_owners[role] + for axis_roles in argument.array.extent_reference_roles + for role in axis_roles + if role in role_owners + ) + def _optional_literal_combination_diagnostics( self, plan: FunctionPlan, diff --git a/prik/wrapper_codegen/plan.py b/prik/wrapper_codegen/plan.py index 3f0163b1c..a2878dcfc 100644 --- a/prik/wrapper_codegen/plan.py +++ b/prik/wrapper_codegen/plan.py @@ -478,6 +478,7 @@ class BindingFunctionPlan(StageRecord): docstring: str release_gil: bool status_error: BindingStatusErrorPlan | None + argument_conversion_order: tuple[str, ...] public: bool = True diff --git a/prik/wrapper_codegen/planner.py b/prik/wrapper_codegen/planner.py index 58d853b20..a45566144 100644 --- a/prik/wrapper_codegen/planner.py +++ b/prik/wrapper_codegen/planner.py @@ -8,6 +8,7 @@ from prik.semantics import models from prik.semantics.native_array_handles import NATIVE_ARRAY_POINTER_C_DESCRIPTOR_HEADER from prik.semantics.wrapper_policy import ( + ArgumentConversionPhase, ArgumentHandoffMode, ArrayHandoffPolicy, CallbackHandoffPolicy, @@ -943,6 +944,7 @@ def _function_plan( ), release_gil=policy.release_gil, status_error=status_error, + argument_conversion_order=self._binding_argument_conversion_order(arguments), public=public, ), bridge=BridgeFunctionPlan( @@ -964,6 +966,81 @@ def _function_plan( release_actions=tuple(self.visit(action) for action in policy.release_actions), ) + @staticmethod + def _binding_argument_conversion_order( + arguments: tuple[ArgumentTransferPlan, ...], + ) -> tuple[str, ...]: + """Plan a stable conversion order that satisfies array-extent dependencies.""" + role_owners = {argument.binding.handoff_role: argument.owner_path for argument in arguments} + dependencies = WrapperPlanner._binding_conversion_dependencies(arguments, role_owners) + ordered: list[str] = [] + converted: set[str] = set() + remaining = list(WrapperPlanner._ranked_binding_arguments(arguments)) + while remaining: + ready_index = WrapperPlanner._ready_binding_argument_index(remaining, dependencies, converted) + if ready_index is None: + owners = tuple(argument.owner_path for argument in remaining) + raise ValueError(f"Cyclic binding argument conversion dependencies: {owners!r}") + argument = remaining.pop(ready_index) + ordered.append(argument.owner_path) + converted.add(argument.owner_path) + return tuple(ordered) + + @staticmethod + def _binding_conversion_dependencies( + arguments: tuple[ArgumentTransferPlan, ...], + role_owners: dict[str, str], + ) -> dict[str, set[str]]: + """Map each planned argument to the argument conversions it requires.""" + return { + argument.owner_path: WrapperPlanner._binding_extent_dependency_owners(argument, role_owners) + for argument in arguments + } + + @staticmethod + def _ranked_binding_arguments( + arguments: tuple[ArgumentTransferPlan, ...], + ) -> tuple[ArgumentTransferPlan, ...]: + """Preserve the established phase and Python-position preference.""" + return tuple( + sorted( + arguments, + key=lambda argument: ( + argument.binding.conversion_phase is ArgumentConversionPhase.DEFERRED_REPLACEMENT, + argument.python_position, + ), + ) + ) + + @staticmethod + def _ready_binding_argument_index( + remaining: list[ArgumentTransferPlan], + dependencies: dict[str, set[str]], + converted: set[str], + ) -> int | None: + """Find the first preferred argument whose dependencies are converted.""" + return next( + (index for index, argument in enumerate(remaining) if dependencies[argument.owner_path] <= converted), + None, + ) + + @staticmethod + def _binding_extent_dependency_owners( + argument: ArgumentTransferPlan, + role_owners: dict[str, str], + ) -> set[str]: + """Resolve the planned arguments needed before one array conversion.""" + if argument.array is None: + return set() + owners = { + role_owners[role] + for axis_roles in argument.array.extent_reference_roles + for role in axis_roles + if role in role_owners + } + owners.discard(argument.owner_path) + return owners + def _native_slot_plans(self, policy: FunctionWrapperPolicy) -> tuple[NativeCallSlotPlan, ...]: """Project ordered native call slots with their completed symbolic roles.""" return tuple( diff --git a/tests/README.md b/tests/README.md index 1a03bb882..c3cf1092b 100644 --- a/tests/README.md +++ b/tests/README.md @@ -71,8 +71,10 @@ python3 -m pytest -q tests/shared python3 -m pytest -q tests/architecture ``` -BLAS and LAPACK remain in the dedicated real-library job. LAPACK is not part -of the default local verification command. +The full-library BLAS/LAPACK integration nodes and the complete correctness +project in `examples/blas/` remain in the dedicated real-library job. The BLAS +sources are owned by `examples/blas/native/`; LAPACK remains under its existing +real-library owner and is not part of the default local verification command. ## Markers @@ -81,8 +83,8 @@ selection: - `fortran_end_to_end` selects every compiled, imported, and called Fortran feature test, and nothing else; -- `real_library` selects only the dedicated BLAS/LAPACK native-source - end-to-end tests; +- `real_library` selects only the dedicated BLAS correctness example and + BLAS/LAPACK native-source end-to-end integration tests; - `property`, `regression`, `benchmark`, and `slow` retain their ordinary meanings; and - `toolchain_smoke` selects only the bounded portable compiler-profile subset diff --git a/tests/architecture/fortran/test_language_ownership.py b/tests/architecture/fortran/test_language_ownership.py index 1d77de497..fa072e75b 100644 --- a/tests/architecture/fortran/test_language_ownership.py +++ b/tests/architecture/fortran/test_language_ownership.py @@ -14,6 +14,7 @@ FORTRAN_INDEX = FORTRAN_ROOT / "README.md" ROADMAP = REPO_ROOT / "docs/maintainer/roadmap/fortran-test-suite-cleanup-checklist.md" REAL_LIBRARY_ROOT = FEATURE_ROOT / "building_shared_library" / "end_to_end" / "real_libraries" +BLAS_EXAMPLE_ROOT = REPO_ROOT / "examples" / "blas" FEATURE_DOCS = { "data_types": "docs/user/guide/data-types.md", @@ -180,14 +181,14 @@ def test_fortran_index_names_every_infrastructure_owner() -> None: assert f"`{owner}`" in text -def test_real_library_owner_contains_only_full_blas_and_lapack_native_projects() -> None: +def test_real_library_and_blas_example_have_single_native_source_owners() -> None: assert {path.name for path in REAL_LIBRARY_ROOT.glob("test_*.py")} == {"test_full_libraries.py"} assert {path.name for path in REAL_LIBRARY_ROOT.iterdir() if path.is_dir() and path.name != "__pycache__"} == { - "blas", "lapack", } - for library in ("blas", "lapack"): - assert (REAL_LIBRARY_ROOT / library / "native").is_dir() + assert (REAL_LIBRARY_ROOT / "lapack" / "native").is_dir() + assert (BLAS_EXAMPLE_ROOT / "native").is_dir() + assert len(tuple((BLAS_EXAMPLE_ROOT / "native").iterdir())) == 155 assert sorted(REAL_LIBRARY_ROOT.rglob("*.pyi")) == [] diff --git a/tests/fortran/README.md b/tests/fortran/README.md index 5d8ede9e3..642e9ac2c 100644 --- a/tests/fortran/README.md +++ b/tests/fortran/README.md @@ -95,8 +95,8 @@ artifact-consumer, and support-consumer inventories live under - Every pytest node below a feature `end_to_end/` carries `fortran_end_to_end`, and no other node does. -- Only BLAS/LAPACK native-source end-to-end nodes additionally carry - `real_library`. +- Only the complete `examples/blas/` correctness project and BLAS/LAPACK + native-source integration nodes additionally carry `real_library`. - `toolchain_smoke` will select exact portable rows from the completed ordinary end-to-end suite; it is not a separate directory. @@ -106,6 +106,5 @@ Run all migrated Fortran evidence with: python3 -m pytest -q tests/fortran ``` -Until the real-library migration is complete, use the legacy exclusions -documented in the repository-level test map and never run LAPACK locally -without an explicit request. +Run the BLAS project directly with `python3 -m pytest -q examples/blas`. Never +run LAPACK locally without an explicit request. diff --git a/tests/fortran/arrays/wrapper_codegen/test_dense_array_shape_lowering.py b/tests/fortran/arrays/wrapper_codegen/test_dense_array_shape_lowering.py index 8c3d3ac61..a66ca3e16 100644 --- a/tests/fortran/arrays/wrapper_codegen/test_dense_array_shape_lowering.py +++ b/tests/fortran/arrays/wrapper_codegen/test_dense_array_shape_lowering.py @@ -181,9 +181,19 @@ def test_dense_array_lowering_uses_planned_shape_checks_and_bridge_orientation() def test_external_interface_declares_late_extent_before_dependent_array(): - artifacts = WrapperCodeGenerator().generate(_late_extent_external_plan()) + plan = _late_extent_external_plan() + function = plan.namespaces[0].functions[0] + artifacts = WrapperCodeGenerator().generate(plan) + c_source = next(source.text for source in artifacts.sources if source.path.suffix == ".c") bridge_source = next(source.text for source in artifacts.sources if source.path.suffix == ".f90") + assert function.binding.argument_conversion_order == ( + "late_extent_external.late_extent.n", + "late_extent_external.late_extent.values", + ) + assert c_source.index("prik_int32_unpack_exact(bound_n_obj, &bound_n)") < c_source.index( + "Argument values has incompatible shape at axis 0" + ) signature = "subroutine late_extent(values, n)" interface = bridge_source.split(signature, maxsplit=1)[1].split("end subroutine late_extent", maxsplit=1)[0] assert interface.index("integer(c_int32_t), optional :: n") < interface.index( @@ -191,6 +201,15 @@ def test_external_interface_declares_late_extent_before_dependent_array(): ) +def test_edited_binding_conversion_order_cannot_read_an_extent_late(): + plan = _late_extent_external_plan() + function = plan.namespaces[0].functions[0] + function.binding.argument_conversion_order = tuple(reversed(function.binding.argument_conversion_order)) + + with pytest.raises(ValueError, match="late-binding-extent-conversion"): + WrapperCodeGenerator().generate(plan) + + def test_unavailable_dense_extent_role_fails_before_backend_lowering(): plan = _dense_plan() array = plan.namespaces[0].functions[0].arguments[-1].array diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py b/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py index 890fea1a6..5a712c672 100644 --- a/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py +++ b/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py @@ -20,6 +20,7 @@ from prik.pipeline.pyi import pyi_paths_to_semantic_modules FORTRAN_LIBRARY_ROOT = Path(__file__).parent +BLAS_SOURCE_ROOT = REPO_ROOT / "examples" / "blas" / "native" NATIVE_CACHE_ENV = "PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR" NATIVE_JOBS_ENV = "PRIK_REAL_LIBRARY_NATIVE_JOBS" DEFAULT_NATIVE_CACHE_ROOT = REPO_ROOT / ".pytest_cache" / "prik" / "real-library-native" @@ -61,7 +62,7 @@ def _archiver() -> str: def _library_sources(library: str) -> tuple[Path, ...]: - root = FORTRAN_LIBRARY_ROOT / library / "native" + root = BLAS_SOURCE_ROOT if library == "blas" else FORTRAN_LIBRARY_ROOT / library / "native" return tuple(sorted(path for path in root.iterdir() if path.is_file() and path.suffix.lower() in FORTRAN_SUFFIXES)) @@ -177,7 +178,7 @@ def _function_names(package: Path) -> set[str]: def _cached_object_path(objects_dir: Path, source: Path) -> Path: - return objects_dir / source.relative_to(FORTRAN_LIBRARY_ROOT).with_suffix(".o") + return objects_dir / source.relative_to(REPO_ROOT).with_suffix(".o") def _compile_native_source(compiler: str, source: Path, native_object: Path, module_dir: Path) -> None: @@ -377,7 +378,8 @@ def _assert_lapack_runtime_smoke(module) -> None: @pytest.mark.real_library @pytest.mark.parametrize("library", ["blas", "lapack"]) def test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library(library: str, tmp_path: Path): - entry = _generate_contract(FORTRAN_LIBRARY_ROOT / library / "native", tmp_path / "contracts" / library) + source_root = BLAS_SOURCE_ROOT if library == "blas" else FORTRAN_LIBRARY_ROOT / library / "native" + entry = _generate_contract(source_root, tmp_path / "contracts" / library) root = _root_module(entry.parent) all_function_names = _function_names(entry.parent) diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index e78c8073d..a8e819d79 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -190,6 +190,8 @@ def test_full_real_library_nodes_have_one_dedicated_workflow() -> None: assert '-m "not real_library and not toolchain_smoke"' in ordinary_jobs assert ordinary_jobs.count('-m "not real_library and not toolchain_smoke"') == 2 assert FULL_REAL_LIBRARY_TEST not in ordinary_jobs + assert "examples/blas" not in ordinary_jobs + assert "python -m pytest -q examples/blas" in dedicated_job assert ( f'"{FULL_REAL_LIBRARY_TEST}::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[blas]"' in dedicated_job diff --git a/tests/shared/docs/test_examples.py b/tests/shared/docs/test_examples.py index 5b4339a6d..d02df2c23 100644 --- a/tests/shared/docs/test_examples.py +++ b/tests/shared/docs/test_examples.py @@ -20,6 +20,7 @@ ROOT = Path(__file__).parents[3] DOC_PATHS = [ ROOT / "README.md", + ROOT / "examples/blas/README.md", *sorted(path for path in (ROOT / "docs").rglob("*.md") if "old_docs" not in path.parts), ] AUDITED_PYTHON_DOC_PATHS = [ @@ -64,6 +65,7 @@ class DocumentedSource: path: Path line: int source_path: Path + selector: str | None source_text: str @property @@ -148,11 +150,14 @@ def _documented_content_from_path(path: Path) -> tuple[list[DocumentationExample if source_marker is not None: marker_line = index + 1 source_text, index, _language = _fenced_block(lines, index + 1) + source_reference = source_marker.group(1) + source_path, separator, selector = source_reference.partition("::") sources.append( DocumentedSource( path=path, line=marker_line, - source_path=ROOT / source_marker.group(1), + source_path=ROOT / source_path, + selector=selector if separator else None, source_text=source_text, ) ) @@ -263,7 +268,14 @@ def test_documentation_has_automatically_verified_examples(): @pytest.mark.parametrize("source", DOCUMENTED_SOURCES, ids=lambda source: source.test_id) def test_documented_source_input(source: DocumentedSource): assert source.source_path.is_file(), f"{source.test_id}: documented source does not exist: {source.source_path}" - assert source.source_text.rstrip("\n") == source.source_path.read_text(encoding="utf-8").rstrip("\n") + file_text = source.source_path.read_text(encoding="utf-8") + expected_text = file_text + if source.selector is not None: + tree = ast.parse(file_text, filename=str(source.source_path)) + selected = [node for node in tree.body if isinstance(node, ast.FunctionDef) and node.name == source.selector] + assert len(selected) == 1, f"{source.test_id}: source selector {source.selector!r} did not name one function" + expected_text = ast.get_source_segment(file_text, selected[0]) or "" + assert source.source_text.rstrip("\n") == expected_text.rstrip("\n") @pytest.mark.parametrize("block", DOCUMENTED_PYTHON_BLOCKS, ids=lambda block: block.test_id) From 6a92d1fbb686df1f2b983e14cd5dd8586cff937a Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Sun, 2 Aug 2026 03:04:45 +0100 Subject: [PATCH 02/22] add lapach example --- .github/workflows/blas-lapack.yml | 31 +- CHANGELOG.md | 7 + README.md | 5 +- docs/developer/repository-structure.md | 5 + docs/developer/source-map.md | 2 + docs/developer/testing-strategy.md | 17 +- .../fortran-test-suite-cleanup-checklist.md | 2 +- .../roadmap/semantic-pyi-wrapper-checklist.md | 4 +- docs/user/examples/index.md | 8 +- docs/user/examples/lapack-wrapper.md | 23 +- examples/lapack/README.md | 406 ++++++++++++ examples/lapack/__init__.py | 1 + examples/lapack/conftest.py | 182 ++++++ examples/lapack/helpers.py | 160 +++++ .../lapack/native/cbbcsd.f | 0 .../lapack/native/cbdsqr.f | 0 .../lapack/native/cgbbrd.f | 0 .../lapack/native/cgbcon.f | 0 .../lapack/native/cgbequ.f | 0 .../lapack/native/cgbequb.f | 0 .../lapack/native/cgbrfs.f | 0 .../lapack/native/cgbrfsx.f | 0 .../lapack/native/cgbsv.f | 0 .../lapack/native/cgbsvx.f | 0 .../lapack/native/cgbsvxx.f | 0 .../lapack/native/cgbtf2.f | 0 .../lapack/native/cgbtrf.f | 0 .../lapack/native/cgbtrs.f | 0 .../lapack/native/cgebak.f | 0 .../lapack/native/cgebal.f | 0 .../lapack/native/cgebd2.f | 0 .../lapack/native/cgebrd.f | 0 .../lapack/native/cgecon.f | 0 .../lapack/native/cgedmd.f90 | 0 .../lapack/native/cgedmdq.f90 | 0 .../lapack/native/cgeequ.f | 0 .../lapack/native/cgeequb.f | 0 .../lapack/native/cgees.f | 0 .../lapack/native/cgeesx.f | 0 .../lapack/native/cgeev.f | 0 .../lapack/native/cgeevx.f | 0 .../lapack/native/cgehd2.f | 0 .../lapack/native/cgehrd.f | 0 .../lapack/native/cgejsv.f | 0 .../lapack/native/cgelq.f | 0 .../lapack/native/cgelq2.f | 0 .../lapack/native/cgelqf.f | 0 .../lapack/native/cgelqt.f | 0 .../lapack/native/cgelqt3.f | 0 .../lapack/native/cgels.f | 0 .../lapack/native/cgelsd.f | 0 .../lapack/native/cgelss.f | 0 .../lapack/native/cgelst.f | 0 .../lapack/native/cgelsy.f | 0 .../lapack/native/cgemlq.f | 0 .../lapack/native/cgemlqt.f | 0 .../lapack/native/cgemqr.f | 0 .../lapack/native/cgemqrt.f | 0 .../lapack/native/cgeql2.f | 0 .../lapack/native/cgeqlf.f | 0 .../lapack/native/cgeqp3.f | 0 .../lapack/native/cgeqp3rk.f | 0 .../lapack/native/cgeqr.f | 0 .../lapack/native/cgeqr2.f | 0 .../lapack/native/cgeqr2p.f | 0 .../lapack/native/cgeqrf.f | 0 .../lapack/native/cgeqrfp.f | 0 .../lapack/native/cgeqrt.f | 0 .../lapack/native/cgeqrt2.f | 0 .../lapack/native/cgeqrt3.f | 0 .../lapack/native/cgerfs.f | 0 .../lapack/native/cgerfsx.f | 0 .../lapack/native/cgerq2.f | 0 .../lapack/native/cgerqf.f | 0 .../lapack/native/cgesc2.f | 0 .../lapack/native/cgesdd.f | 0 .../lapack/native/cgesv.f | 0 .../lapack/native/cgesvd.f | 0 .../lapack/native/cgesvdq.f | 0 .../lapack/native/cgesvdx.f | 0 .../lapack/native/cgesvj.f | 0 .../lapack/native/cgesvx.f | 0 .../lapack/native/cgesvxx.f | 0 .../lapack/native/cgetc2.f | 0 .../lapack/native/cgetf2.f | 0 .../lapack/native/cgetrf.f | 0 .../lapack/native/cgetrf2.f | 0 .../lapack/native/cgetri.f | 0 .../lapack/native/cgetrs.f | 0 .../lapack/native/cgetsls.f | 0 .../lapack/native/cgetsqrhrt.f | 0 .../lapack/native/cggbak.f | 0 .../lapack/native/cggbal.f | 0 .../lapack/native/cgges.f | 0 .../lapack/native/cgges3.f | 0 .../lapack/native/cggesx.f | 0 .../lapack/native/cggev.f | 0 .../lapack/native/cggev3.f | 0 .../lapack/native/cggevx.f | 0 .../lapack/native/cggglm.f | 0 .../lapack/native/cgghd3.f | 0 .../lapack/native/cgghrd.f | 0 .../lapack/native/cgglse.f | 0 .../lapack/native/cggqrf.f | 0 .../lapack/native/cggrqf.f | 0 .../lapack/native/cggsvd3.f | 0 .../lapack/native/cggsvp3.f | 0 .../lapack/native/cgsvj0.f | 0 .../lapack/native/cgsvj1.f | 0 .../lapack/native/cgtcon.f | 0 .../lapack/native/cgtrfs.f | 0 .../lapack/native/cgtsv.f | 0 .../lapack/native/cgtsvx.f | 0 .../lapack/native/cgttrf.f | 0 .../lapack/native/cgttrs.f | 0 .../lapack/native/cgtts2.f | 0 .../lapack/native/chb2st_kernels.f | 0 .../lapack/native/chbev.f | 0 .../lapack/native/chbev_2stage.f | 0 .../lapack/native/chbevd.f | 0 .../lapack/native/chbevd_2stage.f | 0 .../lapack/native/chbevx.f | 0 .../lapack/native/chbevx_2stage.f | 0 .../lapack/native/chbgst.f | 0 .../lapack/native/chbgv.f | 0 .../lapack/native/chbgvd.f | 0 .../lapack/native/chbgvx.f | 0 .../lapack/native/chbtrd.f | 0 .../lapack/native/checon.f | 0 .../lapack/native/checon_3.f | 0 .../lapack/native/checon_rook.f | 0 .../lapack/native/cheequb.f | 0 .../lapack/native/cheev.f | 0 .../lapack/native/cheev_2stage.f | 0 .../lapack/native/cheevd.f | 0 .../lapack/native/cheevd_2stage.f | 0 .../lapack/native/cheevr.f | 0 .../lapack/native/cheevr_2stage.f | 0 .../lapack/native/cheevx.f | 0 .../lapack/native/cheevx_2stage.f | 0 .../lapack/native/chegs2.f | 0 .../lapack/native/chegst.f | 0 .../lapack/native/chegv.f | 0 .../lapack/native/chegv_2stage.f | 0 .../lapack/native/chegvd.f | 0 .../lapack/native/chegvx.f | 0 .../lapack/native/cherfs.f | 0 .../lapack/native/cherfsx.f | 0 .../lapack/native/chesv.f | 0 .../lapack/native/chesv_aa.f | 0 .../lapack/native/chesv_aa_2stage.f | 0 .../lapack/native/chesv_rk.f | 0 .../lapack/native/chesv_rook.f | 0 .../lapack/native/chesvx.f | 0 .../lapack/native/chesvxx.f | 0 .../lapack/native/cheswapr.f | 0 .../lapack/native/chetd2.f | 0 .../lapack/native/chetf2.f | 0 .../lapack/native/chetf2_rk.f | 0 .../lapack/native/chetf2_rook.f | 0 .../lapack/native/chetrd.f | 0 .../lapack/native/chetrd_2stage.f | 0 .../lapack/native/chetrd_hb2st.F | 0 .../lapack/native/chetrd_he2hb.f | 0 .../lapack/native/chetrf.f | 0 .../lapack/native/chetrf_aa.f | 0 .../lapack/native/chetrf_aa_2stage.f | 0 .../lapack/native/chetrf_rk.f | 0 .../lapack/native/chetrf_rook.f | 0 .../lapack/native/chetri.f | 0 .../lapack/native/chetri2.f | 0 .../lapack/native/chetri2x.f | 0 .../lapack/native/chetri_3.f | 0 .../lapack/native/chetri_3x.f | 0 .../lapack/native/chetri_rook.f | 0 .../lapack/native/chetrs.f | 0 .../lapack/native/chetrs2.f | 0 .../lapack/native/chetrs_3.f | 0 .../lapack/native/chetrs_aa.f | 0 .../lapack/native/chetrs_aa_2stage.f | 0 .../lapack/native/chetrs_rook.f | 0 .../lapack/native/chfrk.f | 0 .../lapack/native/chgeqz.f | 0 .../lapack/native/chla_transtype.f | 0 .../lapack/native/chpcon.f | 0 .../lapack/native/chpev.f | 0 .../lapack/native/chpevd.f | 0 .../lapack/native/chpevx.f | 0 .../lapack/native/chpgst.f | 0 .../lapack/native/chpgv.f | 0 .../lapack/native/chpgvd.f | 0 .../lapack/native/chpgvx.f | 0 .../lapack/native/chprfs.f | 0 .../lapack/native/chpsv.f | 0 .../lapack/native/chpsvx.f | 0 .../lapack/native/chptrd.f | 0 .../lapack/native/chptrf.f | 0 .../lapack/native/chptri.f | 0 .../lapack/native/chptrs.f | 0 .../lapack/native/chsein.f | 0 .../lapack/native/chseqr.f | 0 .../lapack/native/cla_gbamv.f | 0 .../lapack/native/cla_gbrcond_c.f | 0 .../lapack/native/cla_gbrcond_x.f | 0 .../lapack/native/cla_gbrfsx_extended.f | 0 .../lapack/native/cla_gbrpvgrw.f | 0 .../lapack/native/cla_geamv.f | 0 .../lapack/native/cla_gercond_c.f | 0 .../lapack/native/cla_gercond_x.f | 0 .../lapack/native/cla_gerfsx_extended.f | 0 .../lapack/native/cla_gerpvgrw.f | 0 .../lapack/native/cla_heamv.f | 0 .../lapack/native/cla_hercond_c.f | 0 .../lapack/native/cla_hercond_x.f | 0 .../lapack/native/cla_herfsx_extended.f | 0 .../lapack/native/cla_herpvgrw.f | 0 .../lapack/native/cla_lin_berr.f | 0 .../lapack/native/cla_porcond_c.f | 0 .../lapack/native/cla_porcond_x.f | 0 .../lapack/native/cla_porfsx_extended.f | 0 .../lapack/native/cla_porpvgrw.f | 0 .../lapack/native/cla_syamv.f | 0 .../lapack/native/cla_syrcond_c.f | 0 .../lapack/native/cla_syrcond_x.f | 0 .../lapack/native/cla_syrfsx_extended.f | 0 .../lapack/native/cla_syrpvgrw.f | 0 .../lapack/native/cla_wwaddw.f | 0 .../lapack/native/clabrd.f | 0 .../lapack/native/clacgv.f | 0 .../lapack/native/clacn2.f | 0 .../lapack/native/clacon.f | 0 .../lapack/native/clacp2.f | 0 .../lapack/native/clacpy.f | 0 .../lapack/native/clacrm.f | 0 .../lapack/native/clacrt.f | 0 .../lapack/native/cladiv.f | 0 .../lapack/native/claed0.f | 0 .../lapack/native/claed7.f | 0 .../lapack/native/claed8.f | 0 .../lapack/native/claein.f | 0 .../lapack/native/claesy.f | 0 .../lapack/native/claev2.f | 0 .../lapack/native/clag2z.f | 0 .../lapack/native/clags2.f | 0 .../lapack/native/clagtm.f | 0 .../lapack/native/clahef.f | 0 .../lapack/native/clahef_aa.f | 0 .../lapack/native/clahef_rk.f | 0 .../lapack/native/clahef_rook.f | 0 .../lapack/native/clahqr.f | 0 .../lapack/native/clahr2.f | 0 .../lapack/native/claic1.f | 0 .../lapack/native/clals0.f | 0 .../lapack/native/clalsa.f | 0 .../lapack/native/clalsd.f | 0 .../lapack/native/clamswlq.f | 0 .../lapack/native/clamtsqr.f | 0 .../lapack/native/clangb.f | 0 .../lapack/native/clange.f | 0 .../lapack/native/clangt.f | 0 .../lapack/native/clanhb.f | 0 .../lapack/native/clanhe.f | 0 .../lapack/native/clanhf.f | 0 .../lapack/native/clanhp.f | 0 .../lapack/native/clanhs.f | 0 .../lapack/native/clanht.f | 0 .../lapack/native/clansb.f | 0 .../lapack/native/clansp.f | 0 .../lapack/native/clansy.f | 0 .../lapack/native/clantb.f | 0 .../lapack/native/clantp.f | 0 .../lapack/native/clantr.f | 0 .../lapack/native/clapll.f | 0 .../lapack/native/clapmr.f | 0 .../lapack/native/clapmt.f | 0 .../lapack/native/claqgb.f | 0 .../lapack/native/claqge.f | 0 .../lapack/native/claqhb.f | 0 .../lapack/native/claqhe.f | 0 .../lapack/native/claqhp.f | 0 .../lapack/native/claqp2.f | 0 .../lapack/native/claqp2rk.f | 0 .../lapack/native/claqp3rk.f | 0 .../lapack/native/claqps.f | 0 .../lapack/native/claqr0.f | 0 .../lapack/native/claqr1.f | 0 .../lapack/native/claqr2.f | 0 .../lapack/native/claqr3.f | 0 .../lapack/native/claqr4.f | 0 .../lapack/native/claqr5.f | 0 .../lapack/native/claqsb.f | 0 .../lapack/native/claqsp.f | 0 .../lapack/native/claqsy.f | 0 .../lapack/native/claqz0.f | 0 .../lapack/native/claqz1.f | 0 .../lapack/native/claqz2.f | 0 .../lapack/native/claqz3.f | 0 .../lapack/native/clar1v.f | 0 .../lapack/native/clar2v.f | 0 .../lapack/native/clarcm.f | 0 .../lapack/native/clarf.f | 0 .../lapack/native/clarf1f.f | 0 .../lapack/native/clarf1l.f | 0 .../lapack/native/clarfb.f | 0 .../lapack/native/clarfb_gett.f | 0 .../lapack/native/clarfg.f | 0 .../lapack/native/clarfgp.f | 0 .../lapack/native/clarft.f | 0 .../lapack/native/clarfx.f | 0 .../lapack/native/clarfy.f | 0 .../lapack/native/clargv.f | 0 .../lapack/native/clarnv.f | 0 .../lapack/native/clarrv.f | 0 .../lapack/native/clarscl2.f | 0 .../lapack/native/clartg.f90 | 0 .../lapack/native/clartv.f | 0 .../lapack/native/clarz.f | 0 .../lapack/native/clarzb.f | 0 .../lapack/native/clarzt.f | 0 .../lapack/native/clascl.f | 0 .../lapack/native/clascl2.f | 0 .../lapack/native/claset.f | 0 .../lapack/native/clasr.f | 0 .../lapack/native/classq.f90 | 0 .../lapack/native/claswlq.f | 0 .../lapack/native/claswp.f | 0 .../lapack/native/clasyf.f | 0 .../lapack/native/clasyf_aa.f | 0 .../lapack/native/clasyf_rk.f | 0 .../lapack/native/clasyf_rook.f | 0 .../lapack/native/clatbs.f | 0 .../lapack/native/clatdf.f | 0 .../lapack/native/clatps.f | 0 .../lapack/native/clatrd.f | 0 .../lapack/native/clatrs.f | 0 .../lapack/native/clatrs3.f | 0 .../lapack/native/clatrz.f | 0 .../lapack/native/clatsqr.f | 0 .../lapack/native/claunhr_col_getrfnp.f | 0 .../lapack/native/claunhr_col_getrfnp2.f | 0 .../lapack/native/clauu2.f | 0 .../lapack/native/clauum.f | 0 .../lapack/native/cpbcon.f | 0 .../lapack/native/cpbequ.f | 0 .../lapack/native/cpbrfs.f | 0 .../lapack/native/cpbstf.f | 0 .../lapack/native/cpbsv.f | 0 .../lapack/native/cpbsvx.f | 0 .../lapack/native/cpbtf2.f | 0 .../lapack/native/cpbtrf.f | 0 .../lapack/native/cpbtrs.f | 0 .../lapack/native/cpftrf.f | 0 .../lapack/native/cpftri.f | 0 .../lapack/native/cpftrs.f | 0 .../lapack/native/cpocon.f | 0 .../lapack/native/cpoequ.f | 0 .../lapack/native/cpoequb.f | 0 .../lapack/native/cporfs.f | 0 .../lapack/native/cporfsx.f | 0 .../lapack/native/cposv.f | 0 .../lapack/native/cposvx.f | 0 .../lapack/native/cposvxx.f | 0 .../lapack/native/cpotf2.f | 0 .../lapack/native/cpotrf.f | 0 .../lapack/native/cpotrf2.f | 0 .../lapack/native/cpotri.f | 0 .../lapack/native/cpotrs.f | 0 .../lapack/native/cppcon.f | 0 .../lapack/native/cppequ.f | 0 .../lapack/native/cpprfs.f | 0 .../lapack/native/cppsv.f | 0 .../lapack/native/cppsvx.f | 0 .../lapack/native/cpptrf.f | 0 .../lapack/native/cpptri.f | 0 .../lapack/native/cpptrs.f | 0 .../lapack/native/cpstf2.f | 0 .../lapack/native/cpstrf.f | 0 .../lapack/native/cptcon.f | 0 .../lapack/native/cpteqr.f | 0 .../lapack/native/cptrfs.f | 0 .../lapack/native/cptsv.f | 0 .../lapack/native/cptsvx.f | 0 .../lapack/native/cpttrf.f | 0 .../lapack/native/cpttrs.f | 0 .../lapack/native/cptts2.f | 0 .../lapack/native/crot.f | 0 .../lapack/native/crscl.f | 0 .../lapack/native/cspcon.f | 0 .../lapack/native/cspmv.f | 0 .../lapack/native/cspr.f | 0 .../lapack/native/csprfs.f | 0 .../lapack/native/cspsv.f | 0 .../lapack/native/cspsvx.f | 0 .../lapack/native/csptrf.f | 0 .../lapack/native/csptri.f | 0 .../lapack/native/csptrs.f | 0 .../lapack/native/csrscl.f | 0 .../lapack/native/cstedc.f | 0 .../lapack/native/cstegr.f | 0 .../lapack/native/cstein.f | 0 .../lapack/native/cstemr.f | 0 .../lapack/native/csteqr.f | 0 .../lapack/native/csycon.f | 0 .../lapack/native/csycon_3.f | 0 .../lapack/native/csycon_rook.f | 0 .../lapack/native/csyconv.f | 0 .../lapack/native/csyconvf.f | 0 .../lapack/native/csyconvf_rook.f | 0 .../lapack/native/csyequb.f | 0 .../lapack/native/csymv.f | 0 .../lapack/native/csyr.f | 0 .../lapack/native/csyrfs.f | 0 .../lapack/native/csyrfsx.f | 0 .../lapack/native/csysv.f | 0 .../lapack/native/csysv_aa.f | 0 .../lapack/native/csysv_aa_2stage.f | 0 .../lapack/native/csysv_rk.f | 0 .../lapack/native/csysv_rook.f | 0 .../lapack/native/csysvx.f | 0 .../lapack/native/csysvxx.f | 0 .../lapack/native/csyswapr.f | 0 .../lapack/native/csytf2.f | 0 .../lapack/native/csytf2_rk.f | 0 .../lapack/native/csytf2_rook.f | 0 .../lapack/native/csytrf.f | 0 .../lapack/native/csytrf_aa.f | 0 .../lapack/native/csytrf_aa_2stage.f | 0 .../lapack/native/csytrf_rk.f | 0 .../lapack/native/csytrf_rook.f | 0 .../lapack/native/csytri.f | 0 .../lapack/native/csytri2.f | 0 .../lapack/native/csytri2x.f | 0 .../lapack/native/csytri_3.f | 0 .../lapack/native/csytri_3x.f | 0 .../lapack/native/csytri_rook.f | 0 .../lapack/native/csytrs.f | 0 .../lapack/native/csytrs2.f | 0 .../lapack/native/csytrs_3.f | 0 .../lapack/native/csytrs_aa.f | 0 .../lapack/native/csytrs_aa_2stage.f | 0 .../lapack/native/csytrs_rook.f | 0 .../lapack/native/ctbcon.f | 0 .../lapack/native/ctbrfs.f | 0 .../lapack/native/ctbtrs.f | 0 .../lapack/native/ctfsm.f | 0 .../lapack/native/ctftri.f | 0 .../lapack/native/ctfttp.f | 0 .../lapack/native/ctfttr.f | 0 .../lapack/native/ctgevc.f | 0 .../lapack/native/ctgex2.f | 0 .../lapack/native/ctgexc.f | 0 .../lapack/native/ctgsen.f | 0 .../lapack/native/ctgsja.f | 0 .../lapack/native/ctgsna.f | 0 .../lapack/native/ctgsy2.f | 0 .../lapack/native/ctgsyl.f | 0 .../lapack/native/ctpcon.f | 0 .../lapack/native/ctplqt.f | 0 .../lapack/native/ctplqt2.f | 0 .../lapack/native/ctpmlqt.f | 0 .../lapack/native/ctpmqrt.f | 0 .../lapack/native/ctpqrt.f | 0 .../lapack/native/ctpqrt2.f | 0 .../lapack/native/ctprfb.f | 0 .../lapack/native/ctprfs.f | 0 .../lapack/native/ctptri.f | 0 .../lapack/native/ctptrs.f | 0 .../lapack/native/ctpttf.f | 0 .../lapack/native/ctpttr.f | 0 .../lapack/native/ctrcon.f | 0 .../lapack/native/ctrevc.f | 0 .../lapack/native/ctrevc3.f | 0 .../lapack/native/ctrexc.f | 0 .../lapack/native/ctrrfs.f | 0 .../lapack/native/ctrsen.f | 0 .../lapack/native/ctrsna.f | 0 .../lapack/native/ctrsyl.f | 0 .../lapack/native/ctrsyl3.f | 0 .../lapack/native/ctrti2.f | 0 .../lapack/native/ctrtri.f | 0 .../lapack/native/ctrtrs.f | 0 .../lapack/native/ctrttf.f | 0 .../lapack/native/ctrttp.f | 0 .../lapack/native/ctzrzf.f | 0 .../lapack/native/cunbdb.f | 0 .../lapack/native/cunbdb1.f | 0 .../lapack/native/cunbdb2.f | 0 .../lapack/native/cunbdb3.f | 0 .../lapack/native/cunbdb4.f | 0 .../lapack/native/cunbdb5.f | 0 .../lapack/native/cunbdb6.f | 0 .../lapack/native/cuncsd.f | 0 .../lapack/native/cuncsd2by1.f | 0 .../lapack/native/cung2l.f | 0 .../lapack/native/cung2r.f | 0 .../lapack/native/cungbr.f | 0 .../lapack/native/cunghr.f | 0 .../lapack/native/cungl2.f | 0 .../lapack/native/cunglq.f | 0 .../lapack/native/cungql.f | 0 .../lapack/native/cungqr.f | 0 .../lapack/native/cungr2.f | 0 .../lapack/native/cungrq.f | 0 .../lapack/native/cungtr.f | 0 .../lapack/native/cungtsqr.f | 0 .../lapack/native/cungtsqr_row.f | 0 .../lapack/native/cunhr_col.f | 0 .../lapack/native/cunm22.f | 0 .../lapack/native/cunm2l.f | 0 .../lapack/native/cunm2r.f | 0 .../lapack/native/cunmbr.f | 0 .../lapack/native/cunmhr.f | 0 .../lapack/native/cunml2.f | 0 .../lapack/native/cunmlq.f | 0 .../lapack/native/cunmql.f | 0 .../lapack/native/cunmqr.f | 0 .../lapack/native/cunmr2.f | 0 .../lapack/native/cunmr3.f | 0 .../lapack/native/cunmrq.f | 0 .../lapack/native/cunmrz.f | 0 .../lapack/native/cunmtr.f | 0 .../lapack/native/cupgtr.f | 0 .../lapack/native/cupmtr.f | 0 .../lapack/native/dbbcsd.f | 0 .../lapack/native/dbdsdc.f | 0 .../lapack/native/dbdsqr.f | 0 .../lapack/native/dbdsvdx.f | 0 .../lapack/native/ddisna.f | 0 .../lapack/native/dgbbrd.f | 0 .../lapack/native/dgbcon.f | 0 .../lapack/native/dgbequ.f | 0 .../lapack/native/dgbequb.f | 0 .../lapack/native/dgbrfs.f | 0 .../lapack/native/dgbrfsx.f | 0 .../lapack/native/dgbsv.f | 0 .../lapack/native/dgbsvx.f | 0 .../lapack/native/dgbsvxx.f | 0 .../lapack/native/dgbtf2.f | 0 .../lapack/native/dgbtrf.f | 0 .../lapack/native/dgbtrs.f | 0 .../lapack/native/dgebak.f | 0 .../lapack/native/dgebal.f | 0 .../lapack/native/dgebd2.f | 0 .../lapack/native/dgebrd.f | 0 .../lapack/native/dgecon.f | 0 .../lapack/native/dgedmd.f90 | 0 .../lapack/native/dgedmdq.f90 | 0 .../lapack/native/dgeequ.f | 0 .../lapack/native/dgeequb.f | 0 .../lapack/native/dgees.f | 0 .../lapack/native/dgeesx.f | 0 .../lapack/native/dgeev.f | 0 .../lapack/native/dgeevx.f | 0 .../lapack/native/dgehd2.f | 0 .../lapack/native/dgehrd.f | 0 .../lapack/native/dgejsv.f | 0 .../lapack/native/dgelq.f | 0 .../lapack/native/dgelq2.f | 0 .../lapack/native/dgelqf.f | 0 .../lapack/native/dgelqt.f | 0 .../lapack/native/dgelqt3.f | 0 .../lapack/native/dgels.f | 0 .../lapack/native/dgelsd.f | 0 .../lapack/native/dgelss.f | 0 .../lapack/native/dgelst.f | 0 .../lapack/native/dgelsy.f | 0 .../lapack/native/dgemlq.f | 0 .../lapack/native/dgemlqt.f | 0 .../lapack/native/dgemqr.f | 0 .../lapack/native/dgemqrt.f | 0 .../lapack/native/dgeql2.f | 0 .../lapack/native/dgeqlf.f | 0 .../lapack/native/dgeqp3.f | 0 .../lapack/native/dgeqp3rk.f | 0 .../lapack/native/dgeqr.f | 0 .../lapack/native/dgeqr2.f | 0 .../lapack/native/dgeqr2p.f | 0 .../lapack/native/dgeqrf.f | 0 .../lapack/native/dgeqrfp.f | 0 .../lapack/native/dgeqrt.f | 0 .../lapack/native/dgeqrt2.f | 0 .../lapack/native/dgeqrt3.f | 0 .../lapack/native/dgerfs.f | 0 .../lapack/native/dgerfsx.f | 0 .../lapack/native/dgerq2.f | 0 .../lapack/native/dgerqf.f | 0 .../lapack/native/dgesc2.f | 0 .../lapack/native/dgesdd.f | 0 .../lapack/native/dgesv.f | 0 .../lapack/native/dgesvd.f | 0 .../lapack/native/dgesvdq.f | 0 .../lapack/native/dgesvdx.f | 0 .../lapack/native/dgesvj.f | 0 .../lapack/native/dgesvx.f | 0 .../lapack/native/dgesvxx.f | 0 .../lapack/native/dgetc2.f | 0 .../lapack/native/dgetf2.f | 0 .../lapack/native/dgetrf.f | 0 .../lapack/native/dgetrf2.f | 0 .../lapack/native/dgetri.f | 0 .../lapack/native/dgetrs.f | 0 .../lapack/native/dgetsls.f | 0 .../lapack/native/dgetsqrhrt.f | 0 .../lapack/native/dggbak.f | 0 .../lapack/native/dggbal.f | 0 .../lapack/native/dgges.f | 0 .../lapack/native/dgges3.f | 0 .../lapack/native/dggesx.f | 0 .../lapack/native/dggev.f | 0 .../lapack/native/dggev3.f | 0 .../lapack/native/dggevx.f | 0 .../lapack/native/dggglm.f | 0 .../lapack/native/dgghd3.f | 0 .../lapack/native/dgghrd.f | 0 .../lapack/native/dgglse.f | 0 .../lapack/native/dggqrf.f | 0 .../lapack/native/dggrqf.f | 0 .../lapack/native/dggsvd3.f | 0 .../lapack/native/dggsvp3.f | 0 .../lapack/native/dgsvj0.f | 0 .../lapack/native/dgsvj1.f | 0 .../lapack/native/dgtcon.f | 0 .../lapack/native/dgtrfs.f | 0 .../lapack/native/dgtsv.f | 0 .../lapack/native/dgtsvx.f | 0 .../lapack/native/dgttrf.f | 0 .../lapack/native/dgttrs.f | 0 .../lapack/native/dgtts2.f | 0 .../lapack/native/dhgeqz.f | 0 .../lapack/native/dhsein.f | 0 .../lapack/native/dhseqr.f | 0 .../lapack/native/disnan.f | 0 .../lapack/native/dla_gbamv.f | 0 .../lapack/native/dla_gbrcond.f | 0 .../lapack/native/dla_gbrfsx_extended.f | 0 .../lapack/native/dla_gbrpvgrw.f | 0 .../lapack/native/dla_geamv.f | 0 .../lapack/native/dla_gercond.f | 0 .../lapack/native/dla_gerfsx_extended.f | 0 .../lapack/native/dla_gerpvgrw.f | 0 .../lapack/native/dla_lin_berr.f | 0 .../lapack/native/dla_porcond.f | 0 .../lapack/native/dla_porfsx_extended.f | 0 .../lapack/native/dla_porpvgrw.f | 0 .../lapack/native/dla_syamv.f | 0 .../lapack/native/dla_syrcond.f | 0 .../lapack/native/dla_syrfsx_extended.f | 0 .../lapack/native/dla_syrpvgrw.f | 0 .../lapack/native/dla_wwaddw.f | 0 .../lapack/native/dlabad.f | 0 .../lapack/native/dlabrd.f | 0 .../lapack/native/dlacn2.f | 0 .../lapack/native/dlacon.f | 0 .../lapack/native/dlacpy.f | 0 .../lapack/native/dladiv.f | 0 .../lapack/native/dlae2.f | 0 .../lapack/native/dlaebz.f | 0 .../lapack/native/dlaed0.f | 0 .../lapack/native/dlaed1.f | 0 .../lapack/native/dlaed2.f | 0 .../lapack/native/dlaed3.f | 0 .../lapack/native/dlaed4.f | 0 .../lapack/native/dlaed5.f | 0 .../lapack/native/dlaed6.f | 0 .../lapack/native/dlaed7.f | 0 .../lapack/native/dlaed8.f | 0 .../lapack/native/dlaed9.f | 0 .../lapack/native/dlaeda.f | 0 .../lapack/native/dlaein.f | 0 .../lapack/native/dlaev2.f | 0 .../lapack/native/dlaexc.f | 0 .../lapack/native/dlag2.f | 0 .../lapack/native/dlag2s.f | 0 .../lapack/native/dlags2.f | 0 .../lapack/native/dlagtf.f | 0 .../lapack/native/dlagtm.f | 0 .../lapack/native/dlagts.f | 0 .../lapack/native/dlagv2.f | 0 .../lapack/native/dlahqr.f | 0 .../lapack/native/dlahr2.f | 0 .../lapack/native/dlaic1.f | 0 .../lapack/native/dlaisnan.f | 0 .../lapack/native/dlaln2.f | 0 .../lapack/native/dlals0.f | 0 .../lapack/native/dlalsa.f | 0 .../lapack/native/dlalsd.f | 0 examples/lapack/native/dlamch.f | 39 ++ .../lapack/native/dlamrg.f | 0 .../lapack/native/dlamswlq.f | 0 .../lapack/native/dlamtsqr.f | 0 .../lapack/native/dlaneg.f | 0 .../lapack/native/dlangb.f | 0 .../lapack/native/dlange.f | 0 .../lapack/native/dlangt.f | 0 .../lapack/native/dlanhs.f | 0 .../lapack/native/dlansb.f | 0 .../lapack/native/dlansf.f | 0 .../lapack/native/dlansp.f | 0 .../lapack/native/dlanst.f | 0 .../lapack/native/dlansy.f | 0 .../lapack/native/dlantb.f | 0 .../lapack/native/dlantp.f | 0 .../lapack/native/dlantr.f | 0 .../lapack/native/dlanv2.f | 0 .../lapack/native/dlaorhr_col_getrfnp.f | 0 .../lapack/native/dlaorhr_col_getrfnp2.f | 0 .../lapack/native/dlapll.f | 0 .../lapack/native/dlapmr.f | 0 .../lapack/native/dlapmt.f | 0 .../lapack/native/dlapy2.f | 0 .../lapack/native/dlapy3.f | 0 .../lapack/native/dlaqgb.f | 0 .../lapack/native/dlaqge.f | 0 .../lapack/native/dlaqp2.f | 0 .../lapack/native/dlaqp2rk.f | 0 .../lapack/native/dlaqp3rk.f | 0 .../lapack/native/dlaqps.f | 0 .../lapack/native/dlaqr0.f | 0 .../lapack/native/dlaqr1.f | 0 .../lapack/native/dlaqr2.f | 0 .../lapack/native/dlaqr3.f | 0 .../lapack/native/dlaqr4.f | 0 .../lapack/native/dlaqr5.f | 0 .../lapack/native/dlaqsb.f | 0 .../lapack/native/dlaqsp.f | 0 .../lapack/native/dlaqsy.f | 0 .../lapack/native/dlaqtr.f | 0 .../lapack/native/dlaqz0.f | 0 .../lapack/native/dlaqz1.f | 0 .../lapack/native/dlaqz2.f | 0 .../lapack/native/dlaqz3.f | 0 .../lapack/native/dlaqz4.f | 0 .../lapack/native/dlar1v.f | 0 .../lapack/native/dlar2v.f | 0 .../lapack/native/dlarf.f | 0 .../lapack/native/dlarf1f.f | 0 .../lapack/native/dlarf1l.f | 0 .../lapack/native/dlarfb.f | 0 .../lapack/native/dlarfb_gett.f | 0 .../lapack/native/dlarfg.f | 0 .../lapack/native/dlarfgp.f | 0 .../lapack/native/dlarft.f | 0 .../lapack/native/dlarfx.f | 0 .../lapack/native/dlarfy.f | 0 .../lapack/native/dlargv.f | 0 .../lapack/native/dlarmm.f | 0 .../lapack/native/dlarnv.f | 0 .../lapack/native/dlarra.f | 0 .../lapack/native/dlarrb.f | 0 .../lapack/native/dlarrc.f | 0 .../lapack/native/dlarrd.f | 0 .../lapack/native/dlarre.f | 0 .../lapack/native/dlarrf.f | 0 .../lapack/native/dlarrj.f | 0 .../lapack/native/dlarrk.f | 0 .../lapack/native/dlarrr.f | 0 .../lapack/native/dlarrv.f | 0 .../lapack/native/dlarscl2.f | 0 .../lapack/native/dlartg.f90 | 0 .../lapack/native/dlartgp.f | 0 .../lapack/native/dlartgs.f | 0 .../lapack/native/dlartv.f | 0 .../lapack/native/dlaruv.f | 0 .../lapack/native/dlarz.f | 0 .../lapack/native/dlarzb.f | 0 .../lapack/native/dlarzt.f | 0 .../lapack/native/dlas2.f | 0 .../lapack/native/dlascl.f | 0 .../lapack/native/dlascl2.f | 0 .../lapack/native/dlasd0.f | 0 .../lapack/native/dlasd1.f | 0 .../lapack/native/dlasd2.f | 0 .../lapack/native/dlasd3.f | 0 .../lapack/native/dlasd4.f | 0 .../lapack/native/dlasd5.f | 0 .../lapack/native/dlasd6.f | 0 .../lapack/native/dlasd7.f | 0 .../lapack/native/dlasd8.f | 0 .../lapack/native/dlasda.f | 0 .../lapack/native/dlasdq.f | 0 .../lapack/native/dlasdt.f | 0 .../lapack/native/dlaset.f | 0 .../lapack/native/dlasq1.f | 0 .../lapack/native/dlasq2.f | 0 .../lapack/native/dlasq3.f | 0 .../lapack/native/dlasq4.f | 0 .../lapack/native/dlasq5.f | 0 .../lapack/native/dlasq6.f | 0 .../lapack/native/dlasr.f | 0 .../lapack/native/dlasrt.f | 0 .../lapack/native/dlassq.f90 | 0 .../lapack/native/dlasv2.f | 0 .../lapack/native/dlaswlq.f | 0 .../lapack/native/dlaswp.f | 0 .../lapack/native/dlasy2.f | 0 .../lapack/native/dlasyf.f | 0 .../lapack/native/dlasyf_aa.f | 0 .../lapack/native/dlasyf_rk.f | 0 .../lapack/native/dlasyf_rook.f | 0 .../lapack/native/dlat2s.f | 0 .../lapack/native/dlatbs.f | 0 .../lapack/native/dlatdf.f | 0 .../lapack/native/dlatps.f | 0 .../lapack/native/dlatrd.f | 0 .../lapack/native/dlatrs.f | 0 .../lapack/native/dlatrs3.f | 0 .../lapack/native/dlatrz.f | 0 .../lapack/native/dlatsqr.f | 0 .../lapack/native/dlauu2.f | 0 .../lapack/native/dlauum.f | 0 .../lapack/native/dopgtr.f | 0 .../lapack/native/dopmtr.f | 0 .../lapack/native/dorbdb.f | 0 .../lapack/native/dorbdb1.f | 0 .../lapack/native/dorbdb2.f | 0 .../lapack/native/dorbdb3.f | 0 .../lapack/native/dorbdb4.f | 0 .../lapack/native/dorbdb5.f | 0 .../lapack/native/dorbdb6.f | 0 .../lapack/native/dorcsd.f | 0 .../lapack/native/dorcsd2by1.f | 0 .../lapack/native/dorg2l.f | 0 .../lapack/native/dorg2r.f | 0 .../lapack/native/dorgbr.f | 0 .../lapack/native/dorghr.f | 0 .../lapack/native/dorgl2.f | 0 .../lapack/native/dorglq.f | 0 .../lapack/native/dorgql.f | 0 .../lapack/native/dorgqr.f | 0 .../lapack/native/dorgr2.f | 0 .../lapack/native/dorgrq.f | 0 .../lapack/native/dorgtr.f | 0 .../lapack/native/dorgtsqr.f | 0 .../lapack/native/dorgtsqr_row.f | 0 .../lapack/native/dorhr_col.f | 0 .../lapack/native/dorm22.f | 0 .../lapack/native/dorm2l.f | 0 .../lapack/native/dorm2r.f | 0 .../lapack/native/dormbr.f | 0 .../lapack/native/dormhr.f | 0 .../lapack/native/dorml2.f | 0 .../lapack/native/dormlq.f | 0 .../lapack/native/dormql.f | 0 .../lapack/native/dormqr.f | 0 .../lapack/native/dormr2.f | 0 .../lapack/native/dormr3.f | 0 .../lapack/native/dormrq.f | 0 .../lapack/native/dormrz.f | 0 .../lapack/native/dormtr.f | 0 .../lapack/native/dpbcon.f | 0 .../lapack/native/dpbequ.f | 0 .../lapack/native/dpbrfs.f | 0 .../lapack/native/dpbstf.f | 0 .../lapack/native/dpbsv.f | 0 .../lapack/native/dpbsvx.f | 0 .../lapack/native/dpbtf2.f | 0 .../lapack/native/dpbtrf.f | 0 .../lapack/native/dpbtrs.f | 0 .../lapack/native/dpftrf.f | 0 .../lapack/native/dpftri.f | 0 .../lapack/native/dpftrs.f | 0 .../lapack/native/dpocon.f | 0 .../lapack/native/dpoequ.f | 0 .../lapack/native/dpoequb.f | 0 .../lapack/native/dporfs.f | 0 .../lapack/native/dporfsx.f | 0 .../lapack/native/dposv.f | 0 .../lapack/native/dposvx.f | 0 .../lapack/native/dposvxx.f | 0 .../lapack/native/dpotf2.f | 0 .../lapack/native/dpotrf.f | 0 .../lapack/native/dpotrf2.f | 0 .../lapack/native/dpotri.f | 0 .../lapack/native/dpotrs.f | 0 .../lapack/native/dppcon.f | 0 .../lapack/native/dppequ.f | 0 .../lapack/native/dpprfs.f | 0 .../lapack/native/dppsv.f | 0 .../lapack/native/dppsvx.f | 0 .../lapack/native/dpptrf.f | 0 .../lapack/native/dpptri.f | 0 .../lapack/native/dpptrs.f | 0 .../lapack/native/dpstf2.f | 0 .../lapack/native/dpstrf.f | 0 .../lapack/native/dptcon.f | 0 .../lapack/native/dpteqr.f | 0 .../lapack/native/dptrfs.f | 0 .../lapack/native/dptsv.f | 0 .../lapack/native/dptsvx.f | 0 .../lapack/native/dpttrf.f | 0 .../lapack/native/dpttrs.f | 0 .../lapack/native/dptts2.f | 0 .../lapack/native/drscl.f | 0 .../lapack/native/dsb2st_kernels.f | 0 .../lapack/native/dsbev.f | 0 .../lapack/native/dsbev_2stage.f | 0 .../lapack/native/dsbevd.f | 0 .../lapack/native/dsbevd_2stage.f | 0 .../lapack/native/dsbevx.f | 0 .../lapack/native/dsbevx_2stage.f | 0 .../lapack/native/dsbgst.f | 0 .../lapack/native/dsbgv.f | 0 .../lapack/native/dsbgvd.f | 0 .../lapack/native/dsbgvx.f | 0 .../lapack/native/dsbtrd.f | 0 .../lapack/native/dsfrk.f | 0 .../lapack/native/dsgesv.f | 0 .../lapack/native/dspcon.f | 0 .../lapack/native/dspev.f | 0 .../lapack/native/dspevd.f | 0 .../lapack/native/dspevx.f | 0 .../lapack/native/dspgst.f | 0 .../lapack/native/dspgv.f | 0 .../lapack/native/dspgvd.f | 0 .../lapack/native/dspgvx.f | 0 .../lapack/native/dsposv.f | 0 .../lapack/native/dsprfs.f | 0 .../lapack/native/dspsv.f | 0 .../lapack/native/dspsvx.f | 0 .../lapack/native/dsptrd.f | 0 .../lapack/native/dsptrf.f | 0 .../lapack/native/dsptri.f | 0 .../lapack/native/dsptrs.f | 0 .../lapack/native/dstebz.f | 0 .../lapack/native/dstedc.f | 0 .../lapack/native/dstegr.f | 0 .../lapack/native/dstein.f | 0 .../lapack/native/dstemr.f | 0 .../lapack/native/dsteqr.f | 0 .../lapack/native/dsterf.f | 0 .../lapack/native/dstev.f | 0 .../lapack/native/dstevd.f | 0 .../lapack/native/dstevr.f | 0 .../lapack/native/dstevx.f | 0 .../lapack/native/dsycon.f | 0 .../lapack/native/dsycon_3.f | 0 .../lapack/native/dsycon_rook.f | 0 .../lapack/native/dsyconv.f | 0 .../lapack/native/dsyconvf.f | 0 .../lapack/native/dsyconvf_rook.f | 0 .../lapack/native/dsyequb.f | 0 .../lapack/native/dsyev.f | 0 .../lapack/native/dsyev_2stage.f | 0 .../lapack/native/dsyevd.f | 0 .../lapack/native/dsyevd_2stage.f | 0 .../lapack/native/dsyevr.f | 0 .../lapack/native/dsyevr_2stage.f | 0 .../lapack/native/dsyevx.f | 0 .../lapack/native/dsyevx_2stage.f | 0 .../lapack/native/dsygs2.f | 0 .../lapack/native/dsygst.f | 0 .../lapack/native/dsygv.f | 0 .../lapack/native/dsygv_2stage.f | 0 .../lapack/native/dsygvd.f | 0 .../lapack/native/dsygvx.f | 0 .../lapack/native/dsyrfs.f | 0 .../lapack/native/dsyrfsx.f | 0 .../lapack/native/dsysv.f | 0 .../lapack/native/dsysv_aa.f | 0 .../lapack/native/dsysv_aa_2stage.f | 0 .../lapack/native/dsysv_rk.f | 0 .../lapack/native/dsysv_rook.f | 0 .../lapack/native/dsysvx.f | 0 .../lapack/native/dsysvxx.f | 0 .../lapack/native/dsyswapr.f | 0 .../lapack/native/dsytd2.f | 0 .../lapack/native/dsytf2.f | 0 .../lapack/native/dsytf2_rk.f | 0 .../lapack/native/dsytf2_rook.f | 0 .../lapack/native/dsytrd.f | 0 .../lapack/native/dsytrd_2stage.f | 0 .../lapack/native/dsytrd_sb2st.F | 0 .../lapack/native/dsytrd_sy2sb.f | 0 .../lapack/native/dsytrf.f | 0 .../lapack/native/dsytrf_aa.f | 0 .../lapack/native/dsytrf_aa_2stage.f | 0 .../lapack/native/dsytrf_rk.f | 0 .../lapack/native/dsytrf_rook.f | 0 .../lapack/native/dsytri.f | 0 .../lapack/native/dsytri2.f | 0 .../lapack/native/dsytri2x.f | 0 .../lapack/native/dsytri_3.f | 0 .../lapack/native/dsytri_3x.f | 0 .../lapack/native/dsytri_rook.f | 0 .../lapack/native/dsytrs.f | 0 .../lapack/native/dsytrs2.f | 0 .../lapack/native/dsytrs_3.f | 0 .../lapack/native/dsytrs_aa.f | 0 .../lapack/native/dsytrs_aa_2stage.f | 0 .../lapack/native/dsytrs_rook.f | 0 .../lapack/native/dtbcon.f | 0 .../lapack/native/dtbrfs.f | 0 .../lapack/native/dtbtrs.f | 0 .../lapack/native/dtfsm.f | 0 .../lapack/native/dtftri.f | 0 .../lapack/native/dtfttp.f | 0 .../lapack/native/dtfttr.f | 0 .../lapack/native/dtgevc.f | 0 .../lapack/native/dtgex2.f | 0 .../lapack/native/dtgexc.f | 0 .../lapack/native/dtgsen.f | 0 .../lapack/native/dtgsja.f | 0 .../lapack/native/dtgsna.f | 0 .../lapack/native/dtgsy2.f | 0 .../lapack/native/dtgsyl.f | 0 .../lapack/native/dtpcon.f | 0 .../lapack/native/dtplqt.f | 0 .../lapack/native/dtplqt2.f | 0 .../lapack/native/dtpmlqt.f | 0 .../lapack/native/dtpmqrt.f | 0 .../lapack/native/dtpqrt.f | 0 .../lapack/native/dtpqrt2.f | 0 .../lapack/native/dtprfb.f | 0 .../lapack/native/dtprfs.f | 0 .../lapack/native/dtptri.f | 0 .../lapack/native/dtptrs.f | 0 .../lapack/native/dtpttf.f | 0 .../lapack/native/dtpttr.f | 0 .../lapack/native/dtrcon.f | 0 .../lapack/native/dtrevc.f | 0 .../lapack/native/dtrevc3.f | 0 .../lapack/native/dtrexc.f | 0 .../lapack/native/dtrrfs.f | 0 .../lapack/native/dtrsen.f | 0 .../lapack/native/dtrsna.f | 0 .../lapack/native/dtrsyl.f | 0 .../lapack/native/dtrsyl3.f | 0 .../lapack/native/dtrti2.f | 0 .../lapack/native/dtrtri.f | 0 .../lapack/native/dtrtrs.f | 0 .../lapack/native/dtrttf.f | 0 .../lapack/native/dtrttp.f | 0 .../lapack/native/dtzrzf.f | 0 .../lapack/native/dzsum1.f | 0 .../lapack/native/icmax1.f | 0 .../lapack/native/ieeeck.f | 0 .../lapack/native/ilaclc.f | 0 .../lapack/native/ilaclr.f | 0 .../lapack/native/iladiag.f | 0 .../lapack/native/iladlc.f | 0 .../lapack/native/iladlr.f | 0 .../lapack/native/ilaenv.f | 0 .../lapack/native/ilaenv2stage.f | 0 .../lapack/native/ilaprec.f | 0 .../lapack/native/ilaslc.f | 0 .../lapack/native/ilaslr.f | 0 .../lapack/native/ilatrans.f | 0 .../lapack/native/ilauplo.f | 0 .../lapack/native/ilazlc.f | 0 .../lapack/native/ilazlr.f | 0 .../lapack/native/iparam2stage.F | 0 .../lapack/native/iparmq.f | 0 .../lapack/native/izmax1.f | 0 .../lapack/native/la_constants.f90 | 0 .../lapack/native/la_xisnan.F90 | 0 .../lapack/native/lsamen.f | 0 .../lapack/native/sbbcsd.f | 0 .../lapack/native/sbdsdc.f | 0 .../lapack/native/sbdsqr.f | 0 .../lapack/native/sbdsvdx.f | 0 .../lapack/native/scsum1.f | 0 .../lapack/native/sdisna.f | 0 .../lapack/native/sgbbrd.f | 0 .../lapack/native/sgbcon.f | 0 .../lapack/native/sgbequ.f | 0 .../lapack/native/sgbequb.f | 0 .../lapack/native/sgbrfs.f | 0 .../lapack/native/sgbrfsx.f | 0 .../lapack/native/sgbsv.f | 0 .../lapack/native/sgbsvx.f | 0 .../lapack/native/sgbsvxx.f | 0 .../lapack/native/sgbtf2.f | 0 .../lapack/native/sgbtrf.f | 0 .../lapack/native/sgbtrs.f | 0 .../lapack/native/sgebak.f | 0 .../lapack/native/sgebal.f | 0 .../lapack/native/sgebd2.f | 0 .../lapack/native/sgebrd.f | 0 .../lapack/native/sgecon.f | 0 .../lapack/native/sgedmd.f90 | 0 .../lapack/native/sgedmdq.f90 | 0 .../lapack/native/sgeequ.f | 0 .../lapack/native/sgeequb.f | 0 .../lapack/native/sgees.f | 0 .../lapack/native/sgeesx.f | 0 .../lapack/native/sgeev.f | 0 .../lapack/native/sgeevx.f | 0 .../lapack/native/sgehd2.f | 0 .../lapack/native/sgehrd.f | 0 .../lapack/native/sgejsv.f | 0 .../lapack/native/sgelq.f | 0 .../lapack/native/sgelq2.f | 0 .../lapack/native/sgelqf.f | 0 .../lapack/native/sgelqt.f | 0 .../lapack/native/sgelqt3.f | 0 .../lapack/native/sgels.f | 0 .../lapack/native/sgelsd.f | 0 .../lapack/native/sgelss.f | 0 .../lapack/native/sgelst.f | 0 .../lapack/native/sgelsy.f | 0 .../lapack/native/sgemlq.f | 0 .../lapack/native/sgemlqt.f | 0 .../lapack/native/sgemqr.f | 0 .../lapack/native/sgemqrt.f | 0 .../lapack/native/sgeql2.f | 0 .../lapack/native/sgeqlf.f | 0 .../lapack/native/sgeqp3.f | 0 .../lapack/native/sgeqp3rk.f | 0 .../lapack/native/sgeqr.f | 0 .../lapack/native/sgeqr2.f | 0 .../lapack/native/sgeqr2p.f | 0 .../lapack/native/sgeqrf.f | 0 .../lapack/native/sgeqrfp.f | 0 .../lapack/native/sgeqrt.f | 0 .../lapack/native/sgeqrt2.f | 0 .../lapack/native/sgeqrt3.f | 0 .../lapack/native/sgerfs.f | 0 .../lapack/native/sgerfsx.f | 0 .../lapack/native/sgerq2.f | 0 .../lapack/native/sgerqf.f | 0 .../lapack/native/sgesc2.f | 0 .../lapack/native/sgesdd.f | 0 .../lapack/native/sgesv.f | 0 .../lapack/native/sgesvd.f | 0 .../lapack/native/sgesvdq.f | 0 .../lapack/native/sgesvdx.f | 0 .../lapack/native/sgesvj.f | 0 .../lapack/native/sgesvx.f | 0 .../lapack/native/sgesvxx.f | 0 .../lapack/native/sgetc2.f | 0 .../lapack/native/sgetf2.f | 0 .../lapack/native/sgetrf.f | 0 .../lapack/native/sgetrf2.f | 0 .../lapack/native/sgetri.f | 0 .../lapack/native/sgetrs.f | 0 .../lapack/native/sgetsls.f | 0 .../lapack/native/sgetsqrhrt.f | 0 .../lapack/native/sggbak.f | 0 .../lapack/native/sggbal.f | 0 .../lapack/native/sgges.f | 0 .../lapack/native/sgges3.f | 0 .../lapack/native/sggesx.f | 0 .../lapack/native/sggev.f | 0 .../lapack/native/sggev3.f | 0 .../lapack/native/sggevx.f | 0 .../lapack/native/sggglm.f | 0 .../lapack/native/sgghd3.f | 0 .../lapack/native/sgghrd.f | 0 .../lapack/native/sgglse.f | 0 .../lapack/native/sggqrf.f | 0 .../lapack/native/sggrqf.f | 0 .../lapack/native/sggsvd3.f | 0 .../lapack/native/sggsvp3.f | 0 .../lapack/native/sgsvj0.f | 0 .../lapack/native/sgsvj1.f | 0 .../lapack/native/sgtcon.f | 0 .../lapack/native/sgtrfs.f | 0 .../lapack/native/sgtsv.f | 0 .../lapack/native/sgtsvx.f | 0 .../lapack/native/sgttrf.f | 0 .../lapack/native/sgttrs.f | 0 .../lapack/native/sgtts2.f | 0 .../lapack/native/shgeqz.f | 0 .../lapack/native/shsein.f | 0 .../lapack/native/shseqr.f | 0 .../lapack/native/sisnan.f | 0 .../lapack/native/sla_gbamv.f | 0 .../lapack/native/sla_gbrcond.f | 0 .../lapack/native/sla_gbrfsx_extended.f | 0 .../lapack/native/sla_gbrpvgrw.f | 0 .../lapack/native/sla_geamv.f | 0 .../lapack/native/sla_gercond.f | 0 .../lapack/native/sla_gerfsx_extended.f | 0 .../lapack/native/sla_gerpvgrw.f | 0 .../lapack/native/sla_lin_berr.f | 0 .../lapack/native/sla_porcond.f | 0 .../lapack/native/sla_porfsx_extended.f | 0 .../lapack/native/sla_porpvgrw.f | 0 .../lapack/native/sla_syamv.f | 0 .../lapack/native/sla_syrcond.f | 0 .../lapack/native/sla_syrfsx_extended.f | 0 .../lapack/native/sla_syrpvgrw.f | 0 .../lapack/native/sla_wwaddw.f | 0 .../lapack/native/slabad.f | 0 .../lapack/native/slabrd.f | 0 .../lapack/native/slacn2.f | 0 .../lapack/native/slacon.f | 0 .../lapack/native/slacpy.f | 0 .../lapack/native/sladiv.f | 0 .../lapack/native/slae2.f | 0 .../lapack/native/slaebz.f | 0 .../lapack/native/slaed0.f | 0 .../lapack/native/slaed1.f | 0 .../lapack/native/slaed2.f | 0 .../lapack/native/slaed3.f | 0 .../lapack/native/slaed4.f | 0 .../lapack/native/slaed5.f | 0 .../lapack/native/slaed6.f | 0 .../lapack/native/slaed7.f | 0 .../lapack/native/slaed8.f | 0 .../lapack/native/slaed9.f | 0 .../lapack/native/slaeda.f | 0 .../lapack/native/slaein.f | 0 .../lapack/native/slaev2.f | 0 .../lapack/native/slaexc.f | 0 .../lapack/native/slag2.f | 0 .../lapack/native/slag2d.f | 0 .../lapack/native/slags2.f | 0 .../lapack/native/slagtf.f | 0 .../lapack/native/slagtm.f | 0 .../lapack/native/slagts.f | 0 .../lapack/native/slagv2.f | 0 .../lapack/native/slahqr.f | 0 .../lapack/native/slahr2.f | 0 .../lapack/native/slaic1.f | 0 .../lapack/native/slaisnan.f | 0 .../lapack/native/slaln2.f | 0 .../lapack/native/slals0.f | 0 .../lapack/native/slalsa.f | 0 .../lapack/native/slalsd.f | 0 .../lapack/native/slamrg.f | 0 .../lapack/native/slamswlq.f | 0 .../lapack/native/slamtsqr.f | 0 .../lapack/native/slaneg.f | 0 .../lapack/native/slangb.f | 0 .../lapack/native/slange.f | 0 .../lapack/native/slangt.f | 0 .../lapack/native/slanhs.f | 0 .../lapack/native/slansb.f | 0 .../lapack/native/slansf.f | 0 .../lapack/native/slansp.f | 0 .../lapack/native/slanst.f | 0 .../lapack/native/slansy.f | 0 .../lapack/native/slantb.f | 0 .../lapack/native/slantp.f | 0 .../lapack/native/slantr.f | 0 .../lapack/native/slanv2.f | 0 .../lapack/native/slaorhr_col_getrfnp.f | 0 .../lapack/native/slaorhr_col_getrfnp2.f | 0 .../lapack/native/slapll.f | 0 .../lapack/native/slapmr.f | 0 .../lapack/native/slapmt.f | 0 .../lapack/native/slapy2.f | 0 .../lapack/native/slapy3.f | 0 .../lapack/native/slaqgb.f | 0 .../lapack/native/slaqge.f | 0 .../lapack/native/slaqp2.f | 0 .../lapack/native/slaqp2rk.f | 0 .../lapack/native/slaqp3rk.f | 0 .../lapack/native/slaqps.f | 0 .../lapack/native/slaqr0.f | 0 .../lapack/native/slaqr1.f | 0 .../lapack/native/slaqr2.f | 0 .../lapack/native/slaqr3.f | 0 .../lapack/native/slaqr4.f | 0 .../lapack/native/slaqr5.f | 0 .../lapack/native/slaqsb.f | 0 .../lapack/native/slaqsp.f | 0 .../lapack/native/slaqsy.f | 0 .../lapack/native/slaqtr.f | 0 .../lapack/native/slaqz0.f | 0 .../lapack/native/slaqz1.f | 0 .../lapack/native/slaqz2.f | 0 .../lapack/native/slaqz3.f | 0 .../lapack/native/slaqz4.f | 0 .../lapack/native/slar1v.f | 0 .../lapack/native/slar2v.f | 0 .../lapack/native/slarf.f | 0 .../lapack/native/slarf1f.f | 0 .../lapack/native/slarf1l.f | 0 .../lapack/native/slarfb.f | 0 .../lapack/native/slarfb_gett.f | 0 .../lapack/native/slarfg.f | 0 .../lapack/native/slarfgp.f | 0 .../lapack/native/slarft.f | 0 .../lapack/native/slarfx.f | 0 .../lapack/native/slarfy.f | 0 .../lapack/native/slargv.f | 0 .../lapack/native/slarmm.f | 0 .../lapack/native/slarnv.f | 0 .../lapack/native/slarra.f | 0 .../lapack/native/slarrb.f | 0 .../lapack/native/slarrc.f | 0 .../lapack/native/slarrd.f | 0 .../lapack/native/slarre.f | 0 .../lapack/native/slarrf.f | 0 .../lapack/native/slarrj.f | 0 .../lapack/native/slarrk.f | 0 .../lapack/native/slarrr.f | 0 .../lapack/native/slarrv.f | 0 .../lapack/native/slarscl2.f | 0 .../lapack/native/slartg.f90 | 0 .../lapack/native/slartgp.f | 0 .../lapack/native/slartgs.f | 0 .../lapack/native/slartv.f | 0 .../lapack/native/slaruv.f | 0 .../lapack/native/slarz.f | 0 .../lapack/native/slarzb.f | 0 .../lapack/native/slarzt.f | 0 .../lapack/native/slas2.f | 0 .../lapack/native/slascl.f | 0 .../lapack/native/slascl2.f | 0 .../lapack/native/slasd0.f | 0 .../lapack/native/slasd1.f | 0 .../lapack/native/slasd2.f | 0 .../lapack/native/slasd3.f | 0 .../lapack/native/slasd4.f | 0 .../lapack/native/slasd5.f | 0 .../lapack/native/slasd6.f | 0 .../lapack/native/slasd7.f | 0 .../lapack/native/slasd8.f | 0 .../lapack/native/slasda.f | 0 .../lapack/native/slasdq.f | 0 .../lapack/native/slasdt.f | 0 .../lapack/native/slaset.f | 0 .../lapack/native/slasq1.f | 0 .../lapack/native/slasq2.f | 0 .../lapack/native/slasq3.f | 0 .../lapack/native/slasq4.f | 0 .../lapack/native/slasq5.f | 0 .../lapack/native/slasq6.f | 0 .../lapack/native/slasr.f | 0 .../lapack/native/slasrt.f | 0 .../lapack/native/slassq.f90 | 0 .../lapack/native/slasv2.f | 0 .../lapack/native/slaswlq.f | 0 .../lapack/native/slaswp.f | 0 .../lapack/native/slasy2.f | 0 .../lapack/native/slasyf.f | 0 .../lapack/native/slasyf_aa.f | 0 .../lapack/native/slasyf_rk.f | 0 .../lapack/native/slasyf_rook.f | 0 .../lapack/native/slatbs.f | 0 .../lapack/native/slatdf.f | 0 .../lapack/native/slatps.f | 0 .../lapack/native/slatrd.f | 0 .../lapack/native/slatrs.f | 0 .../lapack/native/slatrs3.f | 0 .../lapack/native/slatrz.f | 0 .../lapack/native/slatsqr.f | 0 .../lapack/native/slauu2.f | 0 .../lapack/native/slauum.f | 0 .../lapack/native/sopgtr.f | 0 .../lapack/native/sopmtr.f | 0 .../lapack/native/sorbdb.f | 0 .../lapack/native/sorbdb1.f | 0 .../lapack/native/sorbdb2.f | 0 .../lapack/native/sorbdb3.f | 0 .../lapack/native/sorbdb4.f | 0 .../lapack/native/sorbdb5.f | 0 .../lapack/native/sorbdb6.f | 0 .../lapack/native/sorcsd.f | 0 .../lapack/native/sorcsd2by1.f | 0 .../lapack/native/sorg2l.f | 0 .../lapack/native/sorg2r.f | 0 .../lapack/native/sorgbr.f | 0 .../lapack/native/sorghr.f | 0 .../lapack/native/sorgl2.f | 0 .../lapack/native/sorglq.f | 0 .../lapack/native/sorgql.f | 0 .../lapack/native/sorgqr.f | 0 .../lapack/native/sorgr2.f | 0 .../lapack/native/sorgrq.f | 0 .../lapack/native/sorgtr.f | 0 .../lapack/native/sorgtsqr.f | 0 .../lapack/native/sorgtsqr_row.f | 0 .../lapack/native/sorhr_col.f | 0 .../lapack/native/sorm22.f | 0 .../lapack/native/sorm2l.f | 0 .../lapack/native/sorm2r.f | 0 .../lapack/native/sormbr.f | 0 .../lapack/native/sormhr.f | 0 .../lapack/native/sorml2.f | 0 .../lapack/native/sormlq.f | 0 .../lapack/native/sormql.f | 0 .../lapack/native/sormqr.f | 0 .../lapack/native/sormr2.f | 0 .../lapack/native/sormr3.f | 0 .../lapack/native/sormrq.f | 0 .../lapack/native/sormrz.f | 0 .../lapack/native/sormtr.f | 0 .../lapack/native/spbcon.f | 0 .../lapack/native/spbequ.f | 0 .../lapack/native/spbrfs.f | 0 .../lapack/native/spbstf.f | 0 .../lapack/native/spbsv.f | 0 .../lapack/native/spbsvx.f | 0 .../lapack/native/spbtf2.f | 0 .../lapack/native/spbtrf.f | 0 .../lapack/native/spbtrs.f | 0 .../lapack/native/spftrf.f | 0 .../lapack/native/spftri.f | 0 .../lapack/native/spftrs.f | 0 .../lapack/native/spocon.f | 0 .../lapack/native/spoequ.f | 0 .../lapack/native/spoequb.f | 0 .../lapack/native/sporfs.f | 0 .../lapack/native/sporfsx.f | 0 .../lapack/native/sposv.f | 0 .../lapack/native/sposvx.f | 0 .../lapack/native/sposvxx.f | 0 .../lapack/native/spotf2.f | 0 .../lapack/native/spotrf.f | 0 .../lapack/native/spotrf2.f | 0 .../lapack/native/spotri.f | 0 .../lapack/native/spotrs.f | 0 .../lapack/native/sppcon.f | 0 .../lapack/native/sppequ.f | 0 .../lapack/native/spprfs.f | 0 .../lapack/native/sppsv.f | 0 .../lapack/native/sppsvx.f | 0 .../lapack/native/spptrf.f | 0 .../lapack/native/spptri.f | 0 .../lapack/native/spptrs.f | 0 .../lapack/native/spstf2.f | 0 .../lapack/native/spstrf.f | 0 .../lapack/native/sptcon.f | 0 .../lapack/native/spteqr.f | 0 .../lapack/native/sptrfs.f | 0 .../lapack/native/sptsv.f | 0 .../lapack/native/sptsvx.f | 0 .../lapack/native/spttrf.f | 0 .../lapack/native/spttrs.f | 0 .../lapack/native/sptts2.f | 0 .../lapack/native/srscl.f | 0 .../lapack/native/ssb2st_kernels.f | 0 .../lapack/native/ssbev.f | 0 .../lapack/native/ssbev_2stage.f | 0 .../lapack/native/ssbevd.f | 0 .../lapack/native/ssbevd_2stage.f | 0 .../lapack/native/ssbevx.f | 0 .../lapack/native/ssbevx_2stage.f | 0 .../lapack/native/ssbgst.f | 0 .../lapack/native/ssbgv.f | 0 .../lapack/native/ssbgvd.f | 0 .../lapack/native/ssbgvx.f | 0 .../lapack/native/ssbtrd.f | 0 .../lapack/native/ssfrk.f | 0 .../lapack/native/sspcon.f | 0 .../lapack/native/sspev.f | 0 .../lapack/native/sspevd.f | 0 .../lapack/native/sspevx.f | 0 .../lapack/native/sspgst.f | 0 .../lapack/native/sspgv.f | 0 .../lapack/native/sspgvd.f | 0 .../lapack/native/sspgvx.f | 0 .../lapack/native/ssprfs.f | 0 .../lapack/native/sspsv.f | 0 .../lapack/native/sspsvx.f | 0 .../lapack/native/ssptrd.f | 0 .../lapack/native/ssptrf.f | 0 .../lapack/native/ssptri.f | 0 .../lapack/native/ssptrs.f | 0 .../lapack/native/sstebz.f | 0 .../lapack/native/sstedc.f | 0 .../lapack/native/sstegr.f | 0 .../lapack/native/sstein.f | 0 .../lapack/native/sstemr.f | 0 .../lapack/native/ssteqr.f | 0 .../lapack/native/ssterf.f | 0 .../lapack/native/sstev.f | 0 .../lapack/native/sstevd.f | 0 .../lapack/native/sstevr.f | 0 .../lapack/native/sstevx.f | 0 .../lapack/native/ssycon.f | 0 .../lapack/native/ssycon_3.f | 0 .../lapack/native/ssycon_rook.f | 0 .../lapack/native/ssyconv.f | 0 .../lapack/native/ssyconvf.f | 0 .../lapack/native/ssyconvf_rook.f | 0 .../lapack/native/ssyequb.f | 0 .../lapack/native/ssyev.f | 0 .../lapack/native/ssyev_2stage.f | 0 .../lapack/native/ssyevd.f | 0 .../lapack/native/ssyevd_2stage.f | 0 .../lapack/native/ssyevr.f | 0 .../lapack/native/ssyevr_2stage.f | 0 .../lapack/native/ssyevx.f | 0 .../lapack/native/ssyevx_2stage.f | 0 .../lapack/native/ssygs2.f | 0 .../lapack/native/ssygst.f | 0 .../lapack/native/ssygv.f | 0 .../lapack/native/ssygv_2stage.f | 0 .../lapack/native/ssygvd.f | 0 .../lapack/native/ssygvx.f | 0 .../lapack/native/ssyrfs.f | 0 .../lapack/native/ssyrfsx.f | 0 .../lapack/native/ssysv.f | 0 .../lapack/native/ssysv_aa.f | 0 .../lapack/native/ssysv_aa_2stage.f | 0 .../lapack/native/ssysv_rk.f | 0 .../lapack/native/ssysv_rook.f | 0 .../lapack/native/ssysvx.f | 0 .../lapack/native/ssysvxx.f | 0 .../lapack/native/ssyswapr.f | 0 .../lapack/native/ssytd2.f | 0 .../lapack/native/ssytf2.f | 0 .../lapack/native/ssytf2_rk.f | 0 .../lapack/native/ssytf2_rook.f | 0 .../lapack/native/ssytrd.f | 0 .../lapack/native/ssytrd_2stage.f | 0 .../lapack/native/ssytrd_sb2st.F | 0 .../lapack/native/ssytrd_sy2sb.f | 0 .../lapack/native/ssytrf.f | 0 .../lapack/native/ssytrf_aa.f | 0 .../lapack/native/ssytrf_aa_2stage.f | 0 .../lapack/native/ssytrf_rk.f | 0 .../lapack/native/ssytrf_rook.f | 0 .../lapack/native/ssytri.f | 0 .../lapack/native/ssytri2.f | 0 .../lapack/native/ssytri2x.f | 0 .../lapack/native/ssytri_3.f | 0 .../lapack/native/ssytri_3x.f | 0 .../lapack/native/ssytri_rook.f | 0 .../lapack/native/ssytrs.f | 0 .../lapack/native/ssytrs2.f | 0 .../lapack/native/ssytrs_3.f | 0 .../lapack/native/ssytrs_aa.f | 0 .../lapack/native/ssytrs_aa_2stage.f | 0 .../lapack/native/ssytrs_rook.f | 0 .../lapack/native/stbcon.f | 0 .../lapack/native/stbrfs.f | 0 .../lapack/native/stbtrs.f | 0 .../lapack/native/stfsm.f | 0 .../lapack/native/stftri.f | 0 .../lapack/native/stfttp.f | 0 .../lapack/native/stfttr.f | 0 .../lapack/native/stgevc.f | 0 .../lapack/native/stgex2.f | 0 .../lapack/native/stgexc.f | 0 .../lapack/native/stgsen.f | 0 .../lapack/native/stgsja.f | 0 .../lapack/native/stgsna.f | 0 .../lapack/native/stgsy2.f | 0 .../lapack/native/stgsyl.f | 0 .../lapack/native/stpcon.f | 0 .../lapack/native/stplqt.f | 0 .../lapack/native/stplqt2.f | 0 .../lapack/native/stpmlqt.f | 0 .../lapack/native/stpmqrt.f | 0 .../lapack/native/stpqrt.f | 0 .../lapack/native/stpqrt2.f | 0 .../lapack/native/stprfb.f | 0 .../lapack/native/stprfs.f | 0 .../lapack/native/stptri.f | 0 .../lapack/native/stptrs.f | 0 .../lapack/native/stpttf.f | 0 .../lapack/native/stpttr.f | 0 .../lapack/native/strcon.f | 0 .../lapack/native/strevc.f | 0 .../lapack/native/strevc3.f | 0 .../lapack/native/strexc.f | 0 .../lapack/native/strrfs.f | 0 .../lapack/native/strsen.f | 0 .../lapack/native/strsna.f | 0 .../lapack/native/strsyl.f | 0 .../lapack/native/strsyl3.f | 0 .../lapack/native/strti2.f | 0 .../lapack/native/strtri.f | 0 .../lapack/native/strtrs.f | 0 .../lapack/native/strttf.f | 0 .../lapack/native/strttp.f | 0 .../lapack/native/stzrzf.f | 0 .../lapack/native/xerbla.f | 0 .../lapack/native/xerbla_array.f | 0 .../lapack/native/zbbcsd.f | 0 .../lapack/native/zbdsqr.f | 0 .../lapack/native/zcgesv.f | 0 .../lapack/native/zcposv.f | 0 .../lapack/native/zdrscl.f | 0 .../lapack/native/zgbbrd.f | 0 .../lapack/native/zgbcon.f | 0 .../lapack/native/zgbequ.f | 0 .../lapack/native/zgbequb.f | 0 .../lapack/native/zgbrfs.f | 0 .../lapack/native/zgbrfsx.f | 0 .../lapack/native/zgbsv.f | 0 .../lapack/native/zgbsvx.f | 0 .../lapack/native/zgbsvxx.f | 0 .../lapack/native/zgbtf2.f | 0 .../lapack/native/zgbtrf.f | 0 .../lapack/native/zgbtrs.f | 0 .../lapack/native/zgebak.f | 0 .../lapack/native/zgebal.f | 0 .../lapack/native/zgebd2.f | 0 .../lapack/native/zgebrd.f | 0 .../lapack/native/zgecon.f | 0 .../lapack/native/zgedmd.f90 | 0 .../lapack/native/zgedmdq.f90 | 0 .../lapack/native/zgeequ.f | 0 .../lapack/native/zgeequb.f | 0 .../lapack/native/zgees.f | 0 .../lapack/native/zgeesx.f | 0 .../lapack/native/zgeev.f | 0 .../lapack/native/zgeevx.f | 0 .../lapack/native/zgehd2.f | 0 .../lapack/native/zgehrd.f | 0 .../lapack/native/zgejsv.f | 0 .../lapack/native/zgelq.f | 0 .../lapack/native/zgelq2.f | 0 .../lapack/native/zgelqf.f | 0 .../lapack/native/zgelqt.f | 0 .../lapack/native/zgelqt3.f | 0 .../lapack/native/zgels.f | 0 .../lapack/native/zgelsd.f | 0 .../lapack/native/zgelss.f | 0 .../lapack/native/zgelst.f | 0 .../lapack/native/zgelsy.f | 0 .../lapack/native/zgemlq.f | 0 .../lapack/native/zgemlqt.f | 0 .../lapack/native/zgemqr.f | 0 .../lapack/native/zgemqrt.f | 0 .../lapack/native/zgeql2.f | 0 .../lapack/native/zgeqlf.f | 0 .../lapack/native/zgeqp3.f | 0 .../lapack/native/zgeqp3rk.f | 0 .../lapack/native/zgeqr.f | 0 .../lapack/native/zgeqr2.f | 0 .../lapack/native/zgeqr2p.f | 0 .../lapack/native/zgeqrf.f | 0 .../lapack/native/zgeqrfp.f | 0 .../lapack/native/zgeqrt.f | 0 .../lapack/native/zgeqrt2.f | 0 .../lapack/native/zgeqrt3.f | 0 .../lapack/native/zgerfs.f | 0 .../lapack/native/zgerfsx.f | 0 .../lapack/native/zgerq2.f | 0 .../lapack/native/zgerqf.f | 0 .../lapack/native/zgesc2.f | 0 .../lapack/native/zgesdd.f | 0 .../lapack/native/zgesv.f | 0 .../lapack/native/zgesvd.f | 0 .../lapack/native/zgesvdq.f | 0 .../lapack/native/zgesvdx.f | 0 .../lapack/native/zgesvj.f | 0 .../lapack/native/zgesvx.f | 0 .../lapack/native/zgesvxx.f | 0 .../lapack/native/zgetc2.f | 0 .../lapack/native/zgetf2.f | 0 .../lapack/native/zgetrf.f | 0 .../lapack/native/zgetrf2.f | 0 .../lapack/native/zgetri.f | 0 .../lapack/native/zgetrs.f | 0 .../lapack/native/zgetsls.f | 0 .../lapack/native/zgetsqrhrt.f | 0 .../lapack/native/zggbak.f | 0 .../lapack/native/zggbal.f | 0 .../lapack/native/zgges.f | 0 .../lapack/native/zgges3.f | 0 .../lapack/native/zggesx.f | 0 .../lapack/native/zggev.f | 0 .../lapack/native/zggev3.f | 0 .../lapack/native/zggevx.f | 0 .../lapack/native/zggglm.f | 0 .../lapack/native/zgghd3.f | 0 .../lapack/native/zgghrd.f | 0 .../lapack/native/zgglse.f | 0 .../lapack/native/zggqrf.f | 0 .../lapack/native/zggrqf.f | 0 .../lapack/native/zggsvd3.f | 0 .../lapack/native/zggsvp3.f | 0 .../lapack/native/zgsvj0.f | 0 .../lapack/native/zgsvj1.f | 0 .../lapack/native/zgtcon.f | 0 .../lapack/native/zgtrfs.f | 0 .../lapack/native/zgtsv.f | 0 .../lapack/native/zgtsvx.f | 0 .../lapack/native/zgttrf.f | 0 .../lapack/native/zgttrs.f | 0 .../lapack/native/zgtts2.f | 0 .../lapack/native/zhb2st_kernels.f | 0 .../lapack/native/zhbev.f | 0 .../lapack/native/zhbev_2stage.f | 0 .../lapack/native/zhbevd.f | 0 .../lapack/native/zhbevd_2stage.f | 0 .../lapack/native/zhbevx.f | 0 .../lapack/native/zhbevx_2stage.f | 0 .../lapack/native/zhbgst.f | 0 .../lapack/native/zhbgv.f | 0 .../lapack/native/zhbgvd.f | 0 .../lapack/native/zhbgvx.f | 0 .../lapack/native/zhbtrd.f | 0 .../lapack/native/zhecon.f | 0 .../lapack/native/zhecon_3.f | 0 .../lapack/native/zhecon_rook.f | 0 .../lapack/native/zheequb.f | 0 .../lapack/native/zheev.f | 0 .../lapack/native/zheev_2stage.f | 0 .../lapack/native/zheevd.f | 0 .../lapack/native/zheevd_2stage.f | 0 .../lapack/native/zheevr.f | 0 .../lapack/native/zheevr_2stage.f | 0 .../lapack/native/zheevx.f | 0 .../lapack/native/zheevx_2stage.f | 0 .../lapack/native/zhegs2.f | 0 .../lapack/native/zhegst.f | 0 .../lapack/native/zhegv.f | 0 .../lapack/native/zhegv_2stage.f | 0 .../lapack/native/zhegvd.f | 0 .../lapack/native/zhegvx.f | 0 .../lapack/native/zherfs.f | 0 .../lapack/native/zherfsx.f | 0 .../lapack/native/zhesv.f | 0 .../lapack/native/zhesv_aa.f | 0 .../lapack/native/zhesv_aa_2stage.f | 0 .../lapack/native/zhesv_rk.f | 0 .../lapack/native/zhesv_rook.f | 0 .../lapack/native/zhesvx.f | 0 .../lapack/native/zhesvxx.f | 0 .../lapack/native/zheswapr.f | 0 .../lapack/native/zhetd2.f | 0 .../lapack/native/zhetf2.f | 0 .../lapack/native/zhetf2_rk.f | 0 .../lapack/native/zhetf2_rook.f | 0 .../lapack/native/zhetrd.f | 0 .../lapack/native/zhetrd_2stage.f | 0 .../lapack/native/zhetrd_hb2st.F | 0 .../lapack/native/zhetrd_he2hb.f | 0 .../lapack/native/zhetrf.f | 0 .../lapack/native/zhetrf_aa.f | 0 .../lapack/native/zhetrf_aa_2stage.f | 0 .../lapack/native/zhetrf_rk.f | 0 .../lapack/native/zhetrf_rook.f | 0 .../lapack/native/zhetri.f | 0 .../lapack/native/zhetri2.f | 0 .../lapack/native/zhetri2x.f | 0 .../lapack/native/zhetri_3.f | 0 .../lapack/native/zhetri_3x.f | 0 .../lapack/native/zhetri_rook.f | 0 .../lapack/native/zhetrs.f | 0 .../lapack/native/zhetrs2.f | 0 .../lapack/native/zhetrs_3.f | 0 .../lapack/native/zhetrs_aa.f | 0 .../lapack/native/zhetrs_aa_2stage.f | 0 .../lapack/native/zhetrs_rook.f | 0 .../lapack/native/zhfrk.f | 0 .../lapack/native/zhgeqz.f | 0 .../lapack/native/zhpcon.f | 0 .../lapack/native/zhpev.f | 0 .../lapack/native/zhpevd.f | 0 .../lapack/native/zhpevx.f | 0 .../lapack/native/zhpgst.f | 0 .../lapack/native/zhpgv.f | 0 .../lapack/native/zhpgvd.f | 0 .../lapack/native/zhpgvx.f | 0 .../lapack/native/zhprfs.f | 0 .../lapack/native/zhpsv.f | 0 .../lapack/native/zhpsvx.f | 0 .../lapack/native/zhptrd.f | 0 .../lapack/native/zhptrf.f | 0 .../lapack/native/zhptri.f | 0 .../lapack/native/zhptrs.f | 0 .../lapack/native/zhsein.f | 0 .../lapack/native/zhseqr.f | 0 .../lapack/native/zla_gbamv.f | 0 .../lapack/native/zla_gbrcond_c.f | 0 .../lapack/native/zla_gbrcond_x.f | 0 .../lapack/native/zla_gbrfsx_extended.f | 0 .../lapack/native/zla_gbrpvgrw.f | 0 .../lapack/native/zla_geamv.f | 0 .../lapack/native/zla_gercond_c.f | 0 .../lapack/native/zla_gercond_x.f | 0 .../lapack/native/zla_gerfsx_extended.f | 0 .../lapack/native/zla_gerpvgrw.f | 0 .../lapack/native/zla_heamv.f | 0 .../lapack/native/zla_hercond_c.f | 0 .../lapack/native/zla_hercond_x.f | 0 .../lapack/native/zla_herfsx_extended.f | 0 .../lapack/native/zla_herpvgrw.f | 0 .../lapack/native/zla_lin_berr.f | 0 .../lapack/native/zla_porcond_c.f | 0 .../lapack/native/zla_porcond_x.f | 0 .../lapack/native/zla_porfsx_extended.f | 0 .../lapack/native/zla_porpvgrw.f | 0 .../lapack/native/zla_syamv.f | 0 .../lapack/native/zla_syrcond_c.f | 0 .../lapack/native/zla_syrcond_x.f | 0 .../lapack/native/zla_syrfsx_extended.f | 0 .../lapack/native/zla_syrpvgrw.f | 0 .../lapack/native/zla_wwaddw.f | 0 .../lapack/native/zlabrd.f | 0 .../lapack/native/zlacgv.f | 0 .../lapack/native/zlacn2.f | 0 .../lapack/native/zlacon.f | 0 .../lapack/native/zlacp2.f | 0 .../lapack/native/zlacpy.f | 0 .../lapack/native/zlacrm.f | 0 .../lapack/native/zlacrt.f | 0 .../lapack/native/zladiv.f | 0 .../lapack/native/zlaed0.f | 0 .../lapack/native/zlaed7.f | 0 .../lapack/native/zlaed8.f | 0 .../lapack/native/zlaein.f | 0 .../lapack/native/zlaesy.f | 0 .../lapack/native/zlaev2.f | 0 .../lapack/native/zlag2c.f | 0 .../lapack/native/zlags2.f | 0 .../lapack/native/zlagtm.f | 0 .../lapack/native/zlahef.f | 0 .../lapack/native/zlahef_aa.f | 0 .../lapack/native/zlahef_rk.f | 0 .../lapack/native/zlahef_rook.f | 0 .../lapack/native/zlahqr.f | 0 .../lapack/native/zlahr2.f | 0 .../lapack/native/zlaic1.f | 0 .../lapack/native/zlals0.f | 0 .../lapack/native/zlalsa.f | 0 .../lapack/native/zlalsd.f | 0 .../lapack/native/zlamswlq.f | 0 .../lapack/native/zlamtsqr.f | 0 .../lapack/native/zlangb.f | 0 .../lapack/native/zlange.f | 0 .../lapack/native/zlangt.f | 0 .../lapack/native/zlanhb.f | 0 .../lapack/native/zlanhe.f | 0 .../lapack/native/zlanhf.f | 0 .../lapack/native/zlanhp.f | 0 .../lapack/native/zlanhs.f | 0 .../lapack/native/zlanht.f | 0 .../lapack/native/zlansb.f | 0 .../lapack/native/zlansp.f | 0 .../lapack/native/zlansy.f | 0 .../lapack/native/zlantb.f | 0 .../lapack/native/zlantp.f | 0 .../lapack/native/zlantr.f | 0 .../lapack/native/zlapll.f | 0 .../lapack/native/zlapmr.f | 0 .../lapack/native/zlapmt.f | 0 .../lapack/native/zlaqgb.f | 0 .../lapack/native/zlaqge.f | 0 .../lapack/native/zlaqhb.f | 0 .../lapack/native/zlaqhe.f | 0 .../lapack/native/zlaqhp.f | 0 .../lapack/native/zlaqp2.f | 0 .../lapack/native/zlaqp2rk.f | 0 .../lapack/native/zlaqp3rk.f | 0 .../lapack/native/zlaqps.f | 0 .../lapack/native/zlaqr0.f | 0 .../lapack/native/zlaqr1.f | 0 .../lapack/native/zlaqr2.f | 0 .../lapack/native/zlaqr3.f | 0 .../lapack/native/zlaqr4.f | 0 .../lapack/native/zlaqr5.f | 0 .../lapack/native/zlaqsb.f | 0 .../lapack/native/zlaqsp.f | 0 .../lapack/native/zlaqsy.f | 0 .../lapack/native/zlaqz0.f | 0 .../lapack/native/zlaqz1.f | 0 .../lapack/native/zlaqz2.f | 0 .../lapack/native/zlaqz3.f | 0 .../lapack/native/zlar1v.f | 0 .../lapack/native/zlar2v.f | 0 .../lapack/native/zlarcm.f | 0 .../lapack/native/zlarf.f | 0 .../lapack/native/zlarf1f.f | 0 .../lapack/native/zlarf1l.f | 0 .../lapack/native/zlarfb.f | 0 .../lapack/native/zlarfb_gett.f | 0 .../lapack/native/zlarfg.f | 0 .../lapack/native/zlarfgp.f | 0 .../lapack/native/zlarft.f | 0 .../lapack/native/zlarfx.f | 0 .../lapack/native/zlarfy.f | 0 .../lapack/native/zlargv.f | 0 .../lapack/native/zlarnv.f | 0 .../lapack/native/zlarrv.f | 0 .../lapack/native/zlarscl2.f | 0 .../lapack/native/zlartg.f90 | 0 .../lapack/native/zlartv.f | 0 .../lapack/native/zlarz.f | 0 .../lapack/native/zlarzb.f | 0 .../lapack/native/zlarzt.f | 0 .../lapack/native/zlascl.f | 0 .../lapack/native/zlascl2.f | 0 .../lapack/native/zlaset.f | 0 .../lapack/native/zlasr.f | 0 .../lapack/native/zlassq.f90 | 0 .../lapack/native/zlaswlq.f | 0 .../lapack/native/zlaswp.f | 0 .../lapack/native/zlasyf.f | 0 .../lapack/native/zlasyf_aa.f | 0 .../lapack/native/zlasyf_rk.f | 0 .../lapack/native/zlasyf_rook.f | 0 .../lapack/native/zlat2c.f | 0 .../lapack/native/zlatbs.f | 0 .../lapack/native/zlatdf.f | 0 .../lapack/native/zlatps.f | 0 .../lapack/native/zlatrd.f | 0 .../lapack/native/zlatrs.f | 0 .../lapack/native/zlatrs3.f | 0 .../lapack/native/zlatrz.f | 0 .../lapack/native/zlatsqr.f | 0 .../lapack/native/zlaunhr_col_getrfnp.f | 0 .../lapack/native/zlaunhr_col_getrfnp2.f | 0 .../lapack/native/zlauu2.f | 0 .../lapack/native/zlauum.f | 0 .../lapack/native/zpbcon.f | 0 .../lapack/native/zpbequ.f | 0 .../lapack/native/zpbrfs.f | 0 .../lapack/native/zpbstf.f | 0 .../lapack/native/zpbsv.f | 0 .../lapack/native/zpbsvx.f | 0 .../lapack/native/zpbtf2.f | 0 .../lapack/native/zpbtrf.f | 0 .../lapack/native/zpbtrs.f | 0 .../lapack/native/zpftrf.f | 0 .../lapack/native/zpftri.f | 0 .../lapack/native/zpftrs.f | 0 .../lapack/native/zpocon.f | 0 .../lapack/native/zpoequ.f | 0 .../lapack/native/zpoequb.f | 0 .../lapack/native/zporfs.f | 0 .../lapack/native/zporfsx.f | 0 .../lapack/native/zposv.f | 0 .../lapack/native/zposvx.f | 0 .../lapack/native/zposvxx.f | 0 .../lapack/native/zpotf2.f | 0 .../lapack/native/zpotrf.f | 0 .../lapack/native/zpotrf2.f | 0 .../lapack/native/zpotri.f | 0 .../lapack/native/zpotrs.f | 0 .../lapack/native/zppcon.f | 0 .../lapack/native/zppequ.f | 0 .../lapack/native/zpprfs.f | 0 .../lapack/native/zppsv.f | 0 .../lapack/native/zppsvx.f | 0 .../lapack/native/zpptrf.f | 0 .../lapack/native/zpptri.f | 0 .../lapack/native/zpptrs.f | 0 .../lapack/native/zpstf2.f | 0 .../lapack/native/zpstrf.f | 0 .../lapack/native/zptcon.f | 0 .../lapack/native/zpteqr.f | 0 .../lapack/native/zptrfs.f | 0 .../lapack/native/zptsv.f | 0 .../lapack/native/zptsvx.f | 0 .../lapack/native/zpttrf.f | 0 .../lapack/native/zpttrs.f | 0 .../lapack/native/zptts2.f | 0 .../lapack/native/zrot.f | 0 .../lapack/native/zrscl.f | 0 .../lapack/native/zspcon.f | 0 .../lapack/native/zspmv.f | 0 .../lapack/native/zspr.f | 0 .../lapack/native/zsprfs.f | 0 .../lapack/native/zspsv.f | 0 .../lapack/native/zspsvx.f | 0 .../lapack/native/zsptrf.f | 0 .../lapack/native/zsptri.f | 0 .../lapack/native/zsptrs.f | 0 .../lapack/native/zstedc.f | 0 .../lapack/native/zstegr.f | 0 .../lapack/native/zstein.f | 0 .../lapack/native/zstemr.f | 0 .../lapack/native/zsteqr.f | 0 .../lapack/native/zsycon.f | 0 .../lapack/native/zsycon_3.f | 0 .../lapack/native/zsycon_rook.f | 0 .../lapack/native/zsyconv.f | 0 .../lapack/native/zsyconvf.f | 0 .../lapack/native/zsyconvf_rook.f | 0 .../lapack/native/zsyequb.f | 0 .../lapack/native/zsymv.f | 0 .../lapack/native/zsyr.f | 0 .../lapack/native/zsyrfs.f | 0 .../lapack/native/zsyrfsx.f | 0 .../lapack/native/zsysv.f | 0 .../lapack/native/zsysv_aa.f | 0 .../lapack/native/zsysv_aa_2stage.f | 0 .../lapack/native/zsysv_rk.f | 0 .../lapack/native/zsysv_rook.f | 0 .../lapack/native/zsysvx.f | 0 .../lapack/native/zsysvxx.f | 0 .../lapack/native/zsyswapr.f | 0 .../lapack/native/zsytf2.f | 0 .../lapack/native/zsytf2_rk.f | 0 .../lapack/native/zsytf2_rook.f | 0 .../lapack/native/zsytrf.f | 0 .../lapack/native/zsytrf_aa.f | 0 .../lapack/native/zsytrf_aa_2stage.f | 0 .../lapack/native/zsytrf_rk.f | 0 .../lapack/native/zsytrf_rook.f | 0 .../lapack/native/zsytri.f | 0 .../lapack/native/zsytri2.f | 0 .../lapack/native/zsytri2x.f | 0 .../lapack/native/zsytri_3.f | 0 .../lapack/native/zsytri_3x.f | 0 .../lapack/native/zsytri_rook.f | 0 .../lapack/native/zsytrs.f | 0 .../lapack/native/zsytrs2.f | 0 .../lapack/native/zsytrs_3.f | 0 .../lapack/native/zsytrs_aa.f | 0 .../lapack/native/zsytrs_aa_2stage.f | 0 .../lapack/native/zsytrs_rook.f | 0 .../lapack/native/ztbcon.f | 0 .../lapack/native/ztbrfs.f | 0 .../lapack/native/ztbtrs.f | 0 .../lapack/native/ztfsm.f | 0 .../lapack/native/ztftri.f | 0 .../lapack/native/ztfttp.f | 0 .../lapack/native/ztfttr.f | 0 .../lapack/native/ztgevc.f | 0 .../lapack/native/ztgex2.f | 0 .../lapack/native/ztgexc.f | 0 .../lapack/native/ztgsen.f | 0 .../lapack/native/ztgsja.f | 0 .../lapack/native/ztgsna.f | 0 .../lapack/native/ztgsy2.f | 0 .../lapack/native/ztgsyl.f | 0 .../lapack/native/ztpcon.f | 0 .../lapack/native/ztplqt.f | 0 .../lapack/native/ztplqt2.f | 0 .../lapack/native/ztpmlqt.f | 0 .../lapack/native/ztpmqrt.f | 0 .../lapack/native/ztpqrt.f | 0 .../lapack/native/ztpqrt2.f | 0 .../lapack/native/ztprfb.f | 0 .../lapack/native/ztprfs.f | 0 .../lapack/native/ztptri.f | 0 .../lapack/native/ztptrs.f | 0 .../lapack/native/ztpttf.f | 0 .../lapack/native/ztpttr.f | 0 .../lapack/native/ztrcon.f | 0 .../lapack/native/ztrevc.f | 0 .../lapack/native/ztrevc3.f | 0 .../lapack/native/ztrexc.f | 0 .../lapack/native/ztrrfs.f | 0 .../lapack/native/ztrsen.f | 0 .../lapack/native/ztrsna.f | 0 .../lapack/native/ztrsyl.f | 0 .../lapack/native/ztrsyl3.f | 0 .../lapack/native/ztrti2.f | 0 .../lapack/native/ztrtri.f | 0 .../lapack/native/ztrtrs.f | 0 .../lapack/native/ztrttf.f | 0 .../lapack/native/ztrttp.f | 0 .../lapack/native/ztzrzf.f | 0 .../lapack/native/zunbdb.f | 0 .../lapack/native/zunbdb1.f | 0 .../lapack/native/zunbdb2.f | 0 .../lapack/native/zunbdb3.f | 0 .../lapack/native/zunbdb4.f | 0 .../lapack/native/zunbdb5.f | 0 .../lapack/native/zunbdb6.f | 0 .../lapack/native/zuncsd.f | 0 .../lapack/native/zuncsd2by1.f | 0 .../lapack/native/zung2l.f | 0 .../lapack/native/zung2r.f | 0 .../lapack/native/zungbr.f | 0 .../lapack/native/zunghr.f | 0 .../lapack/native/zungl2.f | 0 .../lapack/native/zunglq.f | 0 .../lapack/native/zungql.f | 0 .../lapack/native/zungqr.f | 0 .../lapack/native/zungr2.f | 0 .../lapack/native/zungrq.f | 0 .../lapack/native/zungtr.f | 0 .../lapack/native/zungtsqr.f | 0 .../lapack/native/zungtsqr_row.f | 0 .../lapack/native/zunhr_col.f | 0 .../lapack/native/zunm22.f | 0 .../lapack/native/zunm2l.f | 0 .../lapack/native/zunm2r.f | 0 .../lapack/native/zunmbr.f | 0 .../lapack/native/zunmhr.f | 0 .../lapack/native/zunml2.f | 0 .../lapack/native/zunmlq.f | 0 .../lapack/native/zunmql.f | 0 .../lapack/native/zunmqr.f | 0 .../lapack/native/zunmr2.f | 0 .../lapack/native/zunmr3.f | 0 .../lapack/native/zunmrq.f | 0 .../lapack/native/zunmrz.f | 0 .../lapack/native/zunmtr.f | 0 .../lapack/native/zupgtr.f | 0 .../lapack/native/zupmtr.f | 0 examples/lapack/routine_inventory.py | 505 +++++++++++++++ examples/lapack/test_auxiliary.py | 143 +++++ examples/lapack/test_eigen_generalized.py | 477 ++++++++++++++ examples/lapack/test_eigen_nonsymmetric.py | 249 ++++++++ examples/lapack/test_eigen_symmetric.py | 582 ++++++++++++++++++ examples/lapack/test_least_squares.py | 166 +++++ .../lapack/test_linear_banded_tridiagonal.py | 459 ++++++++++++++ examples/lapack/test_linear_general.py | 286 +++++++++ .../lapack/test_linear_positive_definite.py | 358 +++++++++++ .../test_linear_symmetric_indefinite.py | 224 +++++++ examples/lapack/test_linear_triangular.py | 188 ++++++ .../lapack/test_orthogonal_factorizations.py | 281 +++++++++ examples/lapack/test_routine_coverage.py | 182 ++++++ examples/lapack/test_svd.py | 246 ++++++++ tests/README.md | 7 +- .../fortran/test_language_ownership.py | 10 +- tests/fortran/README.md | 5 +- .../real_libraries/test_full_libraries.py | 14 +- .../architecture/test_test_suite_layout.py | 3 + tests/shared/docs/test_examples.py | 1 + 2096 files changed, 5244 insertions(+), 34 deletions(-) create mode 100644 examples/lapack/README.md create mode 100644 examples/lapack/__init__.py create mode 100644 examples/lapack/conftest.py create mode 100644 examples/lapack/helpers.py rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cbbcsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cbdsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbbrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbrfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbsvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbtf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbtrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgebak.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgebal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgebd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgebrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgecon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgedmd.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgedmdq.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgees.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeesx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgehd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgehrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgejsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgelq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgelq2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgelqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgelqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgelqt3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgels.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgelsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgelss.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgelst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgelsy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgemlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgemlqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgemqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgemqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeql2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeqlf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeqp3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeqp3rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeqr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeqr2p.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeqrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeqrfp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeqrt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgeqrt3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgerfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgerfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgerq2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgerqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgesc2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgesdd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgesv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgesvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgesvdq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgesvdx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgesvj.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgesvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgesvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgetc2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgetf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgetrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgetrf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgetri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgetrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgetsls.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgetsqrhrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cggbak.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cggbal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgges.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgges3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cggesx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cggev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cggev3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cggevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cggglm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgghd3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgghrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgglse.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cggqrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cggrqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cggsvd3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cggsvp3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgsvj0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgsvj1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgtcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgtrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgtsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgtsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgttrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgttrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cgtts2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chb2st_kernels.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chbev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chbev_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chbevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chbevd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chbevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chbevx_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chbgst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chbgv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chbgvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chbgvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chbtrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/checon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/checon_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/checon_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cheequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cheev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cheev_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cheevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cheevd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cheevr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cheevr_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cheevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cheevx_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chegs2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chegst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chegv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chegv_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chegvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chegvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cherfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cherfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chesv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chesv_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chesv_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chesv_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chesv_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chesvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chesvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cheswapr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetf2_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetf2_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrd_hb2st.F (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrd_he2hb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrf_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrf_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrf_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetri2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetri2x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetri_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetri_3x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetri_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrs2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrs_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrs_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrs_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chetrs_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chfrk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chgeqz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chla_transtype.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chpcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chpev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chpevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chpevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chpgst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chpgv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chpgvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chpgvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chpsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chpsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chptrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chptrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chsein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/chseqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_gbamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_gbrcond_c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_gbrcond_x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_gbrfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_gbrpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_geamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_gercond_c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_gercond_x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_gerfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_gerpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_heamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_hercond_c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_hercond_x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_herfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_herpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_lin_berr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_porcond_c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_porcond_x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_porfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_porpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_syamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_syrcond_c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_syrcond_x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_syrfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_syrpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cla_wwaddw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clabrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clacgv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clacn2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clacon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clacp2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clacpy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clacrm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clacrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cladiv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claed0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claed7.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claed8.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claesy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claev2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clag2z.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clags2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clagtm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clahef.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clahef_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clahef_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clahef_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clahqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clahr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claic1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clals0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clalsa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clalsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clamswlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clamtsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clangb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clange.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clangt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clanhb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clanhe.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clanhf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clanhp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clanhs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clanht.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clansb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clansp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clansy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clantb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clantp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clantr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clapll.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clapmr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clapmt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqgb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqge.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqhb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqhe.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqhp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqp2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqp2rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqp3rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqps.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqr0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqr1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqr3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqr4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqr5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqsb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqsp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqsy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqz0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqz1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqz2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claqz3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clar1v.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clar2v.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarcm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarf1f.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarf1l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarfb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarfb_gett.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarfg.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarfgp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarft.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarfx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarfy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clargv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarnv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarrv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarscl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clartg.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clartv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarzb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clarzt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clascl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clascl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claset.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clasr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/classq.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claswlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claswp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clasyf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clasyf_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clasyf_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clasyf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clatbs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clatdf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clatps.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clatrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clatrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clatrs3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clatrz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clatsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claunhr_col_getrfnp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/claunhr_col_getrfnp2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clauu2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/clauum.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpbequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpbstf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpbsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpbtf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpbtrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpftrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpftri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpftrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpocon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpoequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpoequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cporfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cporfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cposv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cposvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cposvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpotf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpotrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpotrf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpotri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpotrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cppcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cppequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cppsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cppsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpptrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpstf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpstrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cptcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpteqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cptrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cptsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cptsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpttrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cpttrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cptts2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/crot.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/crscl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cspcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cspmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cspr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cspsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cspsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csptrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csrscl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cstedc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cstegr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cstein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cstemr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csteqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csycon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csycon_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csycon_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csyconv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csyconvf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csyconvf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csyequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csymv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csyr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csyrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csyrfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csysv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csysv_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csysv_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csysv_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csysv_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csysvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csysvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csyswapr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytf2_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytf2_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytrf_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytrf_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytrf_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytrf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytri2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytri2x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytri_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytri_3x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytri_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytrs2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytrs_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytrs_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytrs_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/csytrs_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctfsm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctftri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctfttp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctfttr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctgevc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctgex2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctgexc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctgsen.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctgsja.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctgsna.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctgsy2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctgsyl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctpcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctplqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctplqt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctpmlqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctpmqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctpqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctpqrt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctprfb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctpttf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctpttr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrevc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrevc3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrexc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrsen.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrsna.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrsyl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrsyl3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrti2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrtri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrttf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctrttp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ctzrzf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunbdb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunbdb1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunbdb2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunbdb3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunbdb4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunbdb5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunbdb6.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cuncsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cuncsd2by1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cung2l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cung2r.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cungbr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunghr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cungl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunglq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cungql.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cungqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cungr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cungrq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cungtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cungtsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cungtsqr_row.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunhr_col.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunm22.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunm2l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunm2r.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunmbr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunmhr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunml2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunmlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunmql.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunmqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunmr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunmr3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunmrq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunmrz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cunmtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cupgtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/cupmtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dbbcsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dbdsdc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dbdsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dbdsvdx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ddisna.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbbrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbrfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbsvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbtf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbtrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgebak.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgebal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgebd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgebrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgecon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgedmd.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgedmdq.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgees.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeesx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgehd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgehrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgejsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgelq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgelq2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgelqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgelqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgelqt3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgels.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgelsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgelss.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgelst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgelsy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgemlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgemlqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgemqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgemqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeql2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeqlf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeqp3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeqp3rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeqr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeqr2p.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeqrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeqrfp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeqrt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgeqrt3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgerfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgerfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgerq2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgerqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgesc2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgesdd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgesv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgesvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgesvdq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgesvdx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgesvj.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgesvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgesvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgetc2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgetf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgetrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgetrf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgetri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgetrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgetsls.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgetsqrhrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dggbak.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dggbal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgges.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgges3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dggesx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dggev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dggev3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dggevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dggglm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgghd3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgghrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgglse.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dggqrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dggrqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dggsvd3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dggsvp3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgsvj0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgsvj1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgtcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgtrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgtsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgtsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgttrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgttrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dgtts2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dhgeqz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dhsein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dhseqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/disnan.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_gbamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_gbrcond.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_gbrfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_gbrpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_geamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_gercond.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_gerfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_gerpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_lin_berr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_porcond.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_porfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_porpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_syamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_syrcond.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_syrfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_syrpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dla_wwaddw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlabad.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlabrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlacn2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlacon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlacpy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dladiv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlae2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaebz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaed0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaed1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaed2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaed3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaed4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaed5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaed6.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaed7.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaed8.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaed9.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaeda.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaev2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaexc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlag2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlag2s.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlags2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlagtf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlagtm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlagts.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlagv2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlahqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlahr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaic1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaisnan.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaln2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlals0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlalsa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlalsd.f (100%) create mode 100644 examples/lapack/native/dlamch.f rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlamrg.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlamswlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlamtsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaneg.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlangb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlange.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlangt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlanhs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlansb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlansf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlansp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlanst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlansy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlantb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlantp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlantr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlanv2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaorhr_col_getrfnp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaorhr_col_getrfnp2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlapll.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlapmr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlapmt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlapy2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlapy3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqgb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqge.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqp2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqp2rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqp3rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqps.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqr0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqr1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqr3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqr4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqr5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqsb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqsp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqsy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqz0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqz1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqz2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqz3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaqz4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlar1v.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlar2v.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarf1f.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarf1l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarfb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarfb_gett.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarfg.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarfgp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarft.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarfx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarfy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlargv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarmm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarnv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarra.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarrb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarrc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarre.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarrj.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarrk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarrr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarrv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarscl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlartg.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlartgp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlartgs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlartv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaruv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarzb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlarzt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlas2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlascl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlascl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasd0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasd1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasd3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasd4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasd5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasd6.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasd7.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasd8.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasda.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasdq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasdt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaset.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasq1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasq2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasq3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasq4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasq5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasq6.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlassq.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasv2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaswlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlaswp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasy2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasyf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasyf_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasyf_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlasyf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlat2s.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlatbs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlatdf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlatps.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlatrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlatrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlatrs3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlatrz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlatsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlauu2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dlauum.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dopgtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dopmtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorbdb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorbdb1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorbdb2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorbdb3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorbdb4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorbdb5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorbdb6.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorcsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorcsd2by1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorg2l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorg2r.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorgbr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorghr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorgl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorglq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorgql.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorgqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorgr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorgrq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorgtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorgtsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorgtsqr_row.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorhr_col.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorm22.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorm2l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorm2r.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dormbr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dormhr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dorml2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dormlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dormql.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dormqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dormr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dormr3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dormrq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dormrz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dormtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpbequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpbstf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpbsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpbtf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpbtrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpftrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpftri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpftrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpocon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpoequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpoequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dporfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dporfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dposv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dposvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dposvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpotf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpotrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpotrf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpotri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpotrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dppcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dppequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dppsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dppsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpptrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpstf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpstrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dptcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpteqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dptrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dptsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dptsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpttrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dpttrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dptts2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/drscl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsb2st_kernels.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsbev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsbev_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsbevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsbevd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsbevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsbevx_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsbgst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsbgv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsbgvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsbgvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsbtrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsfrk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsgesv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dspcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dspev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dspevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dspevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dspgst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dspgv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dspgvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dspgvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsposv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dspsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dspsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsptrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsptrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dstebz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dstedc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dstegr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dstein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dstemr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsteqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsterf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dstev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dstevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dstevr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dstevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsycon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsycon_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsycon_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyconv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyconvf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyconvf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyev_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyevd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyevr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyevr_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyevx_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsygs2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsygst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsygv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsygv_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsygvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsygvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyrfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsysv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsysv_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsysv_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsysv_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsysv_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsysvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsysvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsyswapr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytf2_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytf2_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrd_sb2st.F (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrd_sy2sb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrf_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrf_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrf_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytri2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytri2x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytri_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytri_3x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytri_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrs2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrs_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrs_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrs_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dsytrs_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtfsm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtftri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtfttp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtfttr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtgevc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtgex2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtgexc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtgsen.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtgsja.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtgsna.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtgsy2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtgsyl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtpcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtplqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtplqt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtpmlqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtpmqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtpqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtpqrt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtprfb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtpttf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtpttr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrevc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrevc3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrexc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrsen.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrsna.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrsyl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrsyl3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrti2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrtri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrttf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtrttp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dtzrzf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/dzsum1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/icmax1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ieeeck.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ilaclc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ilaclr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/iladiag.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/iladlc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/iladlr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ilaenv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ilaenv2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ilaprec.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ilaslc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ilaslr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ilatrans.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ilauplo.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ilazlc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ilazlr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/iparam2stage.F (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/iparmq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/izmax1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/la_constants.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/la_xisnan.F90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/lsamen.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sbbcsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sbdsdc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sbdsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sbdsvdx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/scsum1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sdisna.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbbrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbrfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbsvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbtf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbtrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgebak.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgebal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgebd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgebrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgecon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgedmd.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgedmdq.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgees.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeesx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgehd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgehrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgejsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgelq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgelq2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgelqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgelqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgelqt3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgels.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgelsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgelss.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgelst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgelsy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgemlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgemlqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgemqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgemqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeql2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeqlf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeqp3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeqp3rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeqr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeqr2p.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeqrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeqrfp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeqrt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgeqrt3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgerfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgerfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgerq2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgerqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgesc2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgesdd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgesv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgesvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgesvdq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgesvdx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgesvj.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgesvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgesvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgetc2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgetf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgetrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgetrf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgetri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgetrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgetsls.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgetsqrhrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sggbak.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sggbal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgges.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgges3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sggesx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sggev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sggev3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sggevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sggglm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgghd3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgghrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgglse.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sggqrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sggrqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sggsvd3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sggsvp3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgsvj0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgsvj1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgtcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgtrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgtsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgtsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgttrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgttrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sgtts2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/shgeqz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/shsein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/shseqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sisnan.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_gbamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_gbrcond.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_gbrfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_gbrpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_geamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_gercond.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_gerfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_gerpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_lin_berr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_porcond.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_porfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_porpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_syamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_syrcond.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_syrfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_syrpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sla_wwaddw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slabad.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slabrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slacn2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slacon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slacpy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sladiv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slae2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaebz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaed0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaed1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaed2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaed3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaed4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaed5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaed6.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaed7.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaed8.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaed9.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaeda.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaev2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaexc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slag2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slag2d.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slags2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slagtf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slagtm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slagts.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slagv2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slahqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slahr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaic1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaisnan.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaln2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slals0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slalsa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slalsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slamrg.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slamswlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slamtsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaneg.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slangb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slange.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slangt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slanhs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slansb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slansf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slansp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slanst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slansy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slantb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slantp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slantr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slanv2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaorhr_col_getrfnp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaorhr_col_getrfnp2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slapll.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slapmr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slapmt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slapy2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slapy3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqgb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqge.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqp2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqp2rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqp3rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqps.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqr0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqr1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqr3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqr4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqr5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqsb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqsp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqsy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqz0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqz1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqz2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqz3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaqz4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slar1v.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slar2v.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarf1f.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarf1l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarfb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarfb_gett.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarfg.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarfgp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarft.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarfx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarfy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slargv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarmm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarnv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarra.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarrb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarrc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarre.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarrj.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarrk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarrr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarrv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarscl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slartg.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slartgp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slartgs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slartv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaruv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarzb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slarzt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slas2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slascl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slascl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasd0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasd1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasd3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasd4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasd5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasd6.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasd7.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasd8.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasda.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasdq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasdt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaset.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasq1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasq2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasq3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasq4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasq5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasq6.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slassq.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasv2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaswlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slaswp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasy2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasyf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasyf_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasyf_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slasyf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slatbs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slatdf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slatps.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slatrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slatrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slatrs3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slatrz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slatsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slauu2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/slauum.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sopgtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sopmtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorbdb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorbdb1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorbdb2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorbdb3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorbdb4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorbdb5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorbdb6.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorcsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorcsd2by1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorg2l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorg2r.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorgbr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorghr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorgl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorglq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorgql.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorgqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorgr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorgrq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorgtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorgtsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorgtsqr_row.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorhr_col.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorm22.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorm2l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorm2r.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sormbr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sormhr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sorml2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sormlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sormql.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sormqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sormr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sormr3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sormrq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sormrz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sormtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spbequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spbstf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spbsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spbtf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spbtrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spftrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spftri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spftrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spocon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spoequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spoequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sporfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sporfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sposv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sposvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sposvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spotf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spotrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spotrf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spotri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spotrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sppcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sppequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sppsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sppsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spptrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spstf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spstrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sptcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spteqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sptrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sptsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sptsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spttrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/spttrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sptts2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/srscl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssb2st_kernels.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssbev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssbev_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssbevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssbevd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssbevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssbevx_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssbgst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssbgv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssbgvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssbgvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssbtrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssfrk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sspcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sspev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sspevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sspevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sspgst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sspgv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sspgvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sspgvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sspsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sspsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssptrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssptrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sstebz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sstedc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sstegr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sstein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sstemr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssteqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssterf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sstev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sstevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sstevr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/sstevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssycon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssycon_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssycon_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyconv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyconvf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyconvf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyev_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyevd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyevr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyevr_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyevx_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssygs2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssygst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssygv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssygv_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssygvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssygvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyrfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssysv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssysv_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssysv_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssysv_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssysv_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssysvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssysvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssyswapr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytf2_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytf2_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrd_sb2st.F (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrd_sy2sb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrf_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrf_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrf_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytri2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytri2x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytri_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytri_3x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytri_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrs2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrs_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrs_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrs_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ssytrs_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stfsm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stftri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stfttp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stfttr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stgevc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stgex2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stgexc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stgsen.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stgsja.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stgsna.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stgsy2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stgsyl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stpcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stplqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stplqt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stpmlqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stpmqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stpqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stpqrt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stprfb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stpttf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stpttr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strevc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strevc3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strexc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strsen.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strsna.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strsyl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strsyl3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strti2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strtri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strttf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/strttp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/stzrzf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/xerbla.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/xerbla_array.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zbbcsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zbdsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zcgesv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zcposv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zdrscl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbbrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbrfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbsvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbtf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbtrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgebak.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgebal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgebd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgebrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgecon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgedmd.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgedmdq.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgees.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeesx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgehd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgehrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgejsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgelq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgelq2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgelqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgelqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgelqt3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgels.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgelsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgelss.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgelst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgelsy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgemlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgemlqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgemqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgemqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeql2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeqlf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeqp3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeqp3rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeqr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeqr2p.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeqrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeqrfp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeqrt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgeqrt3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgerfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgerfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgerq2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgerqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgesc2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgesdd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgesv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgesvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgesvdq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgesvdx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgesvj.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgesvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgesvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgetc2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgetf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgetrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgetrf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgetri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgetrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgetsls.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgetsqrhrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zggbak.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zggbal.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgges.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgges3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zggesx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zggev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zggev3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zggevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zggglm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgghd3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgghrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgglse.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zggqrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zggrqf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zggsvd3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zggsvp3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgsvj0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgsvj1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgtcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgtrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgtsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgtsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgttrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgttrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zgtts2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhb2st_kernels.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhbev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhbev_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhbevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhbevd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhbevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhbevx_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhbgst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhbgv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhbgvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhbgvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhbtrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhecon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhecon_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhecon_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zheequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zheev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zheev_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zheevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zheevd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zheevr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zheevr_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zheevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zheevx_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhegs2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhegst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhegv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhegv_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhegvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhegvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zherfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zherfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhesv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhesv_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhesv_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhesv_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhesv_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhesvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhesvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zheswapr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetd2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetf2_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetf2_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrd_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrd_hb2st.F (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrd_he2hb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrf_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrf_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrf_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetri2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetri2x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetri_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetri_3x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetri_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrs2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrs_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrs_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrs_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhetrs_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhfrk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhgeqz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhpcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhpev.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhpevd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhpevx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhpgst.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhpgv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhpgvd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhpgvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhpsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhpsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhptrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhptrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhsein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zhseqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_gbamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_gbrcond_c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_gbrcond_x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_gbrfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_gbrpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_geamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_gercond_c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_gercond_x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_gerfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_gerpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_heamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_hercond_c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_hercond_x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_herfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_herpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_lin_berr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_porcond_c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_porcond_x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_porfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_porpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_syamv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_syrcond_c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_syrcond_x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_syrfsx_extended.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_syrpvgrw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zla_wwaddw.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlabrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlacgv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlacn2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlacon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlacp2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlacpy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlacrm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlacrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zladiv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaed0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaed7.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaed8.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaesy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaev2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlag2c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlags2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlagtm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlahef.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlahef_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlahef_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlahef_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlahqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlahr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaic1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlals0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlalsa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlalsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlamswlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlamtsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlangb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlange.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlangt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlanhb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlanhe.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlanhf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlanhp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlanhs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlanht.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlansb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlansp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlansy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlantb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlantp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlantr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlapll.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlapmr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlapmt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqgb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqge.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqhb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqhe.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqhp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqp2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqp2rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqp3rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqps.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqr0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqr1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqr3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqr4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqr5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqsb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqsp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqsy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqz0.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqz1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqz2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaqz3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlar1v.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlar2v.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarcm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarf1f.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarf1l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarfb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarfb_gett.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarfg.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarfgp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarft.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarfx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarfy.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlargv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarnv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarrv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarscl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlartg.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlartv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarzb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlarzt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlascl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlascl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaset.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlasr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlassq.f90 (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaswlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaswp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlasyf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlasyf_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlasyf_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlasyf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlat2c.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlatbs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlatdf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlatps.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlatrd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlatrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlatrs3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlatrz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlatsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaunhr_col_getrfnp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlaunhr_col_getrfnp2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlauu2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zlauum.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpbequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpbstf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpbsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpbsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpbtf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpbtrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpftrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpftri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpftrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpocon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpoequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpoequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zporfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zporfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zposv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zposvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zposvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpotf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpotrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpotrf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpotri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpotrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zppcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zppequ.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zppsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zppsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpptrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpstf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpstrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zptcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpteqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zptrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zptsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zptsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpttrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zpttrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zptts2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zrot.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zrscl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zspcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zspmv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zspr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zspsv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zspsvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsptrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zstedc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zstegr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zstein.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zstemr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsteqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsycon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsycon_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsycon_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsyconv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsyconvf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsyconvf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsyequb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsymv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsyr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsyrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsyrfsx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsysv.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsysv_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsysv_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsysv_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsysv_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsysvx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsysvxx.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsyswapr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytf2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytf2_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytf2_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytrf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytrf_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytrf_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytrf_rk.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytrf_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytri2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytri2x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytri_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytri_3x.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytri_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytrs2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytrs_3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytrs_aa.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytrs_aa_2stage.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zsytrs_rook.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztbcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztbrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztbtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztfsm.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztftri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztfttp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztfttr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztgevc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztgex2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztgexc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztgsen.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztgsja.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztgsna.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztgsy2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztgsyl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztpcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztplqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztplqt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztpmlqt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztpmqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztpqrt.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztpqrt2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztprfb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztprfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztptri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztptrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztpttf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztpttr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrcon.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrevc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrevc3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrexc.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrrfs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrsen.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrsna.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrsyl.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrsyl3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrti2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrtri.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrtrs.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrttf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztrttp.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/ztzrzf.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunbdb.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunbdb1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunbdb2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunbdb3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunbdb4.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunbdb5.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunbdb6.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zuncsd.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zuncsd2by1.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zung2l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zung2r.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zungbr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunghr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zungl2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunglq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zungql.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zungqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zungr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zungrq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zungtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zungtsqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zungtsqr_row.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunhr_col.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunm22.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunm2l.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunm2r.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunmbr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunmhr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunml2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunmlq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunmql.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunmqr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunmr2.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunmr3.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunmrq.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunmrz.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zunmtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zupgtr.f (100%) rename {tests/fortran/building_shared_library/end_to_end/real_libraries => examples}/lapack/native/zupmtr.f (100%) create mode 100644 examples/lapack/routine_inventory.py create mode 100644 examples/lapack/test_auxiliary.py create mode 100644 examples/lapack/test_eigen_generalized.py create mode 100644 examples/lapack/test_eigen_nonsymmetric.py create mode 100644 examples/lapack/test_eigen_symmetric.py create mode 100644 examples/lapack/test_least_squares.py create mode 100644 examples/lapack/test_linear_banded_tridiagonal.py create mode 100644 examples/lapack/test_linear_general.py create mode 100644 examples/lapack/test_linear_positive_definite.py create mode 100644 examples/lapack/test_linear_symmetric_indefinite.py create mode 100644 examples/lapack/test_linear_triangular.py create mode 100644 examples/lapack/test_orthogonal_factorizations.py create mode 100644 examples/lapack/test_routine_coverage.py create mode 100644 examples/lapack/test_svd.py diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index 6f0dca02f..ddc7a8ca5 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -38,6 +38,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install -e ".[qa]" + python -m pip install "scipy==1.18.0" - name: Install pinned GFortran shell: bash run: | @@ -54,12 +55,40 @@ jobs: uses: actions/cache@v4 with: path: ${{ runner.temp }}/prik-real-library-native - key: real-libraries-${{ runner.os }}-gfortran13-${{ hashFiles('examples/blas/native/**', 'tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/**') }} + key: real-libraries-${{ runner.os }}-gfortran13-${{ hashFiles('examples/blas/native/**', 'examples/lapack/native/**') }} - name: Run complete BLAS correctness example env: PYTHONPATH: . HYPOTHESIS_PROFILE: ci run: python -m pytest -q examples/blas + - name: Report reviewed LAPACK inventory + env: + PYTHONPATH: . + run: | + python - <<'PY' + from examples.lapack.routine_inventory import ( + EXPECTED_LAPACK_ROOT_PROCEDURES, + EXPECTED_LAPACK_SOURCE_FILES, + F2PY_NUMERICAL_LIMITATIONS, + ROUTINE_GROUPS, + ROUTINES, + SCIPY_VERSION, + ) + + print(f"SciPy version: {SCIPY_VERSION}") + print(f"LAPACK implementation sources: {EXPECTED_LAPACK_SOURCE_FILES}") + print(f"Expected PRIK root procedures: {EXPECTED_LAPACK_ROOT_PROCEDURES}") + print(f"Selected float64 correctness routines: {len(ROUTINES)}") + print(f"Raw-f2py numerical limitations: {len(F2PY_NUMERICAL_LIMITATIONS)}") + for family, routines in ROUTINE_GROUPS.items(): + print(f" {family}: {len(routines)}") + PY + - name: Run SciPy-exposed LAPACK correctness example + env: + PYTHONPATH: . + HYPOTHESIS_PROFILE: ci + PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native + run: python -m pytest -q examples/lapack - name: Run full BLAS and LAPACK wrapper tests env: PYTHONPATH: . diff --git a/CHANGELOG.md b/CHANGELOG.md index a84ea377a..aced7b703 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,13 @@ release tags add a leading `v` to the package version. - Moved the repository's authoritative Reference BLAS sources to `examples/blas/native/` for shared use by the example, integration tests, LAPACK CI build, and build comparison tooling. +- Added a complete Reference LAPACK build and correctness project. It wraps all + 2,062 implementation sources once and explicitly validates the reviewed 127 + SciPy 1.18.0 double-precision real routines against independent mathematical + invariants and f2py comparisons in the dedicated CI lane. +- Moved the repository's authoritative Reference LAPACK implementation sources + to `examples/lapack/native/` and updated full-library integration and CI to + consume that single source owner alongside `examples/blas/native/`. - Fixed dependency-safe Python argument conversion ordering for wrappers whose array extents depend on later native scalar arguments, including padded BLAS leading dimensions. diff --git a/README.md b/README.md index 1343e5572..b94e3a9d4 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,10 @@ the user guide, examples, and reference material. For a complete real-library example, see the [155-routine BLAS correctness project](examples/blas/README.md), which builds the same Reference BLAS sources with PRIK and f2py and checks both against -independent numerical expectations. +independent numerical expectations. The +[LAPACK correctness project](examples/lapack/README.md) wraps the complete +Reference LAPACK implementation corpus once and validates the reviewed 127 +SciPy-backed double-precision routines in the dedicated CI lane. The complete example below builds with one command: diff --git a/docs/developer/repository-structure.md b/docs/developer/repository-structure.md index c3933b342..9bd8f1cdc 100644 --- a/docs/developer/repository-structure.md +++ b/docs/developer/repository-structure.md @@ -30,6 +30,7 @@ artifacts used by tests. Navigate by ownership boundary first, then by file. | `prik/naming/` | Unified public-name and generated-symbol policy. | | `prik/utilities/` | Small shared Python utilities. | | `examples/blas/` | Complete runnable Reference BLAS correctness project and the repository's single authoritative full BLAS source set under `native/`. | +| `examples/lapack/` | Complete Reference LAPACK build and SciPy-backed float64 correctness project, with the repository's single authoritative LAPACK implementation source set under `native/`. | | `benchmarks/` | Local prik/f2py correctness and performance comparison harness. Benchmark sources and scripts are maintained; native builds and result files are generated locally. | | `tools/generate_performance_docs.py` | Validates paired runtime and clean-build `pyperf` results and generates the bounded public Performance snapshot and both charts. | @@ -56,6 +57,7 @@ through `prik/__init__.py`. | `tests/c/` | C input-language parsing, preprocessing, probe, semantic, CLI, and fixture evidence. | | `tests/shared/` | Language-neutral product architecture, documentation, naming, tools, type mapping, and utility checks. | | `examples/blas/test_*.py` | Dedicated real-library correctness documentation: explicit independent and PRIK/f2py differential validation for every Reference BLAS routine. | +| `examples/lapack/test_*.py` | CI-only real-library correctness documentation: explicit independent and PRIK/SciPy/f2py validation for the reviewed double-precision routine inventory. | | Use inspection APIs from Python | [Use Python inspection APIs](recipes/use-python-inspection-apis.md) | | Pass compiler and preprocessing options | [Use compiler preprocessing options](recipes/compiler-preprocessing.md) | | Build and validate the complete Reference BLAS | [BLAS wrapper](blas-wrapper.md) | +| Build complete Reference LAPACK and validate the SciPy-backed float64 surface | [LAPACK wrapper](lapack-wrapper.md) | ## Planned Project Examples -- [LAPACK wrapper](lapack-wrapper.md) - [ODE solver](ode-solver.md) - [CFD mini-example](cfd-mini-example.md) - [Object-oriented Fortran example](object-oriented-fortran.md) diff --git a/docs/user/examples/lapack-wrapper.md b/docs/user/examples/lapack-wrapper.md index 66c76fe6e..2cfbcef10 100644 --- a/docs/user/examples/lapack-wrapper.md +++ b/docs/user/examples/lapack-wrapper.md @@ -3,15 +3,28 @@ title: LAPACK Wrapper Example audience: users, advanced users prerequisites: arrays, BLAS wrapper example related: blas-wrapper.md, ../guide/error-handling.md -status: planned-documentation +status: maintained publication: draft --- # LAPACK Wrapper Example -Reserved runnable example for a LAPACK-style solver API. +The runnable example in [`examples/lapack/`](../../../examples/lapack/) builds +the complete Reference LAPACK source corpus once through PRIK, then validates +the 127 callable double-precision routines exposed by SciPy 1.18.0. The full +wrapper is available, but the correctness inventory is intentionally limited +to SciPy's `d*` API and excludes the `_lwork` convenience helpers. -## TODO +Run it with: -- TODO: Add a compact LAPACK-style example with status/info handling. -- TODO: Document workspace, shape, dtype, and failure contracts. +```console +python3 -m pytest -q examples/lapack +python3 -m pytest -q examples/lapack/test_linear_general.py::test_dgesv_solves_general_system +``` + +Each test compares PRIK with an independent numerical calculation and with +SciPy. The complete native source set is owned by `examples/lapack/native/`; +BLAS dependencies remain owned by `examples/blas/native/`. Native compiler +output is kept in pytest temporary/cache directories. Repository policy leaves +these LAPACK runtime commands to the dedicated GitHub Actions lane unless a +maintainer explicitly requests a local run. diff --git a/examples/lapack/README.md b/examples/lapack/README.md new file mode 100644 index 000000000..10a380518 --- /dev/null +++ b/examples/lapack/README.md @@ -0,0 +1,406 @@ +# LAPACK correctness example + +This maintained example wraps and compiles the complete Reference LAPACK +implementation corpus once, then validates the reviewed SciPy-backed +double-precision real surface. The two scopes are deliberately different: + +- compilation covers 2,062 LAPACK implementation sources and the required + authoritative BLAS sources; +- correctness covers the 127 native `d*` routines exposed by + `scipy.linalg.lapack` in pinned SciPy 1.18.0 for `dtype=np.float64`. + +SciPy selects eligibility. Standard LAPACK problem families determine the test +layout. PRIK support is not a selection condition: a missing PRIK export fails +the coverage audit instead of shrinking the inventory. + +## Source ownership, provenance, and license + +`examples/lapack/native/` is the repository's only owner of the Reference +LAPACK implementation sources. It contains library implementation routines and +the `la_constants`/`la_xisnan` modules required by the build; it excludes the +upstream testing programs, timing programs, examples, and matrix generators. +The corpus was originally imported from the Netlib Reference LAPACK distribution +and is covered by the LAPACK three-clause BSD-style license. See the +[Reference LAPACK site](https://www.netlib.org/lapack/) and +[license](https://www.netlib.org/lapack/LICENSE.txt). + +BLAS remains separately owned by `examples/blas/native/`. The complete LAPACK +native artifact consumes that source set directly, excluding any BLAS routine +stem already supplied by LAPACK. No BLAS source is copied below this directory. + +## Build topology + +The session fixture reuses the established complete-library integration path in +`tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py`. +It performs these operations once: + +1. generate one semantic package for all LAPACK sources; +2. compile all 2,062 LAPACK sources plus required BLAS dependencies into one + cached shared library; +3. build one PRIK extension from the complete generated contract and shared + library; +4. build one raw f2py comparison surface for the reviewed 127 routines, linked + to that same complete native library; and +5. reuse the three imported comparison surfaces for every correctness file. + +The contract-generation command is: + +```console +python3 -m prik generate --pyi examples/lapack/native --language fortran --out /tmp/prik-lapack/contracts/lapack +``` + +The extension build is performed by `build_pyi_extension` with the complete +contract, the cached `libprik_full_lapack.so`, and `-O0` wrapper flags. The raw +f2py command assembled by `conftest.py` is equivalent to: + +```console +python3 -m numpy.f2py -c -m f2py_reference_lapack_example \ + \ + \ + --build-dir /tmp/prik-lapack/f2py --f77flags=-O0 --f90flags=-O0 --opt=-O0 +``` + +Build products stay in pytest temporary/cache directories. Failures report the +compiler identity, command, stdout, and stderr. Neither build dirties the +repository. + +The fixtures import the complete PRIK module, the raw f2py module, and +`scipy.linalg.lapack`. Character flags are Python `str` through PRIK and +`bytes` through SciPy/f2py. PRIK and raw f2py retain native argument ordering; +SciPy projects arrays and optional arguments into its documented Python API. + +The Reference LAPACK subroutines do not declare Fortran `intent`, so raw f2py +does not project their scalar writebacks. It still exposes in-place array +mutation, which provides enough output for the independent oracle in 114 of +the 123 subroutines; the four LAPACK functions return their values normally. Nine +subroutines have an essential scalar-only result, or need an unprojected scalar +to validate their mutated vector, and are explicitly recorded in +`F2PY_NUMERICAL_LIMITATIONS`. All 127 selected names must still be exported by +the one f2py comparison module. + +The nine reviewed limitations are: + +- `dlarfg`: the vector writeback is compared, but `ALPHA` and `TAU` are not + projected; +- `dlartg`: `C`, `S`, and `R` are all unprojected scalar writebacks; and +- `dgbcon`, `dgecon`, `dgtcon`, `dpocon`, `dppcon`, `dsycon`, and `dtrcon`: + `RCOND` and `INFO` are unprojected scalar writebacks. + +## Correctness evidence + +The official LAPACK contract defines behavior. An independent mathematical +identity is the primary executable oracle. SciPy and f2py are differential +implementations, not the definition of correctness. Each applicable test keeps +the three calls visible and checks solutions, residuals, reconstructions, +orthogonality, eigen equations, singular values, storage, mutation, shape, +dtype, workspace, pivots, and `INFO` as appropriate. + +Equivalent decompositions are compared by invariants. Eigenvectors and singular +vectors may change sign; repeated eigenspaces may use another orthonormal basis; +pivot ties may choose another valid permutation. Tests therefore use residuals, +subspaces, factor reconstruction, and orthogonality instead of byte equality +where the contract permits freedom. + +All numerical inputs use `dtype=np.float64`. `assert_allclose_float64` scales +tolerance with double-precision epsilon and operation length. Residual checks +also scale by matrix and solution norms. Integer results, `INFO`, shapes, dtypes, +pivot bounds, and untouched sentinel storage use exact comparisons. + +## Arrays, storage, workspaces, and indexes + +Matrices are explicitly Fortran contiguous where the native contract requires +column-major storage. Leading dimensions remain visible in PRIK/f2py calls. +Tests use NaNs or sentinel values in unused triangles and padding, then prove +that those locations remain untouched. Helpers reconstruct general band, +symmetric band, tridiagonal, packed, triangular, and rectangular-full-packed +(RFP) representations before evaluating the logical matrix. + +Workspace-bearing tests allocate the native `WORK`/`IWORK` arrays and keep +`LWORK`/`LIWORK` visible. The suite uses reviewed safe sizes; query behavior is +covered where the exposed API supports it. `INFO == 0` is exact on normal paths. +Invalid argument calls that could route through `XERBLA` are not made in-process. + +Native LAPACK pivots and positions are one-based. PRIK and the raw f2py surface +preserve native values. SciPy converts several low-level pivot/index APIs to +zero-based values; each affected test performs the conversion beside the call. +The inventory marks every pivot/index-bearing routine so a new conversion +cannot be hidden in a generic adapter. + +## Run and diagnose + +The dedicated BLAS + LAPACK GitHub Actions lane runs runtime verification: + +```console +python3 -m pytest -q examples/lapack +python3 -m pytest -q examples/lapack/test_linear_general.py +python3 -m pytest -q examples/lapack/test_linear_general.py::test_dgesv_solves_general_system +python3 -m pytest -q examples/lapack -k dgesvd +``` + +Repository policy leaves LAPACK wrapper/runtime execution to that lane unless a +maintainer explicitly requests a local run. Local work may collect tests and run +the structural inventory, documentation, architecture, and static-analysis +checks. + +To diagnose CI, rerun the single named test with `-vv -s` and a retained +`--basetemp`; inspect the reported compiler command and the visible arrays, +wrapper calls, residual, `INFO`, and preservation assertions. The project is +deterministic and correctness-only: it collects no timings and makes no speed +claims. + +## Coverage + +`routine_inventory.py` explicitly classifies all 127 selected routines and +records their source, wrapper names, family, mutation/return/workspace/index +behavior, oracle class, and exact pytest owner. `test_routine_coverage.py` +fails on SciPy drift, duplicate or missing classification, a source-boundary +change, an absent explicit test, a missing PRIK/f2py export, or divergent +documented totals. + +| Outcome | Count | +| --- | ---: | +| Authoritative LAPACK implementation sources | 2,062 | +| Discovered root LAPACK procedures | 2,064 | +| Selected SciPy-backed float64 routines | 127 | +| Explicit correctness tests | 127 | +| PRIK exports required in CI | 127 | +| SciPy exports used | 127 | +| f2py exports required in CI | 127 | +| Routines satisfying the independent oracle through f2py | 118 | +| Documented raw-f2py numerical projection limitations | 9 | +| Documented unsupported/skipped routines | 0 | + +Runtime success, f2py projection limitations, and any PRIK failures are CI +outcomes and must be reported honestly; structural completion does not predict +them. + +## Representative source-verified tests + +The documentation checker extracts each named function from the real test AST +and fails if the displayed source diverges. + +### DGESV + + +```python +def test_dgesv_solves_general_system(prik_lapack, scipy_lapack, f2py_lapack): + original_a = np.array([[3.0, 1.0], [1.0, 2.0]], dtype=np.float64) + original_b = np.array([[5.0], [5.0]], dtype=np.float64) + expected_x = np.array([[1.0], [2.0]], dtype=np.float64) + prik_a, f2py_a = column_major(original_a), column_major(original_a) + prik_b, f2py_b = column_major(original_b), column_major(original_b) + prik_piv = np.empty(2, dtype=np.int32) + f2py_piv = np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dgesv(2, 1, prik_a, 2, prik_piv, prik_b, 2, 0) + f2py_result = f2py_lapack.dgesv(2, 1, f2py_a, 2, f2py_piv, f2py_b, 2, 0) + scipy_lu, scipy_piv, scipy_x, scipy_info = scipy_lapack.dgesv( + original_a.copy(order="F"), original_b.copy(order="F") + ) + + assert prik_scalars == (2, 1, 2, 2, 0) + assert f2py_result is None + assert scipy_info == 0 + assert_allclose_float64(active(prik_b, 2, 1), expected_x, operation_size=2) + assert_allclose_float64(active(f2py_b, 2, 1), expected_x, operation_size=2) + assert_allclose_float64(scipy_x, expected_x, operation_size=2) + assert_allclose_float64(prik_a, scipy_lu, operation_size=2) + assert_allclose_float64(f2py_a, scipy_lu, operation_size=2) + np.testing.assert_array_equal(prik_piv, native_pivots(scipy_piv)) + np.testing.assert_array_equal(f2py_piv, native_pivots(scipy_piv)) + assert_small_residual( + original_a @ prik_b - original_b, + matrix_norm=np.linalg.norm(original_a, ord=np.inf), + solution_norm=np.linalg.norm(prik_b, ord=np.inf), + operation_size=2, + ) +``` + +### DGETRF + + +```python +def test_dgetrf_reconstructs_pivoted_lu(prik_lapack, scipy_lapack, f2py_lapack): + original = np.array([[0.0, 2.0], [3.0, 4.0]], dtype=np.float64) + prik_a, f2py_a = column_major(original), column_major(original) + prik_piv = np.empty(2, dtype=np.int32) + f2py_piv = np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dgetrf(2, 2, prik_a, 2, prik_piv, 0) + f2py_result = f2py_lapack.dgetrf(2, 2, f2py_a, 2, f2py_piv, 0) + scipy_lu, scipy_piv, scipy_info = scipy_lapack.dgetrf(original.copy(order="F")) + + assert prik_scalars == (2, 2, 2, 0) + assert f2py_result is None + assert scipy_info == 0 + expected_native_piv = native_pivots(scipy_piv) + np.testing.assert_array_equal(prik_piv, expected_native_piv) + np.testing.assert_array_equal(f2py_piv, expected_native_piv) + assert_allclose_float64(prik_a, scipy_lu, operation_size=2) + assert_allclose_float64(f2py_a, scipy_lu, operation_size=2) + lower, upper = unpack_lu(prik_a) + permutation = pivot_matrix(prik_piv, 2, one_based=True) + assert_allclose_float64(permutation @ original, lower @ upper, operation_size=2) +``` + +### DPOTRF + + +```python +def test_dpotrf_reconstructs_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): + logical = np.array([[4.0, 1.0], [1.0, 3.0]], dtype=np.float64) + stored = np.array([[4.0, np.nan], [1.0, 3.0]], dtype=np.float64, order="F") + prik_a, f2py_a = column_major(stored), column_major(stored) + + prik_scalars = prik_lapack.dpotrf("L", 2, prik_a, 2, 0) + f2py_result = f2py_lapack.dpotrf(b"L", 2, f2py_a, 2, 0) + scipy_factor, scipy_info = scipy_lapack.dpotrf(stored.copy(order="F"), lower=1, clean=0) + + assert prik_scalars == (2, 2, 0) + assert f2py_result is None + assert scipy_info == 0 + prik_lower = np.tril(prik_a) + f2py_lower = np.tril(f2py_a) + scipy_lower = np.tril(scipy_factor) + assert_allclose_float64(prik_lower @ prik_lower.T, logical, operation_size=2) + assert_allclose_float64(f2py_lower @ f2py_lower.T, logical, operation_size=2) + assert_allclose_float64(scipy_lower @ scipy_lower.T, logical, operation_size=2) + assert_allclose_float64(prik_lower, scipy_lower, operation_size=2) + assert_allclose_float64(f2py_lower, scipy_lower, operation_size=2) + assert_storage_unchanged(np.triu(prik_a, 1), np.triu(stored, 1)) + assert_storage_unchanged(np.triu(f2py_a, 1), np.triu(stored, 1)) +``` + +### DGEQRF + + +```python +def test_dgeqrf_reconstructs_qr_factorization(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 7.0]], dtype=np.float64) + prik_a, f2py_a = column_major(matrix), column_major(matrix) + prik_tau = np.empty(2, dtype=np.float64) + f2py_tau = np.empty(2, dtype=np.float64) + + prik_scalars = prik_lapack.dgeqrf(3, 2, prik_a, 3, prik_tau, np.empty(16), 16, 0) + f2py_result = f2py_lapack.dgeqrf(3, 2, f2py_a, 3, f2py_tau, np.empty(16), 16, 0) + scipy_qr, scipy_tau, _scipy_work, scipy_info = scipy_lapack.dgeqrf(matrix.copy(order="F"), lwork=16) + + assert prik_scalars == (3, 2, 3, 16, 0) + assert f2py_result is None + assert scipy_info == 0 + for factor, tau in ((prik_a, prik_tau), (f2py_a, f2py_tau), (scipy_qr, scipy_tau)): + q = qr_q_from_reflectors(factor, tau) + r = np.triu(factor[:2, :]) + assert_orthogonal(q) + assert_allclose_float64(q @ r, matrix, operation_size=3) + assert_allclose_float64(prik_a, scipy_qr, operation_size=3) + assert_allclose_float64(f2py_a, scipy_qr, operation_size=3) + assert_allclose_float64(prik_tau, scipy_tau, operation_size=3) + assert_allclose_float64(f2py_tau, scipy_tau, operation_size=3) +``` + +### DSYEV + + +```python +def test_dsyev_returns_orthonormal_eigenvectors(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[2.0, 1.0], [1.0, 2.0]], dtype=np.float64) + expected_w = np.array([1.0, 3.0], dtype=np.float64) + prik_vectors, f2py_vectors = column_major(matrix), column_major(matrix) + prik_w = np.empty(2, dtype=np.float64) + f2py_w = np.empty(2, dtype=np.float64) + + prik_scalars = prik_lapack.dsyev("V", "U", 2, prik_vectors, 2, prik_w, np.empty(16), 16, 0) + f2py_result = f2py_lapack.dsyev(b"V", b"U", 2, f2py_vectors, 2, f2py_w, np.empty(16), 16, 0) + scipy_w, scipy_vectors, scipy_info = scipy_lapack.dsyev(matrix.copy(order="F"), compute_v=1, lower=0, lwork=16) + + assert prik_scalars == (2, 2, 16, 0) + assert f2py_result is None + assert scipy_info == 0 + for values, vectors in ( + (prik_w, prik_vectors), + (f2py_w, f2py_vectors), + (scipy_w, scipy_vectors), + ): + assert_allclose_float64(values, expected_w, operation_size=2) + assert_orthogonal(vectors) + assert_allclose_float64(matrix @ vectors, vectors @ np.diag(values), operation_size=2) +``` + +### DGESVD + + +```python +def test_dgesvd_reconstructs_matrix(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 7.0]], dtype=np.float64) + prik_a, f2py_a = column_major(matrix), column_major(matrix) + prik_s, f2py_s = np.empty(2, dtype=np.float64), np.empty(2, dtype=np.float64) + prik_u, f2py_u = column_major(np.zeros((3, 3))), column_major(np.zeros((3, 3))) + prik_vt, f2py_vt = column_major(np.zeros((2, 2))), column_major(np.zeros((2, 2))) + + prik_scalars = prik_lapack.dgesvd("A", "A", 3, 2, prik_a, 3, prik_s, prik_u, 3, prik_vt, 2, np.empty(32), 32, 0) + f2py_result = f2py_lapack.dgesvd(b"A", b"A", 3, 2, f2py_a, 3, f2py_s, f2py_u, 3, f2py_vt, 2, np.empty(32), 32, 0) + scipy_u, scipy_s, scipy_vt, scipy_info = scipy_lapack.dgesvd( + matrix.copy(order="F"), compute_uv=1, full_matrices=1, lwork=32 + ) + + assert prik_scalars == (3, 2, 3, 3, 2, 32, 0) + assert f2py_result is None + assert scipy_info == 0 + for u, values, vt in ( + (prik_u, prik_s, prik_vt), + (f2py_u, f2py_s, f2py_vt), + (scipy_u, scipy_s, scipy_vt), + ): + assert np.all(np.diff(values) <= 0.0) + assert_orthogonal(u) + assert_orthogonal(vt.T) + assert_allclose_float64(u[:, :2] @ np.diag(values) @ vt, matrix, operation_size=3) + assert_allclose_float64(prik_s, scipy_s, operation_size=3) + assert_allclose_float64(f2py_s, scipy_s, operation_size=3) +``` + +### DTBTRS (banded storage) + + +```python +def test_dtbtrs_solves_triangular_band_system(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[2.0, 1.0], [0.0, 3.0]], dtype=np.float64) + band = symmetric_band_storage(matrix, 1, lower=False) + rhs = np.array([[4.0], [6.0]], dtype=np.float64, order="F") + expected = np.array([[1.0], [2.0]], dtype=np.float64) + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dtbtrs("U", "N", "N", 2, 1, 1, band, 2, prik_b, 2, 0) + f2py_result = f2py_lapack.dtbtrs(b"U", b"N", b"N", 2, 1, 1, band, 2, f2py_b, 2, 0) + scipy_x, scipy_info = scipy_lapack.dtbtrs(band, rhs.copy(order="F"), uplo=b"U", trans=b"N", diag=b"N") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, expected, operation_size=2) + assert_allclose_float64(f2py_b, expected, operation_size=2) + assert_allclose_float64(scipy_x, expected, operation_size=2) + assert_allclose_float64(matrix @ prik_b, rhs, operation_size=2) +``` + +### DGECON (condition estimation) + + +```python +def test_dgecon_estimates_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): + factor = np.array([[4.0]], dtype=np.float64, order="F") + expected = 1.0 + + prik_scalars = prik_lapack.dgecon( + "1", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 + ) + f2py_result = f2py_lapack.dgecon( + b"1", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 + ) + scipy_rcond, scipy_info = scipy_lapack.dgecon(factor.copy(order="F"), 4.0, norm=b"1") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_scalars[-2], expected) + assert_allclose_float64(scipy_rcond, expected) +``` diff --git a/examples/lapack/__init__.py b/examples/lapack/__init__.py new file mode 100644 index 000000000..a6dce0b8b --- /dev/null +++ b/examples/lapack/__init__.py @@ -0,0 +1 @@ +"""Correctness example for the SciPy-exposed double-precision LAPACK API.""" diff --git a/examples/lapack/conftest.py b/examples/lapack/conftest.py new file mode 100644 index 000000000..b937c9c6d --- /dev/null +++ b/examples/lapack/conftest.py @@ -0,0 +1,182 @@ +"""Session fixtures for the complete PRIK, f2py, and SciPy LAPACK surfaces.""" + +from __future__ import annotations + +from dataclasses import dataclass +import importlib +import os +from pathlib import Path +import shlex +import subprocess +import sys + +import pytest + +from tests.fortran.building_shared_library.end_to_end.real_libraries import test_full_libraries as full + +from .routine_inventory import F2PY_EXPORT_LIMITATIONS, ROUTINES, SCIPY_VERSION + + +EXAMPLE_ROOT = Path(__file__).resolve().parent +NATIVE_ROOT = EXAMPLE_ROOT / "native" +BUILD_FLAGS = "-O0" +FORTRAN_SUFFIXES = (".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn") + + +@dataclass(frozen=True) +class BuiltLapack: + """One imported wrapper and the evidence needed to diagnose its build.""" + + module: object + module_name: str + workdir: Path + command: tuple[str, ...] + compiler_identity: str + stdout: str + stderr: str + + +def _build_environment(compiler: str) -> dict[str, str]: + environment = dict(os.environ) + environment.update( + { + "CFLAGS": BUILD_FLAGS, + "FC": compiler, + "F77": compiler, + "F90": compiler, + "FFLAGS": BUILD_FLAGS, + "F90FLAGS": BUILD_FLAGS, + } + ) + return environment + + +def _run_build(command: tuple[str, ...], workdir: Path, compiler: str) -> subprocess.CompletedProcess[str]: + result = subprocess.run( # nosec B603 - fixed tools and repository-owned sources + command, + cwd=workdir, + env=_build_environment(compiler), + capture_output=True, + text=True, + check=False, + ) + if result.returncode: + pytest.fail( + "Reference LAPACK comparison build failed\n" + f"compiler: {full._compiler_identity(compiler)}\n" + f"command: {shlex.join(command)}\n" + f"stdout:\n{result.stdout or ''}\n" + f"stderr:\n{result.stderr or ''}" + ) + return result + + +def _import_built_module(module_name: str, workdir: Path): + sys.modules.pop(module_name, None) + sys.path.insert(0, str(workdir)) + old_flags = sys.getdlopenflags() + sys.setdlopenflags(getattr(os, "RTLD_LAZY", old_flags) | getattr(os, "RTLD_GLOBAL", 0)) + try: + return importlib.import_module(module_name) + finally: + sys.setdlopenflags(old_flags) + sys.path.remove(str(workdir)) + + +def _selected_source(routine: str) -> Path: + """Resolve one reviewed routine to its authoritative native source file.""" + matches = tuple(path for suffix in FORTRAN_SUFFIXES if (path := NATIVE_ROOT / f"{routine}{suffix}").is_file()) + if len(matches) != 1: + pytest.fail(f"expected exactly one authoritative source for {routine}, found {[str(path) for path in matches]}") + return matches[0] + + +@pytest.fixture(scope="session") +def prik_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltLapack: + """Build the one complete PRIK LAPACK wrapper through the established path.""" + compiler = full._compiler() + workdir = tmp_path_factory.mktemp("prik-reference-lapack-example") + entry = full._generate_contract(NATIVE_ROOT, workdir / "contracts" / "lapack") + shared = full._cached_native_shared_library("lapack") + runtime_entry = full._runtime_entry("lapack", entry, workdir) + result = full.build_pyi_extension( + runtime_entry, + output_name="prik_reference_lapack_example", + output_dir=workdir / "build", + native_objects=[shared], + wrapper_fortran_flags=full.FULL_LIBRARY_WRAPPER_FLAGS, + wrapper_c_flags=full.FULL_LIBRARY_WRAPPER_FLAGS, + ) + command = ( + sys.executable, + "-m", + "prik", + "", + "--native-shared-library", + str(shared), + ) + return BuiltLapack( + module=_import_built_module(result.module_name, result.output_dir), + module_name=result.module_name, + workdir=workdir, + command=command, + compiler_identity=full._compiler_identity(compiler), + stdout="", + stderr="", + ) + + +@pytest.fixture(scope="session") +def prik_lapack(prik_build: BuiltLapack): + """Return the complete session-scoped PRIK LAPACK module.""" + return prik_build.module + + +@pytest.fixture(scope="session") +def f2py_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltLapack: + """Build one raw f2py comparison surface linked to the complete library.""" + compiler = full._compiler() + workdir = tmp_path_factory.mktemp("f2py-reference-lapack-example") + shared = full._cached_native_shared_library("lapack") + module_name = "f2py_reference_lapack_example" + selected_sources = tuple(_selected_source(name) for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) + command = ( + sys.executable, + "-m", + "numpy.f2py", + "-c", + "-m", + module_name, + *(str(source) for source in selected_sources), + str(shared), + "--build-dir", + str(workdir / "generated"), + f"--f77flags={BUILD_FLAGS}", + f"--f90flags={BUILD_FLAGS}", + f"--opt={BUILD_FLAGS}", + ) + result = _run_build(command, workdir, compiler) + return BuiltLapack( + module=_import_built_module(module_name, workdir), + module_name=module_name, + workdir=workdir, + command=command, + compiler_identity=full._compiler_identity(compiler), + stdout=result.stdout, + stderr=result.stderr, + ) + + +@pytest.fixture(scope="session") +def f2py_lapack(f2py_build: BuiltLapack): + """Return the session-scoped raw f2py comparison module.""" + return f2py_build.module + + +@pytest.fixture(scope="session") +def scipy_lapack(): + """Return the pinned SciPy low-level LAPACK module.""" + scipy = pytest.importorskip("scipy") + if scipy.__version__ != SCIPY_VERSION: + pytest.fail(f"expected SciPy {SCIPY_VERSION}, found {scipy.__version__}") + return importlib.import_module("scipy.linalg.lapack") diff --git a/examples/lapack/helpers.py b/examples/lapack/helpers.py new file mode 100644 index 000000000..fdbc90155 --- /dev/null +++ b/examples/lapack/helpers.py @@ -0,0 +1,160 @@ +"""Small numerical and storage helpers for the LAPACK correctness example.""" + +from __future__ import annotations + +import numpy as np + + +def assert_allclose_float64(actual, expected, *, operation_size: int = 1) -> None: + """Compare float64 LAPACK results with an accumulation-aware tolerance.""" + scale = max(1, operation_size) + expected_array = np.asarray(expected) + magnitude = max(1.0, float(np.max(np.abs(expected_array), initial=0.0))) + np.testing.assert_allclose( + actual, + expected, + rtol=np.finfo(np.float64).eps * 32 * scale, + atol=np.finfo(np.float64).eps * 32 * scale * magnitude, + ) + + +def assert_info(result, expected: int = 0) -> None: + """Check the trailing LAPACK INFO return value.""" + assert int(np.asarray(result[-1])) == expected + + +def assert_small_residual( + residual, + *, + matrix_norm: float, + solution_norm: float, + operation_size: int, +) -> None: + """Check a backward residual scaled by the represented operation.""" + denominator = max(1.0, matrix_norm * solution_norm) + scaled = np.linalg.norm(np.asarray(residual, dtype=np.float64), ord=np.inf) / denominator + tolerance = np.finfo(np.float64).eps * 128 * max(1, operation_size) + assert scaled <= tolerance, f"scaled residual {scaled} exceeded {tolerance}" + + +def assert_orthogonal(matrix: np.ndarray, *, columns: int | None = None) -> None: + """Validate orthonormal columns without hiding a routine invocation.""" + active_columns = matrix.shape[1] if columns is None else columns + basis = np.asarray(matrix[:, :active_columns], dtype=np.float64) + assert_allclose_float64( + basis.T @ basis, + np.eye(active_columns, dtype=np.float64), + operation_size=basis.shape[0], + ) + + +def native_pivots(scipy_pivots: np.ndarray) -> np.ndarray: + """Convert SciPy's zero-based pivots to LAPACK's native one-based values.""" + return np.asarray(scipy_pivots, dtype=np.int32) + np.int32(1) + + +def pivot_matrix(pivots: np.ndarray, size: int, *, one_based: bool) -> np.ndarray: + """Build the row permutation represented by sequential LAPACK pivots.""" + permutation = np.eye(size, dtype=np.float64) + for row, pivot in enumerate(np.asarray(pivots, dtype=np.int64)): + target = int(pivot) - int(one_based) + permutation[[row, target], :] = permutation[[target, row], :] + return permutation + + +def unpack_lu(factor: np.ndarray) -> tuple[np.ndarray, np.ndarray]: + """Split LAPACK's combined LU storage into logical L and U matrices.""" + rows, columns = factor.shape + rank = min(rows, columns) + lower = np.tril(factor[:, :rank], k=-1) + np.eye(rows, rank, dtype=np.float64) + upper = np.triu(factor[:rank, :]) + return lower, upper + + +def qr_q_from_reflectors(factor: np.ndarray, tau: np.ndarray) -> np.ndarray: + """Form reduced Q explicitly from DGEQRF Householder storage.""" + rows, columns = factor.shape + reflectors = min(rows, columns, len(tau)) + q = np.eye(rows, dtype=np.float64) + for index in range(reflectors): + vector = np.zeros(rows, dtype=np.float64) + vector[index] = 1.0 + vector[index + 1 :] = factor[index + 1 :, index] + q = q @ (np.eye(rows, dtype=np.float64) - tau[index] * np.outer(vector, vector)) + return q[:, :columns] + + +def assert_storage_unchanged(actual: np.ndarray, expected: np.ndarray) -> None: + """Compare storage exactly, including NaN sentinels.""" + np.testing.assert_array_equal(actual, expected) + + +def general_band_storage(matrix: np.ndarray, lower: int, upper: int, *, factor: bool = False) -> np.ndarray: + """Pack a square general band matrix in LAPACK column-major storage.""" + logical = np.asarray(matrix, dtype=np.float64) + rows = 2 * lower + upper + 1 if factor else lower + upper + 1 + diagonal_row = lower + upper if factor else upper + band = np.zeros((rows, logical.shape[1]), dtype=np.float64, order="F") + for column in range(logical.shape[1]): + for row in range(max(0, column - upper), min(logical.shape[0], column + lower + 1)): + band[diagonal_row + row - column, column] = logical[row, column] + return band + + +def symmetric_band_storage(matrix: np.ndarray, bandwidth: int, *, lower: bool) -> np.ndarray: + """Pack one triangle of a symmetric band matrix.""" + logical = np.asarray(matrix, dtype=np.float64) + band = np.zeros((bandwidth + 1, logical.shape[1]), dtype=np.float64, order="F") + for column in range(logical.shape[1]): + if lower: + rows = range(column, min(logical.shape[0], column + bandwidth + 1)) + for row in rows: + band[row - column, column] = logical[row, column] + else: + rows = range(max(0, column - bandwidth), column + 1) + for row in rows: + band[bandwidth + row - column, column] = logical[row, column] + return band + + +def packed_symmetric(matrix: np.ndarray, *, lower: bool) -> np.ndarray: + """Pack one triangle in LAPACK packed-column order.""" + logical = np.asarray(matrix, dtype=np.float64) + values: list[float] = [] + for column in range(logical.shape[1]): + rows = range(column, logical.shape[0]) if lower else range(column + 1) + values.extend(float(logical[row, column]) for row in rows) + return np.asarray(values, dtype=np.float64) + + +def unpack_packed_symmetric(values: np.ndarray, size: int, *, lower: bool) -> np.ndarray: + """Reconstruct a symmetric matrix from LAPACK packed-column storage.""" + matrix = np.zeros((size, size), dtype=np.float64) + offset = 0 + for column in range(size): + rows = range(column, size) if lower else range(column + 1) + for row in rows: + matrix[row, column] = values[offset] + matrix[column, row] = values[offset] + offset += 1 + return matrix + + +def tridiagonal_matrix(lower: np.ndarray, diagonal: np.ndarray, upper: np.ndarray) -> np.ndarray: + """Construct the logical matrix represented by three diagonals.""" + return np.diag(diagonal) + np.diag(upper, 1) + np.diag(lower, -1) + + +def column_major(matrix: np.ndarray, *, rows: int | None = None) -> np.ndarray: + """Return a Fortran-contiguous float64 matrix with optional leading padding.""" + array = np.asarray(matrix, dtype=np.float64) + if rows is None or rows == array.shape[0]: + return np.array(array, dtype=np.float64, order="F", copy=True) + padded = np.full((rows, array.shape[1]), np.nan, dtype=np.float64, order="F") + padded[: array.shape[0], :] = array + return padded + + +def active(matrix: np.ndarray, rows: int, columns: int) -> np.ndarray: + """Extract the logical matrix while preserving its column-major convention.""" + return np.asarray(matrix[:rows, :columns], dtype=np.float64) diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cbbcsd.f b/examples/lapack/native/cbbcsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cbbcsd.f rename to examples/lapack/native/cbbcsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cbdsqr.f b/examples/lapack/native/cbdsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cbdsqr.f rename to examples/lapack/native/cbdsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbbrd.f b/examples/lapack/native/cgbbrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbbrd.f rename to examples/lapack/native/cgbbrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbcon.f b/examples/lapack/native/cgbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbcon.f rename to examples/lapack/native/cgbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbequ.f b/examples/lapack/native/cgbequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbequ.f rename to examples/lapack/native/cgbequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbequb.f b/examples/lapack/native/cgbequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbequb.f rename to examples/lapack/native/cgbequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbrfs.f b/examples/lapack/native/cgbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbrfs.f rename to examples/lapack/native/cgbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbrfsx.f b/examples/lapack/native/cgbrfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbrfsx.f rename to examples/lapack/native/cgbrfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbsv.f b/examples/lapack/native/cgbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbsv.f rename to examples/lapack/native/cgbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbsvx.f b/examples/lapack/native/cgbsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbsvx.f rename to examples/lapack/native/cgbsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbsvxx.f b/examples/lapack/native/cgbsvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbsvxx.f rename to examples/lapack/native/cgbsvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbtf2.f b/examples/lapack/native/cgbtf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbtf2.f rename to examples/lapack/native/cgbtf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbtrf.f b/examples/lapack/native/cgbtrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbtrf.f rename to examples/lapack/native/cgbtrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbtrs.f b/examples/lapack/native/cgbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgbtrs.f rename to examples/lapack/native/cgbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgebak.f b/examples/lapack/native/cgebak.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgebak.f rename to examples/lapack/native/cgebak.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgebal.f b/examples/lapack/native/cgebal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgebal.f rename to examples/lapack/native/cgebal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgebd2.f b/examples/lapack/native/cgebd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgebd2.f rename to examples/lapack/native/cgebd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgebrd.f b/examples/lapack/native/cgebrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgebrd.f rename to examples/lapack/native/cgebrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgecon.f b/examples/lapack/native/cgecon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgecon.f rename to examples/lapack/native/cgecon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgedmd.f90 b/examples/lapack/native/cgedmd.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgedmd.f90 rename to examples/lapack/native/cgedmd.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgedmdq.f90 b/examples/lapack/native/cgedmdq.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgedmdq.f90 rename to examples/lapack/native/cgedmdq.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeequ.f b/examples/lapack/native/cgeequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeequ.f rename to examples/lapack/native/cgeequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeequb.f b/examples/lapack/native/cgeequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeequb.f rename to examples/lapack/native/cgeequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgees.f b/examples/lapack/native/cgees.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgees.f rename to examples/lapack/native/cgees.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeesx.f b/examples/lapack/native/cgeesx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeesx.f rename to examples/lapack/native/cgeesx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeev.f b/examples/lapack/native/cgeev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeev.f rename to examples/lapack/native/cgeev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeevx.f b/examples/lapack/native/cgeevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeevx.f rename to examples/lapack/native/cgeevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgehd2.f b/examples/lapack/native/cgehd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgehd2.f rename to examples/lapack/native/cgehd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgehrd.f b/examples/lapack/native/cgehrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgehrd.f rename to examples/lapack/native/cgehrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgejsv.f b/examples/lapack/native/cgejsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgejsv.f rename to examples/lapack/native/cgejsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelq.f b/examples/lapack/native/cgelq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelq.f rename to examples/lapack/native/cgelq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelq2.f b/examples/lapack/native/cgelq2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelq2.f rename to examples/lapack/native/cgelq2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelqf.f b/examples/lapack/native/cgelqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelqf.f rename to examples/lapack/native/cgelqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelqt.f b/examples/lapack/native/cgelqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelqt.f rename to examples/lapack/native/cgelqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelqt3.f b/examples/lapack/native/cgelqt3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelqt3.f rename to examples/lapack/native/cgelqt3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgels.f b/examples/lapack/native/cgels.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgels.f rename to examples/lapack/native/cgels.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelsd.f b/examples/lapack/native/cgelsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelsd.f rename to examples/lapack/native/cgelsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelss.f b/examples/lapack/native/cgelss.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelss.f rename to examples/lapack/native/cgelss.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelst.f b/examples/lapack/native/cgelst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelst.f rename to examples/lapack/native/cgelst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelsy.f b/examples/lapack/native/cgelsy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgelsy.f rename to examples/lapack/native/cgelsy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgemlq.f b/examples/lapack/native/cgemlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgemlq.f rename to examples/lapack/native/cgemlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgemlqt.f b/examples/lapack/native/cgemlqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgemlqt.f rename to examples/lapack/native/cgemlqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgemqr.f b/examples/lapack/native/cgemqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgemqr.f rename to examples/lapack/native/cgemqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgemqrt.f b/examples/lapack/native/cgemqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgemqrt.f rename to examples/lapack/native/cgemqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeql2.f b/examples/lapack/native/cgeql2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeql2.f rename to examples/lapack/native/cgeql2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqlf.f b/examples/lapack/native/cgeqlf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqlf.f rename to examples/lapack/native/cgeqlf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqp3.f b/examples/lapack/native/cgeqp3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqp3.f rename to examples/lapack/native/cgeqp3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqp3rk.f b/examples/lapack/native/cgeqp3rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqp3rk.f rename to examples/lapack/native/cgeqp3rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqr.f b/examples/lapack/native/cgeqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqr.f rename to examples/lapack/native/cgeqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqr2.f b/examples/lapack/native/cgeqr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqr2.f rename to examples/lapack/native/cgeqr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqr2p.f b/examples/lapack/native/cgeqr2p.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqr2p.f rename to examples/lapack/native/cgeqr2p.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqrf.f b/examples/lapack/native/cgeqrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqrf.f rename to examples/lapack/native/cgeqrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqrfp.f b/examples/lapack/native/cgeqrfp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqrfp.f rename to examples/lapack/native/cgeqrfp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqrt.f b/examples/lapack/native/cgeqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqrt.f rename to examples/lapack/native/cgeqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqrt2.f b/examples/lapack/native/cgeqrt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqrt2.f rename to examples/lapack/native/cgeqrt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqrt3.f b/examples/lapack/native/cgeqrt3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgeqrt3.f rename to examples/lapack/native/cgeqrt3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgerfs.f b/examples/lapack/native/cgerfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgerfs.f rename to examples/lapack/native/cgerfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgerfsx.f b/examples/lapack/native/cgerfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgerfsx.f rename to examples/lapack/native/cgerfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgerq2.f b/examples/lapack/native/cgerq2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgerq2.f rename to examples/lapack/native/cgerq2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgerqf.f b/examples/lapack/native/cgerqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgerqf.f rename to examples/lapack/native/cgerqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesc2.f b/examples/lapack/native/cgesc2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesc2.f rename to examples/lapack/native/cgesc2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesdd.f b/examples/lapack/native/cgesdd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesdd.f rename to examples/lapack/native/cgesdd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesv.f b/examples/lapack/native/cgesv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesv.f rename to examples/lapack/native/cgesv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvd.f b/examples/lapack/native/cgesvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvd.f rename to examples/lapack/native/cgesvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvdq.f b/examples/lapack/native/cgesvdq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvdq.f rename to examples/lapack/native/cgesvdq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvdx.f b/examples/lapack/native/cgesvdx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvdx.f rename to examples/lapack/native/cgesvdx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvj.f b/examples/lapack/native/cgesvj.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvj.f rename to examples/lapack/native/cgesvj.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvx.f b/examples/lapack/native/cgesvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvx.f rename to examples/lapack/native/cgesvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvxx.f b/examples/lapack/native/cgesvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgesvxx.f rename to examples/lapack/native/cgesvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetc2.f b/examples/lapack/native/cgetc2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetc2.f rename to examples/lapack/native/cgetc2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetf2.f b/examples/lapack/native/cgetf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetf2.f rename to examples/lapack/native/cgetf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetrf.f b/examples/lapack/native/cgetrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetrf.f rename to examples/lapack/native/cgetrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetrf2.f b/examples/lapack/native/cgetrf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetrf2.f rename to examples/lapack/native/cgetrf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetri.f b/examples/lapack/native/cgetri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetri.f rename to examples/lapack/native/cgetri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetrs.f b/examples/lapack/native/cgetrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetrs.f rename to examples/lapack/native/cgetrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetsls.f b/examples/lapack/native/cgetsls.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetsls.f rename to examples/lapack/native/cgetsls.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetsqrhrt.f b/examples/lapack/native/cgetsqrhrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgetsqrhrt.f rename to examples/lapack/native/cgetsqrhrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggbak.f b/examples/lapack/native/cggbak.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggbak.f rename to examples/lapack/native/cggbak.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggbal.f b/examples/lapack/native/cggbal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggbal.f rename to examples/lapack/native/cggbal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgges.f b/examples/lapack/native/cgges.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgges.f rename to examples/lapack/native/cgges.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgges3.f b/examples/lapack/native/cgges3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgges3.f rename to examples/lapack/native/cgges3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggesx.f b/examples/lapack/native/cggesx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggesx.f rename to examples/lapack/native/cggesx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggev.f b/examples/lapack/native/cggev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggev.f rename to examples/lapack/native/cggev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggev3.f b/examples/lapack/native/cggev3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggev3.f rename to examples/lapack/native/cggev3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggevx.f b/examples/lapack/native/cggevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggevx.f rename to examples/lapack/native/cggevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggglm.f b/examples/lapack/native/cggglm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggglm.f rename to examples/lapack/native/cggglm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgghd3.f b/examples/lapack/native/cgghd3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgghd3.f rename to examples/lapack/native/cgghd3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgghrd.f b/examples/lapack/native/cgghrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgghrd.f rename to examples/lapack/native/cgghrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgglse.f b/examples/lapack/native/cgglse.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgglse.f rename to examples/lapack/native/cgglse.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggqrf.f b/examples/lapack/native/cggqrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggqrf.f rename to examples/lapack/native/cggqrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggrqf.f b/examples/lapack/native/cggrqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggrqf.f rename to examples/lapack/native/cggrqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggsvd3.f b/examples/lapack/native/cggsvd3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggsvd3.f rename to examples/lapack/native/cggsvd3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggsvp3.f b/examples/lapack/native/cggsvp3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cggsvp3.f rename to examples/lapack/native/cggsvp3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgsvj0.f b/examples/lapack/native/cgsvj0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgsvj0.f rename to examples/lapack/native/cgsvj0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgsvj1.f b/examples/lapack/native/cgsvj1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgsvj1.f rename to examples/lapack/native/cgsvj1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgtcon.f b/examples/lapack/native/cgtcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgtcon.f rename to examples/lapack/native/cgtcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgtrfs.f b/examples/lapack/native/cgtrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgtrfs.f rename to examples/lapack/native/cgtrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgtsv.f b/examples/lapack/native/cgtsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgtsv.f rename to examples/lapack/native/cgtsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgtsvx.f b/examples/lapack/native/cgtsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgtsvx.f rename to examples/lapack/native/cgtsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgttrf.f b/examples/lapack/native/cgttrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgttrf.f rename to examples/lapack/native/cgttrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgttrs.f b/examples/lapack/native/cgttrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgttrs.f rename to examples/lapack/native/cgttrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgtts2.f b/examples/lapack/native/cgtts2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cgtts2.f rename to examples/lapack/native/cgtts2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chb2st_kernels.f b/examples/lapack/native/chb2st_kernels.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chb2st_kernels.f rename to examples/lapack/native/chb2st_kernels.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbev.f b/examples/lapack/native/chbev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbev.f rename to examples/lapack/native/chbev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbev_2stage.f b/examples/lapack/native/chbev_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbev_2stage.f rename to examples/lapack/native/chbev_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbevd.f b/examples/lapack/native/chbevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbevd.f rename to examples/lapack/native/chbevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbevd_2stage.f b/examples/lapack/native/chbevd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbevd_2stage.f rename to examples/lapack/native/chbevd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbevx.f b/examples/lapack/native/chbevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbevx.f rename to examples/lapack/native/chbevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbevx_2stage.f b/examples/lapack/native/chbevx_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbevx_2stage.f rename to examples/lapack/native/chbevx_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbgst.f b/examples/lapack/native/chbgst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbgst.f rename to examples/lapack/native/chbgst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbgv.f b/examples/lapack/native/chbgv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbgv.f rename to examples/lapack/native/chbgv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbgvd.f b/examples/lapack/native/chbgvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbgvd.f rename to examples/lapack/native/chbgvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbgvx.f b/examples/lapack/native/chbgvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbgvx.f rename to examples/lapack/native/chbgvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbtrd.f b/examples/lapack/native/chbtrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chbtrd.f rename to examples/lapack/native/chbtrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/checon.f b/examples/lapack/native/checon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/checon.f rename to examples/lapack/native/checon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/checon_3.f b/examples/lapack/native/checon_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/checon_3.f rename to examples/lapack/native/checon_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/checon_rook.f b/examples/lapack/native/checon_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/checon_rook.f rename to examples/lapack/native/checon_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheequb.f b/examples/lapack/native/cheequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheequb.f rename to examples/lapack/native/cheequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheev.f b/examples/lapack/native/cheev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheev.f rename to examples/lapack/native/cheev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheev_2stage.f b/examples/lapack/native/cheev_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheev_2stage.f rename to examples/lapack/native/cheev_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevd.f b/examples/lapack/native/cheevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevd.f rename to examples/lapack/native/cheevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevd_2stage.f b/examples/lapack/native/cheevd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevd_2stage.f rename to examples/lapack/native/cheevd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevr.f b/examples/lapack/native/cheevr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevr.f rename to examples/lapack/native/cheevr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevr_2stage.f b/examples/lapack/native/cheevr_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevr_2stage.f rename to examples/lapack/native/cheevr_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevx.f b/examples/lapack/native/cheevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevx.f rename to examples/lapack/native/cheevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevx_2stage.f b/examples/lapack/native/cheevx_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheevx_2stage.f rename to examples/lapack/native/cheevx_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegs2.f b/examples/lapack/native/chegs2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegs2.f rename to examples/lapack/native/chegs2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegst.f b/examples/lapack/native/chegst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegst.f rename to examples/lapack/native/chegst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegv.f b/examples/lapack/native/chegv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegv.f rename to examples/lapack/native/chegv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegv_2stage.f b/examples/lapack/native/chegv_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegv_2stage.f rename to examples/lapack/native/chegv_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegvd.f b/examples/lapack/native/chegvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegvd.f rename to examples/lapack/native/chegvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegvx.f b/examples/lapack/native/chegvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chegvx.f rename to examples/lapack/native/chegvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cherfs.f b/examples/lapack/native/cherfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cherfs.f rename to examples/lapack/native/cherfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cherfsx.f b/examples/lapack/native/cherfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cherfsx.f rename to examples/lapack/native/cherfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesv.f b/examples/lapack/native/chesv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesv.f rename to examples/lapack/native/chesv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesv_aa.f b/examples/lapack/native/chesv_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesv_aa.f rename to examples/lapack/native/chesv_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesv_aa_2stage.f b/examples/lapack/native/chesv_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesv_aa_2stage.f rename to examples/lapack/native/chesv_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesv_rk.f b/examples/lapack/native/chesv_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesv_rk.f rename to examples/lapack/native/chesv_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesv_rook.f b/examples/lapack/native/chesv_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesv_rook.f rename to examples/lapack/native/chesv_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesvx.f b/examples/lapack/native/chesvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesvx.f rename to examples/lapack/native/chesvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesvxx.f b/examples/lapack/native/chesvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chesvxx.f rename to examples/lapack/native/chesvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheswapr.f b/examples/lapack/native/cheswapr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cheswapr.f rename to examples/lapack/native/cheswapr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetd2.f b/examples/lapack/native/chetd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetd2.f rename to examples/lapack/native/chetd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetf2.f b/examples/lapack/native/chetf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetf2.f rename to examples/lapack/native/chetf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetf2_rk.f b/examples/lapack/native/chetf2_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetf2_rk.f rename to examples/lapack/native/chetf2_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetf2_rook.f b/examples/lapack/native/chetf2_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetf2_rook.f rename to examples/lapack/native/chetf2_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrd.f b/examples/lapack/native/chetrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrd.f rename to examples/lapack/native/chetrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrd_2stage.f b/examples/lapack/native/chetrd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrd_2stage.f rename to examples/lapack/native/chetrd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrd_hb2st.F b/examples/lapack/native/chetrd_hb2st.F similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrd_hb2st.F rename to examples/lapack/native/chetrd_hb2st.F diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrd_he2hb.f b/examples/lapack/native/chetrd_he2hb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrd_he2hb.f rename to examples/lapack/native/chetrd_he2hb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrf.f b/examples/lapack/native/chetrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrf.f rename to examples/lapack/native/chetrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrf_aa.f b/examples/lapack/native/chetrf_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrf_aa.f rename to examples/lapack/native/chetrf_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrf_aa_2stage.f b/examples/lapack/native/chetrf_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrf_aa_2stage.f rename to examples/lapack/native/chetrf_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrf_rk.f b/examples/lapack/native/chetrf_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrf_rk.f rename to examples/lapack/native/chetrf_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrf_rook.f b/examples/lapack/native/chetrf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrf_rook.f rename to examples/lapack/native/chetrf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri.f b/examples/lapack/native/chetri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri.f rename to examples/lapack/native/chetri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri2.f b/examples/lapack/native/chetri2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri2.f rename to examples/lapack/native/chetri2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri2x.f b/examples/lapack/native/chetri2x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri2x.f rename to examples/lapack/native/chetri2x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri_3.f b/examples/lapack/native/chetri_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri_3.f rename to examples/lapack/native/chetri_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri_3x.f b/examples/lapack/native/chetri_3x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri_3x.f rename to examples/lapack/native/chetri_3x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri_rook.f b/examples/lapack/native/chetri_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetri_rook.f rename to examples/lapack/native/chetri_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs.f b/examples/lapack/native/chetrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs.f rename to examples/lapack/native/chetrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs2.f b/examples/lapack/native/chetrs2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs2.f rename to examples/lapack/native/chetrs2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs_3.f b/examples/lapack/native/chetrs_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs_3.f rename to examples/lapack/native/chetrs_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs_aa.f b/examples/lapack/native/chetrs_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs_aa.f rename to examples/lapack/native/chetrs_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs_aa_2stage.f b/examples/lapack/native/chetrs_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs_aa_2stage.f rename to examples/lapack/native/chetrs_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs_rook.f b/examples/lapack/native/chetrs_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chetrs_rook.f rename to examples/lapack/native/chetrs_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chfrk.f b/examples/lapack/native/chfrk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chfrk.f rename to examples/lapack/native/chfrk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chgeqz.f b/examples/lapack/native/chgeqz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chgeqz.f rename to examples/lapack/native/chgeqz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chla_transtype.f b/examples/lapack/native/chla_transtype.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chla_transtype.f rename to examples/lapack/native/chla_transtype.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpcon.f b/examples/lapack/native/chpcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpcon.f rename to examples/lapack/native/chpcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpev.f b/examples/lapack/native/chpev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpev.f rename to examples/lapack/native/chpev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpevd.f b/examples/lapack/native/chpevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpevd.f rename to examples/lapack/native/chpevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpevx.f b/examples/lapack/native/chpevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpevx.f rename to examples/lapack/native/chpevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpgst.f b/examples/lapack/native/chpgst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpgst.f rename to examples/lapack/native/chpgst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpgv.f b/examples/lapack/native/chpgv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpgv.f rename to examples/lapack/native/chpgv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpgvd.f b/examples/lapack/native/chpgvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpgvd.f rename to examples/lapack/native/chpgvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpgvx.f b/examples/lapack/native/chpgvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpgvx.f rename to examples/lapack/native/chpgvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chprfs.f b/examples/lapack/native/chprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chprfs.f rename to examples/lapack/native/chprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpsv.f b/examples/lapack/native/chpsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpsv.f rename to examples/lapack/native/chpsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpsvx.f b/examples/lapack/native/chpsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chpsvx.f rename to examples/lapack/native/chpsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chptrd.f b/examples/lapack/native/chptrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chptrd.f rename to examples/lapack/native/chptrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chptrf.f b/examples/lapack/native/chptrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chptrf.f rename to examples/lapack/native/chptrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chptri.f b/examples/lapack/native/chptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chptri.f rename to examples/lapack/native/chptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chptrs.f b/examples/lapack/native/chptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chptrs.f rename to examples/lapack/native/chptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chsein.f b/examples/lapack/native/chsein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chsein.f rename to examples/lapack/native/chsein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chseqr.f b/examples/lapack/native/chseqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/chseqr.f rename to examples/lapack/native/chseqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gbamv.f b/examples/lapack/native/cla_gbamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gbamv.f rename to examples/lapack/native/cla_gbamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gbrcond_c.f b/examples/lapack/native/cla_gbrcond_c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gbrcond_c.f rename to examples/lapack/native/cla_gbrcond_c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gbrcond_x.f b/examples/lapack/native/cla_gbrcond_x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gbrcond_x.f rename to examples/lapack/native/cla_gbrcond_x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gbrfsx_extended.f b/examples/lapack/native/cla_gbrfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gbrfsx_extended.f rename to examples/lapack/native/cla_gbrfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gbrpvgrw.f b/examples/lapack/native/cla_gbrpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gbrpvgrw.f rename to examples/lapack/native/cla_gbrpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_geamv.f b/examples/lapack/native/cla_geamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_geamv.f rename to examples/lapack/native/cla_geamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gercond_c.f b/examples/lapack/native/cla_gercond_c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gercond_c.f rename to examples/lapack/native/cla_gercond_c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gercond_x.f b/examples/lapack/native/cla_gercond_x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gercond_x.f rename to examples/lapack/native/cla_gercond_x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gerfsx_extended.f b/examples/lapack/native/cla_gerfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gerfsx_extended.f rename to examples/lapack/native/cla_gerfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gerpvgrw.f b/examples/lapack/native/cla_gerpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_gerpvgrw.f rename to examples/lapack/native/cla_gerpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_heamv.f b/examples/lapack/native/cla_heamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_heamv.f rename to examples/lapack/native/cla_heamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_hercond_c.f b/examples/lapack/native/cla_hercond_c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_hercond_c.f rename to examples/lapack/native/cla_hercond_c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_hercond_x.f b/examples/lapack/native/cla_hercond_x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_hercond_x.f rename to examples/lapack/native/cla_hercond_x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_herfsx_extended.f b/examples/lapack/native/cla_herfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_herfsx_extended.f rename to examples/lapack/native/cla_herfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_herpvgrw.f b/examples/lapack/native/cla_herpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_herpvgrw.f rename to examples/lapack/native/cla_herpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_lin_berr.f b/examples/lapack/native/cla_lin_berr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_lin_berr.f rename to examples/lapack/native/cla_lin_berr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_porcond_c.f b/examples/lapack/native/cla_porcond_c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_porcond_c.f rename to examples/lapack/native/cla_porcond_c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_porcond_x.f b/examples/lapack/native/cla_porcond_x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_porcond_x.f rename to examples/lapack/native/cla_porcond_x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_porfsx_extended.f b/examples/lapack/native/cla_porfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_porfsx_extended.f rename to examples/lapack/native/cla_porfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_porpvgrw.f b/examples/lapack/native/cla_porpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_porpvgrw.f rename to examples/lapack/native/cla_porpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_syamv.f b/examples/lapack/native/cla_syamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_syamv.f rename to examples/lapack/native/cla_syamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_syrcond_c.f b/examples/lapack/native/cla_syrcond_c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_syrcond_c.f rename to examples/lapack/native/cla_syrcond_c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_syrcond_x.f b/examples/lapack/native/cla_syrcond_x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_syrcond_x.f rename to examples/lapack/native/cla_syrcond_x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_syrfsx_extended.f b/examples/lapack/native/cla_syrfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_syrfsx_extended.f rename to examples/lapack/native/cla_syrfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_syrpvgrw.f b/examples/lapack/native/cla_syrpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_syrpvgrw.f rename to examples/lapack/native/cla_syrpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_wwaddw.f b/examples/lapack/native/cla_wwaddw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cla_wwaddw.f rename to examples/lapack/native/cla_wwaddw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clabrd.f b/examples/lapack/native/clabrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clabrd.f rename to examples/lapack/native/clabrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacgv.f b/examples/lapack/native/clacgv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacgv.f rename to examples/lapack/native/clacgv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacn2.f b/examples/lapack/native/clacn2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacn2.f rename to examples/lapack/native/clacn2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacon.f b/examples/lapack/native/clacon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacon.f rename to examples/lapack/native/clacon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacp2.f b/examples/lapack/native/clacp2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacp2.f rename to examples/lapack/native/clacp2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacpy.f b/examples/lapack/native/clacpy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacpy.f rename to examples/lapack/native/clacpy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacrm.f b/examples/lapack/native/clacrm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacrm.f rename to examples/lapack/native/clacrm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacrt.f b/examples/lapack/native/clacrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clacrt.f rename to examples/lapack/native/clacrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cladiv.f b/examples/lapack/native/cladiv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cladiv.f rename to examples/lapack/native/cladiv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claed0.f b/examples/lapack/native/claed0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claed0.f rename to examples/lapack/native/claed0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claed7.f b/examples/lapack/native/claed7.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claed7.f rename to examples/lapack/native/claed7.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claed8.f b/examples/lapack/native/claed8.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claed8.f rename to examples/lapack/native/claed8.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claein.f b/examples/lapack/native/claein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claein.f rename to examples/lapack/native/claein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claesy.f b/examples/lapack/native/claesy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claesy.f rename to examples/lapack/native/claesy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claev2.f b/examples/lapack/native/claev2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claev2.f rename to examples/lapack/native/claev2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clag2z.f b/examples/lapack/native/clag2z.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clag2z.f rename to examples/lapack/native/clag2z.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clags2.f b/examples/lapack/native/clags2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clags2.f rename to examples/lapack/native/clags2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clagtm.f b/examples/lapack/native/clagtm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clagtm.f rename to examples/lapack/native/clagtm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahef.f b/examples/lapack/native/clahef.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahef.f rename to examples/lapack/native/clahef.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahef_aa.f b/examples/lapack/native/clahef_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahef_aa.f rename to examples/lapack/native/clahef_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahef_rk.f b/examples/lapack/native/clahef_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahef_rk.f rename to examples/lapack/native/clahef_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahef_rook.f b/examples/lapack/native/clahef_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahef_rook.f rename to examples/lapack/native/clahef_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahqr.f b/examples/lapack/native/clahqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahqr.f rename to examples/lapack/native/clahqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahr2.f b/examples/lapack/native/clahr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clahr2.f rename to examples/lapack/native/clahr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claic1.f b/examples/lapack/native/claic1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claic1.f rename to examples/lapack/native/claic1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clals0.f b/examples/lapack/native/clals0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clals0.f rename to examples/lapack/native/clals0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clalsa.f b/examples/lapack/native/clalsa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clalsa.f rename to examples/lapack/native/clalsa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clalsd.f b/examples/lapack/native/clalsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clalsd.f rename to examples/lapack/native/clalsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clamswlq.f b/examples/lapack/native/clamswlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clamswlq.f rename to examples/lapack/native/clamswlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clamtsqr.f b/examples/lapack/native/clamtsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clamtsqr.f rename to examples/lapack/native/clamtsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clangb.f b/examples/lapack/native/clangb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clangb.f rename to examples/lapack/native/clangb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clange.f b/examples/lapack/native/clange.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clange.f rename to examples/lapack/native/clange.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clangt.f b/examples/lapack/native/clangt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clangt.f rename to examples/lapack/native/clangt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanhb.f b/examples/lapack/native/clanhb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanhb.f rename to examples/lapack/native/clanhb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanhe.f b/examples/lapack/native/clanhe.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanhe.f rename to examples/lapack/native/clanhe.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanhf.f b/examples/lapack/native/clanhf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanhf.f rename to examples/lapack/native/clanhf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanhp.f b/examples/lapack/native/clanhp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanhp.f rename to examples/lapack/native/clanhp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanhs.f b/examples/lapack/native/clanhs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanhs.f rename to examples/lapack/native/clanhs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanht.f b/examples/lapack/native/clanht.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clanht.f rename to examples/lapack/native/clanht.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clansb.f b/examples/lapack/native/clansb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clansb.f rename to examples/lapack/native/clansb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clansp.f b/examples/lapack/native/clansp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clansp.f rename to examples/lapack/native/clansp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clansy.f b/examples/lapack/native/clansy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clansy.f rename to examples/lapack/native/clansy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clantb.f b/examples/lapack/native/clantb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clantb.f rename to examples/lapack/native/clantb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clantp.f b/examples/lapack/native/clantp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clantp.f rename to examples/lapack/native/clantp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clantr.f b/examples/lapack/native/clantr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clantr.f rename to examples/lapack/native/clantr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clapll.f b/examples/lapack/native/clapll.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clapll.f rename to examples/lapack/native/clapll.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clapmr.f b/examples/lapack/native/clapmr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clapmr.f rename to examples/lapack/native/clapmr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clapmt.f b/examples/lapack/native/clapmt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clapmt.f rename to examples/lapack/native/clapmt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqgb.f b/examples/lapack/native/claqgb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqgb.f rename to examples/lapack/native/claqgb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqge.f b/examples/lapack/native/claqge.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqge.f rename to examples/lapack/native/claqge.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqhb.f b/examples/lapack/native/claqhb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqhb.f rename to examples/lapack/native/claqhb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqhe.f b/examples/lapack/native/claqhe.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqhe.f rename to examples/lapack/native/claqhe.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqhp.f b/examples/lapack/native/claqhp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqhp.f rename to examples/lapack/native/claqhp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqp2.f b/examples/lapack/native/claqp2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqp2.f rename to examples/lapack/native/claqp2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqp2rk.f b/examples/lapack/native/claqp2rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqp2rk.f rename to examples/lapack/native/claqp2rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqp3rk.f b/examples/lapack/native/claqp3rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqp3rk.f rename to examples/lapack/native/claqp3rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqps.f b/examples/lapack/native/claqps.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqps.f rename to examples/lapack/native/claqps.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr0.f b/examples/lapack/native/claqr0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr0.f rename to examples/lapack/native/claqr0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr1.f b/examples/lapack/native/claqr1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr1.f rename to examples/lapack/native/claqr1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr2.f b/examples/lapack/native/claqr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr2.f rename to examples/lapack/native/claqr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr3.f b/examples/lapack/native/claqr3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr3.f rename to examples/lapack/native/claqr3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr4.f b/examples/lapack/native/claqr4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr4.f rename to examples/lapack/native/claqr4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr5.f b/examples/lapack/native/claqr5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqr5.f rename to examples/lapack/native/claqr5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqsb.f b/examples/lapack/native/claqsb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqsb.f rename to examples/lapack/native/claqsb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqsp.f b/examples/lapack/native/claqsp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqsp.f rename to examples/lapack/native/claqsp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqsy.f b/examples/lapack/native/claqsy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqsy.f rename to examples/lapack/native/claqsy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqz0.f b/examples/lapack/native/claqz0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqz0.f rename to examples/lapack/native/claqz0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqz1.f b/examples/lapack/native/claqz1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqz1.f rename to examples/lapack/native/claqz1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqz2.f b/examples/lapack/native/claqz2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqz2.f rename to examples/lapack/native/claqz2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqz3.f b/examples/lapack/native/claqz3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claqz3.f rename to examples/lapack/native/claqz3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clar1v.f b/examples/lapack/native/clar1v.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clar1v.f rename to examples/lapack/native/clar1v.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clar2v.f b/examples/lapack/native/clar2v.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clar2v.f rename to examples/lapack/native/clar2v.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarcm.f b/examples/lapack/native/clarcm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarcm.f rename to examples/lapack/native/clarcm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarf.f b/examples/lapack/native/clarf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarf.f rename to examples/lapack/native/clarf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarf1f.f b/examples/lapack/native/clarf1f.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarf1f.f rename to examples/lapack/native/clarf1f.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarf1l.f b/examples/lapack/native/clarf1l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarf1l.f rename to examples/lapack/native/clarf1l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfb.f b/examples/lapack/native/clarfb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfb.f rename to examples/lapack/native/clarfb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfb_gett.f b/examples/lapack/native/clarfb_gett.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfb_gett.f rename to examples/lapack/native/clarfb_gett.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfg.f b/examples/lapack/native/clarfg.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfg.f rename to examples/lapack/native/clarfg.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfgp.f b/examples/lapack/native/clarfgp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfgp.f rename to examples/lapack/native/clarfgp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarft.f b/examples/lapack/native/clarft.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarft.f rename to examples/lapack/native/clarft.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfx.f b/examples/lapack/native/clarfx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfx.f rename to examples/lapack/native/clarfx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfy.f b/examples/lapack/native/clarfy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarfy.f rename to examples/lapack/native/clarfy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clargv.f b/examples/lapack/native/clargv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clargv.f rename to examples/lapack/native/clargv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarnv.f b/examples/lapack/native/clarnv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarnv.f rename to examples/lapack/native/clarnv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarrv.f b/examples/lapack/native/clarrv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarrv.f rename to examples/lapack/native/clarrv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarscl2.f b/examples/lapack/native/clarscl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarscl2.f rename to examples/lapack/native/clarscl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clartg.f90 b/examples/lapack/native/clartg.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clartg.f90 rename to examples/lapack/native/clartg.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clartv.f b/examples/lapack/native/clartv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clartv.f rename to examples/lapack/native/clartv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarz.f b/examples/lapack/native/clarz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarz.f rename to examples/lapack/native/clarz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarzb.f b/examples/lapack/native/clarzb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarzb.f rename to examples/lapack/native/clarzb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarzt.f b/examples/lapack/native/clarzt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clarzt.f rename to examples/lapack/native/clarzt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clascl.f b/examples/lapack/native/clascl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clascl.f rename to examples/lapack/native/clascl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clascl2.f b/examples/lapack/native/clascl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clascl2.f rename to examples/lapack/native/clascl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claset.f b/examples/lapack/native/claset.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claset.f rename to examples/lapack/native/claset.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clasr.f b/examples/lapack/native/clasr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clasr.f rename to examples/lapack/native/clasr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/classq.f90 b/examples/lapack/native/classq.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/classq.f90 rename to examples/lapack/native/classq.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claswlq.f b/examples/lapack/native/claswlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claswlq.f rename to examples/lapack/native/claswlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claswp.f b/examples/lapack/native/claswp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claswp.f rename to examples/lapack/native/claswp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clasyf.f b/examples/lapack/native/clasyf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clasyf.f rename to examples/lapack/native/clasyf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clasyf_aa.f b/examples/lapack/native/clasyf_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clasyf_aa.f rename to examples/lapack/native/clasyf_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clasyf_rk.f b/examples/lapack/native/clasyf_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clasyf_rk.f rename to examples/lapack/native/clasyf_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clasyf_rook.f b/examples/lapack/native/clasyf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clasyf_rook.f rename to examples/lapack/native/clasyf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatbs.f b/examples/lapack/native/clatbs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatbs.f rename to examples/lapack/native/clatbs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatdf.f b/examples/lapack/native/clatdf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatdf.f rename to examples/lapack/native/clatdf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatps.f b/examples/lapack/native/clatps.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatps.f rename to examples/lapack/native/clatps.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatrd.f b/examples/lapack/native/clatrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatrd.f rename to examples/lapack/native/clatrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatrs.f b/examples/lapack/native/clatrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatrs.f rename to examples/lapack/native/clatrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatrs3.f b/examples/lapack/native/clatrs3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatrs3.f rename to examples/lapack/native/clatrs3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatrz.f b/examples/lapack/native/clatrz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatrz.f rename to examples/lapack/native/clatrz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatsqr.f b/examples/lapack/native/clatsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clatsqr.f rename to examples/lapack/native/clatsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claunhr_col_getrfnp.f b/examples/lapack/native/claunhr_col_getrfnp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claunhr_col_getrfnp.f rename to examples/lapack/native/claunhr_col_getrfnp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claunhr_col_getrfnp2.f b/examples/lapack/native/claunhr_col_getrfnp2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/claunhr_col_getrfnp2.f rename to examples/lapack/native/claunhr_col_getrfnp2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clauu2.f b/examples/lapack/native/clauu2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clauu2.f rename to examples/lapack/native/clauu2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clauum.f b/examples/lapack/native/clauum.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/clauum.f rename to examples/lapack/native/clauum.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbcon.f b/examples/lapack/native/cpbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbcon.f rename to examples/lapack/native/cpbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbequ.f b/examples/lapack/native/cpbequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbequ.f rename to examples/lapack/native/cpbequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbrfs.f b/examples/lapack/native/cpbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbrfs.f rename to examples/lapack/native/cpbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbstf.f b/examples/lapack/native/cpbstf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbstf.f rename to examples/lapack/native/cpbstf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbsv.f b/examples/lapack/native/cpbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbsv.f rename to examples/lapack/native/cpbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbsvx.f b/examples/lapack/native/cpbsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbsvx.f rename to examples/lapack/native/cpbsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbtf2.f b/examples/lapack/native/cpbtf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbtf2.f rename to examples/lapack/native/cpbtf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbtrf.f b/examples/lapack/native/cpbtrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbtrf.f rename to examples/lapack/native/cpbtrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbtrs.f b/examples/lapack/native/cpbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpbtrs.f rename to examples/lapack/native/cpbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpftrf.f b/examples/lapack/native/cpftrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpftrf.f rename to examples/lapack/native/cpftrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpftri.f b/examples/lapack/native/cpftri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpftri.f rename to examples/lapack/native/cpftri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpftrs.f b/examples/lapack/native/cpftrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpftrs.f rename to examples/lapack/native/cpftrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpocon.f b/examples/lapack/native/cpocon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpocon.f rename to examples/lapack/native/cpocon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpoequ.f b/examples/lapack/native/cpoequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpoequ.f rename to examples/lapack/native/cpoequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpoequb.f b/examples/lapack/native/cpoequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpoequb.f rename to examples/lapack/native/cpoequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cporfs.f b/examples/lapack/native/cporfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cporfs.f rename to examples/lapack/native/cporfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cporfsx.f b/examples/lapack/native/cporfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cporfsx.f rename to examples/lapack/native/cporfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cposv.f b/examples/lapack/native/cposv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cposv.f rename to examples/lapack/native/cposv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cposvx.f b/examples/lapack/native/cposvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cposvx.f rename to examples/lapack/native/cposvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cposvxx.f b/examples/lapack/native/cposvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cposvxx.f rename to examples/lapack/native/cposvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpotf2.f b/examples/lapack/native/cpotf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpotf2.f rename to examples/lapack/native/cpotf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpotrf.f b/examples/lapack/native/cpotrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpotrf.f rename to examples/lapack/native/cpotrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpotrf2.f b/examples/lapack/native/cpotrf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpotrf2.f rename to examples/lapack/native/cpotrf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpotri.f b/examples/lapack/native/cpotri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpotri.f rename to examples/lapack/native/cpotri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpotrs.f b/examples/lapack/native/cpotrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpotrs.f rename to examples/lapack/native/cpotrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cppcon.f b/examples/lapack/native/cppcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cppcon.f rename to examples/lapack/native/cppcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cppequ.f b/examples/lapack/native/cppequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cppequ.f rename to examples/lapack/native/cppequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpprfs.f b/examples/lapack/native/cpprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpprfs.f rename to examples/lapack/native/cpprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cppsv.f b/examples/lapack/native/cppsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cppsv.f rename to examples/lapack/native/cppsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cppsvx.f b/examples/lapack/native/cppsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cppsvx.f rename to examples/lapack/native/cppsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpptrf.f b/examples/lapack/native/cpptrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpptrf.f rename to examples/lapack/native/cpptrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpptri.f b/examples/lapack/native/cpptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpptri.f rename to examples/lapack/native/cpptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpptrs.f b/examples/lapack/native/cpptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpptrs.f rename to examples/lapack/native/cpptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpstf2.f b/examples/lapack/native/cpstf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpstf2.f rename to examples/lapack/native/cpstf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpstrf.f b/examples/lapack/native/cpstrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpstrf.f rename to examples/lapack/native/cpstrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cptcon.f b/examples/lapack/native/cptcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cptcon.f rename to examples/lapack/native/cptcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpteqr.f b/examples/lapack/native/cpteqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpteqr.f rename to examples/lapack/native/cpteqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cptrfs.f b/examples/lapack/native/cptrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cptrfs.f rename to examples/lapack/native/cptrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cptsv.f b/examples/lapack/native/cptsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cptsv.f rename to examples/lapack/native/cptsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cptsvx.f b/examples/lapack/native/cptsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cptsvx.f rename to examples/lapack/native/cptsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpttrf.f b/examples/lapack/native/cpttrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpttrf.f rename to examples/lapack/native/cpttrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpttrs.f b/examples/lapack/native/cpttrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cpttrs.f rename to examples/lapack/native/cpttrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cptts2.f b/examples/lapack/native/cptts2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cptts2.f rename to examples/lapack/native/cptts2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/crot.f b/examples/lapack/native/crot.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/crot.f rename to examples/lapack/native/crot.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/crscl.f b/examples/lapack/native/crscl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/crscl.f rename to examples/lapack/native/crscl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cspcon.f b/examples/lapack/native/cspcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cspcon.f rename to examples/lapack/native/cspcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cspmv.f b/examples/lapack/native/cspmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cspmv.f rename to examples/lapack/native/cspmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cspr.f b/examples/lapack/native/cspr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cspr.f rename to examples/lapack/native/cspr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csprfs.f b/examples/lapack/native/csprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csprfs.f rename to examples/lapack/native/csprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cspsv.f b/examples/lapack/native/cspsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cspsv.f rename to examples/lapack/native/cspsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cspsvx.f b/examples/lapack/native/cspsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cspsvx.f rename to examples/lapack/native/cspsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csptrf.f b/examples/lapack/native/csptrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csptrf.f rename to examples/lapack/native/csptrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csptri.f b/examples/lapack/native/csptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csptri.f rename to examples/lapack/native/csptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csptrs.f b/examples/lapack/native/csptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csptrs.f rename to examples/lapack/native/csptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csrscl.f b/examples/lapack/native/csrscl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csrscl.f rename to examples/lapack/native/csrscl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cstedc.f b/examples/lapack/native/cstedc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cstedc.f rename to examples/lapack/native/cstedc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cstegr.f b/examples/lapack/native/cstegr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cstegr.f rename to examples/lapack/native/cstegr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cstein.f b/examples/lapack/native/cstein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cstein.f rename to examples/lapack/native/cstein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cstemr.f b/examples/lapack/native/cstemr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cstemr.f rename to examples/lapack/native/cstemr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csteqr.f b/examples/lapack/native/csteqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csteqr.f rename to examples/lapack/native/csteqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csycon.f b/examples/lapack/native/csycon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csycon.f rename to examples/lapack/native/csycon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csycon_3.f b/examples/lapack/native/csycon_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csycon_3.f rename to examples/lapack/native/csycon_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csycon_rook.f b/examples/lapack/native/csycon_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csycon_rook.f rename to examples/lapack/native/csycon_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyconv.f b/examples/lapack/native/csyconv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyconv.f rename to examples/lapack/native/csyconv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyconvf.f b/examples/lapack/native/csyconvf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyconvf.f rename to examples/lapack/native/csyconvf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyconvf_rook.f b/examples/lapack/native/csyconvf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyconvf_rook.f rename to examples/lapack/native/csyconvf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyequb.f b/examples/lapack/native/csyequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyequb.f rename to examples/lapack/native/csyequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csymv.f b/examples/lapack/native/csymv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csymv.f rename to examples/lapack/native/csymv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyr.f b/examples/lapack/native/csyr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyr.f rename to examples/lapack/native/csyr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyrfs.f b/examples/lapack/native/csyrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyrfs.f rename to examples/lapack/native/csyrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyrfsx.f b/examples/lapack/native/csyrfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyrfsx.f rename to examples/lapack/native/csyrfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysv.f b/examples/lapack/native/csysv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysv.f rename to examples/lapack/native/csysv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysv_aa.f b/examples/lapack/native/csysv_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysv_aa.f rename to examples/lapack/native/csysv_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysv_aa_2stage.f b/examples/lapack/native/csysv_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysv_aa_2stage.f rename to examples/lapack/native/csysv_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysv_rk.f b/examples/lapack/native/csysv_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysv_rk.f rename to examples/lapack/native/csysv_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysv_rook.f b/examples/lapack/native/csysv_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysv_rook.f rename to examples/lapack/native/csysv_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysvx.f b/examples/lapack/native/csysvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysvx.f rename to examples/lapack/native/csysvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysvxx.f b/examples/lapack/native/csysvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csysvxx.f rename to examples/lapack/native/csysvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyswapr.f b/examples/lapack/native/csyswapr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csyswapr.f rename to examples/lapack/native/csyswapr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytf2.f b/examples/lapack/native/csytf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytf2.f rename to examples/lapack/native/csytf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytf2_rk.f b/examples/lapack/native/csytf2_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytf2_rk.f rename to examples/lapack/native/csytf2_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytf2_rook.f b/examples/lapack/native/csytf2_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytf2_rook.f rename to examples/lapack/native/csytf2_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrf.f b/examples/lapack/native/csytrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrf.f rename to examples/lapack/native/csytrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrf_aa.f b/examples/lapack/native/csytrf_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrf_aa.f rename to examples/lapack/native/csytrf_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrf_aa_2stage.f b/examples/lapack/native/csytrf_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrf_aa_2stage.f rename to examples/lapack/native/csytrf_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrf_rk.f b/examples/lapack/native/csytrf_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrf_rk.f rename to examples/lapack/native/csytrf_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrf_rook.f b/examples/lapack/native/csytrf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrf_rook.f rename to examples/lapack/native/csytrf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri.f b/examples/lapack/native/csytri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri.f rename to examples/lapack/native/csytri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri2.f b/examples/lapack/native/csytri2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri2.f rename to examples/lapack/native/csytri2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri2x.f b/examples/lapack/native/csytri2x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri2x.f rename to examples/lapack/native/csytri2x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri_3.f b/examples/lapack/native/csytri_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri_3.f rename to examples/lapack/native/csytri_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri_3x.f b/examples/lapack/native/csytri_3x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri_3x.f rename to examples/lapack/native/csytri_3x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri_rook.f b/examples/lapack/native/csytri_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytri_rook.f rename to examples/lapack/native/csytri_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs.f b/examples/lapack/native/csytrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs.f rename to examples/lapack/native/csytrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs2.f b/examples/lapack/native/csytrs2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs2.f rename to examples/lapack/native/csytrs2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs_3.f b/examples/lapack/native/csytrs_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs_3.f rename to examples/lapack/native/csytrs_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs_aa.f b/examples/lapack/native/csytrs_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs_aa.f rename to examples/lapack/native/csytrs_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs_aa_2stage.f b/examples/lapack/native/csytrs_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs_aa_2stage.f rename to examples/lapack/native/csytrs_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs_rook.f b/examples/lapack/native/csytrs_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/csytrs_rook.f rename to examples/lapack/native/csytrs_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctbcon.f b/examples/lapack/native/ctbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctbcon.f rename to examples/lapack/native/ctbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctbrfs.f b/examples/lapack/native/ctbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctbrfs.f rename to examples/lapack/native/ctbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctbtrs.f b/examples/lapack/native/ctbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctbtrs.f rename to examples/lapack/native/ctbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctfsm.f b/examples/lapack/native/ctfsm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctfsm.f rename to examples/lapack/native/ctfsm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctftri.f b/examples/lapack/native/ctftri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctftri.f rename to examples/lapack/native/ctftri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctfttp.f b/examples/lapack/native/ctfttp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctfttp.f rename to examples/lapack/native/ctfttp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctfttr.f b/examples/lapack/native/ctfttr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctfttr.f rename to examples/lapack/native/ctfttr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgevc.f b/examples/lapack/native/ctgevc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgevc.f rename to examples/lapack/native/ctgevc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgex2.f b/examples/lapack/native/ctgex2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgex2.f rename to examples/lapack/native/ctgex2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgexc.f b/examples/lapack/native/ctgexc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgexc.f rename to examples/lapack/native/ctgexc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgsen.f b/examples/lapack/native/ctgsen.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgsen.f rename to examples/lapack/native/ctgsen.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgsja.f b/examples/lapack/native/ctgsja.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgsja.f rename to examples/lapack/native/ctgsja.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgsna.f b/examples/lapack/native/ctgsna.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgsna.f rename to examples/lapack/native/ctgsna.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgsy2.f b/examples/lapack/native/ctgsy2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgsy2.f rename to examples/lapack/native/ctgsy2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgsyl.f b/examples/lapack/native/ctgsyl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctgsyl.f rename to examples/lapack/native/ctgsyl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpcon.f b/examples/lapack/native/ctpcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpcon.f rename to examples/lapack/native/ctpcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctplqt.f b/examples/lapack/native/ctplqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctplqt.f rename to examples/lapack/native/ctplqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctplqt2.f b/examples/lapack/native/ctplqt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctplqt2.f rename to examples/lapack/native/ctplqt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpmlqt.f b/examples/lapack/native/ctpmlqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpmlqt.f rename to examples/lapack/native/ctpmlqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpmqrt.f b/examples/lapack/native/ctpmqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpmqrt.f rename to examples/lapack/native/ctpmqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpqrt.f b/examples/lapack/native/ctpqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpqrt.f rename to examples/lapack/native/ctpqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpqrt2.f b/examples/lapack/native/ctpqrt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpqrt2.f rename to examples/lapack/native/ctpqrt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctprfb.f b/examples/lapack/native/ctprfb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctprfb.f rename to examples/lapack/native/ctprfb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctprfs.f b/examples/lapack/native/ctprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctprfs.f rename to examples/lapack/native/ctprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctptri.f b/examples/lapack/native/ctptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctptri.f rename to examples/lapack/native/ctptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctptrs.f b/examples/lapack/native/ctptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctptrs.f rename to examples/lapack/native/ctptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpttf.f b/examples/lapack/native/ctpttf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpttf.f rename to examples/lapack/native/ctpttf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpttr.f b/examples/lapack/native/ctpttr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctpttr.f rename to examples/lapack/native/ctpttr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrcon.f b/examples/lapack/native/ctrcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrcon.f rename to examples/lapack/native/ctrcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrevc.f b/examples/lapack/native/ctrevc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrevc.f rename to examples/lapack/native/ctrevc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrevc3.f b/examples/lapack/native/ctrevc3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrevc3.f rename to examples/lapack/native/ctrevc3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrexc.f b/examples/lapack/native/ctrexc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrexc.f rename to examples/lapack/native/ctrexc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrrfs.f b/examples/lapack/native/ctrrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrrfs.f rename to examples/lapack/native/ctrrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrsen.f b/examples/lapack/native/ctrsen.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrsen.f rename to examples/lapack/native/ctrsen.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrsna.f b/examples/lapack/native/ctrsna.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrsna.f rename to examples/lapack/native/ctrsna.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrsyl.f b/examples/lapack/native/ctrsyl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrsyl.f rename to examples/lapack/native/ctrsyl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrsyl3.f b/examples/lapack/native/ctrsyl3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrsyl3.f rename to examples/lapack/native/ctrsyl3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrti2.f b/examples/lapack/native/ctrti2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrti2.f rename to examples/lapack/native/ctrti2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrtri.f b/examples/lapack/native/ctrtri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrtri.f rename to examples/lapack/native/ctrtri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrtrs.f b/examples/lapack/native/ctrtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrtrs.f rename to examples/lapack/native/ctrtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrttf.f b/examples/lapack/native/ctrttf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrttf.f rename to examples/lapack/native/ctrttf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrttp.f b/examples/lapack/native/ctrttp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctrttp.f rename to examples/lapack/native/ctrttp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctzrzf.f b/examples/lapack/native/ctzrzf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ctzrzf.f rename to examples/lapack/native/ctzrzf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb.f b/examples/lapack/native/cunbdb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb.f rename to examples/lapack/native/cunbdb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb1.f b/examples/lapack/native/cunbdb1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb1.f rename to examples/lapack/native/cunbdb1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb2.f b/examples/lapack/native/cunbdb2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb2.f rename to examples/lapack/native/cunbdb2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb3.f b/examples/lapack/native/cunbdb3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb3.f rename to examples/lapack/native/cunbdb3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb4.f b/examples/lapack/native/cunbdb4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb4.f rename to examples/lapack/native/cunbdb4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb5.f b/examples/lapack/native/cunbdb5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb5.f rename to examples/lapack/native/cunbdb5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb6.f b/examples/lapack/native/cunbdb6.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunbdb6.f rename to examples/lapack/native/cunbdb6.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cuncsd.f b/examples/lapack/native/cuncsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cuncsd.f rename to examples/lapack/native/cuncsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cuncsd2by1.f b/examples/lapack/native/cuncsd2by1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cuncsd2by1.f rename to examples/lapack/native/cuncsd2by1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cung2l.f b/examples/lapack/native/cung2l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cung2l.f rename to examples/lapack/native/cung2l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cung2r.f b/examples/lapack/native/cung2r.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cung2r.f rename to examples/lapack/native/cung2r.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungbr.f b/examples/lapack/native/cungbr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungbr.f rename to examples/lapack/native/cungbr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunghr.f b/examples/lapack/native/cunghr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunghr.f rename to examples/lapack/native/cunghr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungl2.f b/examples/lapack/native/cungl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungl2.f rename to examples/lapack/native/cungl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunglq.f b/examples/lapack/native/cunglq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunglq.f rename to examples/lapack/native/cunglq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungql.f b/examples/lapack/native/cungql.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungql.f rename to examples/lapack/native/cungql.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungqr.f b/examples/lapack/native/cungqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungqr.f rename to examples/lapack/native/cungqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungr2.f b/examples/lapack/native/cungr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungr2.f rename to examples/lapack/native/cungr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungrq.f b/examples/lapack/native/cungrq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungrq.f rename to examples/lapack/native/cungrq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungtr.f b/examples/lapack/native/cungtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungtr.f rename to examples/lapack/native/cungtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungtsqr.f b/examples/lapack/native/cungtsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungtsqr.f rename to examples/lapack/native/cungtsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungtsqr_row.f b/examples/lapack/native/cungtsqr_row.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cungtsqr_row.f rename to examples/lapack/native/cungtsqr_row.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunhr_col.f b/examples/lapack/native/cunhr_col.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunhr_col.f rename to examples/lapack/native/cunhr_col.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunm22.f b/examples/lapack/native/cunm22.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunm22.f rename to examples/lapack/native/cunm22.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunm2l.f b/examples/lapack/native/cunm2l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunm2l.f rename to examples/lapack/native/cunm2l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunm2r.f b/examples/lapack/native/cunm2r.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunm2r.f rename to examples/lapack/native/cunm2r.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmbr.f b/examples/lapack/native/cunmbr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmbr.f rename to examples/lapack/native/cunmbr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmhr.f b/examples/lapack/native/cunmhr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmhr.f rename to examples/lapack/native/cunmhr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunml2.f b/examples/lapack/native/cunml2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunml2.f rename to examples/lapack/native/cunml2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmlq.f b/examples/lapack/native/cunmlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmlq.f rename to examples/lapack/native/cunmlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmql.f b/examples/lapack/native/cunmql.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmql.f rename to examples/lapack/native/cunmql.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmqr.f b/examples/lapack/native/cunmqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmqr.f rename to examples/lapack/native/cunmqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmr2.f b/examples/lapack/native/cunmr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmr2.f rename to examples/lapack/native/cunmr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmr3.f b/examples/lapack/native/cunmr3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmr3.f rename to examples/lapack/native/cunmr3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmrq.f b/examples/lapack/native/cunmrq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmrq.f rename to examples/lapack/native/cunmrq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmrz.f b/examples/lapack/native/cunmrz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmrz.f rename to examples/lapack/native/cunmrz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmtr.f b/examples/lapack/native/cunmtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cunmtr.f rename to examples/lapack/native/cunmtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cupgtr.f b/examples/lapack/native/cupgtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cupgtr.f rename to examples/lapack/native/cupgtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cupmtr.f b/examples/lapack/native/cupmtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/cupmtr.f rename to examples/lapack/native/cupmtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dbbcsd.f b/examples/lapack/native/dbbcsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dbbcsd.f rename to examples/lapack/native/dbbcsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dbdsdc.f b/examples/lapack/native/dbdsdc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dbdsdc.f rename to examples/lapack/native/dbdsdc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dbdsqr.f b/examples/lapack/native/dbdsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dbdsqr.f rename to examples/lapack/native/dbdsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dbdsvdx.f b/examples/lapack/native/dbdsvdx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dbdsvdx.f rename to examples/lapack/native/dbdsvdx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ddisna.f b/examples/lapack/native/ddisna.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ddisna.f rename to examples/lapack/native/ddisna.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbbrd.f b/examples/lapack/native/dgbbrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbbrd.f rename to examples/lapack/native/dgbbrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbcon.f b/examples/lapack/native/dgbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbcon.f rename to examples/lapack/native/dgbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbequ.f b/examples/lapack/native/dgbequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbequ.f rename to examples/lapack/native/dgbequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbequb.f b/examples/lapack/native/dgbequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbequb.f rename to examples/lapack/native/dgbequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbrfs.f b/examples/lapack/native/dgbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbrfs.f rename to examples/lapack/native/dgbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbrfsx.f b/examples/lapack/native/dgbrfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbrfsx.f rename to examples/lapack/native/dgbrfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbsv.f b/examples/lapack/native/dgbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbsv.f rename to examples/lapack/native/dgbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbsvx.f b/examples/lapack/native/dgbsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbsvx.f rename to examples/lapack/native/dgbsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbsvxx.f b/examples/lapack/native/dgbsvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbsvxx.f rename to examples/lapack/native/dgbsvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbtf2.f b/examples/lapack/native/dgbtf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbtf2.f rename to examples/lapack/native/dgbtf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbtrf.f b/examples/lapack/native/dgbtrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbtrf.f rename to examples/lapack/native/dgbtrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbtrs.f b/examples/lapack/native/dgbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgbtrs.f rename to examples/lapack/native/dgbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgebak.f b/examples/lapack/native/dgebak.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgebak.f rename to examples/lapack/native/dgebak.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgebal.f b/examples/lapack/native/dgebal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgebal.f rename to examples/lapack/native/dgebal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgebd2.f b/examples/lapack/native/dgebd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgebd2.f rename to examples/lapack/native/dgebd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgebrd.f b/examples/lapack/native/dgebrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgebrd.f rename to examples/lapack/native/dgebrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgecon.f b/examples/lapack/native/dgecon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgecon.f rename to examples/lapack/native/dgecon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgedmd.f90 b/examples/lapack/native/dgedmd.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgedmd.f90 rename to examples/lapack/native/dgedmd.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgedmdq.f90 b/examples/lapack/native/dgedmdq.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgedmdq.f90 rename to examples/lapack/native/dgedmdq.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeequ.f b/examples/lapack/native/dgeequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeequ.f rename to examples/lapack/native/dgeequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeequb.f b/examples/lapack/native/dgeequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeequb.f rename to examples/lapack/native/dgeequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgees.f b/examples/lapack/native/dgees.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgees.f rename to examples/lapack/native/dgees.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeesx.f b/examples/lapack/native/dgeesx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeesx.f rename to examples/lapack/native/dgeesx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeev.f b/examples/lapack/native/dgeev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeev.f rename to examples/lapack/native/dgeev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeevx.f b/examples/lapack/native/dgeevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeevx.f rename to examples/lapack/native/dgeevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgehd2.f b/examples/lapack/native/dgehd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgehd2.f rename to examples/lapack/native/dgehd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgehrd.f b/examples/lapack/native/dgehrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgehrd.f rename to examples/lapack/native/dgehrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgejsv.f b/examples/lapack/native/dgejsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgejsv.f rename to examples/lapack/native/dgejsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelq.f b/examples/lapack/native/dgelq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelq.f rename to examples/lapack/native/dgelq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelq2.f b/examples/lapack/native/dgelq2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelq2.f rename to examples/lapack/native/dgelq2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelqf.f b/examples/lapack/native/dgelqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelqf.f rename to examples/lapack/native/dgelqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelqt.f b/examples/lapack/native/dgelqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelqt.f rename to examples/lapack/native/dgelqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelqt3.f b/examples/lapack/native/dgelqt3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelqt3.f rename to examples/lapack/native/dgelqt3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgels.f b/examples/lapack/native/dgels.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgels.f rename to examples/lapack/native/dgels.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelsd.f b/examples/lapack/native/dgelsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelsd.f rename to examples/lapack/native/dgelsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelss.f b/examples/lapack/native/dgelss.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelss.f rename to examples/lapack/native/dgelss.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelst.f b/examples/lapack/native/dgelst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelst.f rename to examples/lapack/native/dgelst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelsy.f b/examples/lapack/native/dgelsy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgelsy.f rename to examples/lapack/native/dgelsy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgemlq.f b/examples/lapack/native/dgemlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgemlq.f rename to examples/lapack/native/dgemlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgemlqt.f b/examples/lapack/native/dgemlqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgemlqt.f rename to examples/lapack/native/dgemlqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgemqr.f b/examples/lapack/native/dgemqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgemqr.f rename to examples/lapack/native/dgemqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgemqrt.f b/examples/lapack/native/dgemqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgemqrt.f rename to examples/lapack/native/dgemqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeql2.f b/examples/lapack/native/dgeql2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeql2.f rename to examples/lapack/native/dgeql2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqlf.f b/examples/lapack/native/dgeqlf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqlf.f rename to examples/lapack/native/dgeqlf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqp3.f b/examples/lapack/native/dgeqp3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqp3.f rename to examples/lapack/native/dgeqp3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqp3rk.f b/examples/lapack/native/dgeqp3rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqp3rk.f rename to examples/lapack/native/dgeqp3rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqr.f b/examples/lapack/native/dgeqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqr.f rename to examples/lapack/native/dgeqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqr2.f b/examples/lapack/native/dgeqr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqr2.f rename to examples/lapack/native/dgeqr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqr2p.f b/examples/lapack/native/dgeqr2p.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqr2p.f rename to examples/lapack/native/dgeqr2p.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqrf.f b/examples/lapack/native/dgeqrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqrf.f rename to examples/lapack/native/dgeqrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqrfp.f b/examples/lapack/native/dgeqrfp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqrfp.f rename to examples/lapack/native/dgeqrfp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqrt.f b/examples/lapack/native/dgeqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqrt.f rename to examples/lapack/native/dgeqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqrt2.f b/examples/lapack/native/dgeqrt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqrt2.f rename to examples/lapack/native/dgeqrt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqrt3.f b/examples/lapack/native/dgeqrt3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgeqrt3.f rename to examples/lapack/native/dgeqrt3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgerfs.f b/examples/lapack/native/dgerfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgerfs.f rename to examples/lapack/native/dgerfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgerfsx.f b/examples/lapack/native/dgerfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgerfsx.f rename to examples/lapack/native/dgerfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgerq2.f b/examples/lapack/native/dgerq2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgerq2.f rename to examples/lapack/native/dgerq2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgerqf.f b/examples/lapack/native/dgerqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgerqf.f rename to examples/lapack/native/dgerqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesc2.f b/examples/lapack/native/dgesc2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesc2.f rename to examples/lapack/native/dgesc2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesdd.f b/examples/lapack/native/dgesdd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesdd.f rename to examples/lapack/native/dgesdd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesv.f b/examples/lapack/native/dgesv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesv.f rename to examples/lapack/native/dgesv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvd.f b/examples/lapack/native/dgesvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvd.f rename to examples/lapack/native/dgesvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvdq.f b/examples/lapack/native/dgesvdq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvdq.f rename to examples/lapack/native/dgesvdq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvdx.f b/examples/lapack/native/dgesvdx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvdx.f rename to examples/lapack/native/dgesvdx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvj.f b/examples/lapack/native/dgesvj.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvj.f rename to examples/lapack/native/dgesvj.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvx.f b/examples/lapack/native/dgesvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvx.f rename to examples/lapack/native/dgesvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvxx.f b/examples/lapack/native/dgesvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgesvxx.f rename to examples/lapack/native/dgesvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetc2.f b/examples/lapack/native/dgetc2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetc2.f rename to examples/lapack/native/dgetc2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetf2.f b/examples/lapack/native/dgetf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetf2.f rename to examples/lapack/native/dgetf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetrf.f b/examples/lapack/native/dgetrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetrf.f rename to examples/lapack/native/dgetrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetrf2.f b/examples/lapack/native/dgetrf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetrf2.f rename to examples/lapack/native/dgetrf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetri.f b/examples/lapack/native/dgetri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetri.f rename to examples/lapack/native/dgetri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetrs.f b/examples/lapack/native/dgetrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetrs.f rename to examples/lapack/native/dgetrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetsls.f b/examples/lapack/native/dgetsls.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetsls.f rename to examples/lapack/native/dgetsls.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetsqrhrt.f b/examples/lapack/native/dgetsqrhrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgetsqrhrt.f rename to examples/lapack/native/dgetsqrhrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggbak.f b/examples/lapack/native/dggbak.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggbak.f rename to examples/lapack/native/dggbak.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggbal.f b/examples/lapack/native/dggbal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggbal.f rename to examples/lapack/native/dggbal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgges.f b/examples/lapack/native/dgges.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgges.f rename to examples/lapack/native/dgges.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgges3.f b/examples/lapack/native/dgges3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgges3.f rename to examples/lapack/native/dgges3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggesx.f b/examples/lapack/native/dggesx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggesx.f rename to examples/lapack/native/dggesx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggev.f b/examples/lapack/native/dggev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggev.f rename to examples/lapack/native/dggev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggev3.f b/examples/lapack/native/dggev3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggev3.f rename to examples/lapack/native/dggev3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggevx.f b/examples/lapack/native/dggevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggevx.f rename to examples/lapack/native/dggevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggglm.f b/examples/lapack/native/dggglm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggglm.f rename to examples/lapack/native/dggglm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgghd3.f b/examples/lapack/native/dgghd3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgghd3.f rename to examples/lapack/native/dgghd3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgghrd.f b/examples/lapack/native/dgghrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgghrd.f rename to examples/lapack/native/dgghrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgglse.f b/examples/lapack/native/dgglse.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgglse.f rename to examples/lapack/native/dgglse.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggqrf.f b/examples/lapack/native/dggqrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggqrf.f rename to examples/lapack/native/dggqrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggrqf.f b/examples/lapack/native/dggrqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggrqf.f rename to examples/lapack/native/dggrqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggsvd3.f b/examples/lapack/native/dggsvd3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggsvd3.f rename to examples/lapack/native/dggsvd3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggsvp3.f b/examples/lapack/native/dggsvp3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dggsvp3.f rename to examples/lapack/native/dggsvp3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgsvj0.f b/examples/lapack/native/dgsvj0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgsvj0.f rename to examples/lapack/native/dgsvj0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgsvj1.f b/examples/lapack/native/dgsvj1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgsvj1.f rename to examples/lapack/native/dgsvj1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgtcon.f b/examples/lapack/native/dgtcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgtcon.f rename to examples/lapack/native/dgtcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgtrfs.f b/examples/lapack/native/dgtrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgtrfs.f rename to examples/lapack/native/dgtrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgtsv.f b/examples/lapack/native/dgtsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgtsv.f rename to examples/lapack/native/dgtsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgtsvx.f b/examples/lapack/native/dgtsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgtsvx.f rename to examples/lapack/native/dgtsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgttrf.f b/examples/lapack/native/dgttrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgttrf.f rename to examples/lapack/native/dgttrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgttrs.f b/examples/lapack/native/dgttrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgttrs.f rename to examples/lapack/native/dgttrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgtts2.f b/examples/lapack/native/dgtts2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dgtts2.f rename to examples/lapack/native/dgtts2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dhgeqz.f b/examples/lapack/native/dhgeqz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dhgeqz.f rename to examples/lapack/native/dhgeqz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dhsein.f b/examples/lapack/native/dhsein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dhsein.f rename to examples/lapack/native/dhsein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dhseqr.f b/examples/lapack/native/dhseqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dhseqr.f rename to examples/lapack/native/dhseqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/disnan.f b/examples/lapack/native/disnan.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/disnan.f rename to examples/lapack/native/disnan.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gbamv.f b/examples/lapack/native/dla_gbamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gbamv.f rename to examples/lapack/native/dla_gbamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gbrcond.f b/examples/lapack/native/dla_gbrcond.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gbrcond.f rename to examples/lapack/native/dla_gbrcond.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gbrfsx_extended.f b/examples/lapack/native/dla_gbrfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gbrfsx_extended.f rename to examples/lapack/native/dla_gbrfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gbrpvgrw.f b/examples/lapack/native/dla_gbrpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gbrpvgrw.f rename to examples/lapack/native/dla_gbrpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_geamv.f b/examples/lapack/native/dla_geamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_geamv.f rename to examples/lapack/native/dla_geamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gercond.f b/examples/lapack/native/dla_gercond.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gercond.f rename to examples/lapack/native/dla_gercond.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gerfsx_extended.f b/examples/lapack/native/dla_gerfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gerfsx_extended.f rename to examples/lapack/native/dla_gerfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gerpvgrw.f b/examples/lapack/native/dla_gerpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_gerpvgrw.f rename to examples/lapack/native/dla_gerpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_lin_berr.f b/examples/lapack/native/dla_lin_berr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_lin_berr.f rename to examples/lapack/native/dla_lin_berr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_porcond.f b/examples/lapack/native/dla_porcond.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_porcond.f rename to examples/lapack/native/dla_porcond.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_porfsx_extended.f b/examples/lapack/native/dla_porfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_porfsx_extended.f rename to examples/lapack/native/dla_porfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_porpvgrw.f b/examples/lapack/native/dla_porpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_porpvgrw.f rename to examples/lapack/native/dla_porpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_syamv.f b/examples/lapack/native/dla_syamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_syamv.f rename to examples/lapack/native/dla_syamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_syrcond.f b/examples/lapack/native/dla_syrcond.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_syrcond.f rename to examples/lapack/native/dla_syrcond.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_syrfsx_extended.f b/examples/lapack/native/dla_syrfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_syrfsx_extended.f rename to examples/lapack/native/dla_syrfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_syrpvgrw.f b/examples/lapack/native/dla_syrpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_syrpvgrw.f rename to examples/lapack/native/dla_syrpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_wwaddw.f b/examples/lapack/native/dla_wwaddw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dla_wwaddw.f rename to examples/lapack/native/dla_wwaddw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlabad.f b/examples/lapack/native/dlabad.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlabad.f rename to examples/lapack/native/dlabad.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlabrd.f b/examples/lapack/native/dlabrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlabrd.f rename to examples/lapack/native/dlabrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlacn2.f b/examples/lapack/native/dlacn2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlacn2.f rename to examples/lapack/native/dlacn2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlacon.f b/examples/lapack/native/dlacon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlacon.f rename to examples/lapack/native/dlacon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlacpy.f b/examples/lapack/native/dlacpy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlacpy.f rename to examples/lapack/native/dlacpy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dladiv.f b/examples/lapack/native/dladiv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dladiv.f rename to examples/lapack/native/dladiv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlae2.f b/examples/lapack/native/dlae2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlae2.f rename to examples/lapack/native/dlae2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaebz.f b/examples/lapack/native/dlaebz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaebz.f rename to examples/lapack/native/dlaebz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed0.f b/examples/lapack/native/dlaed0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed0.f rename to examples/lapack/native/dlaed0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed1.f b/examples/lapack/native/dlaed1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed1.f rename to examples/lapack/native/dlaed1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed2.f b/examples/lapack/native/dlaed2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed2.f rename to examples/lapack/native/dlaed2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed3.f b/examples/lapack/native/dlaed3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed3.f rename to examples/lapack/native/dlaed3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed4.f b/examples/lapack/native/dlaed4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed4.f rename to examples/lapack/native/dlaed4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed5.f b/examples/lapack/native/dlaed5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed5.f rename to examples/lapack/native/dlaed5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed6.f b/examples/lapack/native/dlaed6.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed6.f rename to examples/lapack/native/dlaed6.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed7.f b/examples/lapack/native/dlaed7.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed7.f rename to examples/lapack/native/dlaed7.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed8.f b/examples/lapack/native/dlaed8.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed8.f rename to examples/lapack/native/dlaed8.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed9.f b/examples/lapack/native/dlaed9.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaed9.f rename to examples/lapack/native/dlaed9.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaeda.f b/examples/lapack/native/dlaeda.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaeda.f rename to examples/lapack/native/dlaeda.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaein.f b/examples/lapack/native/dlaein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaein.f rename to examples/lapack/native/dlaein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaev2.f b/examples/lapack/native/dlaev2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaev2.f rename to examples/lapack/native/dlaev2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaexc.f b/examples/lapack/native/dlaexc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaexc.f rename to examples/lapack/native/dlaexc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlag2.f b/examples/lapack/native/dlag2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlag2.f rename to examples/lapack/native/dlag2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlag2s.f b/examples/lapack/native/dlag2s.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlag2s.f rename to examples/lapack/native/dlag2s.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlags2.f b/examples/lapack/native/dlags2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlags2.f rename to examples/lapack/native/dlags2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlagtf.f b/examples/lapack/native/dlagtf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlagtf.f rename to examples/lapack/native/dlagtf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlagtm.f b/examples/lapack/native/dlagtm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlagtm.f rename to examples/lapack/native/dlagtm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlagts.f b/examples/lapack/native/dlagts.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlagts.f rename to examples/lapack/native/dlagts.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlagv2.f b/examples/lapack/native/dlagv2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlagv2.f rename to examples/lapack/native/dlagv2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlahqr.f b/examples/lapack/native/dlahqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlahqr.f rename to examples/lapack/native/dlahqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlahr2.f b/examples/lapack/native/dlahr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlahr2.f rename to examples/lapack/native/dlahr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaic1.f b/examples/lapack/native/dlaic1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaic1.f rename to examples/lapack/native/dlaic1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaisnan.f b/examples/lapack/native/dlaisnan.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaisnan.f rename to examples/lapack/native/dlaisnan.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaln2.f b/examples/lapack/native/dlaln2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaln2.f rename to examples/lapack/native/dlaln2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlals0.f b/examples/lapack/native/dlals0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlals0.f rename to examples/lapack/native/dlals0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlalsa.f b/examples/lapack/native/dlalsa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlalsa.f rename to examples/lapack/native/dlalsa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlalsd.f b/examples/lapack/native/dlalsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlalsd.f rename to examples/lapack/native/dlalsd.f diff --git a/examples/lapack/native/dlamch.f b/examples/lapack/native/dlamch.f new file mode 100644 index 000000000..6d2e24e31 --- /dev/null +++ b/examples/lapack/native/dlamch.f @@ -0,0 +1,39 @@ + DOUBLE PRECISION FUNCTION DLAMCH( CMACH ) + CHARACTER CMACH + DOUBLE PRECISION EPS, SFMIN, BASE, PREC, RND, TINYVAL, HUGEVAL + INTEGER NDIG, MINEXP, MAXEXP + EPS = EPSILON( 0.0D0 ) + BASE = DBLE( RADIX( 0.0D0 ) ) + NDIG = DIGITS( 0.0D0 ) + MINEXP = MINEXPONENT( 0.0D0 ) + MAXEXP = MAXEXPONENT( 0.0D0 ) + TINYVAL = TINY( 0.0D0 ) + HUGEVAL = HUGE( 0.0D0 ) + SFMIN = TINYVAL + PREC = EPS * BASE + RND = 1.0D0 + IF ( CMACH .EQ. 'E' .OR. CMACH .EQ. 'e' ) THEN + DLAMCH = EPS + ELSE IF ( CMACH .EQ. 'S' .OR. CMACH .EQ. 's' ) THEN + DLAMCH = SFMIN + ELSE IF ( CMACH .EQ. 'B' .OR. CMACH .EQ. 'b' ) THEN + DLAMCH = BASE + ELSE IF ( CMACH .EQ. 'P' .OR. CMACH .EQ. 'p' ) THEN + DLAMCH = PREC + ELSE IF ( CMACH .EQ. 'N' .OR. CMACH .EQ. 'n' ) THEN + DLAMCH = DBLE( NDIG ) + ELSE IF ( CMACH .EQ. 'R' .OR. CMACH .EQ. 'r' ) THEN + DLAMCH = RND + ELSE IF ( CMACH .EQ. 'M' .OR. CMACH .EQ. 'm' ) THEN + DLAMCH = DBLE( MINEXP ) + ELSE IF ( CMACH .EQ. 'U' .OR. CMACH .EQ. 'u' ) THEN + DLAMCH = TINYVAL + ELSE IF ( CMACH .EQ. 'L' .OR. CMACH .EQ. 'l' ) THEN + DLAMCH = DBLE( MAXEXP ) + ELSE IF ( CMACH .EQ. 'O' .OR. CMACH .EQ. 'o' ) THEN + DLAMCH = HUGEVAL + ELSE + DLAMCH = 0.0D0 + END IF + RETURN + END diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlamrg.f b/examples/lapack/native/dlamrg.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlamrg.f rename to examples/lapack/native/dlamrg.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlamswlq.f b/examples/lapack/native/dlamswlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlamswlq.f rename to examples/lapack/native/dlamswlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlamtsqr.f b/examples/lapack/native/dlamtsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlamtsqr.f rename to examples/lapack/native/dlamtsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaneg.f b/examples/lapack/native/dlaneg.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaneg.f rename to examples/lapack/native/dlaneg.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlangb.f b/examples/lapack/native/dlangb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlangb.f rename to examples/lapack/native/dlangb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlange.f b/examples/lapack/native/dlange.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlange.f rename to examples/lapack/native/dlange.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlangt.f b/examples/lapack/native/dlangt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlangt.f rename to examples/lapack/native/dlangt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlanhs.f b/examples/lapack/native/dlanhs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlanhs.f rename to examples/lapack/native/dlanhs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlansb.f b/examples/lapack/native/dlansb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlansb.f rename to examples/lapack/native/dlansb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlansf.f b/examples/lapack/native/dlansf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlansf.f rename to examples/lapack/native/dlansf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlansp.f b/examples/lapack/native/dlansp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlansp.f rename to examples/lapack/native/dlansp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlanst.f b/examples/lapack/native/dlanst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlanst.f rename to examples/lapack/native/dlanst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlansy.f b/examples/lapack/native/dlansy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlansy.f rename to examples/lapack/native/dlansy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlantb.f b/examples/lapack/native/dlantb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlantb.f rename to examples/lapack/native/dlantb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlantp.f b/examples/lapack/native/dlantp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlantp.f rename to examples/lapack/native/dlantp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlantr.f b/examples/lapack/native/dlantr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlantr.f rename to examples/lapack/native/dlantr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlanv2.f b/examples/lapack/native/dlanv2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlanv2.f rename to examples/lapack/native/dlanv2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaorhr_col_getrfnp.f b/examples/lapack/native/dlaorhr_col_getrfnp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaorhr_col_getrfnp.f rename to examples/lapack/native/dlaorhr_col_getrfnp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaorhr_col_getrfnp2.f b/examples/lapack/native/dlaorhr_col_getrfnp2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaorhr_col_getrfnp2.f rename to examples/lapack/native/dlaorhr_col_getrfnp2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlapll.f b/examples/lapack/native/dlapll.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlapll.f rename to examples/lapack/native/dlapll.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlapmr.f b/examples/lapack/native/dlapmr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlapmr.f rename to examples/lapack/native/dlapmr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlapmt.f b/examples/lapack/native/dlapmt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlapmt.f rename to examples/lapack/native/dlapmt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlapy2.f b/examples/lapack/native/dlapy2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlapy2.f rename to examples/lapack/native/dlapy2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlapy3.f b/examples/lapack/native/dlapy3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlapy3.f rename to examples/lapack/native/dlapy3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqgb.f b/examples/lapack/native/dlaqgb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqgb.f rename to examples/lapack/native/dlaqgb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqge.f b/examples/lapack/native/dlaqge.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqge.f rename to examples/lapack/native/dlaqge.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqp2.f b/examples/lapack/native/dlaqp2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqp2.f rename to examples/lapack/native/dlaqp2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqp2rk.f b/examples/lapack/native/dlaqp2rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqp2rk.f rename to examples/lapack/native/dlaqp2rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqp3rk.f b/examples/lapack/native/dlaqp3rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqp3rk.f rename to examples/lapack/native/dlaqp3rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqps.f b/examples/lapack/native/dlaqps.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqps.f rename to examples/lapack/native/dlaqps.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr0.f b/examples/lapack/native/dlaqr0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr0.f rename to examples/lapack/native/dlaqr0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr1.f b/examples/lapack/native/dlaqr1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr1.f rename to examples/lapack/native/dlaqr1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr2.f b/examples/lapack/native/dlaqr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr2.f rename to examples/lapack/native/dlaqr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr3.f b/examples/lapack/native/dlaqr3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr3.f rename to examples/lapack/native/dlaqr3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr4.f b/examples/lapack/native/dlaqr4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr4.f rename to examples/lapack/native/dlaqr4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr5.f b/examples/lapack/native/dlaqr5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqr5.f rename to examples/lapack/native/dlaqr5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqsb.f b/examples/lapack/native/dlaqsb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqsb.f rename to examples/lapack/native/dlaqsb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqsp.f b/examples/lapack/native/dlaqsp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqsp.f rename to examples/lapack/native/dlaqsp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqsy.f b/examples/lapack/native/dlaqsy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqsy.f rename to examples/lapack/native/dlaqsy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqtr.f b/examples/lapack/native/dlaqtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqtr.f rename to examples/lapack/native/dlaqtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqz0.f b/examples/lapack/native/dlaqz0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqz0.f rename to examples/lapack/native/dlaqz0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqz1.f b/examples/lapack/native/dlaqz1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqz1.f rename to examples/lapack/native/dlaqz1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqz2.f b/examples/lapack/native/dlaqz2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqz2.f rename to examples/lapack/native/dlaqz2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqz3.f b/examples/lapack/native/dlaqz3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqz3.f rename to examples/lapack/native/dlaqz3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqz4.f b/examples/lapack/native/dlaqz4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaqz4.f rename to examples/lapack/native/dlaqz4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlar1v.f b/examples/lapack/native/dlar1v.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlar1v.f rename to examples/lapack/native/dlar1v.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlar2v.f b/examples/lapack/native/dlar2v.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlar2v.f rename to examples/lapack/native/dlar2v.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarf.f b/examples/lapack/native/dlarf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarf.f rename to examples/lapack/native/dlarf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarf1f.f b/examples/lapack/native/dlarf1f.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarf1f.f rename to examples/lapack/native/dlarf1f.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarf1l.f b/examples/lapack/native/dlarf1l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarf1l.f rename to examples/lapack/native/dlarf1l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfb.f b/examples/lapack/native/dlarfb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfb.f rename to examples/lapack/native/dlarfb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfb_gett.f b/examples/lapack/native/dlarfb_gett.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfb_gett.f rename to examples/lapack/native/dlarfb_gett.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfg.f b/examples/lapack/native/dlarfg.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfg.f rename to examples/lapack/native/dlarfg.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfgp.f b/examples/lapack/native/dlarfgp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfgp.f rename to examples/lapack/native/dlarfgp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarft.f b/examples/lapack/native/dlarft.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarft.f rename to examples/lapack/native/dlarft.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfx.f b/examples/lapack/native/dlarfx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfx.f rename to examples/lapack/native/dlarfx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfy.f b/examples/lapack/native/dlarfy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarfy.f rename to examples/lapack/native/dlarfy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlargv.f b/examples/lapack/native/dlargv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlargv.f rename to examples/lapack/native/dlargv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarmm.f b/examples/lapack/native/dlarmm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarmm.f rename to examples/lapack/native/dlarmm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarnv.f b/examples/lapack/native/dlarnv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarnv.f rename to examples/lapack/native/dlarnv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarra.f b/examples/lapack/native/dlarra.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarra.f rename to examples/lapack/native/dlarra.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrb.f b/examples/lapack/native/dlarrb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrb.f rename to examples/lapack/native/dlarrb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrc.f b/examples/lapack/native/dlarrc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrc.f rename to examples/lapack/native/dlarrc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrd.f b/examples/lapack/native/dlarrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrd.f rename to examples/lapack/native/dlarrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarre.f b/examples/lapack/native/dlarre.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarre.f rename to examples/lapack/native/dlarre.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrf.f b/examples/lapack/native/dlarrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrf.f rename to examples/lapack/native/dlarrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrj.f b/examples/lapack/native/dlarrj.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrj.f rename to examples/lapack/native/dlarrj.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrk.f b/examples/lapack/native/dlarrk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrk.f rename to examples/lapack/native/dlarrk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrr.f b/examples/lapack/native/dlarrr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrr.f rename to examples/lapack/native/dlarrr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrv.f b/examples/lapack/native/dlarrv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarrv.f rename to examples/lapack/native/dlarrv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarscl2.f b/examples/lapack/native/dlarscl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarscl2.f rename to examples/lapack/native/dlarscl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlartg.f90 b/examples/lapack/native/dlartg.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlartg.f90 rename to examples/lapack/native/dlartg.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlartgp.f b/examples/lapack/native/dlartgp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlartgp.f rename to examples/lapack/native/dlartgp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlartgs.f b/examples/lapack/native/dlartgs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlartgs.f rename to examples/lapack/native/dlartgs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlartv.f b/examples/lapack/native/dlartv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlartv.f rename to examples/lapack/native/dlartv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaruv.f b/examples/lapack/native/dlaruv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaruv.f rename to examples/lapack/native/dlaruv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarz.f b/examples/lapack/native/dlarz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarz.f rename to examples/lapack/native/dlarz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarzb.f b/examples/lapack/native/dlarzb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarzb.f rename to examples/lapack/native/dlarzb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarzt.f b/examples/lapack/native/dlarzt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlarzt.f rename to examples/lapack/native/dlarzt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlas2.f b/examples/lapack/native/dlas2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlas2.f rename to examples/lapack/native/dlas2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlascl.f b/examples/lapack/native/dlascl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlascl.f rename to examples/lapack/native/dlascl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlascl2.f b/examples/lapack/native/dlascl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlascl2.f rename to examples/lapack/native/dlascl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd0.f b/examples/lapack/native/dlasd0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd0.f rename to examples/lapack/native/dlasd0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd1.f b/examples/lapack/native/dlasd1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd1.f rename to examples/lapack/native/dlasd1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd2.f b/examples/lapack/native/dlasd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd2.f rename to examples/lapack/native/dlasd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd3.f b/examples/lapack/native/dlasd3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd3.f rename to examples/lapack/native/dlasd3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd4.f b/examples/lapack/native/dlasd4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd4.f rename to examples/lapack/native/dlasd4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd5.f b/examples/lapack/native/dlasd5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd5.f rename to examples/lapack/native/dlasd5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd6.f b/examples/lapack/native/dlasd6.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd6.f rename to examples/lapack/native/dlasd6.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd7.f b/examples/lapack/native/dlasd7.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd7.f rename to examples/lapack/native/dlasd7.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd8.f b/examples/lapack/native/dlasd8.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasd8.f rename to examples/lapack/native/dlasd8.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasda.f b/examples/lapack/native/dlasda.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasda.f rename to examples/lapack/native/dlasda.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasdq.f b/examples/lapack/native/dlasdq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasdq.f rename to examples/lapack/native/dlasdq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasdt.f b/examples/lapack/native/dlasdt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasdt.f rename to examples/lapack/native/dlasdt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaset.f b/examples/lapack/native/dlaset.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaset.f rename to examples/lapack/native/dlaset.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq1.f b/examples/lapack/native/dlasq1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq1.f rename to examples/lapack/native/dlasq1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq2.f b/examples/lapack/native/dlasq2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq2.f rename to examples/lapack/native/dlasq2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq3.f b/examples/lapack/native/dlasq3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq3.f rename to examples/lapack/native/dlasq3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq4.f b/examples/lapack/native/dlasq4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq4.f rename to examples/lapack/native/dlasq4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq5.f b/examples/lapack/native/dlasq5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq5.f rename to examples/lapack/native/dlasq5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq6.f b/examples/lapack/native/dlasq6.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasq6.f rename to examples/lapack/native/dlasq6.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasr.f b/examples/lapack/native/dlasr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasr.f rename to examples/lapack/native/dlasr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasrt.f b/examples/lapack/native/dlasrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasrt.f rename to examples/lapack/native/dlasrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlassq.f90 b/examples/lapack/native/dlassq.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlassq.f90 rename to examples/lapack/native/dlassq.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasv2.f b/examples/lapack/native/dlasv2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasv2.f rename to examples/lapack/native/dlasv2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaswlq.f b/examples/lapack/native/dlaswlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaswlq.f rename to examples/lapack/native/dlaswlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaswp.f b/examples/lapack/native/dlaswp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlaswp.f rename to examples/lapack/native/dlaswp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasy2.f b/examples/lapack/native/dlasy2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasy2.f rename to examples/lapack/native/dlasy2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasyf.f b/examples/lapack/native/dlasyf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasyf.f rename to examples/lapack/native/dlasyf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasyf_aa.f b/examples/lapack/native/dlasyf_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasyf_aa.f rename to examples/lapack/native/dlasyf_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasyf_rk.f b/examples/lapack/native/dlasyf_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasyf_rk.f rename to examples/lapack/native/dlasyf_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasyf_rook.f b/examples/lapack/native/dlasyf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlasyf_rook.f rename to examples/lapack/native/dlasyf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlat2s.f b/examples/lapack/native/dlat2s.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlat2s.f rename to examples/lapack/native/dlat2s.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatbs.f b/examples/lapack/native/dlatbs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatbs.f rename to examples/lapack/native/dlatbs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatdf.f b/examples/lapack/native/dlatdf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatdf.f rename to examples/lapack/native/dlatdf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatps.f b/examples/lapack/native/dlatps.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatps.f rename to examples/lapack/native/dlatps.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatrd.f b/examples/lapack/native/dlatrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatrd.f rename to examples/lapack/native/dlatrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatrs.f b/examples/lapack/native/dlatrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatrs.f rename to examples/lapack/native/dlatrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatrs3.f b/examples/lapack/native/dlatrs3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatrs3.f rename to examples/lapack/native/dlatrs3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatrz.f b/examples/lapack/native/dlatrz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatrz.f rename to examples/lapack/native/dlatrz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatsqr.f b/examples/lapack/native/dlatsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlatsqr.f rename to examples/lapack/native/dlatsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlauu2.f b/examples/lapack/native/dlauu2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlauu2.f rename to examples/lapack/native/dlauu2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlauum.f b/examples/lapack/native/dlauum.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dlauum.f rename to examples/lapack/native/dlauum.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dopgtr.f b/examples/lapack/native/dopgtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dopgtr.f rename to examples/lapack/native/dopgtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dopmtr.f b/examples/lapack/native/dopmtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dopmtr.f rename to examples/lapack/native/dopmtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb.f b/examples/lapack/native/dorbdb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb.f rename to examples/lapack/native/dorbdb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb1.f b/examples/lapack/native/dorbdb1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb1.f rename to examples/lapack/native/dorbdb1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb2.f b/examples/lapack/native/dorbdb2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb2.f rename to examples/lapack/native/dorbdb2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb3.f b/examples/lapack/native/dorbdb3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb3.f rename to examples/lapack/native/dorbdb3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb4.f b/examples/lapack/native/dorbdb4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb4.f rename to examples/lapack/native/dorbdb4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb5.f b/examples/lapack/native/dorbdb5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb5.f rename to examples/lapack/native/dorbdb5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb6.f b/examples/lapack/native/dorbdb6.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorbdb6.f rename to examples/lapack/native/dorbdb6.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorcsd.f b/examples/lapack/native/dorcsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorcsd.f rename to examples/lapack/native/dorcsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorcsd2by1.f b/examples/lapack/native/dorcsd2by1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorcsd2by1.f rename to examples/lapack/native/dorcsd2by1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorg2l.f b/examples/lapack/native/dorg2l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorg2l.f rename to examples/lapack/native/dorg2l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorg2r.f b/examples/lapack/native/dorg2r.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorg2r.f rename to examples/lapack/native/dorg2r.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgbr.f b/examples/lapack/native/dorgbr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgbr.f rename to examples/lapack/native/dorgbr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorghr.f b/examples/lapack/native/dorghr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorghr.f rename to examples/lapack/native/dorghr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgl2.f b/examples/lapack/native/dorgl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgl2.f rename to examples/lapack/native/dorgl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorglq.f b/examples/lapack/native/dorglq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorglq.f rename to examples/lapack/native/dorglq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgql.f b/examples/lapack/native/dorgql.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgql.f rename to examples/lapack/native/dorgql.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgqr.f b/examples/lapack/native/dorgqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgqr.f rename to examples/lapack/native/dorgqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgr2.f b/examples/lapack/native/dorgr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgr2.f rename to examples/lapack/native/dorgr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgrq.f b/examples/lapack/native/dorgrq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgrq.f rename to examples/lapack/native/dorgrq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgtr.f b/examples/lapack/native/dorgtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgtr.f rename to examples/lapack/native/dorgtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgtsqr.f b/examples/lapack/native/dorgtsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgtsqr.f rename to examples/lapack/native/dorgtsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgtsqr_row.f b/examples/lapack/native/dorgtsqr_row.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorgtsqr_row.f rename to examples/lapack/native/dorgtsqr_row.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorhr_col.f b/examples/lapack/native/dorhr_col.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorhr_col.f rename to examples/lapack/native/dorhr_col.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorm22.f b/examples/lapack/native/dorm22.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorm22.f rename to examples/lapack/native/dorm22.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorm2l.f b/examples/lapack/native/dorm2l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorm2l.f rename to examples/lapack/native/dorm2l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorm2r.f b/examples/lapack/native/dorm2r.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorm2r.f rename to examples/lapack/native/dorm2r.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormbr.f b/examples/lapack/native/dormbr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormbr.f rename to examples/lapack/native/dormbr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormhr.f b/examples/lapack/native/dormhr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormhr.f rename to examples/lapack/native/dormhr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorml2.f b/examples/lapack/native/dorml2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dorml2.f rename to examples/lapack/native/dorml2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormlq.f b/examples/lapack/native/dormlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormlq.f rename to examples/lapack/native/dormlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormql.f b/examples/lapack/native/dormql.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormql.f rename to examples/lapack/native/dormql.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormqr.f b/examples/lapack/native/dormqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormqr.f rename to examples/lapack/native/dormqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormr2.f b/examples/lapack/native/dormr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormr2.f rename to examples/lapack/native/dormr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormr3.f b/examples/lapack/native/dormr3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormr3.f rename to examples/lapack/native/dormr3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormrq.f b/examples/lapack/native/dormrq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormrq.f rename to examples/lapack/native/dormrq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormrz.f b/examples/lapack/native/dormrz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormrz.f rename to examples/lapack/native/dormrz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormtr.f b/examples/lapack/native/dormtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dormtr.f rename to examples/lapack/native/dormtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbcon.f b/examples/lapack/native/dpbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbcon.f rename to examples/lapack/native/dpbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbequ.f b/examples/lapack/native/dpbequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbequ.f rename to examples/lapack/native/dpbequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbrfs.f b/examples/lapack/native/dpbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbrfs.f rename to examples/lapack/native/dpbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbstf.f b/examples/lapack/native/dpbstf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbstf.f rename to examples/lapack/native/dpbstf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbsv.f b/examples/lapack/native/dpbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbsv.f rename to examples/lapack/native/dpbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbsvx.f b/examples/lapack/native/dpbsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbsvx.f rename to examples/lapack/native/dpbsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbtf2.f b/examples/lapack/native/dpbtf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbtf2.f rename to examples/lapack/native/dpbtf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbtrf.f b/examples/lapack/native/dpbtrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbtrf.f rename to examples/lapack/native/dpbtrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbtrs.f b/examples/lapack/native/dpbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpbtrs.f rename to examples/lapack/native/dpbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpftrf.f b/examples/lapack/native/dpftrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpftrf.f rename to examples/lapack/native/dpftrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpftri.f b/examples/lapack/native/dpftri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpftri.f rename to examples/lapack/native/dpftri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpftrs.f b/examples/lapack/native/dpftrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpftrs.f rename to examples/lapack/native/dpftrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpocon.f b/examples/lapack/native/dpocon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpocon.f rename to examples/lapack/native/dpocon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpoequ.f b/examples/lapack/native/dpoequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpoequ.f rename to examples/lapack/native/dpoequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpoequb.f b/examples/lapack/native/dpoequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpoequb.f rename to examples/lapack/native/dpoequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dporfs.f b/examples/lapack/native/dporfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dporfs.f rename to examples/lapack/native/dporfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dporfsx.f b/examples/lapack/native/dporfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dporfsx.f rename to examples/lapack/native/dporfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dposv.f b/examples/lapack/native/dposv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dposv.f rename to examples/lapack/native/dposv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dposvx.f b/examples/lapack/native/dposvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dposvx.f rename to examples/lapack/native/dposvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dposvxx.f b/examples/lapack/native/dposvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dposvxx.f rename to examples/lapack/native/dposvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpotf2.f b/examples/lapack/native/dpotf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpotf2.f rename to examples/lapack/native/dpotf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpotrf.f b/examples/lapack/native/dpotrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpotrf.f rename to examples/lapack/native/dpotrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpotrf2.f b/examples/lapack/native/dpotrf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpotrf2.f rename to examples/lapack/native/dpotrf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpotri.f b/examples/lapack/native/dpotri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpotri.f rename to examples/lapack/native/dpotri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpotrs.f b/examples/lapack/native/dpotrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpotrs.f rename to examples/lapack/native/dpotrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dppcon.f b/examples/lapack/native/dppcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dppcon.f rename to examples/lapack/native/dppcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dppequ.f b/examples/lapack/native/dppequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dppequ.f rename to examples/lapack/native/dppequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpprfs.f b/examples/lapack/native/dpprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpprfs.f rename to examples/lapack/native/dpprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dppsv.f b/examples/lapack/native/dppsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dppsv.f rename to examples/lapack/native/dppsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dppsvx.f b/examples/lapack/native/dppsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dppsvx.f rename to examples/lapack/native/dppsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpptrf.f b/examples/lapack/native/dpptrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpptrf.f rename to examples/lapack/native/dpptrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpptri.f b/examples/lapack/native/dpptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpptri.f rename to examples/lapack/native/dpptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpptrs.f b/examples/lapack/native/dpptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpptrs.f rename to examples/lapack/native/dpptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpstf2.f b/examples/lapack/native/dpstf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpstf2.f rename to examples/lapack/native/dpstf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpstrf.f b/examples/lapack/native/dpstrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpstrf.f rename to examples/lapack/native/dpstrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dptcon.f b/examples/lapack/native/dptcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dptcon.f rename to examples/lapack/native/dptcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpteqr.f b/examples/lapack/native/dpteqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpteqr.f rename to examples/lapack/native/dpteqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dptrfs.f b/examples/lapack/native/dptrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dptrfs.f rename to examples/lapack/native/dptrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dptsv.f b/examples/lapack/native/dptsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dptsv.f rename to examples/lapack/native/dptsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dptsvx.f b/examples/lapack/native/dptsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dptsvx.f rename to examples/lapack/native/dptsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpttrf.f b/examples/lapack/native/dpttrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpttrf.f rename to examples/lapack/native/dpttrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpttrs.f b/examples/lapack/native/dpttrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dpttrs.f rename to examples/lapack/native/dpttrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dptts2.f b/examples/lapack/native/dptts2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dptts2.f rename to examples/lapack/native/dptts2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/drscl.f b/examples/lapack/native/drscl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/drscl.f rename to examples/lapack/native/drscl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsb2st_kernels.f b/examples/lapack/native/dsb2st_kernels.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsb2st_kernels.f rename to examples/lapack/native/dsb2st_kernels.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbev.f b/examples/lapack/native/dsbev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbev.f rename to examples/lapack/native/dsbev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbev_2stage.f b/examples/lapack/native/dsbev_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbev_2stage.f rename to examples/lapack/native/dsbev_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbevd.f b/examples/lapack/native/dsbevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbevd.f rename to examples/lapack/native/dsbevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbevd_2stage.f b/examples/lapack/native/dsbevd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbevd_2stage.f rename to examples/lapack/native/dsbevd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbevx.f b/examples/lapack/native/dsbevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbevx.f rename to examples/lapack/native/dsbevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbevx_2stage.f b/examples/lapack/native/dsbevx_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbevx_2stage.f rename to examples/lapack/native/dsbevx_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbgst.f b/examples/lapack/native/dsbgst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbgst.f rename to examples/lapack/native/dsbgst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbgv.f b/examples/lapack/native/dsbgv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbgv.f rename to examples/lapack/native/dsbgv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbgvd.f b/examples/lapack/native/dsbgvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbgvd.f rename to examples/lapack/native/dsbgvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbgvx.f b/examples/lapack/native/dsbgvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbgvx.f rename to examples/lapack/native/dsbgvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbtrd.f b/examples/lapack/native/dsbtrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsbtrd.f rename to examples/lapack/native/dsbtrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsfrk.f b/examples/lapack/native/dsfrk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsfrk.f rename to examples/lapack/native/dsfrk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsgesv.f b/examples/lapack/native/dsgesv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsgesv.f rename to examples/lapack/native/dsgesv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspcon.f b/examples/lapack/native/dspcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspcon.f rename to examples/lapack/native/dspcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspev.f b/examples/lapack/native/dspev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspev.f rename to examples/lapack/native/dspev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspevd.f b/examples/lapack/native/dspevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspevd.f rename to examples/lapack/native/dspevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspevx.f b/examples/lapack/native/dspevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspevx.f rename to examples/lapack/native/dspevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspgst.f b/examples/lapack/native/dspgst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspgst.f rename to examples/lapack/native/dspgst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspgv.f b/examples/lapack/native/dspgv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspgv.f rename to examples/lapack/native/dspgv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspgvd.f b/examples/lapack/native/dspgvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspgvd.f rename to examples/lapack/native/dspgvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspgvx.f b/examples/lapack/native/dspgvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspgvx.f rename to examples/lapack/native/dspgvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsposv.f b/examples/lapack/native/dsposv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsposv.f rename to examples/lapack/native/dsposv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsprfs.f b/examples/lapack/native/dsprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsprfs.f rename to examples/lapack/native/dsprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspsv.f b/examples/lapack/native/dspsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspsv.f rename to examples/lapack/native/dspsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspsvx.f b/examples/lapack/native/dspsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dspsvx.f rename to examples/lapack/native/dspsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsptrd.f b/examples/lapack/native/dsptrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsptrd.f rename to examples/lapack/native/dsptrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsptrf.f b/examples/lapack/native/dsptrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsptrf.f rename to examples/lapack/native/dsptrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsptri.f b/examples/lapack/native/dsptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsptri.f rename to examples/lapack/native/dsptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsptrs.f b/examples/lapack/native/dsptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsptrs.f rename to examples/lapack/native/dsptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstebz.f b/examples/lapack/native/dstebz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstebz.f rename to examples/lapack/native/dstebz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstedc.f b/examples/lapack/native/dstedc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstedc.f rename to examples/lapack/native/dstedc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstegr.f b/examples/lapack/native/dstegr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstegr.f rename to examples/lapack/native/dstegr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstein.f b/examples/lapack/native/dstein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstein.f rename to examples/lapack/native/dstein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstemr.f b/examples/lapack/native/dstemr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstemr.f rename to examples/lapack/native/dstemr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsteqr.f b/examples/lapack/native/dsteqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsteqr.f rename to examples/lapack/native/dsteqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsterf.f b/examples/lapack/native/dsterf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsterf.f rename to examples/lapack/native/dsterf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstev.f b/examples/lapack/native/dstev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstev.f rename to examples/lapack/native/dstev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstevd.f b/examples/lapack/native/dstevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstevd.f rename to examples/lapack/native/dstevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstevr.f b/examples/lapack/native/dstevr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstevr.f rename to examples/lapack/native/dstevr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstevx.f b/examples/lapack/native/dstevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dstevx.f rename to examples/lapack/native/dstevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsycon.f b/examples/lapack/native/dsycon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsycon.f rename to examples/lapack/native/dsycon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsycon_3.f b/examples/lapack/native/dsycon_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsycon_3.f rename to examples/lapack/native/dsycon_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsycon_rook.f b/examples/lapack/native/dsycon_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsycon_rook.f rename to examples/lapack/native/dsycon_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyconv.f b/examples/lapack/native/dsyconv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyconv.f rename to examples/lapack/native/dsyconv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyconvf.f b/examples/lapack/native/dsyconvf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyconvf.f rename to examples/lapack/native/dsyconvf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyconvf_rook.f b/examples/lapack/native/dsyconvf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyconvf_rook.f rename to examples/lapack/native/dsyconvf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyequb.f b/examples/lapack/native/dsyequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyequb.f rename to examples/lapack/native/dsyequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyev.f b/examples/lapack/native/dsyev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyev.f rename to examples/lapack/native/dsyev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyev_2stage.f b/examples/lapack/native/dsyev_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyev_2stage.f rename to examples/lapack/native/dsyev_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevd.f b/examples/lapack/native/dsyevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevd.f rename to examples/lapack/native/dsyevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevd_2stage.f b/examples/lapack/native/dsyevd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevd_2stage.f rename to examples/lapack/native/dsyevd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevr.f b/examples/lapack/native/dsyevr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevr.f rename to examples/lapack/native/dsyevr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevr_2stage.f b/examples/lapack/native/dsyevr_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevr_2stage.f rename to examples/lapack/native/dsyevr_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevx.f b/examples/lapack/native/dsyevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevx.f rename to examples/lapack/native/dsyevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevx_2stage.f b/examples/lapack/native/dsyevx_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyevx_2stage.f rename to examples/lapack/native/dsyevx_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygs2.f b/examples/lapack/native/dsygs2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygs2.f rename to examples/lapack/native/dsygs2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygst.f b/examples/lapack/native/dsygst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygst.f rename to examples/lapack/native/dsygst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygv.f b/examples/lapack/native/dsygv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygv.f rename to examples/lapack/native/dsygv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygv_2stage.f b/examples/lapack/native/dsygv_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygv_2stage.f rename to examples/lapack/native/dsygv_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygvd.f b/examples/lapack/native/dsygvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygvd.f rename to examples/lapack/native/dsygvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygvx.f b/examples/lapack/native/dsygvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsygvx.f rename to examples/lapack/native/dsygvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyrfs.f b/examples/lapack/native/dsyrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyrfs.f rename to examples/lapack/native/dsyrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyrfsx.f b/examples/lapack/native/dsyrfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyrfsx.f rename to examples/lapack/native/dsyrfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysv.f b/examples/lapack/native/dsysv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysv.f rename to examples/lapack/native/dsysv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysv_aa.f b/examples/lapack/native/dsysv_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysv_aa.f rename to examples/lapack/native/dsysv_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysv_aa_2stage.f b/examples/lapack/native/dsysv_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysv_aa_2stage.f rename to examples/lapack/native/dsysv_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysv_rk.f b/examples/lapack/native/dsysv_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysv_rk.f rename to examples/lapack/native/dsysv_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysv_rook.f b/examples/lapack/native/dsysv_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysv_rook.f rename to examples/lapack/native/dsysv_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysvx.f b/examples/lapack/native/dsysvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysvx.f rename to examples/lapack/native/dsysvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysvxx.f b/examples/lapack/native/dsysvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsysvxx.f rename to examples/lapack/native/dsysvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyswapr.f b/examples/lapack/native/dsyswapr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsyswapr.f rename to examples/lapack/native/dsyswapr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytd2.f b/examples/lapack/native/dsytd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytd2.f rename to examples/lapack/native/dsytd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytf2.f b/examples/lapack/native/dsytf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytf2.f rename to examples/lapack/native/dsytf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytf2_rk.f b/examples/lapack/native/dsytf2_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytf2_rk.f rename to examples/lapack/native/dsytf2_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytf2_rook.f b/examples/lapack/native/dsytf2_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytf2_rook.f rename to examples/lapack/native/dsytf2_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrd.f b/examples/lapack/native/dsytrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrd.f rename to examples/lapack/native/dsytrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrd_2stage.f b/examples/lapack/native/dsytrd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrd_2stage.f rename to examples/lapack/native/dsytrd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrd_sb2st.F b/examples/lapack/native/dsytrd_sb2st.F similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrd_sb2st.F rename to examples/lapack/native/dsytrd_sb2st.F diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrd_sy2sb.f b/examples/lapack/native/dsytrd_sy2sb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrd_sy2sb.f rename to examples/lapack/native/dsytrd_sy2sb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrf.f b/examples/lapack/native/dsytrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrf.f rename to examples/lapack/native/dsytrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrf_aa.f b/examples/lapack/native/dsytrf_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrf_aa.f rename to examples/lapack/native/dsytrf_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrf_aa_2stage.f b/examples/lapack/native/dsytrf_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrf_aa_2stage.f rename to examples/lapack/native/dsytrf_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrf_rk.f b/examples/lapack/native/dsytrf_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrf_rk.f rename to examples/lapack/native/dsytrf_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrf_rook.f b/examples/lapack/native/dsytrf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrf_rook.f rename to examples/lapack/native/dsytrf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri.f b/examples/lapack/native/dsytri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri.f rename to examples/lapack/native/dsytri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri2.f b/examples/lapack/native/dsytri2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri2.f rename to examples/lapack/native/dsytri2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri2x.f b/examples/lapack/native/dsytri2x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri2x.f rename to examples/lapack/native/dsytri2x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri_3.f b/examples/lapack/native/dsytri_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri_3.f rename to examples/lapack/native/dsytri_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri_3x.f b/examples/lapack/native/dsytri_3x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri_3x.f rename to examples/lapack/native/dsytri_3x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri_rook.f b/examples/lapack/native/dsytri_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytri_rook.f rename to examples/lapack/native/dsytri_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs.f b/examples/lapack/native/dsytrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs.f rename to examples/lapack/native/dsytrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs2.f b/examples/lapack/native/dsytrs2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs2.f rename to examples/lapack/native/dsytrs2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs_3.f b/examples/lapack/native/dsytrs_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs_3.f rename to examples/lapack/native/dsytrs_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs_aa.f b/examples/lapack/native/dsytrs_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs_aa.f rename to examples/lapack/native/dsytrs_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs_aa_2stage.f b/examples/lapack/native/dsytrs_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs_aa_2stage.f rename to examples/lapack/native/dsytrs_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs_rook.f b/examples/lapack/native/dsytrs_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dsytrs_rook.f rename to examples/lapack/native/dsytrs_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtbcon.f b/examples/lapack/native/dtbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtbcon.f rename to examples/lapack/native/dtbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtbrfs.f b/examples/lapack/native/dtbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtbrfs.f rename to examples/lapack/native/dtbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtbtrs.f b/examples/lapack/native/dtbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtbtrs.f rename to examples/lapack/native/dtbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtfsm.f b/examples/lapack/native/dtfsm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtfsm.f rename to examples/lapack/native/dtfsm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtftri.f b/examples/lapack/native/dtftri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtftri.f rename to examples/lapack/native/dtftri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtfttp.f b/examples/lapack/native/dtfttp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtfttp.f rename to examples/lapack/native/dtfttp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtfttr.f b/examples/lapack/native/dtfttr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtfttr.f rename to examples/lapack/native/dtfttr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgevc.f b/examples/lapack/native/dtgevc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgevc.f rename to examples/lapack/native/dtgevc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgex2.f b/examples/lapack/native/dtgex2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgex2.f rename to examples/lapack/native/dtgex2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgexc.f b/examples/lapack/native/dtgexc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgexc.f rename to examples/lapack/native/dtgexc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgsen.f b/examples/lapack/native/dtgsen.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgsen.f rename to examples/lapack/native/dtgsen.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgsja.f b/examples/lapack/native/dtgsja.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgsja.f rename to examples/lapack/native/dtgsja.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgsna.f b/examples/lapack/native/dtgsna.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgsna.f rename to examples/lapack/native/dtgsna.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgsy2.f b/examples/lapack/native/dtgsy2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgsy2.f rename to examples/lapack/native/dtgsy2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgsyl.f b/examples/lapack/native/dtgsyl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtgsyl.f rename to examples/lapack/native/dtgsyl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpcon.f b/examples/lapack/native/dtpcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpcon.f rename to examples/lapack/native/dtpcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtplqt.f b/examples/lapack/native/dtplqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtplqt.f rename to examples/lapack/native/dtplqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtplqt2.f b/examples/lapack/native/dtplqt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtplqt2.f rename to examples/lapack/native/dtplqt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpmlqt.f b/examples/lapack/native/dtpmlqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpmlqt.f rename to examples/lapack/native/dtpmlqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpmqrt.f b/examples/lapack/native/dtpmqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpmqrt.f rename to examples/lapack/native/dtpmqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpqrt.f b/examples/lapack/native/dtpqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpqrt.f rename to examples/lapack/native/dtpqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpqrt2.f b/examples/lapack/native/dtpqrt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpqrt2.f rename to examples/lapack/native/dtpqrt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtprfb.f b/examples/lapack/native/dtprfb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtprfb.f rename to examples/lapack/native/dtprfb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtprfs.f b/examples/lapack/native/dtprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtprfs.f rename to examples/lapack/native/dtprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtptri.f b/examples/lapack/native/dtptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtptri.f rename to examples/lapack/native/dtptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtptrs.f b/examples/lapack/native/dtptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtptrs.f rename to examples/lapack/native/dtptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpttf.f b/examples/lapack/native/dtpttf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpttf.f rename to examples/lapack/native/dtpttf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpttr.f b/examples/lapack/native/dtpttr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtpttr.f rename to examples/lapack/native/dtpttr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrcon.f b/examples/lapack/native/dtrcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrcon.f rename to examples/lapack/native/dtrcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrevc.f b/examples/lapack/native/dtrevc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrevc.f rename to examples/lapack/native/dtrevc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrevc3.f b/examples/lapack/native/dtrevc3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrevc3.f rename to examples/lapack/native/dtrevc3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrexc.f b/examples/lapack/native/dtrexc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrexc.f rename to examples/lapack/native/dtrexc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrrfs.f b/examples/lapack/native/dtrrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrrfs.f rename to examples/lapack/native/dtrrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrsen.f b/examples/lapack/native/dtrsen.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrsen.f rename to examples/lapack/native/dtrsen.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrsna.f b/examples/lapack/native/dtrsna.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrsna.f rename to examples/lapack/native/dtrsna.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrsyl.f b/examples/lapack/native/dtrsyl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrsyl.f rename to examples/lapack/native/dtrsyl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrsyl3.f b/examples/lapack/native/dtrsyl3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrsyl3.f rename to examples/lapack/native/dtrsyl3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrti2.f b/examples/lapack/native/dtrti2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrti2.f rename to examples/lapack/native/dtrti2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrtri.f b/examples/lapack/native/dtrtri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrtri.f rename to examples/lapack/native/dtrtri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrtrs.f b/examples/lapack/native/dtrtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrtrs.f rename to examples/lapack/native/dtrtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrttf.f b/examples/lapack/native/dtrttf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrttf.f rename to examples/lapack/native/dtrttf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrttp.f b/examples/lapack/native/dtrttp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtrttp.f rename to examples/lapack/native/dtrttp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtzrzf.f b/examples/lapack/native/dtzrzf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dtzrzf.f rename to examples/lapack/native/dtzrzf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dzsum1.f b/examples/lapack/native/dzsum1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/dzsum1.f rename to examples/lapack/native/dzsum1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/icmax1.f b/examples/lapack/native/icmax1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/icmax1.f rename to examples/lapack/native/icmax1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ieeeck.f b/examples/lapack/native/ieeeck.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ieeeck.f rename to examples/lapack/native/ieeeck.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaclc.f b/examples/lapack/native/ilaclc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaclc.f rename to examples/lapack/native/ilaclc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaclr.f b/examples/lapack/native/ilaclr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaclr.f rename to examples/lapack/native/ilaclr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/iladiag.f b/examples/lapack/native/iladiag.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/iladiag.f rename to examples/lapack/native/iladiag.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/iladlc.f b/examples/lapack/native/iladlc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/iladlc.f rename to examples/lapack/native/iladlc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/iladlr.f b/examples/lapack/native/iladlr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/iladlr.f rename to examples/lapack/native/iladlr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaenv.f b/examples/lapack/native/ilaenv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaenv.f rename to examples/lapack/native/ilaenv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaenv2stage.f b/examples/lapack/native/ilaenv2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaenv2stage.f rename to examples/lapack/native/ilaenv2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaprec.f b/examples/lapack/native/ilaprec.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaprec.f rename to examples/lapack/native/ilaprec.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaslc.f b/examples/lapack/native/ilaslc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaslc.f rename to examples/lapack/native/ilaslc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaslr.f b/examples/lapack/native/ilaslr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilaslr.f rename to examples/lapack/native/ilaslr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilatrans.f b/examples/lapack/native/ilatrans.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilatrans.f rename to examples/lapack/native/ilatrans.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilauplo.f b/examples/lapack/native/ilauplo.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilauplo.f rename to examples/lapack/native/ilauplo.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilazlc.f b/examples/lapack/native/ilazlc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilazlc.f rename to examples/lapack/native/ilazlc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilazlr.f b/examples/lapack/native/ilazlr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ilazlr.f rename to examples/lapack/native/ilazlr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/iparam2stage.F b/examples/lapack/native/iparam2stage.F similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/iparam2stage.F rename to examples/lapack/native/iparam2stage.F diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/iparmq.f b/examples/lapack/native/iparmq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/iparmq.f rename to examples/lapack/native/iparmq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/izmax1.f b/examples/lapack/native/izmax1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/izmax1.f rename to examples/lapack/native/izmax1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/la_constants.f90 b/examples/lapack/native/la_constants.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/la_constants.f90 rename to examples/lapack/native/la_constants.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/la_xisnan.F90 b/examples/lapack/native/la_xisnan.F90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/la_xisnan.F90 rename to examples/lapack/native/la_xisnan.F90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/lsamen.f b/examples/lapack/native/lsamen.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/lsamen.f rename to examples/lapack/native/lsamen.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sbbcsd.f b/examples/lapack/native/sbbcsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sbbcsd.f rename to examples/lapack/native/sbbcsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sbdsdc.f b/examples/lapack/native/sbdsdc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sbdsdc.f rename to examples/lapack/native/sbdsdc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sbdsqr.f b/examples/lapack/native/sbdsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sbdsqr.f rename to examples/lapack/native/sbdsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sbdsvdx.f b/examples/lapack/native/sbdsvdx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sbdsvdx.f rename to examples/lapack/native/sbdsvdx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/scsum1.f b/examples/lapack/native/scsum1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/scsum1.f rename to examples/lapack/native/scsum1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sdisna.f b/examples/lapack/native/sdisna.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sdisna.f rename to examples/lapack/native/sdisna.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbbrd.f b/examples/lapack/native/sgbbrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbbrd.f rename to examples/lapack/native/sgbbrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbcon.f b/examples/lapack/native/sgbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbcon.f rename to examples/lapack/native/sgbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbequ.f b/examples/lapack/native/sgbequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbequ.f rename to examples/lapack/native/sgbequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbequb.f b/examples/lapack/native/sgbequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbequb.f rename to examples/lapack/native/sgbequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbrfs.f b/examples/lapack/native/sgbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbrfs.f rename to examples/lapack/native/sgbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbrfsx.f b/examples/lapack/native/sgbrfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbrfsx.f rename to examples/lapack/native/sgbrfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbsv.f b/examples/lapack/native/sgbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbsv.f rename to examples/lapack/native/sgbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbsvx.f b/examples/lapack/native/sgbsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbsvx.f rename to examples/lapack/native/sgbsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbsvxx.f b/examples/lapack/native/sgbsvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbsvxx.f rename to examples/lapack/native/sgbsvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbtf2.f b/examples/lapack/native/sgbtf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbtf2.f rename to examples/lapack/native/sgbtf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbtrf.f b/examples/lapack/native/sgbtrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbtrf.f rename to examples/lapack/native/sgbtrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbtrs.f b/examples/lapack/native/sgbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgbtrs.f rename to examples/lapack/native/sgbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgebak.f b/examples/lapack/native/sgebak.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgebak.f rename to examples/lapack/native/sgebak.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgebal.f b/examples/lapack/native/sgebal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgebal.f rename to examples/lapack/native/sgebal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgebd2.f b/examples/lapack/native/sgebd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgebd2.f rename to examples/lapack/native/sgebd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgebrd.f b/examples/lapack/native/sgebrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgebrd.f rename to examples/lapack/native/sgebrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgecon.f b/examples/lapack/native/sgecon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgecon.f rename to examples/lapack/native/sgecon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgedmd.f90 b/examples/lapack/native/sgedmd.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgedmd.f90 rename to examples/lapack/native/sgedmd.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgedmdq.f90 b/examples/lapack/native/sgedmdq.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgedmdq.f90 rename to examples/lapack/native/sgedmdq.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeequ.f b/examples/lapack/native/sgeequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeequ.f rename to examples/lapack/native/sgeequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeequb.f b/examples/lapack/native/sgeequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeequb.f rename to examples/lapack/native/sgeequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgees.f b/examples/lapack/native/sgees.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgees.f rename to examples/lapack/native/sgees.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeesx.f b/examples/lapack/native/sgeesx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeesx.f rename to examples/lapack/native/sgeesx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeev.f b/examples/lapack/native/sgeev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeev.f rename to examples/lapack/native/sgeev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeevx.f b/examples/lapack/native/sgeevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeevx.f rename to examples/lapack/native/sgeevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgehd2.f b/examples/lapack/native/sgehd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgehd2.f rename to examples/lapack/native/sgehd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgehrd.f b/examples/lapack/native/sgehrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgehrd.f rename to examples/lapack/native/sgehrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgejsv.f b/examples/lapack/native/sgejsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgejsv.f rename to examples/lapack/native/sgejsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelq.f b/examples/lapack/native/sgelq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelq.f rename to examples/lapack/native/sgelq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelq2.f b/examples/lapack/native/sgelq2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelq2.f rename to examples/lapack/native/sgelq2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelqf.f b/examples/lapack/native/sgelqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelqf.f rename to examples/lapack/native/sgelqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelqt.f b/examples/lapack/native/sgelqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelqt.f rename to examples/lapack/native/sgelqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelqt3.f b/examples/lapack/native/sgelqt3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelqt3.f rename to examples/lapack/native/sgelqt3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgels.f b/examples/lapack/native/sgels.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgels.f rename to examples/lapack/native/sgels.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelsd.f b/examples/lapack/native/sgelsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelsd.f rename to examples/lapack/native/sgelsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelss.f b/examples/lapack/native/sgelss.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelss.f rename to examples/lapack/native/sgelss.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelst.f b/examples/lapack/native/sgelst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelst.f rename to examples/lapack/native/sgelst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelsy.f b/examples/lapack/native/sgelsy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgelsy.f rename to examples/lapack/native/sgelsy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgemlq.f b/examples/lapack/native/sgemlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgemlq.f rename to examples/lapack/native/sgemlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgemlqt.f b/examples/lapack/native/sgemlqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgemlqt.f rename to examples/lapack/native/sgemlqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgemqr.f b/examples/lapack/native/sgemqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgemqr.f rename to examples/lapack/native/sgemqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgemqrt.f b/examples/lapack/native/sgemqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgemqrt.f rename to examples/lapack/native/sgemqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeql2.f b/examples/lapack/native/sgeql2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeql2.f rename to examples/lapack/native/sgeql2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqlf.f b/examples/lapack/native/sgeqlf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqlf.f rename to examples/lapack/native/sgeqlf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqp3.f b/examples/lapack/native/sgeqp3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqp3.f rename to examples/lapack/native/sgeqp3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqp3rk.f b/examples/lapack/native/sgeqp3rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqp3rk.f rename to examples/lapack/native/sgeqp3rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqr.f b/examples/lapack/native/sgeqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqr.f rename to examples/lapack/native/sgeqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqr2.f b/examples/lapack/native/sgeqr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqr2.f rename to examples/lapack/native/sgeqr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqr2p.f b/examples/lapack/native/sgeqr2p.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqr2p.f rename to examples/lapack/native/sgeqr2p.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqrf.f b/examples/lapack/native/sgeqrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqrf.f rename to examples/lapack/native/sgeqrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqrfp.f b/examples/lapack/native/sgeqrfp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqrfp.f rename to examples/lapack/native/sgeqrfp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqrt.f b/examples/lapack/native/sgeqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqrt.f rename to examples/lapack/native/sgeqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqrt2.f b/examples/lapack/native/sgeqrt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqrt2.f rename to examples/lapack/native/sgeqrt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqrt3.f b/examples/lapack/native/sgeqrt3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgeqrt3.f rename to examples/lapack/native/sgeqrt3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgerfs.f b/examples/lapack/native/sgerfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgerfs.f rename to examples/lapack/native/sgerfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgerfsx.f b/examples/lapack/native/sgerfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgerfsx.f rename to examples/lapack/native/sgerfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgerq2.f b/examples/lapack/native/sgerq2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgerq2.f rename to examples/lapack/native/sgerq2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgerqf.f b/examples/lapack/native/sgerqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgerqf.f rename to examples/lapack/native/sgerqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesc2.f b/examples/lapack/native/sgesc2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesc2.f rename to examples/lapack/native/sgesc2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesdd.f b/examples/lapack/native/sgesdd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesdd.f rename to examples/lapack/native/sgesdd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesv.f b/examples/lapack/native/sgesv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesv.f rename to examples/lapack/native/sgesv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvd.f b/examples/lapack/native/sgesvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvd.f rename to examples/lapack/native/sgesvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvdq.f b/examples/lapack/native/sgesvdq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvdq.f rename to examples/lapack/native/sgesvdq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvdx.f b/examples/lapack/native/sgesvdx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvdx.f rename to examples/lapack/native/sgesvdx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvj.f b/examples/lapack/native/sgesvj.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvj.f rename to examples/lapack/native/sgesvj.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvx.f b/examples/lapack/native/sgesvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvx.f rename to examples/lapack/native/sgesvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvxx.f b/examples/lapack/native/sgesvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgesvxx.f rename to examples/lapack/native/sgesvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetc2.f b/examples/lapack/native/sgetc2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetc2.f rename to examples/lapack/native/sgetc2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetf2.f b/examples/lapack/native/sgetf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetf2.f rename to examples/lapack/native/sgetf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetrf.f b/examples/lapack/native/sgetrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetrf.f rename to examples/lapack/native/sgetrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetrf2.f b/examples/lapack/native/sgetrf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetrf2.f rename to examples/lapack/native/sgetrf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetri.f b/examples/lapack/native/sgetri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetri.f rename to examples/lapack/native/sgetri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetrs.f b/examples/lapack/native/sgetrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetrs.f rename to examples/lapack/native/sgetrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetsls.f b/examples/lapack/native/sgetsls.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetsls.f rename to examples/lapack/native/sgetsls.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetsqrhrt.f b/examples/lapack/native/sgetsqrhrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgetsqrhrt.f rename to examples/lapack/native/sgetsqrhrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggbak.f b/examples/lapack/native/sggbak.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggbak.f rename to examples/lapack/native/sggbak.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggbal.f b/examples/lapack/native/sggbal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggbal.f rename to examples/lapack/native/sggbal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgges.f b/examples/lapack/native/sgges.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgges.f rename to examples/lapack/native/sgges.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgges3.f b/examples/lapack/native/sgges3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgges3.f rename to examples/lapack/native/sgges3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggesx.f b/examples/lapack/native/sggesx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggesx.f rename to examples/lapack/native/sggesx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggev.f b/examples/lapack/native/sggev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggev.f rename to examples/lapack/native/sggev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggev3.f b/examples/lapack/native/sggev3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggev3.f rename to examples/lapack/native/sggev3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggevx.f b/examples/lapack/native/sggevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggevx.f rename to examples/lapack/native/sggevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggglm.f b/examples/lapack/native/sggglm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggglm.f rename to examples/lapack/native/sggglm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgghd3.f b/examples/lapack/native/sgghd3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgghd3.f rename to examples/lapack/native/sgghd3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgghrd.f b/examples/lapack/native/sgghrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgghrd.f rename to examples/lapack/native/sgghrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgglse.f b/examples/lapack/native/sgglse.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgglse.f rename to examples/lapack/native/sgglse.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggqrf.f b/examples/lapack/native/sggqrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggqrf.f rename to examples/lapack/native/sggqrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggrqf.f b/examples/lapack/native/sggrqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggrqf.f rename to examples/lapack/native/sggrqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggsvd3.f b/examples/lapack/native/sggsvd3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggsvd3.f rename to examples/lapack/native/sggsvd3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggsvp3.f b/examples/lapack/native/sggsvp3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sggsvp3.f rename to examples/lapack/native/sggsvp3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgsvj0.f b/examples/lapack/native/sgsvj0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgsvj0.f rename to examples/lapack/native/sgsvj0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgsvj1.f b/examples/lapack/native/sgsvj1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgsvj1.f rename to examples/lapack/native/sgsvj1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgtcon.f b/examples/lapack/native/sgtcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgtcon.f rename to examples/lapack/native/sgtcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgtrfs.f b/examples/lapack/native/sgtrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgtrfs.f rename to examples/lapack/native/sgtrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgtsv.f b/examples/lapack/native/sgtsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgtsv.f rename to examples/lapack/native/sgtsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgtsvx.f b/examples/lapack/native/sgtsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgtsvx.f rename to examples/lapack/native/sgtsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgttrf.f b/examples/lapack/native/sgttrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgttrf.f rename to examples/lapack/native/sgttrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgttrs.f b/examples/lapack/native/sgttrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgttrs.f rename to examples/lapack/native/sgttrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgtts2.f b/examples/lapack/native/sgtts2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sgtts2.f rename to examples/lapack/native/sgtts2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/shgeqz.f b/examples/lapack/native/shgeqz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/shgeqz.f rename to examples/lapack/native/shgeqz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/shsein.f b/examples/lapack/native/shsein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/shsein.f rename to examples/lapack/native/shsein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/shseqr.f b/examples/lapack/native/shseqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/shseqr.f rename to examples/lapack/native/shseqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sisnan.f b/examples/lapack/native/sisnan.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sisnan.f rename to examples/lapack/native/sisnan.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gbamv.f b/examples/lapack/native/sla_gbamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gbamv.f rename to examples/lapack/native/sla_gbamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gbrcond.f b/examples/lapack/native/sla_gbrcond.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gbrcond.f rename to examples/lapack/native/sla_gbrcond.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gbrfsx_extended.f b/examples/lapack/native/sla_gbrfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gbrfsx_extended.f rename to examples/lapack/native/sla_gbrfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gbrpvgrw.f b/examples/lapack/native/sla_gbrpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gbrpvgrw.f rename to examples/lapack/native/sla_gbrpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_geamv.f b/examples/lapack/native/sla_geamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_geamv.f rename to examples/lapack/native/sla_geamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gercond.f b/examples/lapack/native/sla_gercond.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gercond.f rename to examples/lapack/native/sla_gercond.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gerfsx_extended.f b/examples/lapack/native/sla_gerfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gerfsx_extended.f rename to examples/lapack/native/sla_gerfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gerpvgrw.f b/examples/lapack/native/sla_gerpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_gerpvgrw.f rename to examples/lapack/native/sla_gerpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_lin_berr.f b/examples/lapack/native/sla_lin_berr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_lin_berr.f rename to examples/lapack/native/sla_lin_berr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_porcond.f b/examples/lapack/native/sla_porcond.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_porcond.f rename to examples/lapack/native/sla_porcond.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_porfsx_extended.f b/examples/lapack/native/sla_porfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_porfsx_extended.f rename to examples/lapack/native/sla_porfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_porpvgrw.f b/examples/lapack/native/sla_porpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_porpvgrw.f rename to examples/lapack/native/sla_porpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_syamv.f b/examples/lapack/native/sla_syamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_syamv.f rename to examples/lapack/native/sla_syamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_syrcond.f b/examples/lapack/native/sla_syrcond.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_syrcond.f rename to examples/lapack/native/sla_syrcond.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_syrfsx_extended.f b/examples/lapack/native/sla_syrfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_syrfsx_extended.f rename to examples/lapack/native/sla_syrfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_syrpvgrw.f b/examples/lapack/native/sla_syrpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_syrpvgrw.f rename to examples/lapack/native/sla_syrpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_wwaddw.f b/examples/lapack/native/sla_wwaddw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sla_wwaddw.f rename to examples/lapack/native/sla_wwaddw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slabad.f b/examples/lapack/native/slabad.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slabad.f rename to examples/lapack/native/slabad.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slabrd.f b/examples/lapack/native/slabrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slabrd.f rename to examples/lapack/native/slabrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slacn2.f b/examples/lapack/native/slacn2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slacn2.f rename to examples/lapack/native/slacn2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slacon.f b/examples/lapack/native/slacon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slacon.f rename to examples/lapack/native/slacon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slacpy.f b/examples/lapack/native/slacpy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slacpy.f rename to examples/lapack/native/slacpy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sladiv.f b/examples/lapack/native/sladiv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sladiv.f rename to examples/lapack/native/sladiv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slae2.f b/examples/lapack/native/slae2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slae2.f rename to examples/lapack/native/slae2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaebz.f b/examples/lapack/native/slaebz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaebz.f rename to examples/lapack/native/slaebz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed0.f b/examples/lapack/native/slaed0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed0.f rename to examples/lapack/native/slaed0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed1.f b/examples/lapack/native/slaed1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed1.f rename to examples/lapack/native/slaed1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed2.f b/examples/lapack/native/slaed2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed2.f rename to examples/lapack/native/slaed2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed3.f b/examples/lapack/native/slaed3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed3.f rename to examples/lapack/native/slaed3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed4.f b/examples/lapack/native/slaed4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed4.f rename to examples/lapack/native/slaed4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed5.f b/examples/lapack/native/slaed5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed5.f rename to examples/lapack/native/slaed5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed6.f b/examples/lapack/native/slaed6.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed6.f rename to examples/lapack/native/slaed6.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed7.f b/examples/lapack/native/slaed7.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed7.f rename to examples/lapack/native/slaed7.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed8.f b/examples/lapack/native/slaed8.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed8.f rename to examples/lapack/native/slaed8.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed9.f b/examples/lapack/native/slaed9.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaed9.f rename to examples/lapack/native/slaed9.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaeda.f b/examples/lapack/native/slaeda.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaeda.f rename to examples/lapack/native/slaeda.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaein.f b/examples/lapack/native/slaein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaein.f rename to examples/lapack/native/slaein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaev2.f b/examples/lapack/native/slaev2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaev2.f rename to examples/lapack/native/slaev2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaexc.f b/examples/lapack/native/slaexc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaexc.f rename to examples/lapack/native/slaexc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slag2.f b/examples/lapack/native/slag2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slag2.f rename to examples/lapack/native/slag2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slag2d.f b/examples/lapack/native/slag2d.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slag2d.f rename to examples/lapack/native/slag2d.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slags2.f b/examples/lapack/native/slags2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slags2.f rename to examples/lapack/native/slags2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slagtf.f b/examples/lapack/native/slagtf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slagtf.f rename to examples/lapack/native/slagtf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slagtm.f b/examples/lapack/native/slagtm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slagtm.f rename to examples/lapack/native/slagtm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slagts.f b/examples/lapack/native/slagts.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slagts.f rename to examples/lapack/native/slagts.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slagv2.f b/examples/lapack/native/slagv2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slagv2.f rename to examples/lapack/native/slagv2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slahqr.f b/examples/lapack/native/slahqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slahqr.f rename to examples/lapack/native/slahqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slahr2.f b/examples/lapack/native/slahr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slahr2.f rename to examples/lapack/native/slahr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaic1.f b/examples/lapack/native/slaic1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaic1.f rename to examples/lapack/native/slaic1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaisnan.f b/examples/lapack/native/slaisnan.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaisnan.f rename to examples/lapack/native/slaisnan.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaln2.f b/examples/lapack/native/slaln2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaln2.f rename to examples/lapack/native/slaln2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slals0.f b/examples/lapack/native/slals0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slals0.f rename to examples/lapack/native/slals0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slalsa.f b/examples/lapack/native/slalsa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slalsa.f rename to examples/lapack/native/slalsa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slalsd.f b/examples/lapack/native/slalsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slalsd.f rename to examples/lapack/native/slalsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slamrg.f b/examples/lapack/native/slamrg.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slamrg.f rename to examples/lapack/native/slamrg.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slamswlq.f b/examples/lapack/native/slamswlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slamswlq.f rename to examples/lapack/native/slamswlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slamtsqr.f b/examples/lapack/native/slamtsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slamtsqr.f rename to examples/lapack/native/slamtsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaneg.f b/examples/lapack/native/slaneg.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaneg.f rename to examples/lapack/native/slaneg.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slangb.f b/examples/lapack/native/slangb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slangb.f rename to examples/lapack/native/slangb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slange.f b/examples/lapack/native/slange.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slange.f rename to examples/lapack/native/slange.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slangt.f b/examples/lapack/native/slangt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slangt.f rename to examples/lapack/native/slangt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slanhs.f b/examples/lapack/native/slanhs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slanhs.f rename to examples/lapack/native/slanhs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slansb.f b/examples/lapack/native/slansb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slansb.f rename to examples/lapack/native/slansb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slansf.f b/examples/lapack/native/slansf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slansf.f rename to examples/lapack/native/slansf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slansp.f b/examples/lapack/native/slansp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slansp.f rename to examples/lapack/native/slansp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slanst.f b/examples/lapack/native/slanst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slanst.f rename to examples/lapack/native/slanst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slansy.f b/examples/lapack/native/slansy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slansy.f rename to examples/lapack/native/slansy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slantb.f b/examples/lapack/native/slantb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slantb.f rename to examples/lapack/native/slantb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slantp.f b/examples/lapack/native/slantp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slantp.f rename to examples/lapack/native/slantp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slantr.f b/examples/lapack/native/slantr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slantr.f rename to examples/lapack/native/slantr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slanv2.f b/examples/lapack/native/slanv2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slanv2.f rename to examples/lapack/native/slanv2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaorhr_col_getrfnp.f b/examples/lapack/native/slaorhr_col_getrfnp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaorhr_col_getrfnp.f rename to examples/lapack/native/slaorhr_col_getrfnp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaorhr_col_getrfnp2.f b/examples/lapack/native/slaorhr_col_getrfnp2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaorhr_col_getrfnp2.f rename to examples/lapack/native/slaorhr_col_getrfnp2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slapll.f b/examples/lapack/native/slapll.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slapll.f rename to examples/lapack/native/slapll.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slapmr.f b/examples/lapack/native/slapmr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slapmr.f rename to examples/lapack/native/slapmr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slapmt.f b/examples/lapack/native/slapmt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slapmt.f rename to examples/lapack/native/slapmt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slapy2.f b/examples/lapack/native/slapy2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slapy2.f rename to examples/lapack/native/slapy2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slapy3.f b/examples/lapack/native/slapy3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slapy3.f rename to examples/lapack/native/slapy3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqgb.f b/examples/lapack/native/slaqgb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqgb.f rename to examples/lapack/native/slaqgb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqge.f b/examples/lapack/native/slaqge.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqge.f rename to examples/lapack/native/slaqge.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqp2.f b/examples/lapack/native/slaqp2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqp2.f rename to examples/lapack/native/slaqp2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqp2rk.f b/examples/lapack/native/slaqp2rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqp2rk.f rename to examples/lapack/native/slaqp2rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqp3rk.f b/examples/lapack/native/slaqp3rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqp3rk.f rename to examples/lapack/native/slaqp3rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqps.f b/examples/lapack/native/slaqps.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqps.f rename to examples/lapack/native/slaqps.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr0.f b/examples/lapack/native/slaqr0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr0.f rename to examples/lapack/native/slaqr0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr1.f b/examples/lapack/native/slaqr1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr1.f rename to examples/lapack/native/slaqr1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr2.f b/examples/lapack/native/slaqr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr2.f rename to examples/lapack/native/slaqr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr3.f b/examples/lapack/native/slaqr3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr3.f rename to examples/lapack/native/slaqr3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr4.f b/examples/lapack/native/slaqr4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr4.f rename to examples/lapack/native/slaqr4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr5.f b/examples/lapack/native/slaqr5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqr5.f rename to examples/lapack/native/slaqr5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqsb.f b/examples/lapack/native/slaqsb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqsb.f rename to examples/lapack/native/slaqsb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqsp.f b/examples/lapack/native/slaqsp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqsp.f rename to examples/lapack/native/slaqsp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqsy.f b/examples/lapack/native/slaqsy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqsy.f rename to examples/lapack/native/slaqsy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqtr.f b/examples/lapack/native/slaqtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqtr.f rename to examples/lapack/native/slaqtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqz0.f b/examples/lapack/native/slaqz0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqz0.f rename to examples/lapack/native/slaqz0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqz1.f b/examples/lapack/native/slaqz1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqz1.f rename to examples/lapack/native/slaqz1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqz2.f b/examples/lapack/native/slaqz2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqz2.f rename to examples/lapack/native/slaqz2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqz3.f b/examples/lapack/native/slaqz3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqz3.f rename to examples/lapack/native/slaqz3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqz4.f b/examples/lapack/native/slaqz4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaqz4.f rename to examples/lapack/native/slaqz4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slar1v.f b/examples/lapack/native/slar1v.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slar1v.f rename to examples/lapack/native/slar1v.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slar2v.f b/examples/lapack/native/slar2v.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slar2v.f rename to examples/lapack/native/slar2v.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarf.f b/examples/lapack/native/slarf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarf.f rename to examples/lapack/native/slarf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarf1f.f b/examples/lapack/native/slarf1f.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarf1f.f rename to examples/lapack/native/slarf1f.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarf1l.f b/examples/lapack/native/slarf1l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarf1l.f rename to examples/lapack/native/slarf1l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfb.f b/examples/lapack/native/slarfb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfb.f rename to examples/lapack/native/slarfb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfb_gett.f b/examples/lapack/native/slarfb_gett.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfb_gett.f rename to examples/lapack/native/slarfb_gett.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfg.f b/examples/lapack/native/slarfg.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfg.f rename to examples/lapack/native/slarfg.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfgp.f b/examples/lapack/native/slarfgp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfgp.f rename to examples/lapack/native/slarfgp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarft.f b/examples/lapack/native/slarft.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarft.f rename to examples/lapack/native/slarft.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfx.f b/examples/lapack/native/slarfx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfx.f rename to examples/lapack/native/slarfx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfy.f b/examples/lapack/native/slarfy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarfy.f rename to examples/lapack/native/slarfy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slargv.f b/examples/lapack/native/slargv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slargv.f rename to examples/lapack/native/slargv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarmm.f b/examples/lapack/native/slarmm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarmm.f rename to examples/lapack/native/slarmm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarnv.f b/examples/lapack/native/slarnv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarnv.f rename to examples/lapack/native/slarnv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarra.f b/examples/lapack/native/slarra.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarra.f rename to examples/lapack/native/slarra.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrb.f b/examples/lapack/native/slarrb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrb.f rename to examples/lapack/native/slarrb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrc.f b/examples/lapack/native/slarrc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrc.f rename to examples/lapack/native/slarrc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrd.f b/examples/lapack/native/slarrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrd.f rename to examples/lapack/native/slarrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarre.f b/examples/lapack/native/slarre.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarre.f rename to examples/lapack/native/slarre.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrf.f b/examples/lapack/native/slarrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrf.f rename to examples/lapack/native/slarrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrj.f b/examples/lapack/native/slarrj.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrj.f rename to examples/lapack/native/slarrj.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrk.f b/examples/lapack/native/slarrk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrk.f rename to examples/lapack/native/slarrk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrr.f b/examples/lapack/native/slarrr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrr.f rename to examples/lapack/native/slarrr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrv.f b/examples/lapack/native/slarrv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarrv.f rename to examples/lapack/native/slarrv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarscl2.f b/examples/lapack/native/slarscl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarscl2.f rename to examples/lapack/native/slarscl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slartg.f90 b/examples/lapack/native/slartg.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slartg.f90 rename to examples/lapack/native/slartg.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slartgp.f b/examples/lapack/native/slartgp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slartgp.f rename to examples/lapack/native/slartgp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slartgs.f b/examples/lapack/native/slartgs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slartgs.f rename to examples/lapack/native/slartgs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slartv.f b/examples/lapack/native/slartv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slartv.f rename to examples/lapack/native/slartv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaruv.f b/examples/lapack/native/slaruv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaruv.f rename to examples/lapack/native/slaruv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarz.f b/examples/lapack/native/slarz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarz.f rename to examples/lapack/native/slarz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarzb.f b/examples/lapack/native/slarzb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarzb.f rename to examples/lapack/native/slarzb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarzt.f b/examples/lapack/native/slarzt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slarzt.f rename to examples/lapack/native/slarzt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slas2.f b/examples/lapack/native/slas2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slas2.f rename to examples/lapack/native/slas2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slascl.f b/examples/lapack/native/slascl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slascl.f rename to examples/lapack/native/slascl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slascl2.f b/examples/lapack/native/slascl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slascl2.f rename to examples/lapack/native/slascl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd0.f b/examples/lapack/native/slasd0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd0.f rename to examples/lapack/native/slasd0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd1.f b/examples/lapack/native/slasd1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd1.f rename to examples/lapack/native/slasd1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd2.f b/examples/lapack/native/slasd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd2.f rename to examples/lapack/native/slasd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd3.f b/examples/lapack/native/slasd3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd3.f rename to examples/lapack/native/slasd3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd4.f b/examples/lapack/native/slasd4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd4.f rename to examples/lapack/native/slasd4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd5.f b/examples/lapack/native/slasd5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd5.f rename to examples/lapack/native/slasd5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd6.f b/examples/lapack/native/slasd6.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd6.f rename to examples/lapack/native/slasd6.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd7.f b/examples/lapack/native/slasd7.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd7.f rename to examples/lapack/native/slasd7.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd8.f b/examples/lapack/native/slasd8.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasd8.f rename to examples/lapack/native/slasd8.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasda.f b/examples/lapack/native/slasda.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasda.f rename to examples/lapack/native/slasda.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasdq.f b/examples/lapack/native/slasdq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasdq.f rename to examples/lapack/native/slasdq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasdt.f b/examples/lapack/native/slasdt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasdt.f rename to examples/lapack/native/slasdt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaset.f b/examples/lapack/native/slaset.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaset.f rename to examples/lapack/native/slaset.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq1.f b/examples/lapack/native/slasq1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq1.f rename to examples/lapack/native/slasq1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq2.f b/examples/lapack/native/slasq2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq2.f rename to examples/lapack/native/slasq2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq3.f b/examples/lapack/native/slasq3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq3.f rename to examples/lapack/native/slasq3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq4.f b/examples/lapack/native/slasq4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq4.f rename to examples/lapack/native/slasq4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq5.f b/examples/lapack/native/slasq5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq5.f rename to examples/lapack/native/slasq5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq6.f b/examples/lapack/native/slasq6.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasq6.f rename to examples/lapack/native/slasq6.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasr.f b/examples/lapack/native/slasr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasr.f rename to examples/lapack/native/slasr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasrt.f b/examples/lapack/native/slasrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasrt.f rename to examples/lapack/native/slasrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slassq.f90 b/examples/lapack/native/slassq.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slassq.f90 rename to examples/lapack/native/slassq.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasv2.f b/examples/lapack/native/slasv2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasv2.f rename to examples/lapack/native/slasv2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaswlq.f b/examples/lapack/native/slaswlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaswlq.f rename to examples/lapack/native/slaswlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaswp.f b/examples/lapack/native/slaswp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slaswp.f rename to examples/lapack/native/slaswp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasy2.f b/examples/lapack/native/slasy2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasy2.f rename to examples/lapack/native/slasy2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasyf.f b/examples/lapack/native/slasyf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasyf.f rename to examples/lapack/native/slasyf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasyf_aa.f b/examples/lapack/native/slasyf_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasyf_aa.f rename to examples/lapack/native/slasyf_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasyf_rk.f b/examples/lapack/native/slasyf_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasyf_rk.f rename to examples/lapack/native/slasyf_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasyf_rook.f b/examples/lapack/native/slasyf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slasyf_rook.f rename to examples/lapack/native/slasyf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatbs.f b/examples/lapack/native/slatbs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatbs.f rename to examples/lapack/native/slatbs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatdf.f b/examples/lapack/native/slatdf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatdf.f rename to examples/lapack/native/slatdf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatps.f b/examples/lapack/native/slatps.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatps.f rename to examples/lapack/native/slatps.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatrd.f b/examples/lapack/native/slatrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatrd.f rename to examples/lapack/native/slatrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatrs.f b/examples/lapack/native/slatrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatrs.f rename to examples/lapack/native/slatrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatrs3.f b/examples/lapack/native/slatrs3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatrs3.f rename to examples/lapack/native/slatrs3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatrz.f b/examples/lapack/native/slatrz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatrz.f rename to examples/lapack/native/slatrz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatsqr.f b/examples/lapack/native/slatsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slatsqr.f rename to examples/lapack/native/slatsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slauu2.f b/examples/lapack/native/slauu2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slauu2.f rename to examples/lapack/native/slauu2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slauum.f b/examples/lapack/native/slauum.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/slauum.f rename to examples/lapack/native/slauum.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sopgtr.f b/examples/lapack/native/sopgtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sopgtr.f rename to examples/lapack/native/sopgtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sopmtr.f b/examples/lapack/native/sopmtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sopmtr.f rename to examples/lapack/native/sopmtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb.f b/examples/lapack/native/sorbdb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb.f rename to examples/lapack/native/sorbdb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb1.f b/examples/lapack/native/sorbdb1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb1.f rename to examples/lapack/native/sorbdb1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb2.f b/examples/lapack/native/sorbdb2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb2.f rename to examples/lapack/native/sorbdb2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb3.f b/examples/lapack/native/sorbdb3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb3.f rename to examples/lapack/native/sorbdb3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb4.f b/examples/lapack/native/sorbdb4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb4.f rename to examples/lapack/native/sorbdb4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb5.f b/examples/lapack/native/sorbdb5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb5.f rename to examples/lapack/native/sorbdb5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb6.f b/examples/lapack/native/sorbdb6.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorbdb6.f rename to examples/lapack/native/sorbdb6.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorcsd.f b/examples/lapack/native/sorcsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorcsd.f rename to examples/lapack/native/sorcsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorcsd2by1.f b/examples/lapack/native/sorcsd2by1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorcsd2by1.f rename to examples/lapack/native/sorcsd2by1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorg2l.f b/examples/lapack/native/sorg2l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorg2l.f rename to examples/lapack/native/sorg2l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorg2r.f b/examples/lapack/native/sorg2r.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorg2r.f rename to examples/lapack/native/sorg2r.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgbr.f b/examples/lapack/native/sorgbr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgbr.f rename to examples/lapack/native/sorgbr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorghr.f b/examples/lapack/native/sorghr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorghr.f rename to examples/lapack/native/sorghr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgl2.f b/examples/lapack/native/sorgl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgl2.f rename to examples/lapack/native/sorgl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorglq.f b/examples/lapack/native/sorglq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorglq.f rename to examples/lapack/native/sorglq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgql.f b/examples/lapack/native/sorgql.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgql.f rename to examples/lapack/native/sorgql.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgqr.f b/examples/lapack/native/sorgqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgqr.f rename to examples/lapack/native/sorgqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgr2.f b/examples/lapack/native/sorgr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgr2.f rename to examples/lapack/native/sorgr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgrq.f b/examples/lapack/native/sorgrq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgrq.f rename to examples/lapack/native/sorgrq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgtr.f b/examples/lapack/native/sorgtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgtr.f rename to examples/lapack/native/sorgtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgtsqr.f b/examples/lapack/native/sorgtsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgtsqr.f rename to examples/lapack/native/sorgtsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgtsqr_row.f b/examples/lapack/native/sorgtsqr_row.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorgtsqr_row.f rename to examples/lapack/native/sorgtsqr_row.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorhr_col.f b/examples/lapack/native/sorhr_col.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorhr_col.f rename to examples/lapack/native/sorhr_col.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorm22.f b/examples/lapack/native/sorm22.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorm22.f rename to examples/lapack/native/sorm22.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorm2l.f b/examples/lapack/native/sorm2l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorm2l.f rename to examples/lapack/native/sorm2l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorm2r.f b/examples/lapack/native/sorm2r.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorm2r.f rename to examples/lapack/native/sorm2r.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormbr.f b/examples/lapack/native/sormbr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormbr.f rename to examples/lapack/native/sormbr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormhr.f b/examples/lapack/native/sormhr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormhr.f rename to examples/lapack/native/sormhr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorml2.f b/examples/lapack/native/sorml2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sorml2.f rename to examples/lapack/native/sorml2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormlq.f b/examples/lapack/native/sormlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormlq.f rename to examples/lapack/native/sormlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormql.f b/examples/lapack/native/sormql.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormql.f rename to examples/lapack/native/sormql.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormqr.f b/examples/lapack/native/sormqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormqr.f rename to examples/lapack/native/sormqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormr2.f b/examples/lapack/native/sormr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormr2.f rename to examples/lapack/native/sormr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormr3.f b/examples/lapack/native/sormr3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormr3.f rename to examples/lapack/native/sormr3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormrq.f b/examples/lapack/native/sormrq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormrq.f rename to examples/lapack/native/sormrq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormrz.f b/examples/lapack/native/sormrz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormrz.f rename to examples/lapack/native/sormrz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormtr.f b/examples/lapack/native/sormtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sormtr.f rename to examples/lapack/native/sormtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbcon.f b/examples/lapack/native/spbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbcon.f rename to examples/lapack/native/spbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbequ.f b/examples/lapack/native/spbequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbequ.f rename to examples/lapack/native/spbequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbrfs.f b/examples/lapack/native/spbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbrfs.f rename to examples/lapack/native/spbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbstf.f b/examples/lapack/native/spbstf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbstf.f rename to examples/lapack/native/spbstf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbsv.f b/examples/lapack/native/spbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbsv.f rename to examples/lapack/native/spbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbsvx.f b/examples/lapack/native/spbsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbsvx.f rename to examples/lapack/native/spbsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbtf2.f b/examples/lapack/native/spbtf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbtf2.f rename to examples/lapack/native/spbtf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbtrf.f b/examples/lapack/native/spbtrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbtrf.f rename to examples/lapack/native/spbtrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbtrs.f b/examples/lapack/native/spbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spbtrs.f rename to examples/lapack/native/spbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spftrf.f b/examples/lapack/native/spftrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spftrf.f rename to examples/lapack/native/spftrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spftri.f b/examples/lapack/native/spftri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spftri.f rename to examples/lapack/native/spftri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spftrs.f b/examples/lapack/native/spftrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spftrs.f rename to examples/lapack/native/spftrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spocon.f b/examples/lapack/native/spocon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spocon.f rename to examples/lapack/native/spocon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spoequ.f b/examples/lapack/native/spoequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spoequ.f rename to examples/lapack/native/spoequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spoequb.f b/examples/lapack/native/spoequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spoequb.f rename to examples/lapack/native/spoequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sporfs.f b/examples/lapack/native/sporfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sporfs.f rename to examples/lapack/native/sporfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sporfsx.f b/examples/lapack/native/sporfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sporfsx.f rename to examples/lapack/native/sporfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sposv.f b/examples/lapack/native/sposv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sposv.f rename to examples/lapack/native/sposv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sposvx.f b/examples/lapack/native/sposvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sposvx.f rename to examples/lapack/native/sposvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sposvxx.f b/examples/lapack/native/sposvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sposvxx.f rename to examples/lapack/native/sposvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spotf2.f b/examples/lapack/native/spotf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spotf2.f rename to examples/lapack/native/spotf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spotrf.f b/examples/lapack/native/spotrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spotrf.f rename to examples/lapack/native/spotrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spotrf2.f b/examples/lapack/native/spotrf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spotrf2.f rename to examples/lapack/native/spotrf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spotri.f b/examples/lapack/native/spotri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spotri.f rename to examples/lapack/native/spotri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spotrs.f b/examples/lapack/native/spotrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spotrs.f rename to examples/lapack/native/spotrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sppcon.f b/examples/lapack/native/sppcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sppcon.f rename to examples/lapack/native/sppcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sppequ.f b/examples/lapack/native/sppequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sppequ.f rename to examples/lapack/native/sppequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spprfs.f b/examples/lapack/native/spprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spprfs.f rename to examples/lapack/native/spprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sppsv.f b/examples/lapack/native/sppsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sppsv.f rename to examples/lapack/native/sppsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sppsvx.f b/examples/lapack/native/sppsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sppsvx.f rename to examples/lapack/native/sppsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spptrf.f b/examples/lapack/native/spptrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spptrf.f rename to examples/lapack/native/spptrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spptri.f b/examples/lapack/native/spptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spptri.f rename to examples/lapack/native/spptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spptrs.f b/examples/lapack/native/spptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spptrs.f rename to examples/lapack/native/spptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spstf2.f b/examples/lapack/native/spstf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spstf2.f rename to examples/lapack/native/spstf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spstrf.f b/examples/lapack/native/spstrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spstrf.f rename to examples/lapack/native/spstrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sptcon.f b/examples/lapack/native/sptcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sptcon.f rename to examples/lapack/native/sptcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spteqr.f b/examples/lapack/native/spteqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spteqr.f rename to examples/lapack/native/spteqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sptrfs.f b/examples/lapack/native/sptrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sptrfs.f rename to examples/lapack/native/sptrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sptsv.f b/examples/lapack/native/sptsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sptsv.f rename to examples/lapack/native/sptsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sptsvx.f b/examples/lapack/native/sptsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sptsvx.f rename to examples/lapack/native/sptsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spttrf.f b/examples/lapack/native/spttrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spttrf.f rename to examples/lapack/native/spttrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spttrs.f b/examples/lapack/native/spttrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/spttrs.f rename to examples/lapack/native/spttrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sptts2.f b/examples/lapack/native/sptts2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sptts2.f rename to examples/lapack/native/sptts2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/srscl.f b/examples/lapack/native/srscl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/srscl.f rename to examples/lapack/native/srscl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssb2st_kernels.f b/examples/lapack/native/ssb2st_kernels.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssb2st_kernels.f rename to examples/lapack/native/ssb2st_kernels.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbev.f b/examples/lapack/native/ssbev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbev.f rename to examples/lapack/native/ssbev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbev_2stage.f b/examples/lapack/native/ssbev_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbev_2stage.f rename to examples/lapack/native/ssbev_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbevd.f b/examples/lapack/native/ssbevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbevd.f rename to examples/lapack/native/ssbevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbevd_2stage.f b/examples/lapack/native/ssbevd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbevd_2stage.f rename to examples/lapack/native/ssbevd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbevx.f b/examples/lapack/native/ssbevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbevx.f rename to examples/lapack/native/ssbevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbevx_2stage.f b/examples/lapack/native/ssbevx_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbevx_2stage.f rename to examples/lapack/native/ssbevx_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbgst.f b/examples/lapack/native/ssbgst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbgst.f rename to examples/lapack/native/ssbgst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbgv.f b/examples/lapack/native/ssbgv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbgv.f rename to examples/lapack/native/ssbgv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbgvd.f b/examples/lapack/native/ssbgvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbgvd.f rename to examples/lapack/native/ssbgvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbgvx.f b/examples/lapack/native/ssbgvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbgvx.f rename to examples/lapack/native/ssbgvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbtrd.f b/examples/lapack/native/ssbtrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssbtrd.f rename to examples/lapack/native/ssbtrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssfrk.f b/examples/lapack/native/ssfrk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssfrk.f rename to examples/lapack/native/ssfrk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspcon.f b/examples/lapack/native/sspcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspcon.f rename to examples/lapack/native/sspcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspev.f b/examples/lapack/native/sspev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspev.f rename to examples/lapack/native/sspev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspevd.f b/examples/lapack/native/sspevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspevd.f rename to examples/lapack/native/sspevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspevx.f b/examples/lapack/native/sspevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspevx.f rename to examples/lapack/native/sspevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspgst.f b/examples/lapack/native/sspgst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspgst.f rename to examples/lapack/native/sspgst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspgv.f b/examples/lapack/native/sspgv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspgv.f rename to examples/lapack/native/sspgv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspgvd.f b/examples/lapack/native/sspgvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspgvd.f rename to examples/lapack/native/sspgvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspgvx.f b/examples/lapack/native/sspgvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspgvx.f rename to examples/lapack/native/sspgvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssprfs.f b/examples/lapack/native/ssprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssprfs.f rename to examples/lapack/native/ssprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspsv.f b/examples/lapack/native/sspsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspsv.f rename to examples/lapack/native/sspsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspsvx.f b/examples/lapack/native/sspsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sspsvx.f rename to examples/lapack/native/sspsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssptrd.f b/examples/lapack/native/ssptrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssptrd.f rename to examples/lapack/native/ssptrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssptrf.f b/examples/lapack/native/ssptrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssptrf.f rename to examples/lapack/native/ssptrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssptri.f b/examples/lapack/native/ssptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssptri.f rename to examples/lapack/native/ssptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssptrs.f b/examples/lapack/native/ssptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssptrs.f rename to examples/lapack/native/ssptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstebz.f b/examples/lapack/native/sstebz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstebz.f rename to examples/lapack/native/sstebz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstedc.f b/examples/lapack/native/sstedc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstedc.f rename to examples/lapack/native/sstedc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstegr.f b/examples/lapack/native/sstegr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstegr.f rename to examples/lapack/native/sstegr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstein.f b/examples/lapack/native/sstein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstein.f rename to examples/lapack/native/sstein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstemr.f b/examples/lapack/native/sstemr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstemr.f rename to examples/lapack/native/sstemr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssteqr.f b/examples/lapack/native/ssteqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssteqr.f rename to examples/lapack/native/ssteqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssterf.f b/examples/lapack/native/ssterf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssterf.f rename to examples/lapack/native/ssterf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstev.f b/examples/lapack/native/sstev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstev.f rename to examples/lapack/native/sstev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstevd.f b/examples/lapack/native/sstevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstevd.f rename to examples/lapack/native/sstevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstevr.f b/examples/lapack/native/sstevr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstevr.f rename to examples/lapack/native/sstevr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstevx.f b/examples/lapack/native/sstevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/sstevx.f rename to examples/lapack/native/sstevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssycon.f b/examples/lapack/native/ssycon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssycon.f rename to examples/lapack/native/ssycon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssycon_3.f b/examples/lapack/native/ssycon_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssycon_3.f rename to examples/lapack/native/ssycon_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssycon_rook.f b/examples/lapack/native/ssycon_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssycon_rook.f rename to examples/lapack/native/ssycon_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyconv.f b/examples/lapack/native/ssyconv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyconv.f rename to examples/lapack/native/ssyconv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyconvf.f b/examples/lapack/native/ssyconvf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyconvf.f rename to examples/lapack/native/ssyconvf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyconvf_rook.f b/examples/lapack/native/ssyconvf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyconvf_rook.f rename to examples/lapack/native/ssyconvf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyequb.f b/examples/lapack/native/ssyequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyequb.f rename to examples/lapack/native/ssyequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyev.f b/examples/lapack/native/ssyev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyev.f rename to examples/lapack/native/ssyev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyev_2stage.f b/examples/lapack/native/ssyev_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyev_2stage.f rename to examples/lapack/native/ssyev_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevd.f b/examples/lapack/native/ssyevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevd.f rename to examples/lapack/native/ssyevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevd_2stage.f b/examples/lapack/native/ssyevd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevd_2stage.f rename to examples/lapack/native/ssyevd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevr.f b/examples/lapack/native/ssyevr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevr.f rename to examples/lapack/native/ssyevr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevr_2stage.f b/examples/lapack/native/ssyevr_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevr_2stage.f rename to examples/lapack/native/ssyevr_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevx.f b/examples/lapack/native/ssyevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevx.f rename to examples/lapack/native/ssyevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevx_2stage.f b/examples/lapack/native/ssyevx_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyevx_2stage.f rename to examples/lapack/native/ssyevx_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygs2.f b/examples/lapack/native/ssygs2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygs2.f rename to examples/lapack/native/ssygs2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygst.f b/examples/lapack/native/ssygst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygst.f rename to examples/lapack/native/ssygst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygv.f b/examples/lapack/native/ssygv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygv.f rename to examples/lapack/native/ssygv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygv_2stage.f b/examples/lapack/native/ssygv_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygv_2stage.f rename to examples/lapack/native/ssygv_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygvd.f b/examples/lapack/native/ssygvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygvd.f rename to examples/lapack/native/ssygvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygvx.f b/examples/lapack/native/ssygvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssygvx.f rename to examples/lapack/native/ssygvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyrfs.f b/examples/lapack/native/ssyrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyrfs.f rename to examples/lapack/native/ssyrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyrfsx.f b/examples/lapack/native/ssyrfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyrfsx.f rename to examples/lapack/native/ssyrfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysv.f b/examples/lapack/native/ssysv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysv.f rename to examples/lapack/native/ssysv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysv_aa.f b/examples/lapack/native/ssysv_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysv_aa.f rename to examples/lapack/native/ssysv_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysv_aa_2stage.f b/examples/lapack/native/ssysv_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysv_aa_2stage.f rename to examples/lapack/native/ssysv_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysv_rk.f b/examples/lapack/native/ssysv_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysv_rk.f rename to examples/lapack/native/ssysv_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysv_rook.f b/examples/lapack/native/ssysv_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysv_rook.f rename to examples/lapack/native/ssysv_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysvx.f b/examples/lapack/native/ssysvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysvx.f rename to examples/lapack/native/ssysvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysvxx.f b/examples/lapack/native/ssysvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssysvxx.f rename to examples/lapack/native/ssysvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyswapr.f b/examples/lapack/native/ssyswapr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssyswapr.f rename to examples/lapack/native/ssyswapr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytd2.f b/examples/lapack/native/ssytd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytd2.f rename to examples/lapack/native/ssytd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytf2.f b/examples/lapack/native/ssytf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytf2.f rename to examples/lapack/native/ssytf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytf2_rk.f b/examples/lapack/native/ssytf2_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytf2_rk.f rename to examples/lapack/native/ssytf2_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytf2_rook.f b/examples/lapack/native/ssytf2_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytf2_rook.f rename to examples/lapack/native/ssytf2_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrd.f b/examples/lapack/native/ssytrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrd.f rename to examples/lapack/native/ssytrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrd_2stage.f b/examples/lapack/native/ssytrd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrd_2stage.f rename to examples/lapack/native/ssytrd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrd_sb2st.F b/examples/lapack/native/ssytrd_sb2st.F similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrd_sb2st.F rename to examples/lapack/native/ssytrd_sb2st.F diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrd_sy2sb.f b/examples/lapack/native/ssytrd_sy2sb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrd_sy2sb.f rename to examples/lapack/native/ssytrd_sy2sb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrf.f b/examples/lapack/native/ssytrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrf.f rename to examples/lapack/native/ssytrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrf_aa.f b/examples/lapack/native/ssytrf_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrf_aa.f rename to examples/lapack/native/ssytrf_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrf_aa_2stage.f b/examples/lapack/native/ssytrf_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrf_aa_2stage.f rename to examples/lapack/native/ssytrf_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrf_rk.f b/examples/lapack/native/ssytrf_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrf_rk.f rename to examples/lapack/native/ssytrf_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrf_rook.f b/examples/lapack/native/ssytrf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrf_rook.f rename to examples/lapack/native/ssytrf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri.f b/examples/lapack/native/ssytri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri.f rename to examples/lapack/native/ssytri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri2.f b/examples/lapack/native/ssytri2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri2.f rename to examples/lapack/native/ssytri2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri2x.f b/examples/lapack/native/ssytri2x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri2x.f rename to examples/lapack/native/ssytri2x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri_3.f b/examples/lapack/native/ssytri_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri_3.f rename to examples/lapack/native/ssytri_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri_3x.f b/examples/lapack/native/ssytri_3x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri_3x.f rename to examples/lapack/native/ssytri_3x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri_rook.f b/examples/lapack/native/ssytri_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytri_rook.f rename to examples/lapack/native/ssytri_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs.f b/examples/lapack/native/ssytrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs.f rename to examples/lapack/native/ssytrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs2.f b/examples/lapack/native/ssytrs2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs2.f rename to examples/lapack/native/ssytrs2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs_3.f b/examples/lapack/native/ssytrs_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs_3.f rename to examples/lapack/native/ssytrs_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs_aa.f b/examples/lapack/native/ssytrs_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs_aa.f rename to examples/lapack/native/ssytrs_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs_aa_2stage.f b/examples/lapack/native/ssytrs_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs_aa_2stage.f rename to examples/lapack/native/ssytrs_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs_rook.f b/examples/lapack/native/ssytrs_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ssytrs_rook.f rename to examples/lapack/native/ssytrs_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stbcon.f b/examples/lapack/native/stbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stbcon.f rename to examples/lapack/native/stbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stbrfs.f b/examples/lapack/native/stbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stbrfs.f rename to examples/lapack/native/stbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stbtrs.f b/examples/lapack/native/stbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stbtrs.f rename to examples/lapack/native/stbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stfsm.f b/examples/lapack/native/stfsm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stfsm.f rename to examples/lapack/native/stfsm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stftri.f b/examples/lapack/native/stftri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stftri.f rename to examples/lapack/native/stftri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stfttp.f b/examples/lapack/native/stfttp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stfttp.f rename to examples/lapack/native/stfttp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stfttr.f b/examples/lapack/native/stfttr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stfttr.f rename to examples/lapack/native/stfttr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgevc.f b/examples/lapack/native/stgevc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgevc.f rename to examples/lapack/native/stgevc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgex2.f b/examples/lapack/native/stgex2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgex2.f rename to examples/lapack/native/stgex2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgexc.f b/examples/lapack/native/stgexc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgexc.f rename to examples/lapack/native/stgexc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgsen.f b/examples/lapack/native/stgsen.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgsen.f rename to examples/lapack/native/stgsen.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgsja.f b/examples/lapack/native/stgsja.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgsja.f rename to examples/lapack/native/stgsja.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgsna.f b/examples/lapack/native/stgsna.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgsna.f rename to examples/lapack/native/stgsna.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgsy2.f b/examples/lapack/native/stgsy2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgsy2.f rename to examples/lapack/native/stgsy2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgsyl.f b/examples/lapack/native/stgsyl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stgsyl.f rename to examples/lapack/native/stgsyl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpcon.f b/examples/lapack/native/stpcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpcon.f rename to examples/lapack/native/stpcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stplqt.f b/examples/lapack/native/stplqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stplqt.f rename to examples/lapack/native/stplqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stplqt2.f b/examples/lapack/native/stplqt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stplqt2.f rename to examples/lapack/native/stplqt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpmlqt.f b/examples/lapack/native/stpmlqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpmlqt.f rename to examples/lapack/native/stpmlqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpmqrt.f b/examples/lapack/native/stpmqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpmqrt.f rename to examples/lapack/native/stpmqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpqrt.f b/examples/lapack/native/stpqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpqrt.f rename to examples/lapack/native/stpqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpqrt2.f b/examples/lapack/native/stpqrt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpqrt2.f rename to examples/lapack/native/stpqrt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stprfb.f b/examples/lapack/native/stprfb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stprfb.f rename to examples/lapack/native/stprfb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stprfs.f b/examples/lapack/native/stprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stprfs.f rename to examples/lapack/native/stprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stptri.f b/examples/lapack/native/stptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stptri.f rename to examples/lapack/native/stptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stptrs.f b/examples/lapack/native/stptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stptrs.f rename to examples/lapack/native/stptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpttf.f b/examples/lapack/native/stpttf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpttf.f rename to examples/lapack/native/stpttf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpttr.f b/examples/lapack/native/stpttr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stpttr.f rename to examples/lapack/native/stpttr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strcon.f b/examples/lapack/native/strcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strcon.f rename to examples/lapack/native/strcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strevc.f b/examples/lapack/native/strevc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strevc.f rename to examples/lapack/native/strevc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strevc3.f b/examples/lapack/native/strevc3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strevc3.f rename to examples/lapack/native/strevc3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strexc.f b/examples/lapack/native/strexc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strexc.f rename to examples/lapack/native/strexc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strrfs.f b/examples/lapack/native/strrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strrfs.f rename to examples/lapack/native/strrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strsen.f b/examples/lapack/native/strsen.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strsen.f rename to examples/lapack/native/strsen.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strsna.f b/examples/lapack/native/strsna.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strsna.f rename to examples/lapack/native/strsna.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strsyl.f b/examples/lapack/native/strsyl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strsyl.f rename to examples/lapack/native/strsyl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strsyl3.f b/examples/lapack/native/strsyl3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strsyl3.f rename to examples/lapack/native/strsyl3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strti2.f b/examples/lapack/native/strti2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strti2.f rename to examples/lapack/native/strti2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strtri.f b/examples/lapack/native/strtri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strtri.f rename to examples/lapack/native/strtri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strtrs.f b/examples/lapack/native/strtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strtrs.f rename to examples/lapack/native/strtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strttf.f b/examples/lapack/native/strttf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strttf.f rename to examples/lapack/native/strttf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strttp.f b/examples/lapack/native/strttp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/strttp.f rename to examples/lapack/native/strttp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stzrzf.f b/examples/lapack/native/stzrzf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/stzrzf.f rename to examples/lapack/native/stzrzf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/xerbla.f b/examples/lapack/native/xerbla.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/xerbla.f rename to examples/lapack/native/xerbla.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/xerbla_array.f b/examples/lapack/native/xerbla_array.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/xerbla_array.f rename to examples/lapack/native/xerbla_array.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zbbcsd.f b/examples/lapack/native/zbbcsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zbbcsd.f rename to examples/lapack/native/zbbcsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zbdsqr.f b/examples/lapack/native/zbdsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zbdsqr.f rename to examples/lapack/native/zbdsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zcgesv.f b/examples/lapack/native/zcgesv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zcgesv.f rename to examples/lapack/native/zcgesv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zcposv.f b/examples/lapack/native/zcposv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zcposv.f rename to examples/lapack/native/zcposv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zdrscl.f b/examples/lapack/native/zdrscl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zdrscl.f rename to examples/lapack/native/zdrscl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbbrd.f b/examples/lapack/native/zgbbrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbbrd.f rename to examples/lapack/native/zgbbrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbcon.f b/examples/lapack/native/zgbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbcon.f rename to examples/lapack/native/zgbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbequ.f b/examples/lapack/native/zgbequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbequ.f rename to examples/lapack/native/zgbequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbequb.f b/examples/lapack/native/zgbequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbequb.f rename to examples/lapack/native/zgbequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbrfs.f b/examples/lapack/native/zgbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbrfs.f rename to examples/lapack/native/zgbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbrfsx.f b/examples/lapack/native/zgbrfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbrfsx.f rename to examples/lapack/native/zgbrfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbsv.f b/examples/lapack/native/zgbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbsv.f rename to examples/lapack/native/zgbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbsvx.f b/examples/lapack/native/zgbsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbsvx.f rename to examples/lapack/native/zgbsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbsvxx.f b/examples/lapack/native/zgbsvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbsvxx.f rename to examples/lapack/native/zgbsvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbtf2.f b/examples/lapack/native/zgbtf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbtf2.f rename to examples/lapack/native/zgbtf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbtrf.f b/examples/lapack/native/zgbtrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbtrf.f rename to examples/lapack/native/zgbtrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbtrs.f b/examples/lapack/native/zgbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgbtrs.f rename to examples/lapack/native/zgbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgebak.f b/examples/lapack/native/zgebak.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgebak.f rename to examples/lapack/native/zgebak.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgebal.f b/examples/lapack/native/zgebal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgebal.f rename to examples/lapack/native/zgebal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgebd2.f b/examples/lapack/native/zgebd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgebd2.f rename to examples/lapack/native/zgebd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgebrd.f b/examples/lapack/native/zgebrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgebrd.f rename to examples/lapack/native/zgebrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgecon.f b/examples/lapack/native/zgecon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgecon.f rename to examples/lapack/native/zgecon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgedmd.f90 b/examples/lapack/native/zgedmd.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgedmd.f90 rename to examples/lapack/native/zgedmd.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgedmdq.f90 b/examples/lapack/native/zgedmdq.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgedmdq.f90 rename to examples/lapack/native/zgedmdq.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeequ.f b/examples/lapack/native/zgeequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeequ.f rename to examples/lapack/native/zgeequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeequb.f b/examples/lapack/native/zgeequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeequb.f rename to examples/lapack/native/zgeequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgees.f b/examples/lapack/native/zgees.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgees.f rename to examples/lapack/native/zgees.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeesx.f b/examples/lapack/native/zgeesx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeesx.f rename to examples/lapack/native/zgeesx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeev.f b/examples/lapack/native/zgeev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeev.f rename to examples/lapack/native/zgeev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeevx.f b/examples/lapack/native/zgeevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeevx.f rename to examples/lapack/native/zgeevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgehd2.f b/examples/lapack/native/zgehd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgehd2.f rename to examples/lapack/native/zgehd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgehrd.f b/examples/lapack/native/zgehrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgehrd.f rename to examples/lapack/native/zgehrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgejsv.f b/examples/lapack/native/zgejsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgejsv.f rename to examples/lapack/native/zgejsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelq.f b/examples/lapack/native/zgelq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelq.f rename to examples/lapack/native/zgelq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelq2.f b/examples/lapack/native/zgelq2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelq2.f rename to examples/lapack/native/zgelq2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelqf.f b/examples/lapack/native/zgelqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelqf.f rename to examples/lapack/native/zgelqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelqt.f b/examples/lapack/native/zgelqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelqt.f rename to examples/lapack/native/zgelqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelqt3.f b/examples/lapack/native/zgelqt3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelqt3.f rename to examples/lapack/native/zgelqt3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgels.f b/examples/lapack/native/zgels.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgels.f rename to examples/lapack/native/zgels.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelsd.f b/examples/lapack/native/zgelsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelsd.f rename to examples/lapack/native/zgelsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelss.f b/examples/lapack/native/zgelss.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelss.f rename to examples/lapack/native/zgelss.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelst.f b/examples/lapack/native/zgelst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelst.f rename to examples/lapack/native/zgelst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelsy.f b/examples/lapack/native/zgelsy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgelsy.f rename to examples/lapack/native/zgelsy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgemlq.f b/examples/lapack/native/zgemlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgemlq.f rename to examples/lapack/native/zgemlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgemlqt.f b/examples/lapack/native/zgemlqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgemlqt.f rename to examples/lapack/native/zgemlqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgemqr.f b/examples/lapack/native/zgemqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgemqr.f rename to examples/lapack/native/zgemqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgemqrt.f b/examples/lapack/native/zgemqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgemqrt.f rename to examples/lapack/native/zgemqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeql2.f b/examples/lapack/native/zgeql2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeql2.f rename to examples/lapack/native/zgeql2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqlf.f b/examples/lapack/native/zgeqlf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqlf.f rename to examples/lapack/native/zgeqlf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqp3.f b/examples/lapack/native/zgeqp3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqp3.f rename to examples/lapack/native/zgeqp3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqp3rk.f b/examples/lapack/native/zgeqp3rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqp3rk.f rename to examples/lapack/native/zgeqp3rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqr.f b/examples/lapack/native/zgeqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqr.f rename to examples/lapack/native/zgeqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqr2.f b/examples/lapack/native/zgeqr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqr2.f rename to examples/lapack/native/zgeqr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqr2p.f b/examples/lapack/native/zgeqr2p.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqr2p.f rename to examples/lapack/native/zgeqr2p.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqrf.f b/examples/lapack/native/zgeqrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqrf.f rename to examples/lapack/native/zgeqrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqrfp.f b/examples/lapack/native/zgeqrfp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqrfp.f rename to examples/lapack/native/zgeqrfp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqrt.f b/examples/lapack/native/zgeqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqrt.f rename to examples/lapack/native/zgeqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqrt2.f b/examples/lapack/native/zgeqrt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqrt2.f rename to examples/lapack/native/zgeqrt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqrt3.f b/examples/lapack/native/zgeqrt3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgeqrt3.f rename to examples/lapack/native/zgeqrt3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgerfs.f b/examples/lapack/native/zgerfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgerfs.f rename to examples/lapack/native/zgerfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgerfsx.f b/examples/lapack/native/zgerfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgerfsx.f rename to examples/lapack/native/zgerfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgerq2.f b/examples/lapack/native/zgerq2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgerq2.f rename to examples/lapack/native/zgerq2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgerqf.f b/examples/lapack/native/zgerqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgerqf.f rename to examples/lapack/native/zgerqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesc2.f b/examples/lapack/native/zgesc2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesc2.f rename to examples/lapack/native/zgesc2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesdd.f b/examples/lapack/native/zgesdd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesdd.f rename to examples/lapack/native/zgesdd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesv.f b/examples/lapack/native/zgesv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesv.f rename to examples/lapack/native/zgesv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvd.f b/examples/lapack/native/zgesvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvd.f rename to examples/lapack/native/zgesvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvdq.f b/examples/lapack/native/zgesvdq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvdq.f rename to examples/lapack/native/zgesvdq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvdx.f b/examples/lapack/native/zgesvdx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvdx.f rename to examples/lapack/native/zgesvdx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvj.f b/examples/lapack/native/zgesvj.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvj.f rename to examples/lapack/native/zgesvj.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvx.f b/examples/lapack/native/zgesvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvx.f rename to examples/lapack/native/zgesvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvxx.f b/examples/lapack/native/zgesvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgesvxx.f rename to examples/lapack/native/zgesvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetc2.f b/examples/lapack/native/zgetc2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetc2.f rename to examples/lapack/native/zgetc2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetf2.f b/examples/lapack/native/zgetf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetf2.f rename to examples/lapack/native/zgetf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetrf.f b/examples/lapack/native/zgetrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetrf.f rename to examples/lapack/native/zgetrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetrf2.f b/examples/lapack/native/zgetrf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetrf2.f rename to examples/lapack/native/zgetrf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetri.f b/examples/lapack/native/zgetri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetri.f rename to examples/lapack/native/zgetri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetrs.f b/examples/lapack/native/zgetrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetrs.f rename to examples/lapack/native/zgetrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetsls.f b/examples/lapack/native/zgetsls.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetsls.f rename to examples/lapack/native/zgetsls.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetsqrhrt.f b/examples/lapack/native/zgetsqrhrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgetsqrhrt.f rename to examples/lapack/native/zgetsqrhrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggbak.f b/examples/lapack/native/zggbak.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggbak.f rename to examples/lapack/native/zggbak.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggbal.f b/examples/lapack/native/zggbal.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggbal.f rename to examples/lapack/native/zggbal.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgges.f b/examples/lapack/native/zgges.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgges.f rename to examples/lapack/native/zgges.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgges3.f b/examples/lapack/native/zgges3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgges3.f rename to examples/lapack/native/zgges3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggesx.f b/examples/lapack/native/zggesx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggesx.f rename to examples/lapack/native/zggesx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggev.f b/examples/lapack/native/zggev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggev.f rename to examples/lapack/native/zggev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggev3.f b/examples/lapack/native/zggev3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggev3.f rename to examples/lapack/native/zggev3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggevx.f b/examples/lapack/native/zggevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggevx.f rename to examples/lapack/native/zggevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggglm.f b/examples/lapack/native/zggglm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggglm.f rename to examples/lapack/native/zggglm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgghd3.f b/examples/lapack/native/zgghd3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgghd3.f rename to examples/lapack/native/zgghd3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgghrd.f b/examples/lapack/native/zgghrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgghrd.f rename to examples/lapack/native/zgghrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgglse.f b/examples/lapack/native/zgglse.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgglse.f rename to examples/lapack/native/zgglse.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggqrf.f b/examples/lapack/native/zggqrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggqrf.f rename to examples/lapack/native/zggqrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggrqf.f b/examples/lapack/native/zggrqf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggrqf.f rename to examples/lapack/native/zggrqf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggsvd3.f b/examples/lapack/native/zggsvd3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggsvd3.f rename to examples/lapack/native/zggsvd3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggsvp3.f b/examples/lapack/native/zggsvp3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zggsvp3.f rename to examples/lapack/native/zggsvp3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgsvj0.f b/examples/lapack/native/zgsvj0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgsvj0.f rename to examples/lapack/native/zgsvj0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgsvj1.f b/examples/lapack/native/zgsvj1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgsvj1.f rename to examples/lapack/native/zgsvj1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgtcon.f b/examples/lapack/native/zgtcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgtcon.f rename to examples/lapack/native/zgtcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgtrfs.f b/examples/lapack/native/zgtrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgtrfs.f rename to examples/lapack/native/zgtrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgtsv.f b/examples/lapack/native/zgtsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgtsv.f rename to examples/lapack/native/zgtsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgtsvx.f b/examples/lapack/native/zgtsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgtsvx.f rename to examples/lapack/native/zgtsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgttrf.f b/examples/lapack/native/zgttrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgttrf.f rename to examples/lapack/native/zgttrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgttrs.f b/examples/lapack/native/zgttrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgttrs.f rename to examples/lapack/native/zgttrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgtts2.f b/examples/lapack/native/zgtts2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zgtts2.f rename to examples/lapack/native/zgtts2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhb2st_kernels.f b/examples/lapack/native/zhb2st_kernels.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhb2st_kernels.f rename to examples/lapack/native/zhb2st_kernels.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbev.f b/examples/lapack/native/zhbev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbev.f rename to examples/lapack/native/zhbev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbev_2stage.f b/examples/lapack/native/zhbev_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbev_2stage.f rename to examples/lapack/native/zhbev_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbevd.f b/examples/lapack/native/zhbevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbevd.f rename to examples/lapack/native/zhbevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbevd_2stage.f b/examples/lapack/native/zhbevd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbevd_2stage.f rename to examples/lapack/native/zhbevd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbevx.f b/examples/lapack/native/zhbevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbevx.f rename to examples/lapack/native/zhbevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbevx_2stage.f b/examples/lapack/native/zhbevx_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbevx_2stage.f rename to examples/lapack/native/zhbevx_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbgst.f b/examples/lapack/native/zhbgst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbgst.f rename to examples/lapack/native/zhbgst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbgv.f b/examples/lapack/native/zhbgv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbgv.f rename to examples/lapack/native/zhbgv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbgvd.f b/examples/lapack/native/zhbgvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbgvd.f rename to examples/lapack/native/zhbgvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbgvx.f b/examples/lapack/native/zhbgvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbgvx.f rename to examples/lapack/native/zhbgvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbtrd.f b/examples/lapack/native/zhbtrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhbtrd.f rename to examples/lapack/native/zhbtrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhecon.f b/examples/lapack/native/zhecon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhecon.f rename to examples/lapack/native/zhecon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhecon_3.f b/examples/lapack/native/zhecon_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhecon_3.f rename to examples/lapack/native/zhecon_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhecon_rook.f b/examples/lapack/native/zhecon_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhecon_rook.f rename to examples/lapack/native/zhecon_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheequb.f b/examples/lapack/native/zheequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheequb.f rename to examples/lapack/native/zheequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheev.f b/examples/lapack/native/zheev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheev.f rename to examples/lapack/native/zheev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheev_2stage.f b/examples/lapack/native/zheev_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheev_2stage.f rename to examples/lapack/native/zheev_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevd.f b/examples/lapack/native/zheevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevd.f rename to examples/lapack/native/zheevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevd_2stage.f b/examples/lapack/native/zheevd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevd_2stage.f rename to examples/lapack/native/zheevd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevr.f b/examples/lapack/native/zheevr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevr.f rename to examples/lapack/native/zheevr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevr_2stage.f b/examples/lapack/native/zheevr_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevr_2stage.f rename to examples/lapack/native/zheevr_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevx.f b/examples/lapack/native/zheevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevx.f rename to examples/lapack/native/zheevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevx_2stage.f b/examples/lapack/native/zheevx_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheevx_2stage.f rename to examples/lapack/native/zheevx_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegs2.f b/examples/lapack/native/zhegs2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegs2.f rename to examples/lapack/native/zhegs2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegst.f b/examples/lapack/native/zhegst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegst.f rename to examples/lapack/native/zhegst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegv.f b/examples/lapack/native/zhegv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegv.f rename to examples/lapack/native/zhegv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegv_2stage.f b/examples/lapack/native/zhegv_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegv_2stage.f rename to examples/lapack/native/zhegv_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegvd.f b/examples/lapack/native/zhegvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegvd.f rename to examples/lapack/native/zhegvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegvx.f b/examples/lapack/native/zhegvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhegvx.f rename to examples/lapack/native/zhegvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zherfs.f b/examples/lapack/native/zherfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zherfs.f rename to examples/lapack/native/zherfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zherfsx.f b/examples/lapack/native/zherfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zherfsx.f rename to examples/lapack/native/zherfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesv.f b/examples/lapack/native/zhesv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesv.f rename to examples/lapack/native/zhesv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesv_aa.f b/examples/lapack/native/zhesv_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesv_aa.f rename to examples/lapack/native/zhesv_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesv_aa_2stage.f b/examples/lapack/native/zhesv_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesv_aa_2stage.f rename to examples/lapack/native/zhesv_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesv_rk.f b/examples/lapack/native/zhesv_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesv_rk.f rename to examples/lapack/native/zhesv_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesv_rook.f b/examples/lapack/native/zhesv_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesv_rook.f rename to examples/lapack/native/zhesv_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesvx.f b/examples/lapack/native/zhesvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesvx.f rename to examples/lapack/native/zhesvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesvxx.f b/examples/lapack/native/zhesvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhesvxx.f rename to examples/lapack/native/zhesvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheswapr.f b/examples/lapack/native/zheswapr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zheswapr.f rename to examples/lapack/native/zheswapr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetd2.f b/examples/lapack/native/zhetd2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetd2.f rename to examples/lapack/native/zhetd2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetf2.f b/examples/lapack/native/zhetf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetf2.f rename to examples/lapack/native/zhetf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetf2_rk.f b/examples/lapack/native/zhetf2_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetf2_rk.f rename to examples/lapack/native/zhetf2_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetf2_rook.f b/examples/lapack/native/zhetf2_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetf2_rook.f rename to examples/lapack/native/zhetf2_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrd.f b/examples/lapack/native/zhetrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrd.f rename to examples/lapack/native/zhetrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrd_2stage.f b/examples/lapack/native/zhetrd_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrd_2stage.f rename to examples/lapack/native/zhetrd_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrd_hb2st.F b/examples/lapack/native/zhetrd_hb2st.F similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrd_hb2st.F rename to examples/lapack/native/zhetrd_hb2st.F diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrd_he2hb.f b/examples/lapack/native/zhetrd_he2hb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrd_he2hb.f rename to examples/lapack/native/zhetrd_he2hb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrf.f b/examples/lapack/native/zhetrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrf.f rename to examples/lapack/native/zhetrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrf_aa.f b/examples/lapack/native/zhetrf_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrf_aa.f rename to examples/lapack/native/zhetrf_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrf_aa_2stage.f b/examples/lapack/native/zhetrf_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrf_aa_2stage.f rename to examples/lapack/native/zhetrf_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrf_rk.f b/examples/lapack/native/zhetrf_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrf_rk.f rename to examples/lapack/native/zhetrf_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrf_rook.f b/examples/lapack/native/zhetrf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrf_rook.f rename to examples/lapack/native/zhetrf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri.f b/examples/lapack/native/zhetri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri.f rename to examples/lapack/native/zhetri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri2.f b/examples/lapack/native/zhetri2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri2.f rename to examples/lapack/native/zhetri2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri2x.f b/examples/lapack/native/zhetri2x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri2x.f rename to examples/lapack/native/zhetri2x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri_3.f b/examples/lapack/native/zhetri_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri_3.f rename to examples/lapack/native/zhetri_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri_3x.f b/examples/lapack/native/zhetri_3x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri_3x.f rename to examples/lapack/native/zhetri_3x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri_rook.f b/examples/lapack/native/zhetri_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetri_rook.f rename to examples/lapack/native/zhetri_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs.f b/examples/lapack/native/zhetrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs.f rename to examples/lapack/native/zhetrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs2.f b/examples/lapack/native/zhetrs2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs2.f rename to examples/lapack/native/zhetrs2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs_3.f b/examples/lapack/native/zhetrs_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs_3.f rename to examples/lapack/native/zhetrs_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs_aa.f b/examples/lapack/native/zhetrs_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs_aa.f rename to examples/lapack/native/zhetrs_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs_aa_2stage.f b/examples/lapack/native/zhetrs_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs_aa_2stage.f rename to examples/lapack/native/zhetrs_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs_rook.f b/examples/lapack/native/zhetrs_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhetrs_rook.f rename to examples/lapack/native/zhetrs_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhfrk.f b/examples/lapack/native/zhfrk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhfrk.f rename to examples/lapack/native/zhfrk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhgeqz.f b/examples/lapack/native/zhgeqz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhgeqz.f rename to examples/lapack/native/zhgeqz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpcon.f b/examples/lapack/native/zhpcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpcon.f rename to examples/lapack/native/zhpcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpev.f b/examples/lapack/native/zhpev.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpev.f rename to examples/lapack/native/zhpev.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpevd.f b/examples/lapack/native/zhpevd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpevd.f rename to examples/lapack/native/zhpevd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpevx.f b/examples/lapack/native/zhpevx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpevx.f rename to examples/lapack/native/zhpevx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpgst.f b/examples/lapack/native/zhpgst.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpgst.f rename to examples/lapack/native/zhpgst.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpgv.f b/examples/lapack/native/zhpgv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpgv.f rename to examples/lapack/native/zhpgv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpgvd.f b/examples/lapack/native/zhpgvd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpgvd.f rename to examples/lapack/native/zhpgvd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpgvx.f b/examples/lapack/native/zhpgvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpgvx.f rename to examples/lapack/native/zhpgvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhprfs.f b/examples/lapack/native/zhprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhprfs.f rename to examples/lapack/native/zhprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpsv.f b/examples/lapack/native/zhpsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpsv.f rename to examples/lapack/native/zhpsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpsvx.f b/examples/lapack/native/zhpsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhpsvx.f rename to examples/lapack/native/zhpsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhptrd.f b/examples/lapack/native/zhptrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhptrd.f rename to examples/lapack/native/zhptrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhptrf.f b/examples/lapack/native/zhptrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhptrf.f rename to examples/lapack/native/zhptrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhptri.f b/examples/lapack/native/zhptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhptri.f rename to examples/lapack/native/zhptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhptrs.f b/examples/lapack/native/zhptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhptrs.f rename to examples/lapack/native/zhptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhsein.f b/examples/lapack/native/zhsein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhsein.f rename to examples/lapack/native/zhsein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhseqr.f b/examples/lapack/native/zhseqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zhseqr.f rename to examples/lapack/native/zhseqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gbamv.f b/examples/lapack/native/zla_gbamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gbamv.f rename to examples/lapack/native/zla_gbamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gbrcond_c.f b/examples/lapack/native/zla_gbrcond_c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gbrcond_c.f rename to examples/lapack/native/zla_gbrcond_c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gbrcond_x.f b/examples/lapack/native/zla_gbrcond_x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gbrcond_x.f rename to examples/lapack/native/zla_gbrcond_x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gbrfsx_extended.f b/examples/lapack/native/zla_gbrfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gbrfsx_extended.f rename to examples/lapack/native/zla_gbrfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gbrpvgrw.f b/examples/lapack/native/zla_gbrpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gbrpvgrw.f rename to examples/lapack/native/zla_gbrpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_geamv.f b/examples/lapack/native/zla_geamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_geamv.f rename to examples/lapack/native/zla_geamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gercond_c.f b/examples/lapack/native/zla_gercond_c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gercond_c.f rename to examples/lapack/native/zla_gercond_c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gercond_x.f b/examples/lapack/native/zla_gercond_x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gercond_x.f rename to examples/lapack/native/zla_gercond_x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gerfsx_extended.f b/examples/lapack/native/zla_gerfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gerfsx_extended.f rename to examples/lapack/native/zla_gerfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gerpvgrw.f b/examples/lapack/native/zla_gerpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_gerpvgrw.f rename to examples/lapack/native/zla_gerpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_heamv.f b/examples/lapack/native/zla_heamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_heamv.f rename to examples/lapack/native/zla_heamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_hercond_c.f b/examples/lapack/native/zla_hercond_c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_hercond_c.f rename to examples/lapack/native/zla_hercond_c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_hercond_x.f b/examples/lapack/native/zla_hercond_x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_hercond_x.f rename to examples/lapack/native/zla_hercond_x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_herfsx_extended.f b/examples/lapack/native/zla_herfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_herfsx_extended.f rename to examples/lapack/native/zla_herfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_herpvgrw.f b/examples/lapack/native/zla_herpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_herpvgrw.f rename to examples/lapack/native/zla_herpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_lin_berr.f b/examples/lapack/native/zla_lin_berr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_lin_berr.f rename to examples/lapack/native/zla_lin_berr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_porcond_c.f b/examples/lapack/native/zla_porcond_c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_porcond_c.f rename to examples/lapack/native/zla_porcond_c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_porcond_x.f b/examples/lapack/native/zla_porcond_x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_porcond_x.f rename to examples/lapack/native/zla_porcond_x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_porfsx_extended.f b/examples/lapack/native/zla_porfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_porfsx_extended.f rename to examples/lapack/native/zla_porfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_porpvgrw.f b/examples/lapack/native/zla_porpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_porpvgrw.f rename to examples/lapack/native/zla_porpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_syamv.f b/examples/lapack/native/zla_syamv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_syamv.f rename to examples/lapack/native/zla_syamv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_syrcond_c.f b/examples/lapack/native/zla_syrcond_c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_syrcond_c.f rename to examples/lapack/native/zla_syrcond_c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_syrcond_x.f b/examples/lapack/native/zla_syrcond_x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_syrcond_x.f rename to examples/lapack/native/zla_syrcond_x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_syrfsx_extended.f b/examples/lapack/native/zla_syrfsx_extended.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_syrfsx_extended.f rename to examples/lapack/native/zla_syrfsx_extended.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_syrpvgrw.f b/examples/lapack/native/zla_syrpvgrw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_syrpvgrw.f rename to examples/lapack/native/zla_syrpvgrw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_wwaddw.f b/examples/lapack/native/zla_wwaddw.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zla_wwaddw.f rename to examples/lapack/native/zla_wwaddw.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlabrd.f b/examples/lapack/native/zlabrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlabrd.f rename to examples/lapack/native/zlabrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacgv.f b/examples/lapack/native/zlacgv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacgv.f rename to examples/lapack/native/zlacgv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacn2.f b/examples/lapack/native/zlacn2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacn2.f rename to examples/lapack/native/zlacn2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacon.f b/examples/lapack/native/zlacon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacon.f rename to examples/lapack/native/zlacon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacp2.f b/examples/lapack/native/zlacp2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacp2.f rename to examples/lapack/native/zlacp2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacpy.f b/examples/lapack/native/zlacpy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacpy.f rename to examples/lapack/native/zlacpy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacrm.f b/examples/lapack/native/zlacrm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacrm.f rename to examples/lapack/native/zlacrm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacrt.f b/examples/lapack/native/zlacrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlacrt.f rename to examples/lapack/native/zlacrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zladiv.f b/examples/lapack/native/zladiv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zladiv.f rename to examples/lapack/native/zladiv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaed0.f b/examples/lapack/native/zlaed0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaed0.f rename to examples/lapack/native/zlaed0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaed7.f b/examples/lapack/native/zlaed7.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaed7.f rename to examples/lapack/native/zlaed7.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaed8.f b/examples/lapack/native/zlaed8.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaed8.f rename to examples/lapack/native/zlaed8.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaein.f b/examples/lapack/native/zlaein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaein.f rename to examples/lapack/native/zlaein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaesy.f b/examples/lapack/native/zlaesy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaesy.f rename to examples/lapack/native/zlaesy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaev2.f b/examples/lapack/native/zlaev2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaev2.f rename to examples/lapack/native/zlaev2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlag2c.f b/examples/lapack/native/zlag2c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlag2c.f rename to examples/lapack/native/zlag2c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlags2.f b/examples/lapack/native/zlags2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlags2.f rename to examples/lapack/native/zlags2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlagtm.f b/examples/lapack/native/zlagtm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlagtm.f rename to examples/lapack/native/zlagtm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahef.f b/examples/lapack/native/zlahef.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahef.f rename to examples/lapack/native/zlahef.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahef_aa.f b/examples/lapack/native/zlahef_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahef_aa.f rename to examples/lapack/native/zlahef_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahef_rk.f b/examples/lapack/native/zlahef_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahef_rk.f rename to examples/lapack/native/zlahef_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahef_rook.f b/examples/lapack/native/zlahef_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahef_rook.f rename to examples/lapack/native/zlahef_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahqr.f b/examples/lapack/native/zlahqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahqr.f rename to examples/lapack/native/zlahqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahr2.f b/examples/lapack/native/zlahr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlahr2.f rename to examples/lapack/native/zlahr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaic1.f b/examples/lapack/native/zlaic1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaic1.f rename to examples/lapack/native/zlaic1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlals0.f b/examples/lapack/native/zlals0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlals0.f rename to examples/lapack/native/zlals0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlalsa.f b/examples/lapack/native/zlalsa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlalsa.f rename to examples/lapack/native/zlalsa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlalsd.f b/examples/lapack/native/zlalsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlalsd.f rename to examples/lapack/native/zlalsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlamswlq.f b/examples/lapack/native/zlamswlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlamswlq.f rename to examples/lapack/native/zlamswlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlamtsqr.f b/examples/lapack/native/zlamtsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlamtsqr.f rename to examples/lapack/native/zlamtsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlangb.f b/examples/lapack/native/zlangb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlangb.f rename to examples/lapack/native/zlangb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlange.f b/examples/lapack/native/zlange.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlange.f rename to examples/lapack/native/zlange.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlangt.f b/examples/lapack/native/zlangt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlangt.f rename to examples/lapack/native/zlangt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanhb.f b/examples/lapack/native/zlanhb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanhb.f rename to examples/lapack/native/zlanhb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanhe.f b/examples/lapack/native/zlanhe.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanhe.f rename to examples/lapack/native/zlanhe.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanhf.f b/examples/lapack/native/zlanhf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanhf.f rename to examples/lapack/native/zlanhf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanhp.f b/examples/lapack/native/zlanhp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanhp.f rename to examples/lapack/native/zlanhp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanhs.f b/examples/lapack/native/zlanhs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanhs.f rename to examples/lapack/native/zlanhs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanht.f b/examples/lapack/native/zlanht.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlanht.f rename to examples/lapack/native/zlanht.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlansb.f b/examples/lapack/native/zlansb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlansb.f rename to examples/lapack/native/zlansb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlansp.f b/examples/lapack/native/zlansp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlansp.f rename to examples/lapack/native/zlansp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlansy.f b/examples/lapack/native/zlansy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlansy.f rename to examples/lapack/native/zlansy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlantb.f b/examples/lapack/native/zlantb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlantb.f rename to examples/lapack/native/zlantb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlantp.f b/examples/lapack/native/zlantp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlantp.f rename to examples/lapack/native/zlantp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlantr.f b/examples/lapack/native/zlantr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlantr.f rename to examples/lapack/native/zlantr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlapll.f b/examples/lapack/native/zlapll.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlapll.f rename to examples/lapack/native/zlapll.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlapmr.f b/examples/lapack/native/zlapmr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlapmr.f rename to examples/lapack/native/zlapmr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlapmt.f b/examples/lapack/native/zlapmt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlapmt.f rename to examples/lapack/native/zlapmt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqgb.f b/examples/lapack/native/zlaqgb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqgb.f rename to examples/lapack/native/zlaqgb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqge.f b/examples/lapack/native/zlaqge.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqge.f rename to examples/lapack/native/zlaqge.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqhb.f b/examples/lapack/native/zlaqhb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqhb.f rename to examples/lapack/native/zlaqhb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqhe.f b/examples/lapack/native/zlaqhe.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqhe.f rename to examples/lapack/native/zlaqhe.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqhp.f b/examples/lapack/native/zlaqhp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqhp.f rename to examples/lapack/native/zlaqhp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqp2.f b/examples/lapack/native/zlaqp2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqp2.f rename to examples/lapack/native/zlaqp2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqp2rk.f b/examples/lapack/native/zlaqp2rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqp2rk.f rename to examples/lapack/native/zlaqp2rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqp3rk.f b/examples/lapack/native/zlaqp3rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqp3rk.f rename to examples/lapack/native/zlaqp3rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqps.f b/examples/lapack/native/zlaqps.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqps.f rename to examples/lapack/native/zlaqps.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr0.f b/examples/lapack/native/zlaqr0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr0.f rename to examples/lapack/native/zlaqr0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr1.f b/examples/lapack/native/zlaqr1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr1.f rename to examples/lapack/native/zlaqr1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr2.f b/examples/lapack/native/zlaqr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr2.f rename to examples/lapack/native/zlaqr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr3.f b/examples/lapack/native/zlaqr3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr3.f rename to examples/lapack/native/zlaqr3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr4.f b/examples/lapack/native/zlaqr4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr4.f rename to examples/lapack/native/zlaqr4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr5.f b/examples/lapack/native/zlaqr5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqr5.f rename to examples/lapack/native/zlaqr5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqsb.f b/examples/lapack/native/zlaqsb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqsb.f rename to examples/lapack/native/zlaqsb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqsp.f b/examples/lapack/native/zlaqsp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqsp.f rename to examples/lapack/native/zlaqsp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqsy.f b/examples/lapack/native/zlaqsy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqsy.f rename to examples/lapack/native/zlaqsy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqz0.f b/examples/lapack/native/zlaqz0.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqz0.f rename to examples/lapack/native/zlaqz0.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqz1.f b/examples/lapack/native/zlaqz1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqz1.f rename to examples/lapack/native/zlaqz1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqz2.f b/examples/lapack/native/zlaqz2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqz2.f rename to examples/lapack/native/zlaqz2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqz3.f b/examples/lapack/native/zlaqz3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaqz3.f rename to examples/lapack/native/zlaqz3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlar1v.f b/examples/lapack/native/zlar1v.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlar1v.f rename to examples/lapack/native/zlar1v.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlar2v.f b/examples/lapack/native/zlar2v.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlar2v.f rename to examples/lapack/native/zlar2v.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarcm.f b/examples/lapack/native/zlarcm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarcm.f rename to examples/lapack/native/zlarcm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarf.f b/examples/lapack/native/zlarf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarf.f rename to examples/lapack/native/zlarf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarf1f.f b/examples/lapack/native/zlarf1f.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarf1f.f rename to examples/lapack/native/zlarf1f.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarf1l.f b/examples/lapack/native/zlarf1l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarf1l.f rename to examples/lapack/native/zlarf1l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfb.f b/examples/lapack/native/zlarfb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfb.f rename to examples/lapack/native/zlarfb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfb_gett.f b/examples/lapack/native/zlarfb_gett.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfb_gett.f rename to examples/lapack/native/zlarfb_gett.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfg.f b/examples/lapack/native/zlarfg.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfg.f rename to examples/lapack/native/zlarfg.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfgp.f b/examples/lapack/native/zlarfgp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfgp.f rename to examples/lapack/native/zlarfgp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarft.f b/examples/lapack/native/zlarft.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarft.f rename to examples/lapack/native/zlarft.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfx.f b/examples/lapack/native/zlarfx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfx.f rename to examples/lapack/native/zlarfx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfy.f b/examples/lapack/native/zlarfy.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarfy.f rename to examples/lapack/native/zlarfy.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlargv.f b/examples/lapack/native/zlargv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlargv.f rename to examples/lapack/native/zlargv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarnv.f b/examples/lapack/native/zlarnv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarnv.f rename to examples/lapack/native/zlarnv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarrv.f b/examples/lapack/native/zlarrv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarrv.f rename to examples/lapack/native/zlarrv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarscl2.f b/examples/lapack/native/zlarscl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarscl2.f rename to examples/lapack/native/zlarscl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlartg.f90 b/examples/lapack/native/zlartg.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlartg.f90 rename to examples/lapack/native/zlartg.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlartv.f b/examples/lapack/native/zlartv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlartv.f rename to examples/lapack/native/zlartv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarz.f b/examples/lapack/native/zlarz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarz.f rename to examples/lapack/native/zlarz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarzb.f b/examples/lapack/native/zlarzb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarzb.f rename to examples/lapack/native/zlarzb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarzt.f b/examples/lapack/native/zlarzt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlarzt.f rename to examples/lapack/native/zlarzt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlascl.f b/examples/lapack/native/zlascl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlascl.f rename to examples/lapack/native/zlascl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlascl2.f b/examples/lapack/native/zlascl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlascl2.f rename to examples/lapack/native/zlascl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaset.f b/examples/lapack/native/zlaset.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaset.f rename to examples/lapack/native/zlaset.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlasr.f b/examples/lapack/native/zlasr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlasr.f rename to examples/lapack/native/zlasr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlassq.f90 b/examples/lapack/native/zlassq.f90 similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlassq.f90 rename to examples/lapack/native/zlassq.f90 diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaswlq.f b/examples/lapack/native/zlaswlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaswlq.f rename to examples/lapack/native/zlaswlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaswp.f b/examples/lapack/native/zlaswp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaswp.f rename to examples/lapack/native/zlaswp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlasyf.f b/examples/lapack/native/zlasyf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlasyf.f rename to examples/lapack/native/zlasyf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlasyf_aa.f b/examples/lapack/native/zlasyf_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlasyf_aa.f rename to examples/lapack/native/zlasyf_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlasyf_rk.f b/examples/lapack/native/zlasyf_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlasyf_rk.f rename to examples/lapack/native/zlasyf_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlasyf_rook.f b/examples/lapack/native/zlasyf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlasyf_rook.f rename to examples/lapack/native/zlasyf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlat2c.f b/examples/lapack/native/zlat2c.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlat2c.f rename to examples/lapack/native/zlat2c.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatbs.f b/examples/lapack/native/zlatbs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatbs.f rename to examples/lapack/native/zlatbs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatdf.f b/examples/lapack/native/zlatdf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatdf.f rename to examples/lapack/native/zlatdf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatps.f b/examples/lapack/native/zlatps.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatps.f rename to examples/lapack/native/zlatps.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatrd.f b/examples/lapack/native/zlatrd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatrd.f rename to examples/lapack/native/zlatrd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatrs.f b/examples/lapack/native/zlatrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatrs.f rename to examples/lapack/native/zlatrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatrs3.f b/examples/lapack/native/zlatrs3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatrs3.f rename to examples/lapack/native/zlatrs3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatrz.f b/examples/lapack/native/zlatrz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatrz.f rename to examples/lapack/native/zlatrz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatsqr.f b/examples/lapack/native/zlatsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlatsqr.f rename to examples/lapack/native/zlatsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaunhr_col_getrfnp.f b/examples/lapack/native/zlaunhr_col_getrfnp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaunhr_col_getrfnp.f rename to examples/lapack/native/zlaunhr_col_getrfnp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaunhr_col_getrfnp2.f b/examples/lapack/native/zlaunhr_col_getrfnp2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlaunhr_col_getrfnp2.f rename to examples/lapack/native/zlaunhr_col_getrfnp2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlauu2.f b/examples/lapack/native/zlauu2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlauu2.f rename to examples/lapack/native/zlauu2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlauum.f b/examples/lapack/native/zlauum.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zlauum.f rename to examples/lapack/native/zlauum.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbcon.f b/examples/lapack/native/zpbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbcon.f rename to examples/lapack/native/zpbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbequ.f b/examples/lapack/native/zpbequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbequ.f rename to examples/lapack/native/zpbequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbrfs.f b/examples/lapack/native/zpbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbrfs.f rename to examples/lapack/native/zpbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbstf.f b/examples/lapack/native/zpbstf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbstf.f rename to examples/lapack/native/zpbstf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbsv.f b/examples/lapack/native/zpbsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbsv.f rename to examples/lapack/native/zpbsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbsvx.f b/examples/lapack/native/zpbsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbsvx.f rename to examples/lapack/native/zpbsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbtf2.f b/examples/lapack/native/zpbtf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbtf2.f rename to examples/lapack/native/zpbtf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbtrf.f b/examples/lapack/native/zpbtrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbtrf.f rename to examples/lapack/native/zpbtrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbtrs.f b/examples/lapack/native/zpbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpbtrs.f rename to examples/lapack/native/zpbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpftrf.f b/examples/lapack/native/zpftrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpftrf.f rename to examples/lapack/native/zpftrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpftri.f b/examples/lapack/native/zpftri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpftri.f rename to examples/lapack/native/zpftri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpftrs.f b/examples/lapack/native/zpftrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpftrs.f rename to examples/lapack/native/zpftrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpocon.f b/examples/lapack/native/zpocon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpocon.f rename to examples/lapack/native/zpocon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpoequ.f b/examples/lapack/native/zpoequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpoequ.f rename to examples/lapack/native/zpoequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpoequb.f b/examples/lapack/native/zpoequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpoequb.f rename to examples/lapack/native/zpoequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zporfs.f b/examples/lapack/native/zporfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zporfs.f rename to examples/lapack/native/zporfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zporfsx.f b/examples/lapack/native/zporfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zporfsx.f rename to examples/lapack/native/zporfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zposv.f b/examples/lapack/native/zposv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zposv.f rename to examples/lapack/native/zposv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zposvx.f b/examples/lapack/native/zposvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zposvx.f rename to examples/lapack/native/zposvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zposvxx.f b/examples/lapack/native/zposvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zposvxx.f rename to examples/lapack/native/zposvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpotf2.f b/examples/lapack/native/zpotf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpotf2.f rename to examples/lapack/native/zpotf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpotrf.f b/examples/lapack/native/zpotrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpotrf.f rename to examples/lapack/native/zpotrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpotrf2.f b/examples/lapack/native/zpotrf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpotrf2.f rename to examples/lapack/native/zpotrf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpotri.f b/examples/lapack/native/zpotri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpotri.f rename to examples/lapack/native/zpotri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpotrs.f b/examples/lapack/native/zpotrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpotrs.f rename to examples/lapack/native/zpotrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zppcon.f b/examples/lapack/native/zppcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zppcon.f rename to examples/lapack/native/zppcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zppequ.f b/examples/lapack/native/zppequ.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zppequ.f rename to examples/lapack/native/zppequ.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpprfs.f b/examples/lapack/native/zpprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpprfs.f rename to examples/lapack/native/zpprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zppsv.f b/examples/lapack/native/zppsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zppsv.f rename to examples/lapack/native/zppsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zppsvx.f b/examples/lapack/native/zppsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zppsvx.f rename to examples/lapack/native/zppsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpptrf.f b/examples/lapack/native/zpptrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpptrf.f rename to examples/lapack/native/zpptrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpptri.f b/examples/lapack/native/zpptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpptri.f rename to examples/lapack/native/zpptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpptrs.f b/examples/lapack/native/zpptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpptrs.f rename to examples/lapack/native/zpptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpstf2.f b/examples/lapack/native/zpstf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpstf2.f rename to examples/lapack/native/zpstf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpstrf.f b/examples/lapack/native/zpstrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpstrf.f rename to examples/lapack/native/zpstrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zptcon.f b/examples/lapack/native/zptcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zptcon.f rename to examples/lapack/native/zptcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpteqr.f b/examples/lapack/native/zpteqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpteqr.f rename to examples/lapack/native/zpteqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zptrfs.f b/examples/lapack/native/zptrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zptrfs.f rename to examples/lapack/native/zptrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zptsv.f b/examples/lapack/native/zptsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zptsv.f rename to examples/lapack/native/zptsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zptsvx.f b/examples/lapack/native/zptsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zptsvx.f rename to examples/lapack/native/zptsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpttrf.f b/examples/lapack/native/zpttrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpttrf.f rename to examples/lapack/native/zpttrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpttrs.f b/examples/lapack/native/zpttrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zpttrs.f rename to examples/lapack/native/zpttrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zptts2.f b/examples/lapack/native/zptts2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zptts2.f rename to examples/lapack/native/zptts2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zrot.f b/examples/lapack/native/zrot.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zrot.f rename to examples/lapack/native/zrot.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zrscl.f b/examples/lapack/native/zrscl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zrscl.f rename to examples/lapack/native/zrscl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zspcon.f b/examples/lapack/native/zspcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zspcon.f rename to examples/lapack/native/zspcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zspmv.f b/examples/lapack/native/zspmv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zspmv.f rename to examples/lapack/native/zspmv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zspr.f b/examples/lapack/native/zspr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zspr.f rename to examples/lapack/native/zspr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsprfs.f b/examples/lapack/native/zsprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsprfs.f rename to examples/lapack/native/zsprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zspsv.f b/examples/lapack/native/zspsv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zspsv.f rename to examples/lapack/native/zspsv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zspsvx.f b/examples/lapack/native/zspsvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zspsvx.f rename to examples/lapack/native/zspsvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsptrf.f b/examples/lapack/native/zsptrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsptrf.f rename to examples/lapack/native/zsptrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsptri.f b/examples/lapack/native/zsptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsptri.f rename to examples/lapack/native/zsptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsptrs.f b/examples/lapack/native/zsptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsptrs.f rename to examples/lapack/native/zsptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zstedc.f b/examples/lapack/native/zstedc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zstedc.f rename to examples/lapack/native/zstedc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zstegr.f b/examples/lapack/native/zstegr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zstegr.f rename to examples/lapack/native/zstegr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zstein.f b/examples/lapack/native/zstein.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zstein.f rename to examples/lapack/native/zstein.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zstemr.f b/examples/lapack/native/zstemr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zstemr.f rename to examples/lapack/native/zstemr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsteqr.f b/examples/lapack/native/zsteqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsteqr.f rename to examples/lapack/native/zsteqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsycon.f b/examples/lapack/native/zsycon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsycon.f rename to examples/lapack/native/zsycon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsycon_3.f b/examples/lapack/native/zsycon_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsycon_3.f rename to examples/lapack/native/zsycon_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsycon_rook.f b/examples/lapack/native/zsycon_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsycon_rook.f rename to examples/lapack/native/zsycon_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyconv.f b/examples/lapack/native/zsyconv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyconv.f rename to examples/lapack/native/zsyconv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyconvf.f b/examples/lapack/native/zsyconvf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyconvf.f rename to examples/lapack/native/zsyconvf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyconvf_rook.f b/examples/lapack/native/zsyconvf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyconvf_rook.f rename to examples/lapack/native/zsyconvf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyequb.f b/examples/lapack/native/zsyequb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyequb.f rename to examples/lapack/native/zsyequb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsymv.f b/examples/lapack/native/zsymv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsymv.f rename to examples/lapack/native/zsymv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyr.f b/examples/lapack/native/zsyr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyr.f rename to examples/lapack/native/zsyr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyrfs.f b/examples/lapack/native/zsyrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyrfs.f rename to examples/lapack/native/zsyrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyrfsx.f b/examples/lapack/native/zsyrfsx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyrfsx.f rename to examples/lapack/native/zsyrfsx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysv.f b/examples/lapack/native/zsysv.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysv.f rename to examples/lapack/native/zsysv.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysv_aa.f b/examples/lapack/native/zsysv_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysv_aa.f rename to examples/lapack/native/zsysv_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysv_aa_2stage.f b/examples/lapack/native/zsysv_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysv_aa_2stage.f rename to examples/lapack/native/zsysv_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysv_rk.f b/examples/lapack/native/zsysv_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysv_rk.f rename to examples/lapack/native/zsysv_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysv_rook.f b/examples/lapack/native/zsysv_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysv_rook.f rename to examples/lapack/native/zsysv_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysvx.f b/examples/lapack/native/zsysvx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysvx.f rename to examples/lapack/native/zsysvx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysvxx.f b/examples/lapack/native/zsysvxx.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsysvxx.f rename to examples/lapack/native/zsysvxx.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyswapr.f b/examples/lapack/native/zsyswapr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsyswapr.f rename to examples/lapack/native/zsyswapr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytf2.f b/examples/lapack/native/zsytf2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytf2.f rename to examples/lapack/native/zsytf2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytf2_rk.f b/examples/lapack/native/zsytf2_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytf2_rk.f rename to examples/lapack/native/zsytf2_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytf2_rook.f b/examples/lapack/native/zsytf2_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytf2_rook.f rename to examples/lapack/native/zsytf2_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrf.f b/examples/lapack/native/zsytrf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrf.f rename to examples/lapack/native/zsytrf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrf_aa.f b/examples/lapack/native/zsytrf_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrf_aa.f rename to examples/lapack/native/zsytrf_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrf_aa_2stage.f b/examples/lapack/native/zsytrf_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrf_aa_2stage.f rename to examples/lapack/native/zsytrf_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrf_rk.f b/examples/lapack/native/zsytrf_rk.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrf_rk.f rename to examples/lapack/native/zsytrf_rk.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrf_rook.f b/examples/lapack/native/zsytrf_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrf_rook.f rename to examples/lapack/native/zsytrf_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri.f b/examples/lapack/native/zsytri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri.f rename to examples/lapack/native/zsytri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri2.f b/examples/lapack/native/zsytri2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri2.f rename to examples/lapack/native/zsytri2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri2x.f b/examples/lapack/native/zsytri2x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri2x.f rename to examples/lapack/native/zsytri2x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri_3.f b/examples/lapack/native/zsytri_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri_3.f rename to examples/lapack/native/zsytri_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri_3x.f b/examples/lapack/native/zsytri_3x.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri_3x.f rename to examples/lapack/native/zsytri_3x.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri_rook.f b/examples/lapack/native/zsytri_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytri_rook.f rename to examples/lapack/native/zsytri_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs.f b/examples/lapack/native/zsytrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs.f rename to examples/lapack/native/zsytrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs2.f b/examples/lapack/native/zsytrs2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs2.f rename to examples/lapack/native/zsytrs2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs_3.f b/examples/lapack/native/zsytrs_3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs_3.f rename to examples/lapack/native/zsytrs_3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs_aa.f b/examples/lapack/native/zsytrs_aa.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs_aa.f rename to examples/lapack/native/zsytrs_aa.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs_aa_2stage.f b/examples/lapack/native/zsytrs_aa_2stage.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs_aa_2stage.f rename to examples/lapack/native/zsytrs_aa_2stage.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs_rook.f b/examples/lapack/native/zsytrs_rook.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zsytrs_rook.f rename to examples/lapack/native/zsytrs_rook.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztbcon.f b/examples/lapack/native/ztbcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztbcon.f rename to examples/lapack/native/ztbcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztbrfs.f b/examples/lapack/native/ztbrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztbrfs.f rename to examples/lapack/native/ztbrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztbtrs.f b/examples/lapack/native/ztbtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztbtrs.f rename to examples/lapack/native/ztbtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztfsm.f b/examples/lapack/native/ztfsm.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztfsm.f rename to examples/lapack/native/ztfsm.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztftri.f b/examples/lapack/native/ztftri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztftri.f rename to examples/lapack/native/ztftri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztfttp.f b/examples/lapack/native/ztfttp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztfttp.f rename to examples/lapack/native/ztfttp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztfttr.f b/examples/lapack/native/ztfttr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztfttr.f rename to examples/lapack/native/ztfttr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgevc.f b/examples/lapack/native/ztgevc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgevc.f rename to examples/lapack/native/ztgevc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgex2.f b/examples/lapack/native/ztgex2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgex2.f rename to examples/lapack/native/ztgex2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgexc.f b/examples/lapack/native/ztgexc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgexc.f rename to examples/lapack/native/ztgexc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgsen.f b/examples/lapack/native/ztgsen.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgsen.f rename to examples/lapack/native/ztgsen.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgsja.f b/examples/lapack/native/ztgsja.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgsja.f rename to examples/lapack/native/ztgsja.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgsna.f b/examples/lapack/native/ztgsna.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgsna.f rename to examples/lapack/native/ztgsna.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgsy2.f b/examples/lapack/native/ztgsy2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgsy2.f rename to examples/lapack/native/ztgsy2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgsyl.f b/examples/lapack/native/ztgsyl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztgsyl.f rename to examples/lapack/native/ztgsyl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpcon.f b/examples/lapack/native/ztpcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpcon.f rename to examples/lapack/native/ztpcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztplqt.f b/examples/lapack/native/ztplqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztplqt.f rename to examples/lapack/native/ztplqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztplqt2.f b/examples/lapack/native/ztplqt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztplqt2.f rename to examples/lapack/native/ztplqt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpmlqt.f b/examples/lapack/native/ztpmlqt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpmlqt.f rename to examples/lapack/native/ztpmlqt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpmqrt.f b/examples/lapack/native/ztpmqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpmqrt.f rename to examples/lapack/native/ztpmqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpqrt.f b/examples/lapack/native/ztpqrt.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpqrt.f rename to examples/lapack/native/ztpqrt.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpqrt2.f b/examples/lapack/native/ztpqrt2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpqrt2.f rename to examples/lapack/native/ztpqrt2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztprfb.f b/examples/lapack/native/ztprfb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztprfb.f rename to examples/lapack/native/ztprfb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztprfs.f b/examples/lapack/native/ztprfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztprfs.f rename to examples/lapack/native/ztprfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztptri.f b/examples/lapack/native/ztptri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztptri.f rename to examples/lapack/native/ztptri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztptrs.f b/examples/lapack/native/ztptrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztptrs.f rename to examples/lapack/native/ztptrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpttf.f b/examples/lapack/native/ztpttf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpttf.f rename to examples/lapack/native/ztpttf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpttr.f b/examples/lapack/native/ztpttr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztpttr.f rename to examples/lapack/native/ztpttr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrcon.f b/examples/lapack/native/ztrcon.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrcon.f rename to examples/lapack/native/ztrcon.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrevc.f b/examples/lapack/native/ztrevc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrevc.f rename to examples/lapack/native/ztrevc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrevc3.f b/examples/lapack/native/ztrevc3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrevc3.f rename to examples/lapack/native/ztrevc3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrexc.f b/examples/lapack/native/ztrexc.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrexc.f rename to examples/lapack/native/ztrexc.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrrfs.f b/examples/lapack/native/ztrrfs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrrfs.f rename to examples/lapack/native/ztrrfs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrsen.f b/examples/lapack/native/ztrsen.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrsen.f rename to examples/lapack/native/ztrsen.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrsna.f b/examples/lapack/native/ztrsna.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrsna.f rename to examples/lapack/native/ztrsna.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrsyl.f b/examples/lapack/native/ztrsyl.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrsyl.f rename to examples/lapack/native/ztrsyl.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrsyl3.f b/examples/lapack/native/ztrsyl3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrsyl3.f rename to examples/lapack/native/ztrsyl3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrti2.f b/examples/lapack/native/ztrti2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrti2.f rename to examples/lapack/native/ztrti2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrtri.f b/examples/lapack/native/ztrtri.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrtri.f rename to examples/lapack/native/ztrtri.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrtrs.f b/examples/lapack/native/ztrtrs.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrtrs.f rename to examples/lapack/native/ztrtrs.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrttf.f b/examples/lapack/native/ztrttf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrttf.f rename to examples/lapack/native/ztrttf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrttp.f b/examples/lapack/native/ztrttp.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztrttp.f rename to examples/lapack/native/ztrttp.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztzrzf.f b/examples/lapack/native/ztzrzf.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/ztzrzf.f rename to examples/lapack/native/ztzrzf.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb.f b/examples/lapack/native/zunbdb.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb.f rename to examples/lapack/native/zunbdb.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb1.f b/examples/lapack/native/zunbdb1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb1.f rename to examples/lapack/native/zunbdb1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb2.f b/examples/lapack/native/zunbdb2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb2.f rename to examples/lapack/native/zunbdb2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb3.f b/examples/lapack/native/zunbdb3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb3.f rename to examples/lapack/native/zunbdb3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb4.f b/examples/lapack/native/zunbdb4.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb4.f rename to examples/lapack/native/zunbdb4.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb5.f b/examples/lapack/native/zunbdb5.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb5.f rename to examples/lapack/native/zunbdb5.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb6.f b/examples/lapack/native/zunbdb6.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunbdb6.f rename to examples/lapack/native/zunbdb6.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zuncsd.f b/examples/lapack/native/zuncsd.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zuncsd.f rename to examples/lapack/native/zuncsd.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zuncsd2by1.f b/examples/lapack/native/zuncsd2by1.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zuncsd2by1.f rename to examples/lapack/native/zuncsd2by1.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zung2l.f b/examples/lapack/native/zung2l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zung2l.f rename to examples/lapack/native/zung2l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zung2r.f b/examples/lapack/native/zung2r.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zung2r.f rename to examples/lapack/native/zung2r.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungbr.f b/examples/lapack/native/zungbr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungbr.f rename to examples/lapack/native/zungbr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunghr.f b/examples/lapack/native/zunghr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunghr.f rename to examples/lapack/native/zunghr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungl2.f b/examples/lapack/native/zungl2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungl2.f rename to examples/lapack/native/zungl2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunglq.f b/examples/lapack/native/zunglq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunglq.f rename to examples/lapack/native/zunglq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungql.f b/examples/lapack/native/zungql.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungql.f rename to examples/lapack/native/zungql.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungqr.f b/examples/lapack/native/zungqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungqr.f rename to examples/lapack/native/zungqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungr2.f b/examples/lapack/native/zungr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungr2.f rename to examples/lapack/native/zungr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungrq.f b/examples/lapack/native/zungrq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungrq.f rename to examples/lapack/native/zungrq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungtr.f b/examples/lapack/native/zungtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungtr.f rename to examples/lapack/native/zungtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungtsqr.f b/examples/lapack/native/zungtsqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungtsqr.f rename to examples/lapack/native/zungtsqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungtsqr_row.f b/examples/lapack/native/zungtsqr_row.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zungtsqr_row.f rename to examples/lapack/native/zungtsqr_row.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunhr_col.f b/examples/lapack/native/zunhr_col.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunhr_col.f rename to examples/lapack/native/zunhr_col.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunm22.f b/examples/lapack/native/zunm22.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunm22.f rename to examples/lapack/native/zunm22.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunm2l.f b/examples/lapack/native/zunm2l.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunm2l.f rename to examples/lapack/native/zunm2l.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunm2r.f b/examples/lapack/native/zunm2r.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunm2r.f rename to examples/lapack/native/zunm2r.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmbr.f b/examples/lapack/native/zunmbr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmbr.f rename to examples/lapack/native/zunmbr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmhr.f b/examples/lapack/native/zunmhr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmhr.f rename to examples/lapack/native/zunmhr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunml2.f b/examples/lapack/native/zunml2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunml2.f rename to examples/lapack/native/zunml2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmlq.f b/examples/lapack/native/zunmlq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmlq.f rename to examples/lapack/native/zunmlq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmql.f b/examples/lapack/native/zunmql.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmql.f rename to examples/lapack/native/zunmql.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmqr.f b/examples/lapack/native/zunmqr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmqr.f rename to examples/lapack/native/zunmqr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmr2.f b/examples/lapack/native/zunmr2.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmr2.f rename to examples/lapack/native/zunmr2.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmr3.f b/examples/lapack/native/zunmr3.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmr3.f rename to examples/lapack/native/zunmr3.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmrq.f b/examples/lapack/native/zunmrq.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmrq.f rename to examples/lapack/native/zunmrq.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmrz.f b/examples/lapack/native/zunmrz.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmrz.f rename to examples/lapack/native/zunmrz.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmtr.f b/examples/lapack/native/zunmtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zunmtr.f rename to examples/lapack/native/zunmtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zupgtr.f b/examples/lapack/native/zupgtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zupgtr.f rename to examples/lapack/native/zupgtr.f diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zupmtr.f b/examples/lapack/native/zupmtr.f similarity index 100% rename from tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/native/zupmtr.f rename to examples/lapack/native/zupmtr.f diff --git a/examples/lapack/routine_inventory.py b/examples/lapack/routine_inventory.py new file mode 100644 index 000000000..aee554f1e --- /dev/null +++ b/examples/lapack/routine_inventory.py @@ -0,0 +1,505 @@ +"""Reviewed SciPy 1.18.0 float64 LAPACK inventory and LAPACK family ownership.""" + +from __future__ import annotations + +from dataclasses import dataclass + + +SCIPY_VERSION = "1.18.0" +EXPECTED_LAPACK_SOURCE_FILES = 2062 +EXPECTED_LAPACK_ROOT_PROCEDURES = 2064 + +F2PY_FUNCTION_RESULTS = frozenset({"dlamch", "dlangb", "dlange", "dlantr"}) +F2PY_NUMERICAL_LIMITATIONS = { + "dlarfg": "raw f2py exposes the vector mutation but not the scalar ALPHA and TAU writebacks", + "dlartg": "all three numerical outputs are scalar writebacks that raw f2py does not project", + "dgbcon": "RCOND and INFO are scalar writebacks that raw f2py does not project", + "dgecon": "RCOND and INFO are scalar writebacks that raw f2py does not project", + "dgtcon": "RCOND and INFO are scalar writebacks that raw f2py does not project", + "dpocon": "RCOND and INFO are scalar writebacks that raw f2py does not project", + "dppcon": "RCOND and INFO are scalar writebacks that raw f2py does not project", + "dsycon": "RCOND and INFO are scalar writebacks that raw f2py does not project", + "dtrcon": "RCOND and INFO are scalar writebacks that raw f2py does not project", +} + +ROUTINE_GROUPS = { + "auxiliary": ( + "dlamch", + "dlangb", + "dlange", + "dlantr", + "dlarf", + "dlarfg", + "dlartg", + "dlaswp", + ), + "linear_general": ( + "dgecon", + "dgeequ", + "dgeequb", + "dgesc2", + "dgesv", + "dgesvx", + "dgetc2", + "dgetrf", + "dgetri", + "dgetrs", + ), + "linear_symmetric_indefinite": ( + "dsycon", + "dsyconv", + "dsyequb", + "dsysv", + "dsysvx", + "dsytf2", + "dsytrf", + "dsytri", + "dsytrs", + ), + "linear_positive_definite": ( + "dlauum", + "dpftrf", + "dpftri", + "dpftrs", + "dpocon", + "dposv", + "dposvx", + "dpotrf", + "dpotri", + "dpotrs", + "dppcon", + "dppsv", + "dpptrf", + "dpptri", + "dpptrs", + "dpstf2", + "dpstrf", + "dsfrk", + ), + "linear_banded_tridiagonal": ( + "dgbcon", + "dgbsv", + "dgbtrf", + "dgbtrs", + "dgtcon", + "dgtsv", + "dgtsvx", + "dgttrf", + "dgttrs", + "dpbsv", + "dpbtrf", + "dpbtrs", + "dptsv", + "dptsvx", + "dpttrf", + "dpttrs", + "dtbtrs", + ), + "linear_triangular": ( + "dtfsm", + "dtfttp", + "dtfttr", + "dtpttf", + "dtpttr", + "dtrcon", + "dtrtri", + "dtrtrs", + "dtrttf", + "dtrttp", + ), + "least_squares": ( + "dgels", + "dgelsd", + "dgelss", + "dgelsy", + "dgglse", + ), + "orthogonal_factorizations": ( + "dgemqrt", + "dgeqp3", + "dgeqrf", + "dgeqrfp", + "dgeqrt", + "dgerqf", + "dorgqr", + "dorgrq", + "dormqr", + "dormrz", + "dtpmqrt", + "dtpqrt", + "dtzrzf", + ), + "eigen_nonsymmetric": ( + "dgebal", + "dgees", + "dgeev", + "dgehrd", + "dorghr", + "dtrexc", + "dtrsen", + "dtrsyl", + ), + "eigen_symmetric": ( + "dpteqr", + "dsbev", + "dsbevd", + "dsbevx", + "dstebz", + "dstein", + "dstemr", + "dsterf", + "dstev", + "dstevd", + "dsyev", + "dsyevd", + "dsyevr", + "dsyevx", + "dsytrd", + ), + "eigen_generalized": ( + "dgges", + "dggev", + "dsygst", + "dsygv", + "dsygvd", + "dsygvx", + "dtgexc", + "dtgsen", + "dtgsyl", + ), + "svd": ( + "dgejsv", + "dgesdd", + "dgesvd", + "dorcsd", + "dlasd4", + ), +} + +ROUTINES = tuple(name for names in ROUTINE_GROUPS.values() for name in names) +ROUTINE_FAMILIES = {name: family for family, names in ROUTINE_GROUPS.items() for name in names} +EXPLICIT_TEST_NAMES = { + "dlamch": "test_dlamch_reports_float64_machine_epsilon", + "dlangb": "test_dlangb_computes_frobenius_norm_of_band_storage", + "dlange": "test_dlange_computes_one_norm", + "dlantr": "test_dlantr_ignores_unused_triangle_and_unit_diagonal", + "dlarf": "test_dlarf_applies_householder_reflector_from_left", + "dlarfg": "test_dlarfg_constructs_a_valid_householder_reflector", + "dlartg": "test_dlartg_constructs_a_givens_rotation", + "dlaswp": "test_dlaswp_applies_native_one_based_row_pivots", + "dgecon": "test_dgecon_estimates_reciprocal_condition", + "dgeequ": "test_dgeequ_computes_row_and_column_scaling", + "dgeequb": "test_dgeequb_computes_radix_scaling", + "dgesc2": "test_dgesc2_solves_complete_pivot_lu_system", + "dgesv": "test_dgesv_solves_general_system", + "dgesvx": "test_dgesvx_solves_and_reports_error_bounds", + "dgetc2": "test_dgetc2_factorizes_with_complete_pivoting", + "dgetrf": "test_dgetrf_reconstructs_pivoted_lu", + "dgetri": "test_dgetri_inverts_lu_factorization", + "dgetrs": "test_dgetrs_solves_from_native_lu", + "dsycon": "test_dsycon_estimates_symmetric_reciprocal_condition", + "dsyconv": "test_dsyconv_converts_bunch_kaufman_storage", + "dsyequb": "test_dsyequb_scales_symmetric_matrix", + "dsysv": "test_dsysv_solves_symmetric_indefinite_system", + "dsysvx": "test_dsysvx_solves_and_bounds_symmetric_error", + "dsytf2": "test_dsytf2_factorizes_symmetric_indefinite_matrix", + "dsytrf": "test_dsytrf_factorizes_symmetric_indefinite_matrix", + "dsytri": "test_dsytri_inverts_symmetric_indefinite_factor", + "dsytrs": "test_dsytrs_solves_from_symmetric_indefinite_factor", + "dlauum": "test_dlauum_forms_triangular_product", + "dpftrf": "test_dpftrf_factorizes_rfp_spd_matrix", + "dpftri": "test_dpftri_inverts_rfp_cholesky_factor", + "dpftrs": "test_dpftrs_solves_from_rfp_cholesky_factor", + "dpocon": "test_dpocon_estimates_spd_reciprocal_condition", + "dposv": "test_dposv_solves_spd_system", + "dposvx": "test_dposvx_solves_and_bounds_spd_error", + "dpotrf": "test_dpotrf_reconstructs_spd_matrix", + "dpotri": "test_dpotri_inverts_cholesky_factor", + "dpotrs": "test_dpotrs_solves_from_cholesky_factor", + "dppcon": "test_dppcon_estimates_packed_spd_condition", + "dppsv": "test_dppsv_solves_packed_spd_system", + "dpptrf": "test_dpptrf_factorizes_packed_spd_matrix", + "dpptri": "test_dpptri_inverts_packed_cholesky_factor", + "dpptrs": "test_dpptrs_solves_from_packed_cholesky_factor", + "dpstf2": "test_dpstf2_reconstructs_pivoted_cholesky", + "dpstrf": "test_dpstrf_reconstructs_blocked_pivoted_cholesky", + "dsfrk": "test_dsfrk_updates_spd_matrix_in_rfp_storage", + "dgbcon": "test_dgbcon_estimates_general_band_condition", + "dgbsv": "test_dgbsv_solves_general_band_system", + "dgbtrf": "test_dgbtrf_factorizes_general_band_matrix", + "dgbtrs": "test_dgbtrs_solves_from_general_band_lu", + "dgtcon": "test_dgtcon_estimates_tridiagonal_condition", + "dgtsv": "test_dgtsv_solves_general_tridiagonal_system", + "dgtsvx": "test_dgtsvx_solves_and_bounds_tridiagonal_error", + "dgttrf": "test_dgttrf_factorizes_general_tridiagonal_matrix", + "dgttrs": "test_dgttrs_solves_from_tridiagonal_lu", + "dpbsv": "test_dpbsv_solves_positive_definite_band_system", + "dpbtrf": "test_dpbtrf_factorizes_positive_definite_band_matrix", + "dpbtrs": "test_dpbtrs_solves_from_positive_definite_band_factor", + "dptsv": "test_dptsv_solves_spd_tridiagonal_system", + "dptsvx": "test_dptsvx_solves_and_bounds_spd_tridiagonal_error", + "dpttrf": "test_dpttrf_factorizes_spd_tridiagonal_matrix", + "dpttrs": "test_dpttrs_solves_from_spd_tridiagonal_factor", + "dtbtrs": "test_dtbtrs_solves_triangular_band_system", + "dtfsm": "test_dtfsm_solves_with_rfp_triangular_factor", + "dtfttp": "test_dtfttp_converts_rfp_to_packed", + "dtfttr": "test_dtfttr_converts_rfp_to_full_triangular", + "dtpttf": "test_dtpttf_converts_packed_to_rfp", + "dtpttr": "test_dtpttr_converts_packed_to_full_triangular", + "dtrcon": "test_dtrcon_estimates_triangular_reciprocal_condition", + "dtrtri": "test_dtrtri_inverts_triangular_matrix", + "dtrtrs": "test_dtrtrs_solves_triangular_system", + "dtrttf": "test_dtrttf_converts_full_triangular_to_rfp", + "dtrttp": "test_dtrttp_converts_full_triangular_to_packed", + "dgels": "test_dgels_solves_full_rank_least_squares", + "dgelsd": "test_dgelsd_solves_rank_revealing_least_squares", + "dgelss": "test_dgelss_solves_svd_least_squares", + "dgelsy": "test_dgelsy_solves_pivoted_rank_revealing_least_squares", + "dgglse": "test_dgglse_solves_equality_constrained_least_squares", + "dgemqrt": "test_dgemqrt_applies_compact_wy_reflector", + "dgeqp3": "test_dgeqp3_reconstructs_column_pivoted_qr", + "dgeqrf": "test_dgeqrf_reconstructs_qr_factorization", + "dgeqrfp": "test_dgeqrfp_reconstructs_qr_with_nonnegative_diagonal", + "dgeqrt": "test_dgeqrt_reconstructs_compact_wy_qr", + "dgerqf": "test_dgerqf_reconstructs_rq_factorization", + "dorgqr": "test_dorgqr_forms_explicit_orthogonal_q", + "dorgrq": "test_dorgrq_forms_explicit_row_orthogonal_q", + "dormqr": "test_dormqr_applies_qr_reflectors", + "dormrz": "test_dormrz_applies_rz_reflector", + "dtpmqrt": "test_dtpmqrt_applies_triangular_pentagonal_reflector", + "dtpqrt": "test_dtpqrt_reconstructs_triangular_pentagonal_qr", + "dtzrzf": "test_dtzrzf_reconstructs_rz_factorization", + "dgebal": "test_dgebal_preserves_eigenvalues_while_balancing", + "dgees": "test_dgees_computes_real_schur_decomposition", + "dgeev": "test_dgeev_returns_right_eigenvectors", + "dgehrd": "test_dgehrd_reduces_matrix_to_upper_hessenberg", + "dorghr": "test_dorghr_forms_hessenberg_similarity_transform", + "dtrexc": "test_dtrexc_reorders_real_schur_blocks", + "dtrsen": "test_dtrsen_reorders_selected_schur_eigenvalue", + "dtrsyl": "test_dtrsyl_solves_sylvester_equation", + "dpteqr": "test_dpteqr_diagonalizes_positive_definite_tridiagonal", + "dsbev": "test_dsbev_diagonalizes_symmetric_band_matrix", + "dsbevd": "test_dsbevd_diagonalizes_band_matrix_by_divide_and_conquer", + "dsbevx": "test_dsbevx_selects_all_symmetric_band_eigenpairs", + "dstebz": "test_dstebz_bisects_tridiagonal_eigenvalues", + "dstein": "test_dstein_computes_tridiagonal_eigenvectors", + "dstemr": "test_dstemr_computes_robust_tridiagonal_eigenpairs", + "dsterf": "test_dsterf_computes_tridiagonal_eigenvalues", + "dstev": "test_dstev_computes_tridiagonal_eigenpairs", + "dstevd": "test_dstevd_computes_divide_and_conquer_tridiagonal_eigenpairs", + "dsyev": "test_dsyev_returns_orthonormal_eigenvectors", + "dsyevd": "test_dsyevd_computes_divide_and_conquer_symmetric_eigenpairs", + "dsyevr": "test_dsyevr_selects_symmetric_eigenpairs_by_index", + "dsyevx": "test_dsyevx_selects_symmetric_eigenpairs_by_value", + "dsytrd": "test_dsytrd_reduces_symmetric_matrix_to_tridiagonal", + "dgges": "test_dgges_computes_generalized_real_schur_form", + "dggev": "test_dggev_computes_generalized_right_eigenvectors", + "dsygst": "test_dsygst_reduces_symmetric_generalized_problem", + "dsygv": "test_dsygv_solves_symmetric_generalized_eigenproblem", + "dsygvd": "test_dsygvd_solves_divide_and_conquer_generalized_problem", + "dsygvx": "test_dsygvx_selects_generalized_eigenpairs", + "dtgexc": "test_dtgexc_reorders_generalized_schur_blocks", + "dtgsen": "test_dtgsen_reorders_selected_generalized_eigenvalue", + "dtgsyl": "test_dtgsyl_solves_generalized_sylvester_equations", + "dgejsv": "test_dgejsv_reconstructs_matrix_with_jacobi_svd", + "dgesdd": "test_dgesdd_reconstructs_matrix_with_divide_and_conquer_svd", + "dgesvd": "test_dgesvd_reconstructs_matrix", + "dorcsd": "test_dorcsd_decomposes_partitioned_orthogonal_matrix", + "dlasd4": "test_dlasd4_solves_rank_one_secular_equation", +} + +WORKSPACE_ROUTINES = frozenset( + { + "dgbcon", + "dgecon", + "dgemqrt", + "dgees", + "dgeev", + "dgehrd", + "dgejsv", + "dgels", + "dgelsd", + "dgelss", + "dgelsy", + "dgeqp3", + "dgeqrf", + "dgeqrfp", + "dgeqrt", + "dgerqf", + "dgesdd", + "dgesvd", + "dgesvx", + "dgetri", + "dgges", + "dggev", + "dgglse", + "dgtcon", + "dgtsvx", + "dlangb", + "dlange", + "dlantr", + "dlarf", + "dlasd4", + "dorcsd", + "dorghr", + "dorgqr", + "dorgrq", + "dormqr", + "dormrz", + "dpocon", + "dposvx", + "dppcon", + "dpstf2", + "dpstrf", + "dpteqr", + "dptsvx", + "dsbev", + "dsbevd", + "dsbevx", + "dstebz", + "dstein", + "dstemr", + "dstev", + "dstevd", + "dsycon", + "dsyequb", + "dsyev", + "dsyevd", + "dsyevr", + "dsyevx", + "dsygvd", + "dsygv", + "dsygvx", + "dsysv", + "dsysvx", + "dsytrd", + "dsytrf", + "dsytri", + "dtgexc", + "dtgsen", + "dtgsyl", + "dtpmqrt", + "dtpqrt", + "dtrcon", + "dtrexc", + "dtrsen", + "dtzrzf", + } +) + +INDEX_ROUTINES = frozenset( + { + "dgbcon", + "dgbsv", + "dgbtrf", + "dgbtrs", + "dgebal", + "dgeqp3", + "dgesc2", + "dgesv", + "dgesvx", + "dgetc2", + "dgetrf", + "dgetri", + "dgetrs", + "dgtcon", + "dgtsvx", + "dgttrf", + "dgttrs", + "dgelsy", + "dlasd4", + "dlaswp", + "dpstf2", + "dpstrf", + "dsbevx", + "dstebz", + "dstein", + "dstemr", + "dsyevr", + "dsyevx", + "dsycon", + "dsyconv", + "dsysv", + "dsysvx", + "dsytf2", + "dsytrf", + "dsytri", + "dsytrs", + "dsygvx", + "dtgexc", + "dtgsen", + "dtrexc", + } +) + +ORACLE_BY_FAMILY = { + "auxiliary": "explicit machine, norm, reflector, rotation, or permutation identity", + "linear_general": "solution residual, LU reconstruction, inverse identity, scaling, or condition estimate", + "linear_symmetric_indefinite": "solution residual, Bunch-Kaufman factor behavior, inverse, scaling, or condition estimate", + "linear_positive_definite": "Cholesky reconstruction, solution residual, inverse, rank, storage conversion, or condition estimate", + "linear_banded_tridiagonal": "reconstructed logical matrix, factor agreement, solution residual, or condition estimate", + "linear_triangular": "triangular residual, inverse identity, condition estimate, or packed/RFP round trip", + "least_squares": "normal-equation residual, rank, singular values, or equality constraint", + "orthogonal_factorizations": "reflector identity, orthogonality, and factorization/application reconstruction", + "eigen_nonsymmetric": "eigen residual, similarity/Schur reconstruction, orthogonality, or Sylvester equation", + "eigen_symmetric": "eigen residual, orthogonality, selected spectrum, or tridiagonal reduction", + "eigen_generalized": "generalized eigen residual, Schur reconstruction, or generalized Sylvester equations", + "svd": "SVD/CSD reconstruction, orthogonality, or secular equation", +} + + +@dataclass(frozen=True) +class RoutineSpec: + """Reviewed audit metadata for one selected native LAPACK routine.""" + + native_name: str + source_file: str + scipy_name: str + prik_export: str + f2py_export: str + f2py_limitation: str + family: str + mutation: str + returns: str + workspace: str + index_convention: str + oracle: str + test_name: str + + +ROUTINE_SPECS = { + name: RoutineSpec( + native_name=name, + source_file=f"{name}.f90" if name == "dlartg" else f"{name}.f", + scipy_name=name, + prik_export=name, + f2py_export=name, + f2py_limitation=F2PY_NUMERICAL_LIMITATIONS.get( + name, + ( + "raw f2py exposes array mutation but not scalar subroutine writebacks from the intent-free source" + if name not in F2PY_FUNCTION_RESULTS + else "none" + ), + ), + family=ROUTINE_FAMILIES[name], + mutation="explicit in/out arrays and preserved inputs are asserted in the named test", + returns="PRIK native scalar tuple, SciPy projected tuple, and raw f2py observable writeback", + workspace=( + "explicit workspace arrays and sizes are visible in the named test" + if name in WORKSPACE_ROUTINES + else "no caller-managed workspace" + ), + index_convention=( + "native PRIK/f2py indexes are one-based; any SciPy conversion is visible in the named test" + if name in INDEX_ROUTINES + else "no pivot or index conversion" + ), + oracle=ORACLE_BY_FAMILY[ROUTINE_FAMILIES[name]], + test_name=EXPLICIT_TEST_NAMES[name], + ) + for name in ROUTINES +} + +# Populate only after a missing raw f2py export has been reproduced in CI. +F2PY_EXPORT_LIMITATIONS: dict[str, str] = {} diff --git a/examples/lapack/test_auxiliary.py b/examples/lapack/test_auxiliary.py new file mode 100644 index 000000000..f5bc3db08 --- /dev/null +++ b/examples/lapack/test_auxiliary.py @@ -0,0 +1,143 @@ +"""Auxiliary, norm, reflector, rotation, and permutation correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import assert_allclose_float64, column_major, general_band_storage, native_pivots + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_dlamch_reports_float64_machine_epsilon(prik_lapack, scipy_lapack, f2py_lapack): + expected = np.finfo(np.float64).eps / 2.0 + + prik_value = prik_lapack.dlamch("E") + f2py_value = f2py_lapack.dlamch(b"E") + scipy_value = scipy_lapack.dlamch(b"E") + + assert_allclose_float64(prik_value, expected) + assert_allclose_float64(f2py_value, expected) + assert_allclose_float64(scipy_value, expected) + + +def test_dlangb_computes_frobenius_norm_of_band_storage(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[2.0, -1.0, 0.0], [3.0, 4.0, 5.0], [0.0, 6.0, -2.0]], dtype=np.float64) + expected = float(np.sqrt(sum(float(value * value) for value in matrix.flat))) + prik_ab = general_band_storage(matrix, 1, 1) + f2py_ab = prik_ab.copy(order="F") + scipy_ab = prik_ab.copy(order="F") + + prik_result = prik_lapack.dlangb("F", 3, 1, 1, prik_ab, 3, np.empty(3, dtype=np.float64)) + f2py_value = f2py_lapack.dlangb(b"F", 3, 1, 1, f2py_ab, 3, np.empty(3, dtype=np.float64)) + scipy_value = scipy_lapack.dlangb(b"F", 1, 1, scipy_ab) + + assert prik_result[1:] == (3, 1, 1, 3) + assert_allclose_float64(prik_result[0], expected, operation_size=7) + assert_allclose_float64(f2py_value, expected, operation_size=7) + assert_allclose_float64(scipy_value, expected, operation_size=7) + + +def test_dlange_computes_one_norm(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, -5.0], [3.0, 2.0], [-2.0, 4.0]], dtype=np.float64, order="F") + expected = 11.0 + work = np.empty(3, dtype=np.float64) + + prik_result = prik_lapack.dlange("1", 3, 2, matrix.copy(order="F"), 3, work.copy()) + f2py_value = f2py_lapack.dlange(b"1", 3, 2, matrix.copy(order="F"), 3, work.copy()) + scipy_value = scipy_lapack.dlange(b"1", matrix.copy(order="F")) + + assert prik_result[1:] == (3, 2, 3) + assert_allclose_float64(prik_result[0], expected, operation_size=3) + assert_allclose_float64(f2py_value, expected, operation_size=3) + assert_allclose_float64(scipy_value, expected, operation_size=3) + + +def test_dlantr_ignores_unused_triangle_and_unit_diagonal(prik_lapack, scipy_lapack, f2py_lapack): + stored = np.array([[np.nan, 2.0, -1.0], [np.nan, np.nan, 3.0], [np.nan, np.nan, np.nan]], order="F") + expected = float(np.sqrt(1.0 + 4.0 + 1.0 + 1.0 + 9.0 + 1.0)) + work = np.empty(3, dtype=np.float64) + + prik_result = prik_lapack.dlantr("F", "U", "U", 3, 3, stored.copy(order="F"), 3, work.copy()) + f2py_value = f2py_lapack.dlantr(b"F", b"U", b"U", 3, 3, stored.copy(order="F"), 3, work.copy()) + scipy_value = scipy_lapack.dlantr(b"F", stored.copy(order="F"), uplo=b"U", diag=b"U") + + assert prik_result[1:] == (3, 3, 3) + assert_allclose_float64(prik_result[0], expected, operation_size=6) + assert_allclose_float64(f2py_value, expected, operation_size=6) + assert_allclose_float64(scipy_value, expected, operation_size=6) + + +def test_dlarf_applies_householder_reflector_from_left(prik_lapack, scipy_lapack, f2py_lapack): + vector = np.array([1.0, 2.0], dtype=np.float64) + tau = 0.4 + original = np.array([[1.0, 3.0], [2.0, -1.0]], dtype=np.float64) + reflector = np.eye(2, dtype=np.float64) - tau * np.outer(vector, vector) + expected = reflector @ original + prik_c, f2py_c = column_major(original), column_major(original) + + prik_scalars = prik_lapack.dlarf("L", 2, 2, vector, 1, tau, prik_c, 2, np.empty(2)) + f2py_result = f2py_lapack.dlarf(b"L", 2, 2, vector, 1, tau, f2py_c, 2, np.empty(2)) + scipy_c = scipy_lapack.dlarf(vector, tau, original.copy(order="F"), np.empty(2), side=b"L") + + assert prik_scalars == (2, 2, 1, tau, 2) + assert f2py_result is None + assert_allclose_float64(prik_c, expected, operation_size=2) + assert_allclose_float64(f2py_c, expected, operation_size=2) + assert_allclose_float64(scipy_c, expected, operation_size=2) + + +def test_dlarfg_constructs_a_valid_householder_reflector(prik_lapack, scipy_lapack, f2py_lapack): + alpha = 4.0 + original_x = np.array([3.0, 0.0], dtype=np.float64) + prik_x, f2py_x = original_x.copy(), original_x.copy() + + prik_scalars = prik_lapack.dlarfg(3, alpha, prik_x, 1, 0.0) + f2py_result = f2py_lapack.dlarfg(3, alpha, f2py_x, 1, 0.0) + scipy_beta, scipy_x, scipy_tau = scipy_lapack.dlarfg(3, alpha, original_x.copy()) + + _, prik_beta, _, prik_tau = prik_scalars + prik_vector = np.concatenate(([1.0], prik_x)) + original = np.concatenate(([alpha], original_x)) + expected = np.array([prik_beta, 0.0, 0.0], dtype=np.float64) + assert f2py_result is None # raw f2py cannot project the scalar ALPHA and TAU writebacks + assert_allclose_float64((np.eye(3) - prik_tau * np.outer(prik_vector, prik_vector)) @ original, expected) + assert_allclose_float64(prik_beta, scipy_beta) + assert_allclose_float64(prik_x, scipy_x) + assert_allclose_float64(f2py_x, scipy_x) + assert_allclose_float64(prik_tau, scipy_tau) + + +def test_dlartg_constructs_a_givens_rotation(prik_lapack, scipy_lapack, f2py_lapack): + f, g = 3.0, 4.0 + + prik_scalars = prik_lapack.dlartg(f, g, 0.0, 0.0, 0.0) + f2py_result = f2py_lapack.dlartg(f, g, 0.0, 0.0, 0.0) + scipy_c, scipy_s, scipy_r = scipy_lapack.dlartg(f, g) + + _, _, prik_c, prik_s, prik_r = prik_scalars + assert f2py_result is None # raw f2py cannot project scalar-only subroutine outputs + assert_allclose_float64(prik_c * f + prik_s * g, prik_r) + assert_allclose_float64(-prik_s * f + prik_c * g, 0.0) + assert_allclose_float64(prik_c * prik_c + prik_s * prik_s, 1.0) + assert_allclose_float64([prik_c, prik_s, prik_r], [scipy_c, scipy_s, scipy_r]) + + +def test_dlaswp_applies_native_one_based_row_pivots(prik_lapack, scipy_lapack, f2py_lapack): + original = np.array([[1.0, 10.0], [2.0, 20.0], [3.0, 30.0]], dtype=np.float64) + scipy_pivots = np.array([2, 2], dtype=np.int32) + native_ipiv = native_pivots(scipy_pivots) + expected = original[[2, 0, 1], :] + prik_a, f2py_a = column_major(original), column_major(original) + + prik_scalars = prik_lapack.dlaswp(2, prik_a, 3, 1, 2, native_ipiv, 1) + f2py_result = f2py_lapack.dlaswp(2, f2py_a, 3, 1, 2, native_ipiv, 1) + scipy_a = scipy_lapack.dlaswp(original.copy(order="F"), scipy_pivots, k1=0, k2=1) + + assert prik_scalars == (2, 3, 1, 2, 1) + assert f2py_result is None + assert_allclose_float64(prik_a, expected) + assert_allclose_float64(f2py_a, expected) + assert_allclose_float64(scipy_a, expected) diff --git a/examples/lapack/test_eigen_generalized.py b/examples/lapack/test_eigen_generalized.py new file mode 100644 index 000000000..40e45f73f --- /dev/null +++ b/examples/lapack/test_eigen_generalized.py @@ -0,0 +1,477 @@ +"""Generalized nonsymmetric and symmetric eigenvalue correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import assert_allclose_float64, assert_orthogonal + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def _generalized_problem(): + a = np.diag([2.0, 6.0]).astype(np.float64, order="F") + b = np.diag([1.0, 2.0]).astype(np.float64, order="F") + return a, b + + +def _assert_generalized_eigenpairs(a, b, values, vectors): + assert_allclose_float64(values, [2.0, 3.0]) + for index in range(2): + assert_allclose_float64(a @ vectors[:, index], values[index] * (b @ vectors[:, index]), operation_size=2) + assert_allclose_float64(vectors.T @ b @ vectors, np.eye(2), operation_size=2) + + +def test_dgges_computes_generalized_real_schur_form(prik_lapack, scipy_lapack, f2py_lapack): + original_a, original_b = _generalized_problem() + prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") + prik_b, f2py_b = original_b.copy(order="F"), original_b.copy(order="F") + prik_ar, prik_ai, prik_beta = np.empty(2), np.empty(2), np.empty(2) + f2py_ar, f2py_ai, f2py_beta = np.empty(2), np.empty(2), np.empty(2) + prik_vsl, prik_vsr = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + f2py_vsl, f2py_vsr = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + + prik_scalars = prik_lapack.dgges( + "V", + "V", + "N", + False, + 2, + prik_a, + 2, + prik_b, + 2, + 0, + prik_ar, + prik_ai, + prik_beta, + prik_vsl, + 2, + prik_vsr, + 2, + np.empty(64), + 64, + np.zeros(2, dtype=np.bool_), + 0, + ) + f2py_result = f2py_lapack.dgges( + b"V", + b"V", + b"N", + lambda _ar, _ai, _beta: 0, + 2, + f2py_a, + 2, + f2py_b, + 2, + 0, + f2py_ar, + f2py_ai, + f2py_beta, + f2py_vsl, + 2, + f2py_vsr, + 2, + np.empty(64), + 64, + np.zeros(2, dtype=np.int32), + 0, + ) + scipy_a, scipy_b, scipy_sdim, scipy_ar, scipy_ai, scipy_beta, scipy_vsl, scipy_vsr, _work, scipy_info = ( + scipy_lapack.dgges( + lambda _ar, _ai, _beta: 0, + original_a.copy(order="F"), + original_b.copy(order="F"), + jobvsl=1, + jobvsr=1, + sort_t=0, + lwork=64, + ) + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[4] == scipy_sdim == 0 + for s, t, ar, ai, beta, q, z in ( + (prik_a, prik_b, prik_ar, prik_ai, prik_beta, prik_vsl, prik_vsr), + (f2py_a, f2py_b, f2py_ar, f2py_ai, f2py_beta, f2py_vsl, f2py_vsr), + (scipy_a, scipy_b, scipy_ar, scipy_ai, scipy_beta, scipy_vsl, scipy_vsr), + ): + assert_orthogonal(q) + assert_orthogonal(z) + assert_allclose_float64(q @ s @ z.T, original_a, operation_size=2) + assert_allclose_float64(q @ t @ z.T, original_b, operation_size=2) + assert_allclose_float64(ai, [0.0, 0.0]) + assert_allclose_float64(ar / beta, [2.0, 3.0]) + + +def test_dggev_computes_generalized_right_eigenvectors(prik_lapack, scipy_lapack, f2py_lapack): + a, b = _generalized_problem() + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_ar, prik_ai, prik_beta = np.empty(2), np.empty(2), np.empty(2) + f2py_ar, f2py_ai, f2py_beta = np.empty(2), np.empty(2), np.empty(2) + prik_vl, prik_vr = np.empty((1, 2), order="F"), np.empty((2, 2), order="F") + f2py_vl, f2py_vr = np.empty((1, 2), order="F"), np.empty((2, 2), order="F") + + prik_scalars = prik_lapack.dggev( + "N", "V", 2, prik_a, 2, prik_b, 2, prik_ar, prik_ai, prik_beta, prik_vl, 1, prik_vr, 2, np.empty(64), 64, 0 + ) + f2py_result = f2py_lapack.dggev( + b"N", b"V", 2, f2py_a, 2, f2py_b, 2, f2py_ar, f2py_ai, f2py_beta, f2py_vl, 1, f2py_vr, 2, np.empty(64), 64, 0 + ) + scipy_ar, scipy_ai, scipy_beta, _vl, scipy_vr, _work, scipy_info = scipy_lapack.dggev( + a.copy(order="F"), b.copy(order="F"), compute_vl=0, compute_vr=1, lwork=64 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for ar, ai, beta, vr in ( + (prik_ar, prik_ai, prik_beta, prik_vr), + (f2py_ar, f2py_ai, f2py_beta, f2py_vr), + (scipy_ar, scipy_ai, scipy_beta, scipy_vr), + ): + assert_allclose_float64(ai, [0.0, 0.0]) + for index in range(2): + assert_allclose_float64(beta[index] * (a @ vr[:, index]), ar[index] * (b @ vr[:, index]), operation_size=2) + + +def test_dsygst_reduces_symmetric_generalized_problem(prik_lapack, scipy_lapack, f2py_lapack): + a, _b = _generalized_problem() + cholesky = np.diag([1.0, np.sqrt(2.0)]).astype(np.float64, order="F") + expected = np.diag([2.0, 3.0]) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + + prik_scalars = prik_lapack.dsygst(1, "U", 2, prik_a, 2, cholesky, 2, 0) + f2py_result = f2py_lapack.dsygst(1, b"U", 2, f2py_a, 2, cholesky, 2, 0) + scipy_a, scipy_info = scipy_lapack.dsygst(a.copy(order="F"), cholesky, itype=1, lower=0) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, expected, operation_size=2) + assert_allclose_float64(f2py_a, expected, operation_size=2) + assert_allclose_float64(scipy_a, expected, operation_size=2) + assert_allclose_float64(np.linalg.inv(cholesky.T) @ a @ np.linalg.inv(cholesky), expected, operation_size=2) + + +def test_dsygv_solves_symmetric_generalized_eigenproblem(prik_lapack, scipy_lapack, f2py_lapack): + a, b = _generalized_problem() + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_w, f2py_w = np.empty(2), np.empty(2) + + prik_scalars = prik_lapack.dsygv(1, "V", "U", 2, prik_a, 2, prik_b, 2, prik_w, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dsygv(1, b"V", b"U", 2, f2py_a, 2, f2py_b, 2, f2py_w, np.empty(64), 64, 0) + scipy_w, scipy_v, scipy_info = scipy_lapack.dsygv( + a.copy(order="F"), b.copy(order="F"), itype=1, jobz=b"V", uplo=b"U", lwork=64 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + _assert_generalized_eigenpairs(a, b, prik_w, prik_a) + _assert_generalized_eigenpairs(a, b, f2py_w, f2py_a) + _assert_generalized_eigenpairs(a, b, scipy_w, scipy_v) + + +def test_dsygvd_solves_divide_and_conquer_generalized_problem(prik_lapack, scipy_lapack, f2py_lapack): + a, b = _generalized_problem() + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_w, f2py_w = np.empty(2), np.empty(2) + + prik_scalars = prik_lapack.dsygvd( + 1, "V", "U", 2, prik_a, 2, prik_b, 2, prik_w, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + ) + f2py_result = f2py_lapack.dsygvd( + 1, b"V", b"U", 2, f2py_a, 2, f2py_b, 2, f2py_w, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + ) + scipy_w, scipy_v, scipy_info = scipy_lapack.dsygvd( + a.copy(order="F"), b.copy(order="F"), itype=1, jobz=b"V", uplo=b"U", lwork=64, liwork=32 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + _assert_generalized_eigenpairs(a, b, prik_w, prik_a) + _assert_generalized_eigenpairs(a, b, f2py_w, f2py_a) + _assert_generalized_eigenpairs(a, b, scipy_w, scipy_v) + + +def test_dsygvx_selects_generalized_eigenpairs(prik_lapack, scipy_lapack, f2py_lapack): + a, b = _generalized_problem() + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_w, f2py_w = np.empty(2), np.empty(2) + prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + prik_ifail, f2py_ifail = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dsygvx( + 1, + "V", + "I", + "U", + 2, + prik_a, + 2, + prik_b, + 2, + 0.0, + 0.0, + 1, + 2, + 0.0, + 0, + prik_w, + prik_z, + 2, + np.empty(64), + 64, + np.empty(10, dtype=np.int32), + prik_ifail, + 0, + ) + f2py_result = f2py_lapack.dsygvx( + 1, + b"V", + b"I", + b"U", + 2, + f2py_a, + 2, + f2py_b, + 2, + 0.0, + 0.0, + 1, + 2, + 0.0, + 0, + f2py_w, + f2py_z, + 2, + np.empty(64), + 64, + np.empty(10, dtype=np.int32), + f2py_ifail, + 0, + ) + scipy_w, scipy_z, scipy_m, scipy_ifail, scipy_info = scipy_lapack.dsygvx( + a.copy(order="F"), b.copy(order="F"), itype=1, jobz=b"V", range=b"I", uplo=b"U", il=1, iu=2, lwork=64 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[9] == scipy_m == 2 + _assert_generalized_eigenpairs(a, b, prik_w, prik_z) + _assert_generalized_eigenpairs(a, b, f2py_w, f2py_z) + _assert_generalized_eigenpairs(a, b, scipy_w, scipy_z) + np.testing.assert_array_equal(prik_ifail, scipy_ifail) + np.testing.assert_array_equal(f2py_ifail, scipy_ifail) + + +def test_dtgexc_reorders_generalized_schur_blocks(prik_lapack, scipy_lapack, f2py_lapack): + a, b = _generalized_problem() + identity = np.eye(2, dtype=np.float64, order="F") + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_q, f2py_q = identity.copy(order="F"), identity.copy(order="F") + prik_z, f2py_z = identity.copy(order="F"), identity.copy(order="F") + + prik_scalars = prik_lapack.dtgexc( + True, True, 2, prik_a, 2, prik_b, 2, prik_q, 2, prik_z, 2, 1, 2, np.empty(64), 64, 0 + ) + f2py_result = f2py_lapack.dtgexc(1, 1, 2, f2py_a, 2, f2py_b, 2, f2py_q, 2, f2py_z, 2, 1, 2, np.empty(64), 64, 0) + scipy_a, scipy_b, scipy_q, scipy_z, _work, scipy_info = scipy_lapack.dtgexc( + a.copy(order="F"), + b.copy(order="F"), + identity.copy(order="F"), + identity.copy(order="F"), + 0, + 1, + wantq=1, + wantz=1, + lwork=64, + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for s, t, q, z in ( + (prik_a, prik_b, prik_q, prik_z), + (f2py_a, f2py_b, f2py_q, f2py_z), + (scipy_a, scipy_b, scipy_q, scipy_z), + ): + assert_allclose_float64(np.diag(s) / np.diag(t), [3.0, 2.0]) + assert_allclose_float64(q @ s @ z.T, a, operation_size=2) + assert_allclose_float64(q @ t @ z.T, b, operation_size=2) + + +def test_dtgsen_reorders_selected_generalized_eigenvalue(prik_lapack, scipy_lapack, f2py_lapack): + a, b = _generalized_problem() + identity = np.eye(2, dtype=np.float64, order="F") + selection = np.array([False, True], dtype=np.bool_) + prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") + prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") + prik_q, f2py_q = identity.copy(order="F"), identity.copy(order="F") + prik_z, f2py_z = identity.copy(order="F"), identity.copy(order="F") + prik_ar, prik_ai, prik_beta = np.empty(2), np.empty(2), np.empty(2) + f2py_ar, f2py_ai, f2py_beta = np.empty(2), np.empty(2), np.empty(2) + prik_dif, f2py_dif = np.empty(2), np.empty(2) + + prik_scalars = prik_lapack.dtgsen( + 0, + True, + True, + selection, + 2, + prik_a, + 2, + prik_b, + 2, + prik_ar, + prik_ai, + prik_beta, + prik_q, + 2, + prik_z, + 2, + 0, + 0.0, + 0.0, + prik_dif, + np.empty(64), + 64, + np.empty(16, dtype=np.int32), + 16, + 0, + ) + f2py_result = f2py_lapack.dtgsen( + 0, + 1, + 1, + selection.astype(np.int32), + 2, + f2py_a, + 2, + f2py_b, + 2, + f2py_ar, + f2py_ai, + f2py_beta, + f2py_q, + 2, + f2py_z, + 2, + 0, + 0.0, + 0.0, + f2py_dif, + np.empty(64), + 64, + np.empty(16, dtype=np.int32), + 16, + 0, + ) + scipy_a, scipy_b, scipy_ar, scipy_ai, scipy_beta, scipy_q, scipy_z, scipy_m, _pl, _pr, _dif, scipy_info = ( + scipy_lapack.dtgsen( + selection.astype(np.int32), + a.copy(order="F"), + b.copy(order="F"), + identity.copy(order="F"), + identity.copy(order="F"), + ijob=0, + wantq=1, + wantz=1, + lwork=64, + liwork=16, + ) + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[8] == scipy_m == 1 + for s, t, ar, ai, beta, q, z in ( + (prik_a, prik_b, prik_ar, prik_ai, prik_beta, prik_q, prik_z), + (f2py_a, f2py_b, f2py_ar, f2py_ai, f2py_beta, f2py_q, f2py_z), + (scipy_a, scipy_b, scipy_ar, scipy_ai, scipy_beta, scipy_q, scipy_z), + ): + assert_allclose_float64(ai, [0.0, 0.0]) + assert_allclose_float64(ar / beta, [3.0, 2.0]) + assert_allclose_float64(q @ s @ z.T, a, operation_size=2) + assert_allclose_float64(q @ t @ z.T, b, operation_size=2) + + +def test_dtgsyl_solves_generalized_sylvester_equations(prik_lapack, scipy_lapack, f2py_lapack): + a = np.array([[2.0]], dtype=np.float64, order="F") + b = np.array([[3.0]], dtype=np.float64, order="F") + c = np.array([[-4.0]], dtype=np.float64, order="F") + d = np.array([[1.0]], dtype=np.float64, order="F") + e = np.array([[4.0]], dtype=np.float64, order="F") + f = np.array([[-7.0]], dtype=np.float64, order="F") + prik_c, f2py_c = c.copy(order="F"), c.copy(order="F") + prik_f, f2py_f = f.copy(order="F"), f.copy(order="F") + + prik_scalars = prik_lapack.dtgsyl( + "N", + 0, + 1, + 1, + a, + 1, + b, + 1, + prik_c, + 1, + d, + 1, + e, + 1, + prik_f, + 1, + 0.0, + 0.0, + np.empty(8), + 8, + np.empty(2, dtype=np.int32), + 0, + ) + f2py_result = f2py_lapack.dtgsyl( + b"N", + 0, + 1, + 1, + a, + 1, + b, + 1, + f2py_c, + 1, + d, + 1, + e, + 1, + f2py_f, + 1, + 0.0, + 0.0, + np.empty(8), + 8, + np.empty(2, dtype=np.int32), + 0, + ) + scipy_r, scipy_l, scipy_scale, scipy_dif, scipy_info = scipy_lapack.dtgsyl( + a, b, c.copy(order="F"), d, e, f.copy(order="F"), trans=b"N", ijob=0, lwork=8 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_c, [[1.0]]) + assert_allclose_float64(f2py_c, [[1.0]]) + assert_allclose_float64(scipy_r, [[1.0]]) + assert_allclose_float64(prik_f, [[2.0]]) + assert_allclose_float64(f2py_f, [[2.0]]) + assert_allclose_float64(scipy_l, [[2.0]]) + assert_allclose_float64(a @ prik_c - prik_f @ b, prik_scalars[-4] * c) + assert_allclose_float64(d @ prik_c - prik_f @ e, prik_scalars[-4] * f) + assert_allclose_float64(prik_scalars[-4], scipy_scale) + assert_allclose_float64(prik_scalars[-3], scipy_dif) diff --git a/examples/lapack/test_eigen_nonsymmetric.py b/examples/lapack/test_eigen_nonsymmetric.py new file mode 100644 index 000000000..7977204cf --- /dev/null +++ b/examples/lapack/test_eigen_nonsymmetric.py @@ -0,0 +1,249 @@ +"""Nonsymmetric eigenvalue, Schur, Hessenberg, and Sylvester correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import assert_allclose_float64, assert_orthogonal + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_dgebal_preserves_eigenvalues_while_balancing(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.diag(np.array([2.0, 5.0], dtype=np.float64)).copy(order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_scale, f2py_scale = np.empty(2), np.empty(2) + + prik_scalars = prik_lapack.dgebal("B", 2, prik_a, 2, 0, 0, prik_scale, 0) + f2py_result = f2py_lapack.dgebal(b"B", 2, f2py_a, 2, 0, 0, f2py_scale, 0) + scipy_a, scipy_lo, scipy_hi, scipy_scale, scipy_info = scipy_lapack.dgebal( + matrix.copy(order="F"), scale=1, permute=1 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[2:4] == (scipy_lo + 1, scipy_hi + 1) + assert_allclose_float64(np.sort(np.diag(prik_a)), [2.0, 5.0]) + assert_allclose_float64(np.sort(np.diag(f2py_a)), [2.0, 5.0]) + assert_allclose_float64(prik_a, scipy_a) + assert_allclose_float64(f2py_a, scipy_a) + assert_allclose_float64(prik_scale, scipy_scale) + assert_allclose_float64(f2py_scale, scipy_scale) + + +def test_dgees_computes_real_schur_decomposition(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 2.0], [0.0, 3.0]], dtype=np.float64, order="F") + prik_t, f2py_t = matrix.copy(order="F"), matrix.copy(order="F") + prik_wr, prik_wi = np.empty(2), np.empty(2) + f2py_wr, f2py_wi = np.empty(2), np.empty(2) + prik_vs, f2py_vs = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + + prik_scalars = prik_lapack.dgees( + "V", "N", False, 2, prik_t, 2, 0, prik_wr, prik_wi, prik_vs, 2, np.empty(64), 64, np.zeros(2, dtype=np.bool_), 0 + ) + f2py_result = f2py_lapack.dgees( + b"V", + b"N", + lambda _wr, _wi: 0, + 2, + f2py_t, + 2, + 0, + f2py_wr, + f2py_wi, + f2py_vs, + 2, + np.empty(64), + 64, + np.zeros(2, dtype=np.int32), + 0, + ) + scipy_t, scipy_sdim, scipy_wr, scipy_wi, scipy_vs, _work, scipy_info = scipy_lapack.dgees( + lambda _wr, _wi: 0, matrix.copy(order="F"), compute_v=1, sort_t=0, lwork=64 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[3] == scipy_sdim == 0 + for t, vs, wr, wi in ( + (prik_t, prik_vs, prik_wr, prik_wi), + (f2py_t, f2py_vs, f2py_wr, f2py_wi), + (scipy_t, scipy_vs, scipy_wr, scipy_wi), + ): + assert_orthogonal(vs) + assert_allclose_float64(vs @ t @ vs.T, matrix, operation_size=2) + assert_allclose_float64(np.sort(wr), [1.0, 3.0]) + assert_allclose_float64(wi, [0.0, 0.0]) + + +def test_dgeev_returns_right_eigenvectors(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 2.0], [0.0, 3.0]], dtype=np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_wr, prik_wi = np.empty(2), np.empty(2) + f2py_wr, f2py_wi = np.empty(2), np.empty(2) + prik_vl, prik_vr = np.empty((1, 2), order="F"), np.empty((2, 2), order="F") + f2py_vl, f2py_vr = np.empty((1, 2), order="F"), np.empty((2, 2), order="F") + + prik_scalars = prik_lapack.dgeev( + "N", "V", 2, prik_a, 2, prik_wr, prik_wi, prik_vl, 1, prik_vr, 2, np.empty(64), 64, 0 + ) + f2py_result = f2py_lapack.dgeev( + b"N", b"V", 2, f2py_a, 2, f2py_wr, f2py_wi, f2py_vl, 1, f2py_vr, 2, np.empty(64), 64, 0 + ) + scipy_wr, scipy_wi, _vl, scipy_vr, scipy_info = scipy_lapack.dgeev( + matrix.copy(order="F"), compute_vl=0, compute_vr=1, lwork=64 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for wr, wi, vr in ((prik_wr, prik_wi, prik_vr), (f2py_wr, f2py_wi, f2py_vr), (scipy_wr, scipy_wi, scipy_vr)): + assert_allclose_float64(wi, [0.0, 0.0]) + for index in range(2): + assert_allclose_float64(matrix @ vr[:, index], wr[index] * vr[:, index], operation_size=2) + + +def test_dgehrd_reduces_matrix_to_upper_hessenberg(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_tau, f2py_tau = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dgehrd(2, 1, 2, prik_a, 2, prik_tau, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dgehrd(2, 1, 2, f2py_a, 2, f2py_tau, np.empty(64), 64, 0) + scipy_a, scipy_tau, scipy_info = scipy_lapack.dgehrd(matrix.copy(order="F"), lo=0, hi=1, lwork=64) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(np.triu(prik_a, -1), matrix) + assert_allclose_float64(np.triu(f2py_a, -1), matrix) + assert_allclose_float64(prik_a, scipy_a) + assert_allclose_float64(f2py_a, scipy_a) + assert_allclose_float64(prik_tau, scipy_tau) + assert_allclose_float64(f2py_tau, scipy_tau) + + +def test_dorghr_forms_hessenberg_similarity_transform(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float64, order="F") + factor, tau, factor_info = scipy_lapack.dgehrd(matrix.copy(order="F"), lo=0, hi=1, lwork=64) + assert factor_info == 0 + prik_q, f2py_q = factor.copy(order="F"), factor.copy(order="F") + + prik_scalars = prik_lapack.dorghr(2, 1, 2, prik_q, 2, tau, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dorghr(2, 1, 2, f2py_q, 2, tau, np.empty(64), 64, 0) + scipy_q, scipy_info = scipy_lapack.dorghr(factor.copy(order="F"), tau, lo=0, hi=1, lwork=64) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for q in (prik_q, f2py_q, scipy_q): + assert_orthogonal(q) + assert_allclose_float64(q.T @ matrix @ q, matrix, operation_size=2) + + +def test_dtrexc_reorders_real_schur_blocks(prik_lapack, scipy_lapack, f2py_lapack): + schur = np.diag([1.0, 2.0]).astype(np.float64, order="F") + identity = np.eye(2, dtype=np.float64, order="F") + prik_t, f2py_t = schur.copy(order="F"), schur.copy(order="F") + prik_q, f2py_q = identity.copy(order="F"), identity.copy(order="F") + + prik_scalars = prik_lapack.dtrexc("V", 2, prik_t, 2, prik_q, 2, 1, 2, np.empty(2), 0) + f2py_result = f2py_lapack.dtrexc(b"V", 2, f2py_t, 2, f2py_q, 2, 1, 2, np.empty(2), 0) + scipy_t, scipy_q, scipy_info = scipy_lapack.dtrexc(schur.copy(order="F"), identity.copy(order="F"), 0, 1, wantq=1) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for t, q in ((prik_t, prik_q), (f2py_t, f2py_q), (scipy_t, scipy_q)): + assert_allclose_float64(np.diag(t), [2.0, 1.0]) + assert_orthogonal(q) + assert_allclose_float64(q @ t @ q.T, schur, operation_size=2) + + +def test_dtrsen_reorders_selected_schur_eigenvalue(prik_lapack, scipy_lapack, f2py_lapack): + schur = np.diag([1.0, 2.0]).astype(np.float64, order="F") + identity = np.eye(2, dtype=np.float64, order="F") + prik_t, f2py_t = schur.copy(order="F"), schur.copy(order="F") + prik_q, f2py_q = identity.copy(order="F"), identity.copy(order="F") + prik_wr, prik_wi = np.empty(2), np.empty(2) + f2py_wr, f2py_wi = np.empty(2), np.empty(2) + selection = np.array([False, True], dtype=np.bool_) + + prik_scalars = prik_lapack.dtrsen( + "N", + "V", + selection, + 2, + prik_t, + 2, + prik_q, + 2, + prik_wr, + prik_wi, + 0, + 0.0, + 0.0, + np.empty(8), + 8, + np.empty(2, dtype=np.int32), + 2, + 0, + ) + f2py_result = f2py_lapack.dtrsen( + b"N", + b"V", + selection.astype(np.int32), + 2, + f2py_t, + 2, + f2py_q, + 2, + f2py_wr, + f2py_wi, + 0, + 0.0, + 0.0, + np.empty(8), + 8, + np.empty(2, dtype=np.int32), + 2, + 0, + ) + scipy_t, scipy_q, scipy_wr, scipy_wi, scipy_m, _s, _sep, scipy_info = scipy_lapack.dtrsen( + selection.astype(np.int32), + schur.copy(order="F"), + identity.copy(order="F"), + job=b"N", + wantq=1, + lwork=8, + liwork=2, + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[3] == scipy_m == 1 + for t, q, wr, wi in ( + (prik_t, prik_q, prik_wr, prik_wi), + (f2py_t, f2py_q, f2py_wr, f2py_wi), + (scipy_t, scipy_q, scipy_wr, scipy_wi), + ): + assert_allclose_float64(wr, [2.0, 1.0]) + assert_allclose_float64(wi, [0.0, 0.0]) + assert_allclose_float64(q @ t @ q.T, schur, operation_size=2) + + +def test_dtrsyl_solves_sylvester_equation(prik_lapack, scipy_lapack, f2py_lapack): + a = np.array([[2.0]], dtype=np.float64, order="F") + b = np.array([[3.0]], dtype=np.float64, order="F") + c = np.array([[10.0]], dtype=np.float64, order="F") + prik_c, f2py_c = c.copy(order="F"), c.copy(order="F") + + prik_scalars = prik_lapack.dtrsyl("N", "N", 1, 1, 1, a, 1, b, 1, prik_c, 1, 0.0, 0) + f2py_result = f2py_lapack.dtrsyl(b"N", b"N", 1, 1, 1, a, 1, b, 1, f2py_c, 1, 0.0, 0) + scipy_x, scipy_scale, scipy_info = scipy_lapack.dtrsyl(a, b, c.copy(order="F"), trana=b"N", tranb=b"N", isgn=1) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_c, [[2.0]]) + assert_allclose_float64(f2py_c, [[2.0]]) + assert_allclose_float64(scipy_x, [[2.0]]) + assert_allclose_float64(prik_scalars[-2], scipy_scale) + assert_allclose_float64(a @ prik_c + prik_c @ b, prik_scalars[-2] * c) diff --git a/examples/lapack/test_eigen_symmetric.py b/examples/lapack/test_eigen_symmetric.py new file mode 100644 index 000000000..bebbfff66 --- /dev/null +++ b/examples/lapack/test_eigen_symmetric.py @@ -0,0 +1,582 @@ +"""Symmetric and tridiagonal eigenvalue correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import assert_allclose_float64, assert_orthogonal, column_major, symmetric_band_storage + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def _diagonal_problem(): + matrix = np.diag([2.0, 3.0]).astype(np.float64, order="F") + diagonal = np.array([2.0, 3.0], dtype=np.float64) + offdiag = np.array([0.0], dtype=np.float64) + return matrix, diagonal, offdiag + + +def _assert_eigensystem(matrix, values, vectors): + assert_allclose_float64(values, [2.0, 3.0]) + assert_orthogonal(vectors) + assert_allclose_float64(matrix @ vectors, vectors @ np.diag(values), operation_size=2) + + +def test_dpteqr_diagonalizes_positive_definite_tridiagonal(prik_lapack, scipy_lapack, f2py_lapack): + matrix, diagonal, offdiag = _diagonal_problem() + prik_d, f2py_d = diagonal.copy(), diagonal.copy() + prik_e, f2py_e = offdiag.copy(), offdiag.copy() + prik_z, f2py_z = np.eye(2, dtype=np.float64, order="F"), np.eye(2, dtype=np.float64, order="F") + + prik_scalars = prik_lapack.dpteqr("I", 2, prik_d, prik_e, prik_z, 2, np.empty(8), 0) + f2py_result = f2py_lapack.dpteqr(b"I", 2, f2py_d, f2py_e, f2py_z, 2, np.empty(8), 0) + scipy_d, _scipy_e, scipy_z, scipy_info = scipy_lapack.dpteqr(diagonal, offdiag, np.eye(2, order="F"), compute_z=1) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + _assert_eigensystem(matrix, prik_d, prik_z) + _assert_eigensystem(matrix, f2py_d, f2py_z) + _assert_eigensystem(matrix, scipy_d, scipy_z) + + +def test_dsbev_diagonalizes_symmetric_band_matrix(prik_lapack, scipy_lapack, f2py_lapack): + matrix, _diagonal, _offdiag = _diagonal_problem() + band = symmetric_band_storage(matrix, 1, lower=False) + prik_ab, f2py_ab = band.copy(order="F"), band.copy(order="F") + prik_w, f2py_w = np.empty(2), np.empty(2) + prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + + prik_scalars = prik_lapack.dsbev("V", "U", 2, 1, prik_ab, 2, prik_w, prik_z, 2, np.empty(6), 0) + f2py_result = f2py_lapack.dsbev(b"V", b"U", 2, 1, f2py_ab, 2, f2py_w, f2py_z, 2, np.empty(6), 0) + scipy_w, scipy_z, scipy_info = scipy_lapack.dsbev(band.copy(order="F"), compute_v=1, lower=0) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + _assert_eigensystem(matrix, prik_w, prik_z) + _assert_eigensystem(matrix, f2py_w, f2py_z) + _assert_eigensystem(matrix, scipy_w, scipy_z) + + +def test_dsbevd_diagonalizes_band_matrix_by_divide_and_conquer(prik_lapack, scipy_lapack, f2py_lapack): + matrix, _diagonal, _offdiag = _diagonal_problem() + band = symmetric_band_storage(matrix, 1, lower=False) + prik_ab, f2py_ab = band.copy(order="F"), band.copy(order="F") + prik_w, f2py_w = np.empty(2), np.empty(2) + prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + + prik_scalars = prik_lapack.dsbevd( + "V", "U", 2, 1, prik_ab, 2, prik_w, prik_z, 2, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + ) + f2py_result = f2py_lapack.dsbevd( + b"V", b"U", 2, 1, f2py_ab, 2, f2py_w, f2py_z, 2, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + ) + scipy_w, scipy_z, scipy_info = scipy_lapack.dsbevd(band.copy(order="F"), compute_v=1, lower=0, liwork=32) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + _assert_eigensystem(matrix, prik_w, prik_z) + _assert_eigensystem(matrix, f2py_w, f2py_z) + _assert_eigensystem(matrix, scipy_w, scipy_z) + + +def test_dsbevx_selects_all_symmetric_band_eigenpairs(prik_lapack, scipy_lapack, f2py_lapack): + matrix, _diagonal, _offdiag = _diagonal_problem() + band = symmetric_band_storage(matrix, 1, lower=False) + prik_ab, f2py_ab = band.copy(order="F"), band.copy(order="F") + prik_w, f2py_w = np.empty(2), np.empty(2) + prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + prik_ifail, f2py_ifail = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dsbevx( + "V", + "A", + "U", + 2, + 1, + prik_ab, + 2, + np.empty((2, 2), order="F"), + 2, + 0.0, + 0.0, + 1, + 2, + 0.0, + 0, + prik_w, + prik_z, + 2, + np.empty(14), + np.empty(10, dtype=np.int32), + prik_ifail, + 0, + ) + f2py_result = f2py_lapack.dsbevx( + b"V", + b"A", + b"U", + 2, + 1, + f2py_ab, + 2, + np.empty((2, 2), order="F"), + 2, + 0.0, + 0.0, + 1, + 2, + 0.0, + 0, + f2py_w, + f2py_z, + 2, + np.empty(14), + np.empty(10, dtype=np.int32), + f2py_ifail, + 0, + ) + scipy_w, scipy_z, scipy_m, scipy_ifail, scipy_info = scipy_lapack.dsbevx( + band.copy(order="F"), 0.0, 0.0, 1, 2, compute_v=1, range=0, lower=0, mmax=2 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[10] == scipy_m == 2 + _assert_eigensystem(matrix, prik_w, prik_z) + _assert_eigensystem(matrix, f2py_w, f2py_z) + _assert_eigensystem(matrix, scipy_w, scipy_z) + np.testing.assert_array_equal(prik_ifail, scipy_ifail) + np.testing.assert_array_equal(f2py_ifail, scipy_ifail) + + +def test_dstebz_bisects_tridiagonal_eigenvalues(prik_lapack, scipy_lapack, f2py_lapack): + _matrix, diagonal, offdiag = _diagonal_problem() + prik_w, f2py_w = np.empty(2), np.empty(2) + prik_iblock, f2py_iblock = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) + prik_isplit, f2py_isplit = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dstebz( + "A", + "E", + 2, + 0.0, + 0.0, + 1, + 2, + 0.0, + diagonal, + offdiag, + 0, + 0, + prik_w, + prik_iblock, + prik_isplit, + np.empty(8), + np.empty(6, dtype=np.int32), + 0, + ) + f2py_result = f2py_lapack.dstebz( + b"A", + b"E", + 2, + 0.0, + 0.0, + 1, + 2, + 0.0, + diagonal, + offdiag, + 0, + 0, + f2py_w, + f2py_iblock, + f2py_isplit, + np.empty(8), + np.empty(6, dtype=np.int32), + 0, + ) + scipy_m, scipy_w, scipy_iblock, scipy_isplit, scipy_info = scipy_lapack.dstebz( + diagonal, offdiag, 0, 0.0, 0.0, 1, 2, 0.0, b"E" + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[7] == scipy_m == 2 + assert_allclose_float64(prik_w[:2], [2.0, 3.0]) + assert_allclose_float64(f2py_w[:2], [2.0, 3.0]) + assert_allclose_float64(scipy_w[:2], [2.0, 3.0]) + np.testing.assert_array_equal(prik_iblock, scipy_iblock) + np.testing.assert_array_equal(f2py_iblock, scipy_iblock) + np.testing.assert_array_equal(prik_isplit, scipy_isplit) + np.testing.assert_array_equal(f2py_isplit, scipy_isplit) + + +def test_dstein_computes_tridiagonal_eigenvectors(prik_lapack, scipy_lapack, f2py_lapack): + matrix, diagonal, offdiag = _diagonal_problem() + m, values, iblock, isplit, split_info = scipy_lapack.dstebz(diagonal, offdiag, 0, 0.0, 0.0, 1, 2, 0.0, b"E") + assert split_info == 0 and m == 2 + prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + prik_ifail, f2py_ifail = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dstein( + 2, + diagonal, + offdiag, + 2, + values, + iblock, + isplit, + prik_z, + 2, + np.empty(10), + np.empty(2, dtype=np.int32), + prik_ifail, + 0, + ) + f2py_result = f2py_lapack.dstein( + 2, + diagonal, + offdiag, + 2, + values, + iblock, + isplit, + f2py_z, + 2, + np.empty(10), + np.empty(2, dtype=np.int32), + f2py_ifail, + 0, + ) + scipy_z, scipy_info = scipy_lapack.dstein(diagonal, offdiag, values, iblock, isplit) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + _assert_eigensystem(matrix, values, prik_z) + _assert_eigensystem(matrix, values, f2py_z) + _assert_eigensystem(matrix, values, scipy_z) + np.testing.assert_array_equal(prik_ifail, [0, 0]) + np.testing.assert_array_equal(f2py_ifail, [0, 0]) + + +def test_dstemr_computes_robust_tridiagonal_eigenpairs(prik_lapack, scipy_lapack, f2py_lapack): + matrix, diagonal, offdiag = _diagonal_problem() + prik_d, f2py_d = diagonal.copy(), diagonal.copy() + prik_e, f2py_e = np.array([offdiag[0], 0.0]), np.array([offdiag[0], 0.0]) + prik_w, f2py_w = np.empty(2), np.empty(2) + prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + prik_support, f2py_support = np.empty(4, dtype=np.int32), np.empty(4, dtype=np.int32) + + prik_scalars = prik_lapack.dstemr( + "V", + "A", + 2, + prik_d, + prik_e, + 0.0, + 0.0, + 1, + 2, + 0, + prik_w, + prik_z, + 2, + 2, + prik_support, + True, + np.empty(128), + 128, + np.empty(64, dtype=np.int32), + 64, + 0, + ) + f2py_result = f2py_lapack.dstemr( + b"V", + b"A", + 2, + f2py_d, + f2py_e, + 0.0, + 0.0, + 1, + 2, + 0, + f2py_w, + f2py_z, + 2, + 2, + f2py_support, + 1, + np.empty(128), + 128, + np.empty(64, dtype=np.int32), + 64, + 0, + ) + scipy_m, scipy_w, scipy_z, scipy_info = scipy_lapack.dstemr( + diagonal, np.array([0.0, 0.0]), 0, 0.0, 0.0, 1, 2, compute_v=1, lwork=128, liwork=64 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[8] == scipy_m == 2 + _assert_eigensystem(matrix, prik_w, prik_z) + _assert_eigensystem(matrix, f2py_w, f2py_z) + _assert_eigensystem(matrix, scipy_w, scipy_z) + + +def test_dsterf_computes_tridiagonal_eigenvalues(prik_lapack, scipy_lapack, f2py_lapack): + _matrix, diagonal, offdiag = _diagonal_problem() + prik_d, f2py_d = diagonal.copy(), diagonal.copy() + prik_e, f2py_e = offdiag.copy(), offdiag.copy() + + prik_scalars = prik_lapack.dsterf(2, prik_d, prik_e, 0) + f2py_result = f2py_lapack.dsterf(2, f2py_d, f2py_e, 0) + scipy_values, scipy_info = scipy_lapack.dsterf(diagonal, offdiag) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_d, [2.0, 3.0]) + assert_allclose_float64(f2py_d, [2.0, 3.0]) + assert_allclose_float64(scipy_values, [2.0, 3.0]) + + +def test_dstev_computes_tridiagonal_eigenpairs(prik_lapack, scipy_lapack, f2py_lapack): + matrix, diagonal, offdiag = _diagonal_problem() + prik_d, f2py_d = diagonal.copy(), diagonal.copy() + prik_e, f2py_e = offdiag.copy(), offdiag.copy() + prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + + prik_scalars = prik_lapack.dstev("V", 2, prik_d, prik_e, prik_z, 2, np.empty(4), 0) + f2py_result = f2py_lapack.dstev(b"V", 2, f2py_d, f2py_e, f2py_z, 2, np.empty(4), 0) + scipy_values, scipy_z, scipy_info = scipy_lapack.dstev(diagonal, offdiag, compute_v=1) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + _assert_eigensystem(matrix, prik_d, prik_z) + _assert_eigensystem(matrix, f2py_d, f2py_z) + _assert_eigensystem(matrix, scipy_values, scipy_z) + + +def test_dstevd_computes_divide_and_conquer_tridiagonal_eigenpairs(prik_lapack, scipy_lapack, f2py_lapack): + matrix, diagonal, offdiag = _diagonal_problem() + prik_d, f2py_d = diagonal.copy(), diagonal.copy() + prik_e, f2py_e = offdiag.copy(), offdiag.copy() + prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + + prik_scalars = prik_lapack.dstevd( + "V", 2, prik_d, prik_e, prik_z, 2, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + ) + f2py_result = f2py_lapack.dstevd( + b"V", 2, f2py_d, f2py_e, f2py_z, 2, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + ) + scipy_values, scipy_z, scipy_info = scipy_lapack.dstevd(diagonal, offdiag, compute_v=1, lwork=64, liwork=32) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + _assert_eigensystem(matrix, prik_d, prik_z) + _assert_eigensystem(matrix, f2py_d, f2py_z) + _assert_eigensystem(matrix, scipy_values, scipy_z) + + +def test_dsyev_returns_orthonormal_eigenvectors(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[2.0, 1.0], [1.0, 2.0]], dtype=np.float64) + expected_w = np.array([1.0, 3.0], dtype=np.float64) + prik_vectors, f2py_vectors = column_major(matrix), column_major(matrix) + prik_w = np.empty(2, dtype=np.float64) + f2py_w = np.empty(2, dtype=np.float64) + + prik_scalars = prik_lapack.dsyev("V", "U", 2, prik_vectors, 2, prik_w, np.empty(16), 16, 0) + f2py_result = f2py_lapack.dsyev(b"V", b"U", 2, f2py_vectors, 2, f2py_w, np.empty(16), 16, 0) + scipy_w, scipy_vectors, scipy_info = scipy_lapack.dsyev(matrix.copy(order="F"), compute_v=1, lower=0, lwork=16) + + assert prik_scalars == (2, 2, 16, 0) + assert f2py_result is None + assert scipy_info == 0 + for values, vectors in ( + (prik_w, prik_vectors), + (f2py_w, f2py_vectors), + (scipy_w, scipy_vectors), + ): + assert_allclose_float64(values, expected_w, operation_size=2) + assert_orthogonal(vectors) + assert_allclose_float64(matrix @ vectors, vectors @ np.diag(values), operation_size=2) + + +def test_dsyevd_computes_divide_and_conquer_symmetric_eigenpairs(prik_lapack, scipy_lapack, f2py_lapack): + matrix, _diagonal, _offdiag = _diagonal_problem() + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_w, f2py_w = np.empty(2), np.empty(2) + + prik_scalars = prik_lapack.dsyevd( + "V", "U", 2, prik_a, 2, prik_w, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + ) + f2py_result = f2py_lapack.dsyevd( + b"V", b"U", 2, f2py_a, 2, f2py_w, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + ) + scipy_w, scipy_a, scipy_info = scipy_lapack.dsyevd( + matrix.copy(order="F"), compute_v=1, lower=0, lwork=64, liwork=32 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + _assert_eigensystem(matrix, prik_w, prik_a) + _assert_eigensystem(matrix, f2py_w, f2py_a) + _assert_eigensystem(matrix, scipy_w, scipy_a) + + +def test_dsyevr_selects_symmetric_eigenpairs_by_index(prik_lapack, scipy_lapack, f2py_lapack): + matrix, _diagonal, _offdiag = _diagonal_problem() + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_w, f2py_w = np.empty(2), np.empty(2) + prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + prik_support, f2py_support = np.empty(4, dtype=np.int32), np.empty(4, dtype=np.int32) + + prik_scalars = prik_lapack.dsyevr( + "V", + "I", + "U", + 2, + prik_a, + 2, + 0.0, + 0.0, + 1, + 2, + 0.0, + 0, + prik_w, + prik_z, + 2, + prik_support, + np.empty(128), + 128, + np.empty(64, dtype=np.int32), + 64, + 0, + ) + f2py_result = f2py_lapack.dsyevr( + b"V", + b"I", + b"U", + 2, + f2py_a, + 2, + 0.0, + 0.0, + 1, + 2, + 0.0, + 0, + f2py_w, + f2py_z, + 2, + f2py_support, + np.empty(128), + 128, + np.empty(64, dtype=np.int32), + 64, + 0, + ) + scipy_w, scipy_z, scipy_m, _support, scipy_info = scipy_lapack.dsyevr( + matrix.copy(order="F"), compute_v=1, range=b"I", lower=0, il=1, iu=2, lwork=128, liwork=64 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[8] == scipy_m == 2 + _assert_eigensystem(matrix, prik_w, prik_z) + _assert_eigensystem(matrix, f2py_w, f2py_z) + _assert_eigensystem(matrix, scipy_w, scipy_z) + + +def test_dsyevx_selects_symmetric_eigenpairs_by_value(prik_lapack, scipy_lapack, f2py_lapack): + matrix, _diagonal, _offdiag = _diagonal_problem() + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_w, f2py_w = np.empty(2), np.empty(2) + prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + prik_ifail, f2py_ifail = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dsyevx( + "V", + "V", + "U", + 2, + prik_a, + 2, + 1.5, + 3.5, + 1, + 2, + 0.0, + 0, + prik_w, + prik_z, + 2, + np.empty(64), + 64, + np.empty(10, dtype=np.int32), + prik_ifail, + 0, + ) + f2py_result = f2py_lapack.dsyevx( + b"V", + b"V", + b"U", + 2, + f2py_a, + 2, + 1.5, + 3.5, + 1, + 2, + 0.0, + 0, + f2py_w, + f2py_z, + 2, + np.empty(64), + 64, + np.empty(10, dtype=np.int32), + f2py_ifail, + 0, + ) + scipy_w, scipy_z, scipy_m, scipy_ifail, scipy_info = scipy_lapack.dsyevx( + matrix.copy(order="F"), compute_v=1, range=b"V", lower=0, vl=1.5, vu=3.5, lwork=64 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[8] == scipy_m == 2 + _assert_eigensystem(matrix, prik_w, prik_z) + _assert_eigensystem(matrix, f2py_w, f2py_z) + _assert_eigensystem(matrix, scipy_w, scipy_z) + np.testing.assert_array_equal(prik_ifail, scipy_ifail) + np.testing.assert_array_equal(f2py_ifail, scipy_ifail) + + +def test_dsytrd_reduces_symmetric_matrix_to_tridiagonal(prik_lapack, scipy_lapack, f2py_lapack): + matrix, diagonal, offdiag = _diagonal_problem() + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_d, f2py_d = np.empty(2), np.empty(2) + prik_e, f2py_e = np.empty(1), np.empty(1) + prik_tau, f2py_tau = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dsytrd("U", 2, prik_a, 2, prik_d, prik_e, prik_tau, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dsytrd(b"U", 2, f2py_a, 2, f2py_d, f2py_e, f2py_tau, np.empty(64), 64, 0) + scipy_a, scipy_d, scipy_e, scipy_tau, scipy_info = scipy_lapack.dsytrd(matrix.copy(order="F"), lower=0, lwork=64) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_d, diagonal) + assert_allclose_float64(f2py_d, diagonal) + assert_allclose_float64(scipy_d, diagonal) + assert_allclose_float64(prik_e, offdiag) + assert_allclose_float64(f2py_e, offdiag) + assert_allclose_float64(scipy_e, offdiag) + assert_allclose_float64(prik_a, scipy_a) + assert_allclose_float64(f2py_a, scipy_a) + assert_allclose_float64(prik_tau, scipy_tau) + assert_allclose_float64(f2py_tau, scipy_tau) diff --git a/examples/lapack/test_least_squares.py b/examples/lapack/test_least_squares.py new file mode 100644 index 000000000..871f5ab72 --- /dev/null +++ b/examples/lapack/test_least_squares.py @@ -0,0 +1,166 @@ +"""Least-squares and equality-constrained least-squares correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import assert_allclose_float64, assert_small_residual + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def _exact_tall_problem(): + matrix = np.array([[1.0, 0.0], [0.0, 1.0], [1.0, 1.0]], dtype=np.float64, order="F") + expected = np.array([[1.0], [2.0]], dtype=np.float64) + rhs = np.array([[1.0], [2.0], [3.0]], dtype=np.float64, order="F") + return matrix, rhs, expected + + +def _assert_least_squares(matrix, rhs, solution): + residual = matrix @ solution - rhs + assert_small_residual( + residual, + matrix_norm=np.linalg.norm(matrix, ord=np.inf), + solution_norm=np.linalg.norm(solution, ord=np.inf), + operation_size=matrix.shape[0], + ) + assert_allclose_float64(matrix.T @ residual, np.zeros((matrix.shape[1], 1)), operation_size=3) + + +def test_dgels_solves_full_rank_least_squares(prik_lapack, scipy_lapack, f2py_lapack): + matrix, rhs, expected = _exact_tall_problem() + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dgels("N", 3, 2, 1, prik_a, 3, prik_b, 3, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dgels(b"N", 3, 2, 1, f2py_a, 3, f2py_b, 3, np.empty(64), 64, 0) + _factor, scipy_b, scipy_info = scipy_lapack.dgels(matrix.copy(order="F"), rhs.copy(order="F"), trans=b"N", lwork=64) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for solution in (prik_b[:2], f2py_b[:2], scipy_b[:2]): + assert_allclose_float64(solution, expected, operation_size=3) + _assert_least_squares(matrix, rhs, solution) + + +def test_dgelsd_solves_rank_revealing_least_squares(prik_lapack, scipy_lapack, f2py_lapack): + matrix, rhs, expected = _exact_tall_problem() + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + prik_s, f2py_s = np.empty(2), np.empty(2) + + prik_scalars = prik_lapack.dgelsd( + 3, 2, 1, prik_a, 3, prik_b, 3, prik_s, -1.0, 0, np.empty(128), 128, np.empty(128, dtype=np.int32), 0 + ) + f2py_result = f2py_lapack.dgelsd( + 3, 2, 1, f2py_a, 3, f2py_b, 3, f2py_s, -1.0, 0, np.empty(128), 128, np.empty(128, dtype=np.int32), 0 + ) + scipy_x, scipy_s, scipy_rank, scipy_info = scipy_lapack.dgelsd( + matrix.copy(order="F"), rhs.copy(order="F"), 128, 128, cond=-1.0 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[-3] == scipy_rank == 2 + for solution in (prik_b[:2], f2py_b[:2], scipy_x[:2]): + assert_allclose_float64(solution, expected, operation_size=3) + _assert_least_squares(matrix, rhs, solution) + assert_allclose_float64(prik_s, scipy_s, operation_size=3) + assert_allclose_float64(f2py_s, scipy_s, operation_size=3) + + +def test_dgelss_solves_svd_least_squares(prik_lapack, scipy_lapack, f2py_lapack): + matrix, rhs, expected = _exact_tall_problem() + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + prik_s, f2py_s = np.empty(2), np.empty(2) + + prik_scalars = prik_lapack.dgelss(3, 2, 1, prik_a, 3, prik_b, 3, prik_s, -1.0, 0, np.empty(128), 128, 0) + f2py_result = f2py_lapack.dgelss(3, 2, 1, f2py_a, 3, f2py_b, 3, f2py_s, -1.0, 0, np.empty(128), 128, 0) + _v, scipy_x, scipy_s, scipy_rank, _work, scipy_info = scipy_lapack.dgelss( + matrix.copy(order="F"), rhs.copy(order="F"), cond=-1.0, lwork=128 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[-3] == scipy_rank == 2 + for solution in (prik_b[:2], f2py_b[:2], scipy_x[:2]): + assert_allclose_float64(solution, expected, operation_size=3) + _assert_least_squares(matrix, rhs, solution) + assert_allclose_float64(prik_s, scipy_s, operation_size=3) + assert_allclose_float64(f2py_s, scipy_s, operation_size=3) + + +def test_dgelsy_solves_pivoted_rank_revealing_least_squares(prik_lapack, scipy_lapack, f2py_lapack): + matrix, rhs, expected = _exact_tall_problem() + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + prik_jpvt, f2py_jpvt = np.zeros(2, dtype=np.int32), np.zeros(2, dtype=np.int32) + + prik_scalars = prik_lapack.dgelsy(3, 2, 1, prik_a, 3, prik_b, 3, prik_jpvt, -1.0, 0, np.empty(128), 128, 0) + f2py_result = f2py_lapack.dgelsy(3, 2, 1, f2py_a, 3, f2py_b, 3, f2py_jpvt, -1.0, 0, np.empty(128), 128, 0) + _v, scipy_x, scipy_jpvt, scipy_rank, scipy_info = scipy_lapack.dgelsy( + matrix.copy(order="F"), rhs.copy(order="F"), np.zeros(2, dtype=np.int32), -1.0, 128 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[-3] == scipy_rank == 2 + for solution in (prik_b[:2], f2py_b[:2], scipy_x[:2]): + assert_allclose_float64(solution, expected, operation_size=3) + _assert_least_squares(matrix, rhs, solution) + np.testing.assert_array_equal(prik_jpvt, scipy_jpvt + 1) + np.testing.assert_array_equal(f2py_jpvt, scipy_jpvt + 1) + + +def test_dgglse_solves_equality_constrained_least_squares(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.eye(2, dtype=np.float64, order="F") + constraint = np.array([[1.0, 0.0]], dtype=np.float64, order="F") + target = np.array([1.0, 2.0], dtype=np.float64) + constrained_value = np.array([1.0], dtype=np.float64) + expected = np.array([1.0, 2.0], dtype=np.float64) + prik_x, f2py_x = np.empty(2), np.empty(2) + + prik_scalars = prik_lapack.dgglse( + 2, + 2, + 1, + matrix.copy(order="F"), + 2, + constraint.copy(order="F"), + 1, + target.copy(), + constrained_value.copy(), + prik_x, + np.empty(128), + 128, + 0, + ) + f2py_result = f2py_lapack.dgglse( + 2, + 2, + 1, + matrix.copy(order="F"), + 2, + constraint.copy(order="F"), + 1, + target.copy(), + constrained_value.copy(), + f2py_x, + np.empty(128), + 128, + 0, + ) + _t, _r, _res, scipy_x, scipy_info = scipy_lapack.dgglse( + matrix.copy(order="F"), constraint.copy(order="F"), target.copy(), constrained_value.copy(), lwork=128 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_x, expected, operation_size=2) + assert_allclose_float64(f2py_x, expected, operation_size=2) + assert_allclose_float64(scipy_x, expected, operation_size=2) + assert_allclose_float64(constraint @ prik_x, constrained_value) + assert_allclose_float64(matrix.T @ (matrix @ prik_x - target), np.zeros(2)) diff --git a/examples/lapack/test_linear_banded_tridiagonal.py b/examples/lapack/test_linear_banded_tridiagonal.py new file mode 100644 index 000000000..e5e50b65e --- /dev/null +++ b/examples/lapack/test_linear_banded_tridiagonal.py @@ -0,0 +1,459 @@ +"""General-banded, positive-banded, and tridiagonal correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import ( + assert_allclose_float64, + general_band_storage, + native_pivots, + symmetric_band_storage, +) + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def _general_tridiagonal(): + lower = np.array([1.0], dtype=np.float64) + diagonal = np.array([4.0, 3.0], dtype=np.float64) + upper = np.array([1.0], dtype=np.float64) + rhs = np.array([[6.0], [7.0]], dtype=np.float64, order="F") + expected = np.array([[1.0], [2.0]], dtype=np.float64) + return lower, diagonal, upper, rhs, expected + + +def test_dgbcon_estimates_general_band_condition(prik_lapack, scipy_lapack, f2py_lapack): + factor = np.array([[4.0]], dtype=np.float64, order="F") + native_ipiv = np.array([1], dtype=np.int32) + + prik_scalars = prik_lapack.dgbcon( + "1", 1, 0, 0, factor.copy(order="F"), 1, native_ipiv, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 + ) + f2py_result = f2py_lapack.dgbcon( + b"1", 1, 0, 0, factor.copy(order="F"), 1, native_ipiv, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 + ) + scipy_rcond, scipy_info = scipy_lapack.dgbcon(0, 0, factor.copy(order="F"), np.array([0], dtype=np.int32), 4.0) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_scalars[-2], 1.0) + assert_allclose_float64(scipy_rcond, 1.0) + + +def test_dgbsv_solves_general_band_system(prik_lapack, scipy_lapack, f2py_lapack): + prik_ab, f2py_ab = np.array([[4.0]], order="F"), np.array([[4.0]], order="F") + prik_b, f2py_b = np.array([[8.0]], order="F"), np.array([[8.0]], order="F") + prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) + + prik_scalars = prik_lapack.dgbsv(1, 0, 0, 1, prik_ab, 1, prik_piv, prik_b, 1, 0) + f2py_result = f2py_lapack.dgbsv(1, 0, 0, 1, f2py_ab, 1, f2py_piv, f2py_b, 1, 0) + scipy_lu, scipy_piv, scipy_x, scipy_info = scipy_lapack.dgbsv( + 0, 0, np.array([[4.0]], order="F"), np.array([[8.0]], order="F") + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, [[2.0]]) + assert_allclose_float64(f2py_b, [[2.0]]) + assert_allclose_float64(scipy_x, [[2.0]]) + assert_allclose_float64(prik_ab, scipy_lu) + assert_allclose_float64(f2py_ab, scipy_lu) + np.testing.assert_array_equal(prik_piv, native_pivots(scipy_piv)) + + +def test_dgbtrf_factorizes_general_band_matrix(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0, 1.0], [1.0, 3.0]], dtype=np.float64) + band = general_band_storage(matrix, 1, 1, factor=True) + prik_ab, f2py_ab = band.copy(order="F"), band.copy(order="F") + prik_piv, f2py_piv = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dgbtrf(2, 2, 1, 1, prik_ab, 4, prik_piv, 0) + f2py_result = f2py_lapack.dgbtrf(2, 2, 1, 1, f2py_ab, 4, f2py_piv, 0) + scipy_lu, scipy_piv, scipy_info = scipy_lapack.dgbtrf(band.copy(order="F"), 1, 1) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_ab, scipy_lu, operation_size=2) + assert_allclose_float64(f2py_ab, scipy_lu, operation_size=2) + np.testing.assert_array_equal(prik_piv, native_pivots(scipy_piv)) + np.testing.assert_array_equal(f2py_piv, native_pivots(scipy_piv)) + + +def test_dgbtrs_solves_from_general_band_lu(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0, 1.0], [1.0, 3.0]], dtype=np.float64) + band = general_band_storage(matrix, 1, 1, factor=True) + scipy_lu, scipy_piv, factor_info = scipy_lapack.dgbtrf(band.copy(order="F"), 1, 1) + assert factor_info == 0 + native_ipiv = native_pivots(scipy_piv) + rhs = np.array([[6.0], [7.0]], dtype=np.float64, order="F") + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dgbtrs("N", 2, 1, 1, 1, scipy_lu.copy(order="F"), 4, native_ipiv, prik_b, 2, 0) + f2py_result = f2py_lapack.dgbtrs(b"N", 2, 1, 1, 1, scipy_lu.copy(order="F"), 4, native_ipiv, f2py_b, 2, 0) + scipy_x, scipy_info = scipy_lapack.dgbtrs(scipy_lu, 1, 1, rhs.copy(order="F"), scipy_piv) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, [[1.0], [2.0]], operation_size=2) + assert_allclose_float64(f2py_b, [[1.0], [2.0]], operation_size=2) + assert_allclose_float64(scipy_x, [[1.0], [2.0]], operation_size=2) + + +def test_dgtcon_estimates_tridiagonal_condition(prik_lapack, scipy_lapack, f2py_lapack): + lower, diagonal, upper, _rhs, _expected = _general_tridiagonal() + scipy_dl, scipy_d, scipy_du, scipy_du2, scipy_piv, factor_info = scipy_lapack.dgttrf(lower, diagonal, upper) + assert factor_info == 0 + native_ipiv = native_pivots(scipy_piv) + anorm = 5.0 + + prik_scalars = prik_lapack.dgtcon( + "1", + 2, + scipy_dl, + scipy_d, + scipy_du, + scipy_du2, + native_ipiv, + anorm, + 0.0, + np.empty(4), + np.empty(2, dtype=np.int32), + 0, + ) + f2py_result = f2py_lapack.dgtcon( + b"1", + 2, + scipy_dl, + scipy_d, + scipy_du, + scipy_du2, + native_ipiv, + anorm, + 0.0, + np.empty(4), + np.empty(2, dtype=np.int32), + 0, + ) + scipy_rcond, scipy_info = scipy_lapack.dgtcon(scipy_dl, scipy_d, scipy_du, scipy_du2, scipy_piv, anorm) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_scalars[-2], scipy_rcond, operation_size=2) + assert 0.0 < scipy_rcond <= 1.0 + + +def test_dgtsv_solves_general_tridiagonal_system(prik_lapack, scipy_lapack, f2py_lapack): + lower, diagonal, upper, rhs, expected = _general_tridiagonal() + prik_dl, prik_d, prik_du = lower.copy(), diagonal.copy(), upper.copy() + f2py_dl, f2py_d, f2py_du = lower.copy(), diagonal.copy(), upper.copy() + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dgtsv(2, 1, prik_dl, prik_d, prik_du, prik_b, 2, 0) + f2py_result = f2py_lapack.dgtsv(2, 1, f2py_dl, f2py_d, f2py_du, f2py_b, 2, 0) + _du2, _d, _du, scipy_x, scipy_info = scipy_lapack.dgtsv(lower, diagonal, upper, rhs.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, expected, operation_size=2) + assert_allclose_float64(f2py_b, expected, operation_size=2) + assert_allclose_float64(scipy_x, expected, operation_size=2) + + +def test_dgtsvx_solves_and_bounds_tridiagonal_error(prik_lapack, scipy_lapack, f2py_lapack): + lower, diagonal, upper, rhs, expected = _general_tridiagonal() + prik_dlf, f2py_dlf = np.empty(1), np.empty(1) + prik_df, f2py_df = np.empty(2), np.empty(2) + prik_duf, f2py_duf = np.empty(1), np.empty(1) + prik_du2, f2py_du2 = np.empty(0), np.empty(0) + prik_piv, f2py_piv = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) + prik_x, f2py_x = np.empty_like(rhs), np.empty_like(rhs) + prik_ferr, f2py_ferr = np.empty(1), np.empty(1) + prik_berr, f2py_berr = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dgtsvx( + "N", + "N", + 2, + 1, + lower, + diagonal, + upper, + prik_dlf, + prik_df, + prik_duf, + prik_du2, + prik_piv, + rhs.copy(order="F"), + 2, + prik_x, + 2, + 0.0, + prik_ferr, + prik_berr, + np.empty(6), + np.empty(2, dtype=np.int32), + 0, + ) + f2py_result = f2py_lapack.dgtsvx( + b"N", + b"N", + 2, + 1, + lower, + diagonal, + upper, + f2py_dlf, + f2py_df, + f2py_duf, + f2py_du2, + f2py_piv, + rhs.copy(order="F"), + 2, + f2py_x, + 2, + 0.0, + f2py_ferr, + f2py_berr, + np.empty(6), + np.empty(2, dtype=np.int32), + 0, + ) + _dlf, _df, _duf, _du2, _piv, scipy_x, scipy_rcond, scipy_ferr, scipy_berr, scipy_info = scipy_lapack.dgtsvx( + lower, diagonal, upper, rhs.copy(order="F") + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_x, expected, operation_size=2) + assert_allclose_float64(f2py_x, expected, operation_size=2) + assert_allclose_float64(scipy_x, expected, operation_size=2) + assert_allclose_float64(prik_scalars[-2], scipy_rcond, operation_size=2) + assert_allclose_float64(prik_ferr, scipy_ferr) + assert_allclose_float64(prik_berr, scipy_berr) + + +def test_dgttrf_factorizes_general_tridiagonal_matrix(prik_lapack, scipy_lapack, f2py_lapack): + lower, diagonal, upper, _rhs, _expected = _general_tridiagonal() + prik_dl, prik_d, prik_du = lower.copy(), diagonal.copy(), upper.copy() + f2py_dl, f2py_d, f2py_du = lower.copy(), diagonal.copy(), upper.copy() + prik_du2, f2py_du2 = np.empty(0), np.empty(0) + prik_piv, f2py_piv = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dgttrf(2, prik_dl, prik_d, prik_du, prik_du2, prik_piv, 0) + f2py_result = f2py_lapack.dgttrf(2, f2py_dl, f2py_d, f2py_du, f2py_du2, f2py_piv, 0) + scipy_dl, scipy_d, scipy_du, _scipy_du2, scipy_piv, scipy_info = scipy_lapack.dgttrf(lower, diagonal, upper) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_dl, scipy_dl) + assert_allclose_float64(prik_d, scipy_d) + assert_allclose_float64(prik_du, scipy_du) + assert_allclose_float64(f2py_dl, scipy_dl) + assert_allclose_float64(f2py_d, scipy_d) + assert_allclose_float64(f2py_du, scipy_du) + np.testing.assert_array_equal(prik_piv, native_pivots(scipy_piv)) + np.testing.assert_array_equal(f2py_piv, native_pivots(scipy_piv)) + + +def test_dgttrs_solves_from_tridiagonal_lu(prik_lapack, scipy_lapack, f2py_lapack): + lower, diagonal, upper, rhs, expected = _general_tridiagonal() + dl, d, du, du2, scipy_piv, factor_info = scipy_lapack.dgttrf(lower, diagonal, upper) + assert factor_info == 0 + native_ipiv = native_pivots(scipy_piv) + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dgttrs("N", 2, 1, dl, d, du, du2, native_ipiv, prik_b, 2, 0) + f2py_result = f2py_lapack.dgttrs(b"N", 2, 1, dl, d, du, du2, native_ipiv, f2py_b, 2, 0) + scipy_x, scipy_info = scipy_lapack.dgttrs(dl, d, du, du2, scipy_piv, rhs.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, expected, operation_size=2) + assert_allclose_float64(f2py_b, expected, operation_size=2) + assert_allclose_float64(scipy_x, expected, operation_size=2) + + +def test_dpbsv_solves_positive_definite_band_system(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0, 1.0], [1.0, 3.0]], dtype=np.float64) + band = symmetric_band_storage(matrix, 1, lower=False) + rhs = np.array([[6.0], [7.0]], dtype=np.float64, order="F") + prik_ab, f2py_ab = band.copy(order="F"), band.copy(order="F") + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dpbsv("U", 2, 1, 1, prik_ab, 2, prik_b, 2, 0) + f2py_result = f2py_lapack.dpbsv(b"U", 2, 1, 1, f2py_ab, 2, f2py_b, 2, 0) + scipy_factor, scipy_x, scipy_info = scipy_lapack.dpbsv(band.copy(order="F"), rhs.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_ab, scipy_factor, operation_size=2) + assert_allclose_float64(f2py_ab, scipy_factor, operation_size=2) + assert_allclose_float64(prik_b, [[1.0], [2.0]], operation_size=2) + assert_allclose_float64(f2py_b, [[1.0], [2.0]], operation_size=2) + assert_allclose_float64(scipy_x, [[1.0], [2.0]], operation_size=2) + + +def test_dpbtrf_factorizes_positive_definite_band_matrix(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0, 1.0], [1.0, 3.0]], dtype=np.float64) + band = symmetric_band_storage(matrix, 1, lower=False) + prik_ab, f2py_ab = band.copy(order="F"), band.copy(order="F") + + prik_scalars = prik_lapack.dpbtrf("U", 2, 1, prik_ab, 2, 0) + f2py_result = f2py_lapack.dpbtrf(b"U", 2, 1, f2py_ab, 2, 0) + scipy_factor, scipy_info = scipy_lapack.dpbtrf(band.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_ab, scipy_factor, operation_size=2) + assert_allclose_float64(f2py_ab, scipy_factor, operation_size=2) + + +def test_dpbtrs_solves_from_positive_definite_band_factor(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0, 1.0], [1.0, 3.0]], dtype=np.float64) + band = symmetric_band_storage(matrix, 1, lower=False) + factor, factor_info = scipy_lapack.dpbtrf(band.copy(order="F")) + assert factor_info == 0 + rhs = np.array([[6.0], [7.0]], dtype=np.float64, order="F") + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dpbtrs("U", 2, 1, 1, factor, 2, prik_b, 2, 0) + f2py_result = f2py_lapack.dpbtrs(b"U", 2, 1, 1, factor, 2, f2py_b, 2, 0) + scipy_x, scipy_info = scipy_lapack.dpbtrs(factor, rhs.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, [[1.0], [2.0]], operation_size=2) + assert_allclose_float64(f2py_b, [[1.0], [2.0]], operation_size=2) + assert_allclose_float64(scipy_x, [[1.0], [2.0]], operation_size=2) + + +def test_dptsv_solves_spd_tridiagonal_system(prik_lapack, scipy_lapack, f2py_lapack): + lower, diagonal, upper, rhs, expected = _general_tridiagonal() + assert_allclose_float64(lower, upper) + prik_d, f2py_d = diagonal.copy(), diagonal.copy() + prik_e, f2py_e = upper.copy(), upper.copy() + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dptsv(2, 1, prik_d, prik_e, prik_b, 2, 0) + f2py_result = f2py_lapack.dptsv(2, 1, f2py_d, f2py_e, f2py_b, 2, 0) + _d, _e, scipy_x, scipy_info = scipy_lapack.dptsv(diagonal, upper, rhs.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, expected, operation_size=2) + assert_allclose_float64(f2py_b, expected, operation_size=2) + assert_allclose_float64(scipy_x, expected, operation_size=2) + + +def test_dptsvx_solves_and_bounds_spd_tridiagonal_error(prik_lapack, scipy_lapack, f2py_lapack): + _lower, diagonal, offdiag, rhs, expected = _general_tridiagonal() + prik_df, f2py_df = np.empty(2), np.empty(2) + prik_ef, f2py_ef = np.empty(1), np.empty(1) + prik_x, f2py_x = np.empty_like(rhs), np.empty_like(rhs) + prik_ferr, f2py_ferr = np.empty(1), np.empty(1) + prik_berr, f2py_berr = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dptsvx( + "N", + 2, + 1, + diagonal, + offdiag, + prik_df, + prik_ef, + rhs.copy(order="F"), + 2, + prik_x, + 2, + 0.0, + prik_ferr, + prik_berr, + np.empty(4), + 0, + ) + f2py_result = f2py_lapack.dptsvx( + b"N", + 2, + 1, + diagonal, + offdiag, + f2py_df, + f2py_ef, + rhs.copy(order="F"), + 2, + f2py_x, + 2, + 0.0, + f2py_ferr, + f2py_berr, + np.empty(4), + 0, + ) + _df, _ef, scipy_x, scipy_rcond, scipy_ferr, scipy_berr, scipy_info = scipy_lapack.dptsvx( + diagonal, offdiag, rhs.copy(order="F") + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_x, expected, operation_size=2) + assert_allclose_float64(f2py_x, expected, operation_size=2) + assert_allclose_float64(scipy_x, expected, operation_size=2) + assert_allclose_float64(prik_scalars[-2], scipy_rcond, operation_size=2) + assert_allclose_float64(prik_ferr, scipy_ferr) + assert_allclose_float64(prik_berr, scipy_berr) + + +def test_dpttrf_factorizes_spd_tridiagonal_matrix(prik_lapack, scipy_lapack, f2py_lapack): + _lower, diagonal, offdiag, _rhs, _expected = _general_tridiagonal() + prik_d, f2py_d = diagonal.copy(), diagonal.copy() + prik_e, f2py_e = offdiag.copy(), offdiag.copy() + + prik_scalars = prik_lapack.dpttrf(2, prik_d, prik_e, 0) + f2py_result = f2py_lapack.dpttrf(2, f2py_d, f2py_e, 0) + scipy_d, scipy_e, scipy_info = scipy_lapack.dpttrf(diagonal, offdiag) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_d, scipy_d) + assert_allclose_float64(prik_e, scipy_e) + assert_allclose_float64(f2py_d, scipy_d) + assert_allclose_float64(f2py_e, scipy_e) + + +def test_dpttrs_solves_from_spd_tridiagonal_factor(prik_lapack, scipy_lapack, f2py_lapack): + _lower, diagonal, offdiag, rhs, expected = _general_tridiagonal() + factor_d, factor_e, factor_info = scipy_lapack.dpttrf(diagonal, offdiag) + assert factor_info == 0 + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dpttrs(2, 1, factor_d, factor_e, prik_b, 2, 0) + f2py_result = f2py_lapack.dpttrs(2, 1, factor_d, factor_e, f2py_b, 2, 0) + scipy_x, scipy_info = scipy_lapack.dpttrs(factor_d, factor_e, rhs.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, expected, operation_size=2) + assert_allclose_float64(f2py_b, expected, operation_size=2) + assert_allclose_float64(scipy_x, expected, operation_size=2) + + +def test_dtbtrs_solves_triangular_band_system(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[2.0, 1.0], [0.0, 3.0]], dtype=np.float64) + band = symmetric_band_storage(matrix, 1, lower=False) + rhs = np.array([[4.0], [6.0]], dtype=np.float64, order="F") + expected = np.array([[1.0], [2.0]], dtype=np.float64) + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dtbtrs("U", "N", "N", 2, 1, 1, band, 2, prik_b, 2, 0) + f2py_result = f2py_lapack.dtbtrs(b"U", b"N", b"N", 2, 1, 1, band, 2, f2py_b, 2, 0) + scipy_x, scipy_info = scipy_lapack.dtbtrs(band, rhs.copy(order="F"), uplo=b"U", trans=b"N", diag=b"N") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, expected, operation_size=2) + assert_allclose_float64(f2py_b, expected, operation_size=2) + assert_allclose_float64(scipy_x, expected, operation_size=2) + assert_allclose_float64(matrix @ prik_b, rhs, operation_size=2) diff --git a/examples/lapack/test_linear_general.py b/examples/lapack/test_linear_general.py new file mode 100644 index 000000000..5e5700c44 --- /dev/null +++ b/examples/lapack/test_linear_general.py @@ -0,0 +1,286 @@ +"""General dense linear-equation correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import ( + active, + assert_allclose_float64, + assert_small_residual, + assert_storage_unchanged, + column_major, + native_pivots, + pivot_matrix, + unpack_lu, +) + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_dgecon_estimates_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): + factor = np.array([[4.0]], dtype=np.float64, order="F") + expected = 1.0 + + prik_scalars = prik_lapack.dgecon( + "1", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 + ) + f2py_result = f2py_lapack.dgecon( + b"1", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 + ) + scipy_rcond, scipy_info = scipy_lapack.dgecon(factor.copy(order="F"), 4.0, norm=b"1") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_scalars[-2], expected) + assert_allclose_float64(scipy_rcond, expected) + + +def test_dgeequ_computes_row_and_column_scaling(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0]], dtype=np.float64, order="F") + prik_r, prik_c = np.empty(1), np.empty(1) + f2py_r, f2py_c = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dgeequ(1, 1, matrix.copy(order="F"), 1, prik_r, prik_c, 0.0, 0.0, 0.0, 0) + f2py_result = f2py_lapack.dgeequ(1, 1, matrix.copy(order="F"), 1, f2py_r, f2py_c, 0.0, 0.0, 0.0, 0) + scipy_r, scipy_c, scipy_rowcnd, scipy_colcnd, scipy_amax, scipy_info = scipy_lapack.dgeequ(matrix) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_r, [0.25]) + assert_allclose_float64(f2py_r, [0.25]) + assert_allclose_float64(prik_c, [1.0]) + assert_allclose_float64(f2py_c, [1.0]) + assert_allclose_float64(prik_scalars[3:6], [scipy_rowcnd, scipy_colcnd, scipy_amax]) + assert_allclose_float64(scipy_r, [0.25]) + assert_allclose_float64(scipy_c, [1.0]) + + +def test_dgeequb_computes_radix_scaling(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0]], dtype=np.float64, order="F") + prik_r, prik_c = np.empty(1), np.empty(1) + f2py_r, f2py_c = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dgeequb(1, 1, matrix.copy(order="F"), 1, prik_r, prik_c, 0.0, 0.0, 0.0, 0) + f2py_result = f2py_lapack.dgeequb(1, 1, matrix.copy(order="F"), 1, f2py_r, f2py_c, 0.0, 0.0, 0.0, 0) + scipy_r, scipy_c, scipy_rowcnd, scipy_colcnd, scipy_amax, scipy_info = scipy_lapack.dgeequb(matrix) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_r, scipy_r) + assert_allclose_float64(f2py_r, scipy_r) + assert_allclose_float64(prik_c, scipy_c) + assert_allclose_float64(f2py_c, scipy_c) + assert_allclose_float64(prik_scalars[3:6], [scipy_rowcnd, scipy_colcnd, scipy_amax]) + assert_allclose_float64(prik_r * matrix * prik_c, [[1.0]]) + + +def test_dgesc2_solves_complete_pivot_lu_system(prik_lapack, scipy_lapack, f2py_lapack): + factor = np.array([[4.0]], dtype=np.float64, order="F") + native_ipiv = np.array([1], dtype=np.int32) + prik_rhs, f2py_rhs = np.array([8.0]), np.array([8.0]) + + prik_scalars = prik_lapack.dgesc2(1, factor.copy(order="F"), 1, prik_rhs, native_ipiv, native_ipiv, 0.0) + f2py_result = f2py_lapack.dgesc2(1, factor.copy(order="F"), 1, f2py_rhs, native_ipiv, native_ipiv, 0.0) + scipy_x, scipy_scale = scipy_lapack.dgesc2( + factor.copy(order="F"), np.array([8.0]), np.array([0], dtype=np.int32), np.array([0], dtype=np.int32) + ) + + assert f2py_result is None + assert_allclose_float64(prik_rhs, [2.0]) + assert_allclose_float64(f2py_rhs, [2.0]) + assert_allclose_float64(scipy_x, [2.0]) + assert_allclose_float64(prik_scalars[-1], scipy_scale) + + +def test_dgesvx_solves_and_reports_error_bounds(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0]], dtype=np.float64, order="F") + rhs = np.array([[8.0]], dtype=np.float64, order="F") + prik_af, f2py_af = np.empty_like(matrix), np.empty_like(matrix) + prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) + prik_x, f2py_x = np.empty_like(rhs), np.empty_like(rhs) + prik_ferr, f2py_ferr = np.empty(1), np.empty(1) + prik_berr, f2py_berr = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dgesvx( + "N", + "N", + 1, + 1, + matrix.copy(order="F"), + 1, + prik_af, + 1, + prik_piv, + "N", + np.ones(1), + np.ones(1), + rhs.copy(order="F"), + 1, + prik_x, + 1, + 0.0, + prik_ferr, + prik_berr, + np.empty(4), + np.empty(1, dtype=np.int32), + 0, + ) + f2py_result = f2py_lapack.dgesvx( + b"N", + b"N", + 1, + 1, + matrix.copy(order="F"), + 1, + f2py_af, + 1, + f2py_piv, + b"N", + np.ones(1), + np.ones(1), + rhs.copy(order="F"), + 1, + f2py_x, + 1, + 0.0, + f2py_ferr, + f2py_berr, + np.empty(4), + np.empty(1, dtype=np.int32), + 0, + ) + _a, scipy_lu, scipy_piv, _equed, _r, _c, _b, scipy_x, scipy_rcond, scipy_ferr, scipy_berr, scipy_info = ( + scipy_lapack.dgesvx(matrix.copy(order="F"), rhs.copy(order="F"), fact=b"N", trans=b"N") + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_x, [[2.0]]) + assert_allclose_float64(f2py_x, [[2.0]]) + assert_allclose_float64(scipy_x, [[2.0]]) + assert_allclose_float64(prik_af, scipy_lu) + assert_allclose_float64(f2py_af, scipy_lu) + np.testing.assert_array_equal(prik_piv, native_pivots(scipy_piv)) + np.testing.assert_array_equal(f2py_piv, native_pivots(scipy_piv)) + assert_allclose_float64(prik_scalars[-2], scipy_rcond) + assert_allclose_float64(prik_ferr, scipy_ferr) + assert_allclose_float64(prik_berr, scipy_berr) + + +def test_dgetc2_factorizes_with_complete_pivoting(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0]], dtype=np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_ipiv, prik_jpiv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) + f2py_ipiv, f2py_jpiv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) + + prik_scalars = prik_lapack.dgetc2(1, prik_a, 1, prik_ipiv, prik_jpiv, 0) + f2py_result = f2py_lapack.dgetc2(1, f2py_a, 1, f2py_ipiv, f2py_jpiv, 0) + scipy_lu, scipy_ipiv, scipy_jpiv, scipy_info = scipy_lapack.dgetc2(matrix.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, [[4.0]]) + assert_allclose_float64(f2py_a, [[4.0]]) + assert_allclose_float64(scipy_lu, [[4.0]]) + np.testing.assert_array_equal(prik_ipiv, native_pivots(scipy_ipiv)) + np.testing.assert_array_equal(prik_jpiv, native_pivots(scipy_jpiv)) + + +def test_dgetri_inverts_lu_factorization(prik_lapack, scipy_lapack, f2py_lapack): + factor = np.array([[4.0]], dtype=np.float64, order="F") + native_ipiv = np.array([1], dtype=np.int32) + prik_a, f2py_a = factor.copy(order="F"), factor.copy(order="F") + + prik_scalars = prik_lapack.dgetri(1, prik_a, 1, native_ipiv, np.empty(8), 8, 0) + f2py_result = f2py_lapack.dgetri(1, f2py_a, 1, native_ipiv, np.empty(8), 8, 0) + scipy_inverse, scipy_info = scipy_lapack.dgetri(factor.copy(order="F"), np.array([0], dtype=np.int32), lwork=8) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, [[0.25]]) + assert_allclose_float64(f2py_a, [[0.25]]) + assert_allclose_float64(scipy_inverse, [[0.25]]) + assert_allclose_float64(np.array([[4.0]]) @ prik_a, np.eye(1)) + + +def test_dgesv_solves_general_system(prik_lapack, scipy_lapack, f2py_lapack): + original_a = np.array([[3.0, 1.0], [1.0, 2.0]], dtype=np.float64) + original_b = np.array([[5.0], [5.0]], dtype=np.float64) + expected_x = np.array([[1.0], [2.0]], dtype=np.float64) + prik_a, f2py_a = column_major(original_a), column_major(original_a) + prik_b, f2py_b = column_major(original_b), column_major(original_b) + prik_piv = np.empty(2, dtype=np.int32) + f2py_piv = np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dgesv(2, 1, prik_a, 2, prik_piv, prik_b, 2, 0) + f2py_result = f2py_lapack.dgesv(2, 1, f2py_a, 2, f2py_piv, f2py_b, 2, 0) + scipy_lu, scipy_piv, scipy_x, scipy_info = scipy_lapack.dgesv( + original_a.copy(order="F"), original_b.copy(order="F") + ) + + assert prik_scalars == (2, 1, 2, 2, 0) + assert f2py_result is None + assert scipy_info == 0 + assert_allclose_float64(active(prik_b, 2, 1), expected_x, operation_size=2) + assert_allclose_float64(active(f2py_b, 2, 1), expected_x, operation_size=2) + assert_allclose_float64(scipy_x, expected_x, operation_size=2) + assert_allclose_float64(prik_a, scipy_lu, operation_size=2) + assert_allclose_float64(f2py_a, scipy_lu, operation_size=2) + np.testing.assert_array_equal(prik_piv, native_pivots(scipy_piv)) + np.testing.assert_array_equal(f2py_piv, native_pivots(scipy_piv)) + assert_small_residual( + original_a @ prik_b - original_b, + matrix_norm=np.linalg.norm(original_a, ord=np.inf), + solution_norm=np.linalg.norm(prik_b, ord=np.inf), + operation_size=2, + ) + + +def test_dgetrf_reconstructs_pivoted_lu(prik_lapack, scipy_lapack, f2py_lapack): + original = np.array([[0.0, 2.0], [3.0, 4.0]], dtype=np.float64) + prik_a, f2py_a = column_major(original), column_major(original) + prik_piv = np.empty(2, dtype=np.int32) + f2py_piv = np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dgetrf(2, 2, prik_a, 2, prik_piv, 0) + f2py_result = f2py_lapack.dgetrf(2, 2, f2py_a, 2, f2py_piv, 0) + scipy_lu, scipy_piv, scipy_info = scipy_lapack.dgetrf(original.copy(order="F")) + + assert prik_scalars == (2, 2, 2, 0) + assert f2py_result is None + assert scipy_info == 0 + expected_native_piv = native_pivots(scipy_piv) + np.testing.assert_array_equal(prik_piv, expected_native_piv) + np.testing.assert_array_equal(f2py_piv, expected_native_piv) + assert_allclose_float64(prik_a, scipy_lu, operation_size=2) + assert_allclose_float64(f2py_a, scipy_lu, operation_size=2) + lower, upper = unpack_lu(prik_a) + permutation = pivot_matrix(prik_piv, 2, one_based=True) + assert_allclose_float64(permutation @ original, lower @ upper, operation_size=2) + + +def test_dgetrs_solves_from_native_lu(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[3.0, 1.0], [1.0, 2.0]], dtype=np.float64) + original_b = np.array([[5.0], [5.0]], dtype=np.float64) + expected_x = np.array([[1.0], [2.0]], dtype=np.float64) + scipy_lu, scipy_piv, factor_info = scipy_lapack.dgetrf(matrix.copy(order="F")) + assert factor_info == 0 + native_ipiv = native_pivots(scipy_piv) + prik_lu, f2py_lu = column_major(scipy_lu), column_major(scipy_lu) + prik_b, f2py_b = column_major(original_b), column_major(original_b) + + prik_scalars = prik_lapack.dgetrs("N", 2, 1, prik_lu, 2, native_ipiv.copy(), prik_b, 2, 0) + f2py_result = f2py_lapack.dgetrs(b"N", 2, 1, f2py_lu, 2, native_ipiv.copy(), f2py_b, 2, 0) + scipy_x, scipy_info = scipy_lapack.dgetrs(scipy_lu, scipy_piv, original_b.copy(order="F"), trans=0) + + assert prik_scalars == (2, 1, 2, 2, 0) + assert f2py_result is None + assert scipy_info == 0 + assert_allclose_float64(prik_b, expected_x, operation_size=2) + assert_allclose_float64(f2py_b, expected_x, operation_size=2) + assert_allclose_float64(scipy_x, expected_x, operation_size=2) + assert_storage_unchanged(prik_lu, scipy_lu) + assert_storage_unchanged(f2py_lu, scipy_lu) diff --git a/examples/lapack/test_linear_positive_definite.py b/examples/lapack/test_linear_positive_definite.py new file mode 100644 index 000000000..68eca860b --- /dev/null +++ b/examples/lapack/test_linear_positive_definite.py @@ -0,0 +1,358 @@ +"""Symmetric positive-definite linear-equation correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import assert_allclose_float64, assert_storage_unchanged, column_major + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_dlauum_forms_triangular_product(prik_lapack, scipy_lapack, f2py_lapack): + triangular = np.array([[2.0]], dtype=np.float64, order="F") + prik_a, f2py_a = triangular.copy(order="F"), triangular.copy(order="F") + + prik_scalars = prik_lapack.dlauum("U", 1, prik_a, 1, 0) + f2py_result = f2py_lapack.dlauum(b"U", 1, f2py_a, 1, 0) + scipy_a, scipy_info = scipy_lapack.dlauum(triangular.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, [[4.0]]) + assert_allclose_float64(f2py_a, [[4.0]]) + assert_allclose_float64(scipy_a, [[4.0]]) + + +def test_dpftrf_factorizes_rfp_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): + prik_a, f2py_a = np.array([4.0]), np.array([4.0]) + + prik_scalars = prik_lapack.dpftrf("N", "U", 1, prik_a, 0) + f2py_result = f2py_lapack.dpftrf(b"N", b"U", 1, f2py_a, 0) + scipy_a, scipy_info = scipy_lapack.dpftrf(1, np.array([4.0]), transr=b"N", uplo=b"U") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, [2.0]) + assert_allclose_float64(f2py_a, [2.0]) + assert_allclose_float64(scipy_a, [2.0]) + + +def test_dpftri_inverts_rfp_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapack): + prik_a, f2py_a = np.array([2.0]), np.array([2.0]) + + prik_scalars = prik_lapack.dpftri("N", "U", 1, prik_a, 0) + f2py_result = f2py_lapack.dpftri(b"N", b"U", 1, f2py_a, 0) + scipy_a, scipy_info = scipy_lapack.dpftri(1, np.array([2.0]), transr=b"N", uplo=b"U") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, [0.25]) + assert_allclose_float64(f2py_a, [0.25]) + assert_allclose_float64(scipy_a, [0.25]) + + +def test_dpftrs_solves_from_rfp_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapack): + factor = np.array([2.0]) + prik_b = np.array([[8.0]], dtype=np.float64, order="F") + f2py_b = prik_b.copy(order="F") + + prik_scalars = prik_lapack.dpftrs("N", "U", 1, 1, factor, prik_b, 1, 0) + f2py_result = f2py_lapack.dpftrs(b"N", b"U", 1, 1, factor, f2py_b, 1, 0) + scipy_x, scipy_info = scipy_lapack.dpftrs(1, factor, np.array([[8.0]], order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, [[2.0]]) + assert_allclose_float64(f2py_b, [[2.0]]) + assert_allclose_float64(scipy_x, [[2.0]]) + + +def test_dpocon_estimates_spd_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): + factor = np.array([[2.0]], dtype=np.float64, order="F") + + prik_scalars = prik_lapack.dpocon( + "U", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 + ) + f2py_result = f2py_lapack.dpocon( + b"U", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 + ) + scipy_rcond, scipy_info = scipy_lapack.dpocon(factor.copy(order="F"), 4.0, uplo=b"U") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_scalars[-2], 1.0) + assert_allclose_float64(scipy_rcond, 1.0) + + +def test_dposv_solves_spd_system(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0]], dtype=np.float64, order="F") + rhs = np.array([[8.0]], dtype=np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dposv("U", 1, 1, prik_a, 1, prik_b, 1, 0) + f2py_result = f2py_lapack.dposv(b"U", 1, 1, f2py_a, 1, f2py_b, 1, 0) + scipy_factor, scipy_x, scipy_info = scipy_lapack.dposv(matrix.copy(order="F"), rhs.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, scipy_factor) + assert_allclose_float64(f2py_a, scipy_factor) + assert_allclose_float64(prik_b, [[2.0]]) + assert_allclose_float64(f2py_b, [[2.0]]) + assert_allclose_float64(scipy_x, [[2.0]]) + + +def test_dposvx_solves_and_bounds_spd_error(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0]], dtype=np.float64, order="F") + rhs = np.array([[8.0]], dtype=np.float64, order="F") + prik_af, f2py_af = np.empty_like(matrix), np.empty_like(matrix) + prik_x, f2py_x = np.empty_like(rhs), np.empty_like(rhs) + prik_ferr, f2py_ferr = np.empty(1), np.empty(1) + prik_berr, f2py_berr = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dposvx( + "N", + "U", + 1, + 1, + matrix.copy(order="F"), + 1, + prik_af, + 1, + "N", + np.ones(1), + rhs.copy(order="F"), + 1, + prik_x, + 1, + 0.0, + prik_ferr, + prik_berr, + np.empty(3), + np.empty(1, dtype=np.int32), + 0, + ) + f2py_result = f2py_lapack.dposvx( + b"N", + b"U", + 1, + 1, + matrix.copy(order="F"), + 1, + f2py_af, + 1, + b"N", + np.ones(1), + rhs.copy(order="F"), + 1, + f2py_x, + 1, + 0.0, + f2py_ferr, + f2py_berr, + np.empty(3), + np.empty(1, dtype=np.int32), + 0, + ) + _a, scipy_factor, _equed, _s, _b, scipy_x, scipy_rcond, scipy_ferr, scipy_berr, scipy_info = scipy_lapack.dposvx( + matrix.copy(order="F"), rhs.copy(order="F"), fact=b"N" + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_af, scipy_factor) + assert_allclose_float64(f2py_af, scipy_factor) + assert_allclose_float64(prik_x, [[2.0]]) + assert_allclose_float64(f2py_x, [[2.0]]) + assert_allclose_float64(scipy_x, [[2.0]]) + assert_allclose_float64(prik_scalars[-2], scipy_rcond) + assert_allclose_float64(prik_ferr, scipy_ferr) + assert_allclose_float64(prik_berr, scipy_berr) + + +def test_dpotrf_reconstructs_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): + logical = np.array([[4.0, 1.0], [1.0, 3.0]], dtype=np.float64) + stored = np.array([[4.0, np.nan], [1.0, 3.0]], dtype=np.float64, order="F") + prik_a, f2py_a = column_major(stored), column_major(stored) + + prik_scalars = prik_lapack.dpotrf("L", 2, prik_a, 2, 0) + f2py_result = f2py_lapack.dpotrf(b"L", 2, f2py_a, 2, 0) + scipy_factor, scipy_info = scipy_lapack.dpotrf(stored.copy(order="F"), lower=1, clean=0) + + assert prik_scalars == (2, 2, 0) + assert f2py_result is None + assert scipy_info == 0 + prik_lower = np.tril(prik_a) + f2py_lower = np.tril(f2py_a) + scipy_lower = np.tril(scipy_factor) + assert_allclose_float64(prik_lower @ prik_lower.T, logical, operation_size=2) + assert_allclose_float64(f2py_lower @ f2py_lower.T, logical, operation_size=2) + assert_allclose_float64(scipy_lower @ scipy_lower.T, logical, operation_size=2) + assert_allclose_float64(prik_lower, scipy_lower, operation_size=2) + assert_allclose_float64(f2py_lower, scipy_lower, operation_size=2) + assert_storage_unchanged(np.triu(prik_a, 1), np.triu(stored, 1)) + assert_storage_unchanged(np.triu(f2py_a, 1), np.triu(stored, 1)) + + +def test_dpotri_inverts_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapack): + factor = np.array([[2.0]], dtype=np.float64, order="F") + prik_a, f2py_a = factor.copy(order="F"), factor.copy(order="F") + + prik_scalars = prik_lapack.dpotri("U", 1, prik_a, 1, 0) + f2py_result = f2py_lapack.dpotri(b"U", 1, f2py_a, 1, 0) + scipy_inverse, scipy_info = scipy_lapack.dpotri(factor.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, [[0.25]]) + assert_allclose_float64(f2py_a, [[0.25]]) + assert_allclose_float64(scipy_inverse, [[0.25]]) + + +def test_dpotrs_solves_from_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapack): + factor = np.array([[2.0]], dtype=np.float64, order="F") + rhs = np.array([[8.0]], dtype=np.float64, order="F") + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dpotrs("U", 1, 1, factor.copy(order="F"), 1, prik_b, 1, 0) + f2py_result = f2py_lapack.dpotrs(b"U", 1, 1, factor.copy(order="F"), 1, f2py_b, 1, 0) + scipy_x, scipy_info = scipy_lapack.dpotrs(factor.copy(order="F"), rhs.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, [[2.0]]) + assert_allclose_float64(f2py_b, [[2.0]]) + assert_allclose_float64(scipy_x, [[2.0]]) + + +def test_dppcon_estimates_packed_spd_condition(prik_lapack, scipy_lapack, f2py_lapack): + factor = np.array([2.0]) + + prik_scalars = prik_lapack.dppcon("U", 1, factor, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0) + f2py_result = f2py_lapack.dppcon(b"U", 1, factor, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0) + scipy_rcond, scipy_info = scipy_lapack.dppcon(1, factor, 4.0) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_scalars[-2], 1.0) + assert_allclose_float64(scipy_rcond, 1.0) + + +def test_dppsv_solves_packed_spd_system(prik_lapack, scipy_lapack, f2py_lapack): + prik_ap, f2py_ap = np.array([4.0]), np.array([4.0]) + prik_b = np.array([[8.0]], dtype=np.float64, order="F") + f2py_b = prik_b.copy(order="F") + + prik_scalars = prik_lapack.dppsv("U", 1, 1, prik_ap, prik_b, 1, 0) + f2py_result = f2py_lapack.dppsv(b"U", 1, 1, f2py_ap, f2py_b, 1, 0) + scipy_x, scipy_info = scipy_lapack.dppsv(1, np.array([4.0]), np.array([[8.0]], order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_ap, [2.0]) + assert_allclose_float64(f2py_ap, [2.0]) + assert_allclose_float64(prik_b, [[2.0]]) + assert_allclose_float64(f2py_b, [[2.0]]) + assert_allclose_float64(scipy_x, [[2.0]]) + + +def test_dpptrf_factorizes_packed_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): + prik_ap, f2py_ap = np.array([4.0]), np.array([4.0]) + + prik_scalars = prik_lapack.dpptrf("U", 1, prik_ap, 0) + f2py_result = f2py_lapack.dpptrf(b"U", 1, f2py_ap, 0) + scipy_ap, scipy_info = scipy_lapack.dpptrf(1, np.array([4.0])) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_ap, [2.0]) + assert_allclose_float64(f2py_ap, [2.0]) + assert_allclose_float64(scipy_ap, [2.0]) + + +def test_dpptri_inverts_packed_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapack): + prik_ap, f2py_ap = np.array([2.0]), np.array([2.0]) + + prik_scalars = prik_lapack.dpptri("U", 1, prik_ap, 0) + f2py_result = f2py_lapack.dpptri(b"U", 1, f2py_ap, 0) + scipy_ap, scipy_info = scipy_lapack.dpptri(1, np.array([2.0])) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_ap, [0.25]) + assert_allclose_float64(f2py_ap, [0.25]) + assert_allclose_float64(scipy_ap, [0.25]) + + +def test_dpptrs_solves_from_packed_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapack): + factor = np.array([2.0]) + prik_b = np.array([[8.0]], dtype=np.float64, order="F") + f2py_b = prik_b.copy(order="F") + + prik_scalars = prik_lapack.dpptrs("U", 1, 1, factor, prik_b, 1, 0) + f2py_result = f2py_lapack.dpptrs(b"U", 1, 1, factor, f2py_b, 1, 0) + scipy_x, scipy_info = scipy_lapack.dpptrs(1, factor, np.array([[8.0]], order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, [[2.0]]) + assert_allclose_float64(f2py_b, [[2.0]]) + assert_allclose_float64(scipy_x, [[2.0]]) + + +def test_dpstf2_reconstructs_pivoted_cholesky(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0]], dtype=np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) + + prik_scalars = prik_lapack.dpstf2("U", 1, prik_a, 1, prik_piv, 0, -1.0, np.empty(2), 0) + f2py_result = f2py_lapack.dpstf2(b"U", 1, f2py_a, 1, f2py_piv, 0, -1.0, np.empty(2), 0) + scipy_a, _scipy_piv, scipy_rank, scipy_info = scipy_lapack.dpstf2(matrix.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[2] == scipy_rank == 1 + assert_allclose_float64(prik_a.T @ prik_a, matrix) + assert_allclose_float64(f2py_a.T @ f2py_a, matrix) + assert_allclose_float64(scipy_a.T @ scipy_a, matrix) + np.testing.assert_array_equal(prik_piv, [1]) + np.testing.assert_array_equal(f2py_piv, [1]) + + +def test_dpstrf_reconstructs_blocked_pivoted_cholesky(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0]], dtype=np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) + + prik_scalars = prik_lapack.dpstrf("U", 1, prik_a, 1, prik_piv, 0, -1.0, np.empty(2), 0) + f2py_result = f2py_lapack.dpstrf(b"U", 1, f2py_a, 1, f2py_piv, 0, -1.0, np.empty(2), 0) + scipy_a, _scipy_piv, scipy_rank, scipy_info = scipy_lapack.dpstrf(matrix.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[2] == scipy_rank == 1 + assert_allclose_float64(prik_a.T @ prik_a, matrix) + assert_allclose_float64(f2py_a.T @ f2py_a, matrix) + assert_allclose_float64(scipy_a.T @ scipy_a, matrix) + np.testing.assert_array_equal(prik_piv, [1]) + np.testing.assert_array_equal(f2py_piv, [1]) + + +def test_dsfrk_updates_spd_matrix_in_rfp_storage(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[2.0, 3.0]], dtype=np.float64, order="F") + prik_c, f2py_c = np.array([1.0]), np.array([1.0]) + expected = np.array([14.0]) + + prik_scalars = prik_lapack.dsfrk("N", "U", "N", 1, 2, 1.0, matrix, 1, 1.0, prik_c) + f2py_result = f2py_lapack.dsfrk(b"N", b"U", b"N", 1, 2, 1.0, matrix, 1, 1.0, f2py_c) + scipy_c = scipy_lapack.dsfrk(1, 2, 1.0, matrix, 1.0, np.array([1.0])) + + assert f2py_result is None + assert prik_scalars == (1, 2, 1.0, 1, 1.0) + assert_allclose_float64(prik_c, expected, operation_size=2) + assert_allclose_float64(f2py_c, expected, operation_size=2) + assert_allclose_float64(scipy_c, expected, operation_size=2) diff --git a/examples/lapack/test_linear_symmetric_indefinite.py b/examples/lapack/test_linear_symmetric_indefinite.py new file mode 100644 index 000000000..2acb3be71 --- /dev/null +++ b/examples/lapack/test_linear_symmetric_indefinite.py @@ -0,0 +1,224 @@ +"""Symmetric-indefinite factorization and solve correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import assert_allclose_float64 + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def _negative_scalar_factor(): + matrix = np.array([[-4.0]], dtype=np.float64, order="F") + return matrix, np.array([1], dtype=np.int32) + + +def test_dsycon_estimates_symmetric_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): + factor, native_ipiv = _negative_scalar_factor() + + prik_scalars = prik_lapack.dsycon( + "U", 1, factor.copy(order="F"), 1, native_ipiv, 4.0, 0.0, np.empty(2), np.empty(1, dtype=np.int32), 0 + ) + f2py_result = f2py_lapack.dsycon( + b"U", 1, factor.copy(order="F"), 1, native_ipiv, 4.0, 0.0, np.empty(2), np.empty(1, dtype=np.int32), 0 + ) + scipy_rcond, scipy_info = scipy_lapack.dsycon(factor.copy(order="F"), native_ipiv, 4.0) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_scalars[-2], 1.0) + assert_allclose_float64(scipy_rcond, 1.0) + + +def test_dsyconv_converts_bunch_kaufman_storage(prik_lapack, scipy_lapack, f2py_lapack): + factor, native_ipiv = _negative_scalar_factor() + prik_a, f2py_a = factor.copy(order="F"), factor.copy(order="F") + prik_e, f2py_e = np.full(1, np.nan), np.full(1, np.nan) + + prik_scalars = prik_lapack.dsyconv("U", "C", 1, prik_a, 1, native_ipiv, prik_e, 0) + f2py_result = f2py_lapack.dsyconv(b"U", b"C", 1, f2py_a, 1, native_ipiv, f2py_e, 0) + scipy_a, scipy_e, scipy_info = scipy_lapack.dsyconv(factor.copy(order="F"), native_ipiv, lower=0, way=0) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, scipy_a) + assert_allclose_float64(f2py_a, scipy_a) + assert_allclose_float64(prik_e, scipy_e) + assert_allclose_float64(f2py_e, scipy_e) + + +def test_dsyequb_scales_symmetric_matrix(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[4.0]], dtype=np.float64, order="F") + prik_s, f2py_s = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dsyequb("U", 1, matrix.copy(order="F"), 1, prik_s, 0.0, 0.0, np.empty(3), 0) + f2py_result = f2py_lapack.dsyequb(b"U", 1, matrix.copy(order="F"), 1, f2py_s, 0.0, 0.0, np.empty(3), 0) + scipy_s, scipy_scond, scipy_amax, scipy_info = scipy_lapack.dsyequb(matrix.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_s, scipy_s) + assert_allclose_float64(f2py_s, scipy_s) + assert_allclose_float64(prik_scalars[-3:-1], [scipy_scond, scipy_amax]) + assert_allclose_float64(prik_s * matrix * prik_s, [[1.0]]) + + +def test_dsysv_solves_symmetric_indefinite_system(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[-4.0]], dtype=np.float64, order="F") + rhs = np.array([[8.0]], dtype=np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) + + prik_scalars = prik_lapack.dsysv("U", 1, 1, prik_a, 1, prik_piv, prik_b, 1, np.empty(8), 8, 0) + f2py_result = f2py_lapack.dsysv(b"U", 1, 1, f2py_a, 1, f2py_piv, f2py_b, 1, np.empty(8), 8, 0) + scipy_factor, _scipy_piv, scipy_x, scipy_info = scipy_lapack.dsysv( + matrix.copy(order="F"), rhs.copy(order="F"), lwork=8 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, [[-2.0]]) + assert_allclose_float64(f2py_b, [[-2.0]]) + assert_allclose_float64(scipy_x, [[-2.0]]) + assert_allclose_float64(prik_a, scipy_factor) + assert_allclose_float64(f2py_a, scipy_factor) + assert_allclose_float64(matrix @ prik_b, rhs) + + +def test_dsysvx_solves_and_bounds_symmetric_error(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[-4.0]], dtype=np.float64, order="F") + rhs = np.array([[8.0]], dtype=np.float64, order="F") + prik_af, f2py_af = np.empty_like(matrix), np.empty_like(matrix) + prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) + prik_x, f2py_x = np.empty_like(rhs), np.empty_like(rhs) + prik_ferr, f2py_ferr = np.empty(1), np.empty(1) + prik_berr, f2py_berr = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dsysvx( + "N", + "U", + 1, + 1, + matrix.copy(order="F"), + 1, + prik_af, + 1, + prik_piv, + rhs.copy(order="F"), + 1, + prik_x, + 1, + 0.0, + prik_ferr, + prik_berr, + np.empty(3), + 3, + np.empty(1, dtype=np.int32), + 0, + ) + f2py_result = f2py_lapack.dsysvx( + b"N", + b"U", + 1, + 1, + matrix.copy(order="F"), + 1, + f2py_af, + 1, + f2py_piv, + rhs.copy(order="F"), + 1, + f2py_x, + 1, + 0.0, + f2py_ferr, + f2py_berr, + np.empty(3), + 3, + np.empty(1, dtype=np.int32), + 0, + ) + _a, scipy_factor, _piv, _b, scipy_x, scipy_rcond, scipy_ferr, scipy_berr, scipy_info = scipy_lapack.dsysvx( + matrix.copy(order="F"), rhs.copy(order="F"), lwork=3 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_x, [[-2.0]]) + assert_allclose_float64(f2py_x, [[-2.0]]) + assert_allclose_float64(scipy_x, [[-2.0]]) + assert_allclose_float64(prik_af, scipy_factor) + assert_allclose_float64(f2py_af, scipy_factor) + assert_allclose_float64(prik_scalars[-3], scipy_rcond) + assert_allclose_float64(prik_ferr, scipy_ferr) + assert_allclose_float64(prik_berr, scipy_berr) + + +def test_dsytf2_factorizes_symmetric_indefinite_matrix(prik_lapack, scipy_lapack, f2py_lapack): + matrix, _native_ipiv = _negative_scalar_factor() + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) + + prik_scalars = prik_lapack.dsytf2("U", 1, prik_a, 1, prik_piv, 0) + f2py_result = f2py_lapack.dsytf2(b"U", 1, f2py_a, 1, f2py_piv, 0) + scipy_factor, _scipy_piv, scipy_info = scipy_lapack.dsytf2(matrix.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, [[-4.0]]) + assert_allclose_float64(f2py_a, [[-4.0]]) + assert_allclose_float64(scipy_factor, [[-4.0]]) + np.testing.assert_array_equal(prik_piv, [1]) + np.testing.assert_array_equal(f2py_piv, [1]) + + +def test_dsytrf_factorizes_symmetric_indefinite_matrix(prik_lapack, scipy_lapack, f2py_lapack): + matrix, _native_ipiv = _negative_scalar_factor() + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) + + prik_scalars = prik_lapack.dsytrf("U", 1, prik_a, 1, prik_piv, np.empty(8), 8, 0) + f2py_result = f2py_lapack.dsytrf(b"U", 1, f2py_a, 1, f2py_piv, np.empty(8), 8, 0) + scipy_factor, _scipy_piv, scipy_info = scipy_lapack.dsytrf(matrix.copy(order="F"), lwork=8) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, scipy_factor) + assert_allclose_float64(f2py_a, scipy_factor) + np.testing.assert_array_equal(prik_piv, [1]) + np.testing.assert_array_equal(f2py_piv, [1]) + + +def test_dsytri_inverts_symmetric_indefinite_factor(prik_lapack, scipy_lapack, f2py_lapack): + factor, native_ipiv = _negative_scalar_factor() + prik_a, f2py_a = factor.copy(order="F"), factor.copy(order="F") + + prik_scalars = prik_lapack.dsytri("U", 1, prik_a, 1, native_ipiv, np.empty(1), 0) + f2py_result = f2py_lapack.dsytri(b"U", 1, f2py_a, 1, native_ipiv, np.empty(1), 0) + scipy_inverse, scipy_info = scipy_lapack.dsytri(factor.copy(order="F"), native_ipiv) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_a, [[-0.25]]) + assert_allclose_float64(f2py_a, [[-0.25]]) + assert_allclose_float64(scipy_inverse, [[-0.25]]) + + +def test_dsytrs_solves_from_symmetric_indefinite_factor(prik_lapack, scipy_lapack, f2py_lapack): + factor, native_ipiv = _negative_scalar_factor() + rhs = np.array([[8.0]], dtype=np.float64, order="F") + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dsytrs("U", 1, 1, factor.copy(order="F"), 1, native_ipiv, prik_b, 1, 0) + f2py_result = f2py_lapack.dsytrs(b"U", 1, 1, factor.copy(order="F"), 1, native_ipiv, f2py_b, 1, 0) + scipy_x, scipy_info = scipy_lapack.dsytrs(factor.copy(order="F"), native_ipiv, rhs.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, [[-2.0]]) + assert_allclose_float64(f2py_b, [[-2.0]]) + assert_allclose_float64(scipy_x, [[-2.0]]) diff --git a/examples/lapack/test_linear_triangular.py b/examples/lapack/test_linear_triangular.py new file mode 100644 index 000000000..e0fcb2365 --- /dev/null +++ b/examples/lapack/test_linear_triangular.py @@ -0,0 +1,188 @@ +"""Triangular solve, inverse, condition, packed, and RFP correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import assert_allclose_float64, assert_storage_unchanged + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def _upper_triangular(): + logical = np.array([[2.0, 1.0], [0.0, 3.0]], dtype=np.float64) + stored = np.array([[2.0, 1.0], [np.nan, 3.0]], dtype=np.float64, order="F") + packed = np.array([2.0, 1.0, 3.0], dtype=np.float64) + return logical, stored, packed + + +def test_dtfsm_solves_with_rfp_triangular_factor(prik_lapack, scipy_lapack, f2py_lapack): + logical, stored, _packed = _upper_triangular() + rfp, convert_info = scipy_lapack.dtrttf(stored.copy(order="F"), transr=b"N", uplo=b"U") + assert convert_info == 0 + rhs = np.array([[4.0], [6.0]], dtype=np.float64, order="F") + expected = np.array([[1.0], [2.0]], dtype=np.float64) + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dtfsm("N", "L", "U", "N", "N", 2, 1, 1.0, rfp, prik_b, 2) + f2py_result = f2py_lapack.dtfsm(b"N", b"L", b"U", b"N", b"N", 2, 1, 1.0, rfp, f2py_b, 2) + scipy_x = scipy_lapack.dtfsm( + 1.0, rfp, rhs.copy(order="F"), transr=b"N", side=b"L", uplo=b"U", trans=b"N", diag=b"N" + ) + + assert f2py_result is None + assert prik_scalars == (2, 1, 1.0, 2) + assert_allclose_float64(prik_b, expected, operation_size=2) + assert_allclose_float64(f2py_b, expected, operation_size=2) + assert_allclose_float64(scipy_x, expected, operation_size=2) + assert_allclose_float64(logical @ prik_b, rhs, operation_size=2) + + +def test_dtfttp_converts_rfp_to_packed(prik_lapack, scipy_lapack, f2py_lapack): + _logical, stored, expected_packed = _upper_triangular() + rfp, convert_info = scipy_lapack.dtrttf(stored.copy(order="F"), transr=b"N", uplo=b"U") + assert convert_info == 0 + prik_ap, f2py_ap = np.empty(3), np.empty(3) + + prik_scalars = prik_lapack.dtfttp("N", "U", 2, rfp, prik_ap, 0) + f2py_result = f2py_lapack.dtfttp(b"N", b"U", 2, rfp, f2py_ap, 0) + scipy_ap, scipy_info = scipy_lapack.dtfttp(2, rfp, transr=b"N", uplo=b"U") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_ap, expected_packed) + assert_allclose_float64(f2py_ap, expected_packed) + assert_allclose_float64(scipy_ap, expected_packed) + + +def test_dtfttr_converts_rfp_to_full_triangular(prik_lapack, scipy_lapack, f2py_lapack): + logical, stored, _packed = _upper_triangular() + rfp, convert_info = scipy_lapack.dtrttf(stored.copy(order="F"), transr=b"N", uplo=b"U") + assert convert_info == 0 + prik_a = np.full((2, 2), np.nan, dtype=np.float64, order="F") + f2py_a = prik_a.copy(order="F") + + prik_scalars = prik_lapack.dtfttr("N", "U", 2, rfp, prik_a, 2, 0) + f2py_result = f2py_lapack.dtfttr(b"N", b"U", 2, rfp, f2py_a, 2, 0) + scipy_a, scipy_info = scipy_lapack.dtfttr(2, rfp, transr=b"N", uplo=b"U") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(np.triu(prik_a), logical) + assert_allclose_float64(np.triu(f2py_a), logical) + assert_allclose_float64(np.triu(scipy_a), logical) + assert_storage_unchanged(np.tril(prik_a, -1), np.tril(stored, -1)) + assert_storage_unchanged(np.tril(f2py_a, -1), np.tril(stored, -1)) + + +def test_dtpttf_converts_packed_to_rfp(prik_lapack, scipy_lapack, f2py_lapack): + _logical, _stored, packed = _upper_triangular() + prik_rfp, f2py_rfp = np.empty(3), np.empty(3) + + prik_scalars = prik_lapack.dtpttf("N", "U", 2, packed, prik_rfp, 0) + f2py_result = f2py_lapack.dtpttf(b"N", b"U", 2, packed, f2py_rfp, 0) + scipy_rfp, scipy_info = scipy_lapack.dtpttf(2, packed, transr=b"N", uplo=b"U") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_rfp, scipy_rfp) + assert_allclose_float64(f2py_rfp, scipy_rfp) + + +def test_dtpttr_converts_packed_to_full_triangular(prik_lapack, scipy_lapack, f2py_lapack): + logical, stored, packed = _upper_triangular() + prik_a = np.full((2, 2), np.nan, dtype=np.float64, order="F") + f2py_a = prik_a.copy(order="F") + + prik_scalars = prik_lapack.dtpttr("U", 2, packed, prik_a, 2, 0) + f2py_result = f2py_lapack.dtpttr(b"U", 2, packed, f2py_a, 2, 0) + scipy_a, scipy_info = scipy_lapack.dtpttr(2, packed, uplo=b"U") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(np.triu(prik_a), logical) + assert_allclose_float64(np.triu(f2py_a), logical) + assert_allclose_float64(np.triu(scipy_a), logical) + assert_storage_unchanged(np.tril(prik_a, -1), np.tril(stored, -1)) + assert_storage_unchanged(np.tril(f2py_a, -1), np.tril(stored, -1)) + + +def test_dtrcon_estimates_triangular_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): + _logical, stored, _packed = _upper_triangular() + + prik_scalars = prik_lapack.dtrcon( + "1", "U", "N", 2, stored.copy(order="F"), 2, 0.0, np.empty(6), np.empty(2, dtype=np.int32), 0 + ) + f2py_result = f2py_lapack.dtrcon( + b"1", b"U", b"N", 2, stored.copy(order="F"), 2, 0.0, np.empty(6), np.empty(2, dtype=np.int32), 0 + ) + scipy_rcond, scipy_info = scipy_lapack.dtrcon(stored.copy(order="F"), norm=b"1", uplo=b"U", diag=b"N") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_scalars[-2], scipy_rcond, operation_size=2) + assert 0.0 < scipy_rcond <= 1.0 + + +def test_dtrtri_inverts_triangular_matrix(prik_lapack, scipy_lapack, f2py_lapack): + logical, stored, _packed = _upper_triangular() + prik_a, f2py_a = stored.copy(order="F"), stored.copy(order="F") + + prik_scalars = prik_lapack.dtrtri("U", "N", 2, prik_a, 2, 0) + f2py_result = f2py_lapack.dtrtri(b"U", b"N", 2, f2py_a, 2, 0) + scipy_a, scipy_info = scipy_lapack.dtrtri(stored.copy(order="F"), lower=0, unitdiag=0) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(logical @ np.triu(prik_a), np.eye(2), operation_size=2) + assert_allclose_float64(logical @ np.triu(f2py_a), np.eye(2), operation_size=2) + assert_allclose_float64(logical @ np.triu(scipy_a), np.eye(2), operation_size=2) + + +def test_dtrtrs_solves_triangular_system(prik_lapack, scipy_lapack, f2py_lapack): + logical, stored, _packed = _upper_triangular() + rhs = np.array([[4.0], [6.0]], dtype=np.float64, order="F") + expected = np.array([[1.0], [2.0]], dtype=np.float64) + prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") + + prik_scalars = prik_lapack.dtrtrs("U", "N", "N", 2, 1, stored.copy(order="F"), 2, prik_b, 2, 0) + f2py_result = f2py_lapack.dtrtrs(b"U", b"N", b"N", 2, 1, stored.copy(order="F"), 2, f2py_b, 2, 0) + scipy_x, scipy_info = scipy_lapack.dtrtrs(stored.copy(order="F"), rhs.copy(order="F"), lower=0, trans=0, unitdiag=0) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_b, expected, operation_size=2) + assert_allclose_float64(f2py_b, expected, operation_size=2) + assert_allclose_float64(scipy_x, expected, operation_size=2) + assert_allclose_float64(logical @ prik_b, rhs, operation_size=2) + + +def test_dtrttf_converts_full_triangular_to_rfp(prik_lapack, scipy_lapack, f2py_lapack): + _logical, stored, _packed = _upper_triangular() + prik_rfp, f2py_rfp = np.empty(3), np.empty(3) + + prik_scalars = prik_lapack.dtrttf("N", "U", 2, stored.copy(order="F"), 2, prik_rfp, 0) + f2py_result = f2py_lapack.dtrttf(b"N", b"U", 2, stored.copy(order="F"), 2, f2py_rfp, 0) + scipy_rfp, scipy_info = scipy_lapack.dtrttf(stored.copy(order="F"), transr=b"N", uplo=b"U") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_rfp, scipy_rfp) + assert_allclose_float64(f2py_rfp, scipy_rfp) + + +def test_dtrttp_converts_full_triangular_to_packed(prik_lapack, scipy_lapack, f2py_lapack): + _logical, stored, expected_packed = _upper_triangular() + prik_ap, f2py_ap = np.empty(3), np.empty(3) + + prik_scalars = prik_lapack.dtrttp("U", 2, stored.copy(order="F"), 2, prik_ap, 0) + f2py_result = f2py_lapack.dtrttp(b"U", 2, stored.copy(order="F"), 2, f2py_ap, 0) + scipy_ap, scipy_info = scipy_lapack.dtrttp(stored.copy(order="F"), uplo=b"U") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_ap, expected_packed) + assert_allclose_float64(f2py_ap, expected_packed) + assert_allclose_float64(scipy_ap, expected_packed) diff --git a/examples/lapack/test_orthogonal_factorizations.py b/examples/lapack/test_orthogonal_factorizations.py new file mode 100644 index 000000000..d469062ea --- /dev/null +++ b/examples/lapack/test_orthogonal_factorizations.py @@ -0,0 +1,281 @@ +"""Orthogonal-factorization and transformation correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import assert_allclose_float64, assert_orthogonal, column_major, qr_q_from_reflectors + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_dgemqrt_applies_compact_wy_reflector(prik_lapack, scipy_lapack, f2py_lapack): + original = np.array([[3.0], [4.0]], dtype=np.float64, order="F") + factor, compact_t, factor_info = scipy_lapack.dgeqrt(1, original.copy(order="F")) + assert factor_info == 0 + vector = np.array([1.0, factor[1, 0]], dtype=np.float64) + q = np.eye(2) - compact_t[0, 0] * np.outer(vector, vector) + target = np.array([[2.0], [1.0]], dtype=np.float64, order="F") + expected = q @ target + prik_c, f2py_c = target.copy(order="F"), target.copy(order="F") + + prik_scalars = prik_lapack.dgemqrt("L", "N", 2, 1, 1, 1, factor, 2, compact_t, 1, prik_c, 2, np.empty(1), 0) + f2py_result = f2py_lapack.dgemqrt(b"L", b"N", 2, 1, 1, 1, factor, 2, compact_t, 1, f2py_c, 2, np.empty(1), 0) + scipy_c, scipy_info = scipy_lapack.dgemqrt(factor, compact_t, target.copy(order="F"), side=b"L", trans=b"N") + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_c, expected, operation_size=2) + assert_allclose_float64(f2py_c, expected, operation_size=2) + assert_allclose_float64(scipy_c, expected, operation_size=2) + + +def test_dgeqp3_reconstructs_column_pivoted_qr(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 5.0], [2.0, 6.0], [3.0, 8.0]], dtype=np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_jpvt, f2py_jpvt = np.zeros(2, dtype=np.int32), np.zeros(2, dtype=np.int32) + prik_tau, f2py_tau = np.empty(2), np.empty(2) + + prik_scalars = prik_lapack.dgeqp3(3, 2, prik_a, 3, prik_jpvt, prik_tau, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dgeqp3(3, 2, f2py_a, 3, f2py_jpvt, f2py_tau, np.empty(64), 64, 0) + scipy_qr, scipy_jpvt, _scipy_tau, _work, scipy_info = scipy_lapack.dgeqp3(matrix.copy(order="F"), lwork=64) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for factor, tau, pivots in ((prik_a, prik_tau, prik_jpvt), (f2py_a, f2py_tau, f2py_jpvt)): + q = qr_q_from_reflectors(factor, tau) + r = np.triu(factor[:2, :]) + assert_allclose_float64(q @ r, matrix[:, pivots - 1], operation_size=3) + assert_allclose_float64(prik_a, scipy_qr, operation_size=3) + assert_allclose_float64(f2py_a, scipy_qr, operation_size=3) + np.testing.assert_array_equal(prik_jpvt, scipy_jpvt + 1) + np.testing.assert_array_equal(f2py_jpvt, scipy_jpvt + 1) + + +def test_dgeqrf_reconstructs_qr_factorization(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 7.0]], dtype=np.float64) + prik_a, f2py_a = column_major(matrix), column_major(matrix) + prik_tau = np.empty(2, dtype=np.float64) + f2py_tau = np.empty(2, dtype=np.float64) + + prik_scalars = prik_lapack.dgeqrf(3, 2, prik_a, 3, prik_tau, np.empty(16), 16, 0) + f2py_result = f2py_lapack.dgeqrf(3, 2, f2py_a, 3, f2py_tau, np.empty(16), 16, 0) + scipy_qr, scipy_tau, _scipy_work, scipy_info = scipy_lapack.dgeqrf(matrix.copy(order="F"), lwork=16) + + assert prik_scalars == (3, 2, 3, 16, 0) + assert f2py_result is None + assert scipy_info == 0 + for factor, tau in ((prik_a, prik_tau), (f2py_a, f2py_tau), (scipy_qr, scipy_tau)): + q = qr_q_from_reflectors(factor, tau) + r = np.triu(factor[:2, :]) + assert_orthogonal(q) + assert_allclose_float64(q @ r, matrix, operation_size=3) + assert_allclose_float64(prik_a, scipy_qr, operation_size=3) + assert_allclose_float64(f2py_a, scipy_qr, operation_size=3) + assert_allclose_float64(prik_tau, scipy_tau, operation_size=3) + assert_allclose_float64(f2py_tau, scipy_tau, operation_size=3) + + +def test_dgeqrfp_reconstructs_qr_with_nonnegative_diagonal(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 2.0], [3.0, -4.0], [5.0, 7.0]], dtype=np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_tau, f2py_tau = np.empty(2), np.empty(2) + + prik_scalars = prik_lapack.dgeqrfp(3, 2, prik_a, 3, prik_tau, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dgeqrfp(3, 2, f2py_a, 3, f2py_tau, np.empty(64), 64, 0) + scipy_qr, scipy_tau, scipy_info = scipy_lapack.dgeqrfp(matrix.copy(order="F"), lwork=64) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for factor, tau in ((prik_a, prik_tau), (f2py_a, f2py_tau), (scipy_qr, scipy_tau)): + q = qr_q_from_reflectors(factor, tau) + r = np.triu(factor[:2, :]) + assert_allclose_float64(q @ r, matrix, operation_size=3) + assert np.all(np.diag(r) >= 0.0) + + +def test_dgeqrt_reconstructs_compact_wy_qr(prik_lapack, scipy_lapack, f2py_lapack): + original = np.array([[3.0], [4.0]], dtype=np.float64, order="F") + prik_a, f2py_a = original.copy(order="F"), original.copy(order="F") + prik_t, f2py_t = np.empty((1, 1), order="F"), np.empty((1, 1), order="F") + + prik_scalars = prik_lapack.dgeqrt(2, 1, 1, prik_a, 2, prik_t, 1, np.empty(1), 0) + f2py_result = f2py_lapack.dgeqrt(2, 1, 1, f2py_a, 2, f2py_t, 1, np.empty(1), 0) + scipy_a, scipy_t, scipy_info = scipy_lapack.dgeqrt(1, original.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for factor, compact_t in ((prik_a, prik_t), (f2py_a, f2py_t), (scipy_a, scipy_t)): + vector = np.array([1.0, factor[1, 0]]) + q = np.eye(2) - compact_t[0, 0] * np.outer(vector, vector) + assert_orthogonal(q) + assert_allclose_float64(q @ np.array([[factor[0, 0]], [0.0]]), original, operation_size=2) + + +def test_dgerqf_reconstructs_rq_factorization(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[3.0, 4.0]], dtype=np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_tau, f2py_tau = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dgerqf(1, 2, prik_a, 1, prik_tau, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dgerqf(1, 2, f2py_a, 1, f2py_tau, np.empty(64), 64, 0) + scipy_rq, scipy_tau, _work, scipy_info = scipy_lapack.dgerqf(matrix.copy(order="F"), lwork=64) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for factor, tau in ((prik_a, prik_tau), (f2py_a, f2py_tau), (scipy_rq, scipy_tau)): + vector = np.array([factor[0, 0], 1.0]) + q = np.eye(2) - tau[0] * np.outer(vector, vector) + assert_allclose_float64(np.array([[0.0, factor[0, 1]]]) @ q, matrix, operation_size=2) + + +def test_dorgqr_forms_explicit_orthogonal_q(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 7.0]], dtype=np.float64) + factor, tau, _work, factor_info = scipy_lapack.dgeqrf(matrix.copy(order="F"), lwork=16) + assert factor_info == 0 + r = np.triu(factor[:2, :]) + prik_q, f2py_q = column_major(factor), column_major(factor) + + prik_scalars = prik_lapack.dorgqr(3, 2, 2, prik_q, 3, tau.copy(), np.empty(16), 16, 0) + f2py_result = f2py_lapack.dorgqr(3, 2, 2, f2py_q, 3, tau.copy(), np.empty(16), 16, 0) + scipy_q, _scipy_work, scipy_info = scipy_lapack.dorgqr(factor.copy(order="F"), tau.copy(), lwork=16) + + assert prik_scalars == (3, 2, 2, 3, 16, 0) + assert f2py_result is None + assert scipy_info == 0 + for q in (prik_q, f2py_q, scipy_q): + assert_orthogonal(q) + assert_allclose_float64(q @ r, matrix, operation_size=3) + assert_allclose_float64(prik_q, scipy_q, operation_size=3) + assert_allclose_float64(f2py_q, scipy_q, operation_size=3) + + +def test_dorgrq_forms_explicit_row_orthogonal_q(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[3.0, 4.0]], dtype=np.float64, order="F") + factor, tau, _work, factor_info = scipy_lapack.dgerqf(matrix.copy(order="F"), lwork=64) + assert factor_info == 0 + r = factor[0, 1] + prik_q, f2py_q = factor.copy(order="F"), factor.copy(order="F") + + prik_scalars = prik_lapack.dorgrq(1, 2, 1, prik_q, 1, tau.copy(), np.empty(64), 64, 0) + f2py_result = f2py_lapack.dorgrq(1, 2, 1, f2py_q, 1, tau.copy(), np.empty(64), 64, 0) + scipy_q, _work, scipy_info = scipy_lapack.dorgrq(factor.copy(order="F"), tau.copy(), lwork=64) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for q in (prik_q, f2py_q, scipy_q): + assert_allclose_float64(q @ q.T, np.eye(1), operation_size=2) + assert_allclose_float64(r * q, matrix, operation_size=2) + + +def test_dormqr_applies_qr_reflectors(prik_lapack, scipy_lapack, f2py_lapack): + source = np.array([[3.0], [4.0]], dtype=np.float64, order="F") + factor, tau, _work, factor_info = scipy_lapack.dgeqrf(source.copy(order="F"), lwork=64) + assert factor_info == 0 + q = qr_q_from_reflectors(factor, tau) + target = np.array([[2.0], [1.0]], dtype=np.float64, order="F") + expected = q @ target + prik_c, f2py_c = target.copy(order="F"), target.copy(order="F") + + prik_scalars = prik_lapack.dormqr("L", "N", 2, 1, 1, factor, 2, tau, prik_c, 2, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dormqr(b"L", b"N", 2, 1, 1, factor, 2, tau, f2py_c, 2, np.empty(64), 64, 0) + scipy_c, _work, scipy_info = scipy_lapack.dormqr(b"L", b"N", factor, tau, target.copy(order="F"), 64) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_c, expected, operation_size=2) + assert_allclose_float64(f2py_c, expected, operation_size=2) + assert_allclose_float64(scipy_c, expected, operation_size=2) + + +def test_dormrz_applies_rz_reflector(prik_lapack, scipy_lapack, f2py_lapack): + source = np.array([[3.0, 4.0]], dtype=np.float64, order="F") + factor, tau, factor_info = scipy_lapack.dtzrzf(source.copy(order="F"), lwork=64) + assert factor_info == 0 + vector = np.array([1.0, factor[0, 1]]) + z = np.eye(2) - tau[0] * np.outer(vector, vector) + target = np.array([[2.0, 1.0]], dtype=np.float64, order="F") + expected = target @ z + prik_c, f2py_c = target.copy(order="F"), target.copy(order="F") + + prik_scalars = prik_lapack.dormrz("R", "N", 1, 2, 1, 1, factor, 1, tau, prik_c, 1, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dormrz(b"R", b"N", 1, 2, 1, 1, factor, 1, tau, f2py_c, 1, np.empty(64), 64, 0) + scipy_c, scipy_info = scipy_lapack.dormrz(factor, tau, target.copy(order="F"), side=b"R", trans=b"N", lwork=64) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(prik_c, expected, operation_size=2) + assert_allclose_float64(f2py_c, expected, operation_size=2) + assert_allclose_float64(scipy_c, expected, operation_size=2) + + +def test_dtpmqrt_applies_triangular_pentagonal_reflector(prik_lapack, scipy_lapack, f2py_lapack): + top = np.array([[2.0]], dtype=np.float64, order="F") + bottom = np.array([[3.0]], dtype=np.float64, order="F") + _factor_a, factor_b, compact_t, factor_info = scipy_lapack.dtpqrt(0, 1, top.copy(order="F"), bottom.copy(order="F")) + assert factor_info == 0 + vector = np.array([1.0, factor_b[0, 0]]) + q = np.eye(2) - compact_t[0, 0] * np.outer(vector, vector) + target_a = np.array([[4.0]], dtype=np.float64, order="F") + target_b = np.array([[5.0]], dtype=np.float64, order="F") + expected = q @ np.vstack((target_a, target_b)) + prik_a, prik_b = target_a.copy(order="F"), target_b.copy(order="F") + f2py_a, f2py_b = target_a.copy(order="F"), target_b.copy(order="F") + + prik_scalars = prik_lapack.dtpmqrt( + "L", "N", 1, 1, 1, 0, 1, factor_b, 1, compact_t, 1, prik_a, 1, prik_b, 1, np.empty(1), 0 + ) + f2py_result = f2py_lapack.dtpmqrt( + b"L", b"N", 1, 1, 1, 0, 1, factor_b, 1, compact_t, 1, f2py_a, 1, f2py_b, 1, np.empty(1), 0 + ) + scipy_a, scipy_b, scipy_info = scipy_lapack.dtpmqrt( + 0, factor_b, compact_t, target_a.copy(order="F"), target_b.copy(order="F"), side=b"L", trans=b"N" + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + assert_allclose_float64(np.vstack((prik_a, prik_b)), expected, operation_size=2) + assert_allclose_float64(np.vstack((f2py_a, f2py_b)), expected, operation_size=2) + assert_allclose_float64(np.vstack((scipy_a, scipy_b)), expected, operation_size=2) + + +def test_dtpqrt_reconstructs_triangular_pentagonal_qr(prik_lapack, scipy_lapack, f2py_lapack): + top = np.array([[2.0]], dtype=np.float64, order="F") + bottom = np.array([[3.0]], dtype=np.float64, order="F") + prik_a, f2py_a = top.copy(order="F"), top.copy(order="F") + prik_b, f2py_b = bottom.copy(order="F"), bottom.copy(order="F") + prik_t, f2py_t = np.empty((1, 1), order="F"), np.empty((1, 1), order="F") + + prik_scalars = prik_lapack.dtpqrt(1, 1, 0, 1, prik_a, 1, prik_b, 1, prik_t, 1, np.empty(1), 0) + f2py_result = f2py_lapack.dtpqrt(1, 1, 0, 1, f2py_a, 1, f2py_b, 1, f2py_t, 1, np.empty(1), 0) + scipy_a, scipy_b, scipy_t, scipy_info = scipy_lapack.dtpqrt(0, 1, top.copy(order="F"), bottom.copy(order="F")) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for factor_a, factor_b, compact_t in ( + (prik_a, prik_b, prik_t), + (f2py_a, f2py_b, f2py_t), + (scipy_a, scipy_b, scipy_t), + ): + vector = np.array([1.0, factor_b[0, 0]]) + q = np.eye(2) - compact_t[0, 0] * np.outer(vector, vector) + assert_allclose_float64(q @ np.array([[factor_a[0, 0]], [0.0]]), np.vstack((top, bottom)), operation_size=2) + + +def test_dtzrzf_reconstructs_rz_factorization(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[3.0, 4.0]], dtype=np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_tau, f2py_tau = np.empty(1), np.empty(1) + + prik_scalars = prik_lapack.dtzrzf(1, 2, prik_a, 1, prik_tau, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dtzrzf(1, 2, f2py_a, 1, f2py_tau, np.empty(64), 64, 0) + scipy_a, scipy_tau, scipy_info = scipy_lapack.dtzrzf(matrix.copy(order="F"), lwork=64) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for factor, tau in ((prik_a, prik_tau), (f2py_a, f2py_tau), (scipy_a, scipy_tau)): + vector = np.array([1.0, factor[0, 1]]) + z = np.eye(2) - tau[0] * np.outer(vector, vector) + assert_allclose_float64(np.array([[factor[0, 0], 0.0]]) @ z, matrix, operation_size=2) diff --git a/examples/lapack/test_routine_coverage.py b/examples/lapack/test_routine_coverage.py new file mode 100644 index 000000000..5b3ce81fe --- /dev/null +++ b/examples/lapack/test_routine_coverage.py @@ -0,0 +1,182 @@ +"""Fail-closed audit for the reviewed SciPy float64 LAPACK surface.""" + +from __future__ import annotations + +import ast +from pathlib import Path + +import pytest + +from .routine_inventory import ( + EXPLICIT_TEST_NAMES, + EXPECTED_LAPACK_ROOT_PROCEDURES, + EXPECTED_LAPACK_SOURCE_FILES, + F2PY_EXPORT_LIMITATIONS, + F2PY_FUNCTION_RESULTS, + F2PY_NUMERICAL_LIMITATIONS, + ROUTINE_FAMILIES, + ROUTINE_GROUPS, + ROUTINE_SPECS, + ROUTINES, + SCIPY_VERSION, +) + + +EXAMPLE_ROOT = Path(__file__).resolve().parent +NATIVE_ROOT = EXAMPLE_ROOT / "native" +OLD_NATIVE_ROOT = ( + EXAMPLE_ROOT.parents[1] + / "tests" + / "fortran" + / "building_shared_library" + / "end_to_end" + / "real_libraries" + / "lapack" + / "native" +) +FORTRAN_SUFFIXES = {".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"} +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def _explicit_test_owners() -> dict[str, list[tuple[str, Path]]]: + owners: dict[str, list[tuple[str, Path]]] = {} + for path in sorted(EXAMPLE_ROOT.glob("test_*.py")): + tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path)) + for node in tree.body: + if not isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)): + continue + matches = [routine for routine, test_name in EXPLICIT_TEST_NAMES.items() if node.name == test_name] + assert len(matches) <= 1, f"{node.name} ambiguously owns {matches}" + if matches: + owners.setdefault(matches[0], []).append((node.name, path)) + return owners + + +def _visible_wrapper_calls(path: Path, test_name: str, routine: str) -> set[str]: + tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path)) + test_node = next( + node + for node in tree.body + if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)) and node.name == test_name + ) + return { + call.func.value.id + for call in ast.walk(test_node) + if isinstance(call, ast.Call) + and isinstance(call.func, ast.Attribute) + and call.func.attr == routine + and isinstance(call.func.value, ast.Name) + } + + +def test_inventory_is_unique_and_matches_pinned_scipy_surface(scipy_lapack): + """The reviewed inventory exactly matches SciPy's native d* surface.""" + observed = tuple( + sorted( + name + for name in dir(scipy_lapack) + if name.startswith("d") and callable(getattr(scipy_lapack, name)) and not name.endswith("_lwork") + ) + ) + assert len(ROUTINES) == 127 + assert len(set(ROUTINES)) == len(ROUTINES) + assert tuple(sorted(ROUTINES)) == observed, f"inventory drifted from SciPy {SCIPY_VERSION}" + + +def test_inventory_groups_form_one_complete_partition(): + """Every selected routine has exactly one LAPACK family owner.""" + grouped = tuple(name for names in ROUTINE_GROUPS.values() for name in names) + assert grouped == ROUTINES + assert len(set(grouped)) == len(grouped) + assert set(ROUTINE_FAMILIES) == set(ROUTINES) + assert set(ROUTINE_SPECS) == set(ROUTINES) + for routine, spec in ROUTINE_SPECS.items(): + assert spec.native_name == routine + assert spec.family == ROUTINE_FAMILIES[routine] + assert spec.test_name == EXPLICIT_TEST_NAMES[routine] + assert all( + ( + spec.source_file, + spec.scipy_name, + spec.prik_export, + spec.f2py_export, + spec.f2py_limitation, + spec.mutation, + spec.returns, + spec.workspace, + spec.index_convention, + spec.oracle, + ) + ) + assert set(ROUTINES) >= F2PY_FUNCTION_RESULTS + assert set(F2PY_NUMERICAL_LIMITATIONS) <= set(ROUTINES) + assert set(F2PY_EXPORT_LIMITATIONS) <= set(ROUTINES) + + +def test_authoritative_native_source_boundary_is_complete_and_unique(): + """The maintained source owner contains the complete library corpus once.""" + sources = tuple( + sorted(path for path in NATIVE_ROOT.iterdir() if path.is_file() and path.suffix.lower() in FORTRAN_SUFFIXES) + ) + stems = {path.stem.lower() for path in sources} + assert len(sources) == EXPECTED_LAPACK_SOURCE_FILES + assert EXPECTED_LAPACK_ROOT_PROCEDURES == EXPECTED_LAPACK_SOURCE_FILES - 2 + 4 + assert set(ROUTINES) <= stems + for routine, spec in ROUTINE_SPECS.items(): + assert (NATIVE_ROOT / spec.source_file).is_file(), routine + assert {"la_constants", "la_xisnan"} <= stems + assert not OLD_NATIVE_ROOT.exists() + + +def test_selected_routines_have_one_explicit_named_test(): + """Static AST ownership prevents generated or silently missing tests.""" + owners = _explicit_test_owners() + assert set(owners) == set(ROUTINES) + duplicates = {routine: tests for routine, tests in owners.items() if len(tests) != 1} + assert duplicates == {} + + +def test_selected_tests_keep_all_wrapper_calls_visible(): + """A named test only counts when it directly invokes all three surfaces.""" + expected_surfaces = {"prik_lapack", "scipy_lapack", "f2py_lapack"} + owners = _explicit_test_owners() + missing = {} + for routine, [(test_name, path)] in owners.items(): + visible = _visible_wrapper_calls(path, test_name, routine) + if visible != expected_surfaces: + missing[routine] = sorted(expected_surfaces - visible) + assert missing == {} + + +def test_documented_coverage_totals_match_inventory(): + """Published totals are derived from the reviewed inventory, not hand-waved.""" + readme = (EXAMPLE_ROOT / "README.md").read_text(encoding="utf-8") + expected_rows = { + "Authoritative LAPACK implementation sources": EXPECTED_LAPACK_SOURCE_FILES, + "Discovered root LAPACK procedures": EXPECTED_LAPACK_ROOT_PROCEDURES, + "Selected SciPy-backed float64 routines": len(ROUTINES), + "Explicit correctness tests": len(EXPLICIT_TEST_NAMES), + "PRIK exports required in CI": len(ROUTINES), + "SciPy exports used": len(ROUTINES), + "f2py exports required in CI": len(ROUTINES) - len(F2PY_EXPORT_LIMITATIONS), + "Routines satisfying the independent oracle through f2py": len(ROUTINES) - len(F2PY_NUMERICAL_LIMITATIONS), + "Documented raw-f2py numerical projection limitations": len(F2PY_NUMERICAL_LIMITATIONS), + "Documented unsupported/skipped routines": 0, + } + for label, count in expected_rows.items(): + assert f"| {label} | {count:,} |" in readme + + +def test_selected_routines_are_exported_by_prik(prik_lapack): + """The complete PRIK wrapper must export every selected routine.""" + missing = [name for name in ROUTINES if not hasattr(prik_lapack, name)] + assert missing == [] + + +def test_expected_f2py_routines_are_exported(f2py_lapack): + """Only reproduced and documented f2py limitations may lack an export.""" + expected = [name for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS] + missing = [name for name in expected if not hasattr(f2py_lapack, name)] + assert missing == [] + unexpected = [name for name in F2PY_EXPORT_LIMITATIONS if hasattr(f2py_lapack, name)] + assert unexpected == [] diff --git a/examples/lapack/test_svd.py b/examples/lapack/test_svd.py new file mode 100644 index 000000000..bbe429cb3 --- /dev/null +++ b/examples/lapack/test_svd.py @@ -0,0 +1,246 @@ +"""Singular-value-decomposition correctness tests.""" + +from __future__ import annotations + +import numpy as np +import pytest + +from .helpers import assert_allclose_float64, assert_orthogonal, column_major + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_dgejsv_reconstructs_matrix_with_jacobi_svd(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.diag([3.0, 2.0]).astype(np.float64, order="F") + prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") + prik_s, f2py_s = np.empty(2), np.empty(2) + prik_u, f2py_u = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + prik_v, f2py_v = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + + prik_scalars = prik_lapack.dgejsv( + "A", + "U", + "V", + "N", + "N", + "N", + 2, + 2, + prik_a, + 2, + prik_s, + prik_u, + 2, + prik_v, + 2, + np.empty(128), + 128, + np.empty(16, dtype=np.int32), + 0, + ) + f2py_result = f2py_lapack.dgejsv( + b"A", + b"U", + b"V", + b"N", + b"N", + b"N", + 2, + 2, + f2py_a, + 2, + f2py_s, + f2py_u, + 2, + f2py_v, + 2, + np.empty(128), + 128, + np.empty(16, dtype=np.int32), + 0, + ) + scipy_s, scipy_u, scipy_v, _work, _iwork, scipy_info = scipy_lapack.dgejsv( + matrix.copy(order="F"), joba=4, jobu=0, jobv=0, jobr=1, jobt=0, jobp=1, lwork=128 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for values, u, v in ((prik_s, prik_u, prik_v), (f2py_s, f2py_u, f2py_v), (scipy_s, scipy_u, scipy_v)): + assert_allclose_float64(values, [3.0, 2.0], operation_size=2) + assert_orthogonal(u) + assert_orthogonal(v) + assert_allclose_float64(u @ np.diag(values) @ v.T, matrix, operation_size=2) + + +def test_dgesdd_reconstructs_matrix_with_divide_and_conquer_svd(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 7.0]], dtype=np.float64) + prik_a, f2py_a = column_major(matrix), column_major(matrix) + prik_s, f2py_s = np.empty(2), np.empty(2) + prik_u, f2py_u = np.empty((3, 3), order="F"), np.empty((3, 3), order="F") + prik_vt, f2py_vt = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + + prik_scalars = prik_lapack.dgesdd( + "A", 3, 2, prik_a, 3, prik_s, prik_u, 3, prik_vt, 2, np.empty(128), 128, np.empty(16, dtype=np.int32), 0 + ) + f2py_result = f2py_lapack.dgesdd( + b"A", 3, 2, f2py_a, 3, f2py_s, f2py_u, 3, f2py_vt, 2, np.empty(128), 128, np.empty(16, dtype=np.int32), 0 + ) + scipy_u, scipy_s, scipy_vt, scipy_info = scipy_lapack.dgesdd( + matrix.copy(order="F"), compute_uv=1, full_matrices=1, lwork=128 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for u, values, vt in ((prik_u, prik_s, prik_vt), (f2py_u, f2py_s, f2py_vt), (scipy_u, scipy_s, scipy_vt)): + assert_orthogonal(u) + assert_orthogonal(vt.T) + assert_allclose_float64(u[:, :2] @ np.diag(values) @ vt, matrix, operation_size=3) + assert_allclose_float64(prik_s, scipy_s, operation_size=3) + assert_allclose_float64(f2py_s, scipy_s, operation_size=3) + + +def test_dgesvd_reconstructs_matrix(prik_lapack, scipy_lapack, f2py_lapack): + matrix = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 7.0]], dtype=np.float64) + prik_a, f2py_a = column_major(matrix), column_major(matrix) + prik_s, f2py_s = np.empty(2, dtype=np.float64), np.empty(2, dtype=np.float64) + prik_u, f2py_u = column_major(np.zeros((3, 3))), column_major(np.zeros((3, 3))) + prik_vt, f2py_vt = column_major(np.zeros((2, 2))), column_major(np.zeros((2, 2))) + + prik_scalars = prik_lapack.dgesvd("A", "A", 3, 2, prik_a, 3, prik_s, prik_u, 3, prik_vt, 2, np.empty(32), 32, 0) + f2py_result = f2py_lapack.dgesvd(b"A", b"A", 3, 2, f2py_a, 3, f2py_s, f2py_u, 3, f2py_vt, 2, np.empty(32), 32, 0) + scipy_u, scipy_s, scipy_vt, scipy_info = scipy_lapack.dgesvd( + matrix.copy(order="F"), compute_uv=1, full_matrices=1, lwork=32 + ) + + assert prik_scalars == (3, 2, 3, 3, 2, 32, 0) + assert f2py_result is None + assert scipy_info == 0 + for u, values, vt in ( + (prik_u, prik_s, prik_vt), + (f2py_u, f2py_s, f2py_vt), + (scipy_u, scipy_s, scipy_vt), + ): + assert np.all(np.diff(values) <= 0.0) + assert_orthogonal(u) + assert_orthogonal(vt.T) + assert_allclose_float64(u[:, :2] @ np.diag(values) @ vt, matrix, operation_size=3) + assert_allclose_float64(prik_s, scipy_s, operation_size=3) + assert_allclose_float64(f2py_s, scipy_s, operation_size=3) + + +def test_dorcsd_decomposes_partitioned_orthogonal_matrix(prik_lapack, scipy_lapack, f2py_lapack): + x11 = np.array([[1.0]], dtype=np.float64, order="F") + x12 = np.array([[0.0]], dtype=np.float64, order="F") + x21 = np.array([[0.0]], dtype=np.float64, order="F") + x22 = np.array([[1.0]], dtype=np.float64, order="F") + prik_blocks = [block.copy(order="F") for block in (x11, x12, x21, x22)] + f2py_blocks = [block.copy(order="F") for block in (x11, x12, x21, x22)] + prik_theta, f2py_theta = np.empty(1), np.empty(1) + prik_u1, prik_u2, prik_v1t, prik_v2t = (np.empty((1, 1), order="F") for _ in range(4)) + f2py_u1, f2py_u2, f2py_v1t, f2py_v2t = (np.empty((1, 1), order="F") for _ in range(4)) + + prik_scalars = prik_lapack.dorcsd( + "Y", + "Y", + "Y", + "Y", + "N", + "O", + 2, + 1, + 1, + prik_blocks[0], + 1, + prik_blocks[1], + 1, + prik_blocks[2], + 1, + prik_blocks[3], + 1, + prik_theta, + prik_u1, + 1, + prik_u2, + 1, + prik_v1t, + 1, + prik_v2t, + 1, + np.empty(128), + 128, + np.empty(16, dtype=np.int32), + 0, + ) + f2py_result = f2py_lapack.dorcsd( + b"Y", + b"Y", + b"Y", + b"Y", + b"N", + b"O", + 2, + 1, + 1, + f2py_blocks[0], + 1, + f2py_blocks[1], + 1, + f2py_blocks[2], + 1, + f2py_blocks[3], + 1, + f2py_theta, + f2py_u1, + 1, + f2py_u2, + 1, + f2py_v1t, + 1, + f2py_v2t, + 1, + np.empty(128), + 128, + np.empty(16, dtype=np.int32), + 0, + ) + _c11, _c12, _c21, _c22, scipy_theta, scipy_u1, scipy_u2, scipy_v1t, scipy_v2t, scipy_info = scipy_lapack.dorcsd( + x11, x12, x21, x22, compute_u1=1, compute_u2=1, compute_v1t=1, compute_v2t=1, trans=0, signs=0, lwork=128 + ) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + for theta, u1, u2, v1t, v2t in ( + (prik_theta, prik_u1, prik_u2, prik_v1t, prik_v2t), + (f2py_theta, f2py_u1, f2py_u2, f2py_v1t, f2py_v2t), + (scipy_theta, scipy_u1, scipy_u2, scipy_v1t, scipy_v2t), + ): + cosine = np.array([[np.cos(theta[0])]]) + assert_allclose_float64(theta, [0.0]) + assert_allclose_float64(u1 @ cosine @ v1t, x11) + assert_allclose_float64(u2 @ cosine @ v2t, x22) + + +def test_dlasd4_solves_rank_one_secular_equation(prik_lapack, scipy_lapack, f2py_lapack): + diagonal = np.array([1.0, 3.0], dtype=np.float64) + update = np.array([0.6, 0.8], dtype=np.float64) + rho = 1.0 + expected = float(np.sqrt(np.linalg.eigvalsh(np.diag(diagonal * diagonal) + rho * np.outer(update, update))[0])) + prik_delta, f2py_delta = np.empty(2), np.empty(2) + prik_work, f2py_work = np.empty(2), np.empty(2) + + prik_scalars = prik_lapack.dlasd4(2, 1, diagonal, update, prik_delta, rho, 0.0, prik_work, 0) + f2py_result = f2py_lapack.dlasd4(2, 1, diagonal, update, f2py_delta, rho, 0.0, f2py_work, 0) + scipy_delta, scipy_sigma, scipy_work, scipy_info = scipy_lapack.dlasd4(0, diagonal, update, rho=rho) + + assert f2py_result is None + assert prik_scalars[-1] == scipy_info == 0 + prik_sigma = prik_scalars[-2] + assert_allclose_float64(prik_sigma, expected, operation_size=2) + assert_allclose_float64(scipy_sigma, expected, operation_size=2) + assert_allclose_float64(prik_delta, diagonal - prik_sigma) + assert_allclose_float64(prik_work, diagonal + prik_sigma) + assert_allclose_float64(f2py_delta, scipy_delta) + assert_allclose_float64(f2py_work, scipy_work) + secular = 1.0 + rho * np.sum(update * update / (diagonal * diagonal - prik_sigma * prik_sigma)) + assert_allclose_float64(secular, 0.0, operation_size=2) diff --git a/tests/README.md b/tests/README.md index c3cf1092b..01b495028 100644 --- a/tests/README.md +++ b/tests/README.md @@ -72,9 +72,10 @@ python3 -m pytest -q tests/architecture ``` The full-library BLAS/LAPACK integration nodes and the complete correctness -project in `examples/blas/` remain in the dedicated real-library job. The BLAS -sources are owned by `examples/blas/native/`; LAPACK remains under its existing -real-library owner and is not part of the default local verification command. +projects in `examples/blas/` and `examples/lapack/` remain in the dedicated +real-library job. The BLAS and LAPACK sources are owned by +`examples/blas/native/` and `examples/lapack/native/`; LAPACK is not part of +the default local verification command. ## Markers diff --git a/tests/architecture/fortran/test_language_ownership.py b/tests/architecture/fortran/test_language_ownership.py index fa072e75b..4cb92e3be 100644 --- a/tests/architecture/fortran/test_language_ownership.py +++ b/tests/architecture/fortran/test_language_ownership.py @@ -15,6 +15,7 @@ ROADMAP = REPO_ROOT / "docs/maintainer/roadmap/fortran-test-suite-cleanup-checklist.md" REAL_LIBRARY_ROOT = FEATURE_ROOT / "building_shared_library" / "end_to_end" / "real_libraries" BLAS_EXAMPLE_ROOT = REPO_ROOT / "examples" / "blas" +LAPACK_EXAMPLE_ROOT = REPO_ROOT / "examples" / "lapack" FEATURE_DOCS = { "data_types": "docs/user/guide/data-types.md", @@ -181,14 +182,13 @@ def test_fortran_index_names_every_infrastructure_owner() -> None: assert f"`{owner}`" in text -def test_real_library_and_blas_example_have_single_native_source_owners() -> None: +def test_real_library_examples_have_single_native_source_owners() -> None: assert {path.name for path in REAL_LIBRARY_ROOT.glob("test_*.py")} == {"test_full_libraries.py"} - assert {path.name for path in REAL_LIBRARY_ROOT.iterdir() if path.is_dir() and path.name != "__pycache__"} == { - "lapack", - } - assert (REAL_LIBRARY_ROOT / "lapack" / "native").is_dir() + assert {path.name for path in REAL_LIBRARY_ROOT.iterdir() if path.is_dir() and path.name != "__pycache__"} == set() assert (BLAS_EXAMPLE_ROOT / "native").is_dir() + assert (LAPACK_EXAMPLE_ROOT / "native").is_dir() assert len(tuple((BLAS_EXAMPLE_ROOT / "native").iterdir())) == 155 + assert len(tuple((LAPACK_EXAMPLE_ROOT / "native").iterdir())) == 2062 assert sorted(REAL_LIBRARY_ROOT.rglob("*.pyi")) == [] diff --git a/tests/fortran/README.md b/tests/fortran/README.md index 642e9ac2c..84e2bfe29 100644 --- a/tests/fortran/README.md +++ b/tests/fortran/README.md @@ -95,8 +95,9 @@ artifact-consumer, and support-consumer inventories live under - Every pytest node below a feature `end_to_end/` carries `fortran_end_to_end`, and no other node does. -- Only the complete `examples/blas/` correctness project and BLAS/LAPACK - native-source integration nodes additionally carry `real_library`. +- Only the complete `examples/blas/` and `examples/lapack/` correctness + projects and BLAS/LAPACK native-source integration nodes additionally carry + `real_library`. - `toolchain_smoke` will select exact portable rows from the completed ordinary end-to-end suite; it is not a separate directory. diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py b/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py index 5a712c672..de3bc295a 100644 --- a/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py +++ b/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py @@ -19,8 +19,8 @@ from prik import build_pyi_extension from prik.pipeline.pyi import pyi_paths_to_semantic_modules -FORTRAN_LIBRARY_ROOT = Path(__file__).parent BLAS_SOURCE_ROOT = REPO_ROOT / "examples" / "blas" / "native" +LAPACK_SOURCE_ROOT = REPO_ROOT / "examples" / "lapack" / "native" NATIVE_CACHE_ENV = "PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR" NATIVE_JOBS_ENV = "PRIK_REAL_LIBRARY_NATIVE_JOBS" DEFAULT_NATIVE_CACHE_ROOT = REPO_ROOT / ".pytest_cache" / "prik" / "real-library-native" @@ -38,10 +38,10 @@ "sentinel_functions": {"dasum", "daxpy", "ddot", "dgemm", "dscal", "lsame", "xerbla"}, }, "lapack": { - "root_function_count": 2063, + "root_function_count": 2064, "source_stem_exceptions": {"la_constants", "la_xisnan"}, "extra_function_names": {"dladiv1", "dladiv2", "sladiv1", "sladiv2"}, - "sentinel_functions": {"dgesv", "dgetrf", "dgetrs", "dlamrg", "zgesv"}, + "sentinel_functions": {"dgesv", "dgetrf", "dgetrs", "dlamch", "dlamrg", "zgesv"}, }, } LAPACK_RUNTIME_EXCLUDED_IMPORTS = {"from . import LA_CONSTANTS\n", "from . import LA_XISNAN\n"} @@ -62,7 +62,7 @@ def _archiver() -> str: def _library_sources(library: str) -> tuple[Path, ...]: - root = BLAS_SOURCE_ROOT if library == "blas" else FORTRAN_LIBRARY_ROOT / library / "native" + root = BLAS_SOURCE_ROOT if library == "blas" else LAPACK_SOURCE_ROOT return tuple(sorted(path for path in root.iterdir() if path.is_file() and path.suffix.lower() in FORTRAN_SUFFIXES)) @@ -73,8 +73,8 @@ def _native_sources(library: str) -> tuple[Path, ...]: module_sources = tuple( source for source in ( - FORTRAN_LIBRARY_ROOT / "lapack" / "native" / "la_constants.f90", - FORTRAN_LIBRARY_ROOT / "lapack" / "native" / "la_xisnan.F90", + LAPACK_SOURCE_ROOT / "la_constants.f90", + LAPACK_SOURCE_ROOT / "la_xisnan.F90", ) if source.is_file() ) @@ -378,7 +378,7 @@ def _assert_lapack_runtime_smoke(module) -> None: @pytest.mark.real_library @pytest.mark.parametrize("library", ["blas", "lapack"]) def test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library(library: str, tmp_path: Path): - source_root = BLAS_SOURCE_ROOT if library == "blas" else FORTRAN_LIBRARY_ROOT / library / "native" + source_root = BLAS_SOURCE_ROOT if library == "blas" else LAPACK_SOURCE_ROOT entry = _generate_contract(source_root, tmp_path / "contracts" / library) root = _root_module(entry.parent) diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index a8e819d79..f30920002 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -191,7 +191,10 @@ def test_full_real_library_nodes_have_one_dedicated_workflow() -> None: assert ordinary_jobs.count('-m "not real_library and not toolchain_smoke"') == 2 assert FULL_REAL_LIBRARY_TEST not in ordinary_jobs assert "examples/blas" not in ordinary_jobs + assert "examples/lapack" not in ordinary_jobs assert "python -m pytest -q examples/blas" in dedicated_job + assert "python -m pytest -q examples/lapack" in dedicated_job + assert 'python -m pip install "scipy==1.18.0"' in dedicated_job assert ( f'"{FULL_REAL_LIBRARY_TEST}::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[blas]"' in dedicated_job diff --git a/tests/shared/docs/test_examples.py b/tests/shared/docs/test_examples.py index d02df2c23..da6b1278d 100644 --- a/tests/shared/docs/test_examples.py +++ b/tests/shared/docs/test_examples.py @@ -21,6 +21,7 @@ DOC_PATHS = [ ROOT / "README.md", ROOT / "examples/blas/README.md", + ROOT / "examples/lapack/README.md", *sorted(path for path in (ROOT / "docs").rglob("*.md") if "old_docs" not in path.parts), ] AUDITED_PYTHON_DOC_PATHS = [ From 3f58da5987694ea5f41b7b1082e5005fbc7d785e Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Sun, 2 Aug 2026 04:18:30 +0100 Subject: [PATCH 03/22] require meson and ninja --- .github/workflows/blas-lapack.yml | 5 ++++- examples/blas/README.md | 8 ++++++++ examples/lapack/README.md | 8 ++++++++ tests/shared/architecture/test_test_suite_layout.py | 4 +++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index ddc7a8ca5..9be6eeb32 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -38,7 +38,10 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install -e ".[qa]" - python -m pip install "scipy==1.18.0" + python -m pip install \ + "meson==1.11.2" \ + "ninja==1.13.0" \ + "scipy==1.18.0" - name: Install pinned GFortran shell: bash run: | diff --git a/examples/blas/README.md b/examples/blas/README.md index 5441cd207..689152ed7 100644 --- a/examples/blas/README.md +++ b/examples/blas/README.md @@ -26,6 +26,14 @@ license. ## Reproduce the two builds +On Python 3.12 and newer, NumPy's f2py uses its Meson backend. Install the +same Meson and Ninja versions used by the dedicated BLAS/LAPACK CI lane before +running the example: + +```console +python3 -m pip install "meson==1.11.2" "ninja==1.13.0" +``` + The session fixtures use the following effective commands. Both commands receive the same sorted absolute source list and `-O0`; all artifacts stay in a temporary directory. diff --git a/examples/lapack/README.md b/examples/lapack/README.md index 10a380518..8fd32d8f9 100644 --- a/examples/lapack/README.md +++ b/examples/lapack/README.md @@ -30,6 +30,14 @@ stem already supplied by LAPACK. No BLAS source is copied below this directory. ## Build topology +On Python 3.12 and newer, NumPy's f2py uses its Meson backend. Install the +same Meson, Ninja, and SciPy versions used by the dedicated BLAS/LAPACK CI lane +before running this example: + +```console +python3 -m pip install "meson==1.11.2" "ninja==1.13.0" "scipy==1.18.0" +``` + The session fixture reuses the established complete-library integration path in `tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py`. It performs these operations once: diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index 7af41330a..3a69cfa03 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -194,7 +194,9 @@ def test_full_real_library_nodes_have_one_dedicated_workflow() -> None: assert "examples/lapack" not in ordinary_jobs assert "python -m pytest -q examples/blas" in dedicated_job assert "python -m pytest -q examples/lapack" in dedicated_job - assert 'python -m pip install "scipy==1.18.0"' in dedicated_job + assert '"meson==1.11.2"' in dedicated_job + assert '"ninja==1.13.0"' in dedicated_job + assert '"scipy==1.18.0"' in dedicated_job assert ( f'"{FULL_REAL_LIBRARY_TEST}::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[blas]"' in dedicated_job From af854b0371292982ef7a709c4e62da7cef729480 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Sun, 2 Aug 2026 05:52:53 +0100 Subject: [PATCH 04/22] require f2py to only wrap the necessary routines --- .github/workflows/blas-lapack.yml | 8 +- examples/lapack/README.md | 150 ++++++++--- examples/lapack/conftest.py | 62 +++-- examples/lapack/helpers.py | 7 + examples/lapack/routine_inventory.py | 28 +- examples/lapack/test_auxiliary.py | 32 ++- examples/lapack/test_eigen_generalized.py | 247 +++++++++--------- examples/lapack/test_eigen_nonsymmetric.py | 128 +++++---- examples/lapack/test_eigen_symmetric.py | 211 ++++++++------- examples/lapack/test_least_squares.py | 92 +++++-- .../lapack/test_linear_banded_tridiagonal.py | 181 ++++++++----- examples/lapack/test_linear_general.py | 94 ++++--- .../lapack/test_linear_positive_definite.py | 105 +++++--- .../test_linear_symmetric_indefinite.py | 97 +++++-- examples/lapack/test_linear_triangular.py | 49 ++-- .../lapack/test_orthogonal_factorizations.py | 151 ++++++++--- examples/lapack/test_routine_coverage.py | 39 ++- examples/lapack/test_svd.py | 93 ++++--- .../architecture/test_test_suite_layout.py | 2 + 19 files changed, 1161 insertions(+), 615 deletions(-) diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index 9be6eeb32..ecfa9af06 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -42,13 +42,15 @@ jobs: "meson==1.11.2" \ "ninja==1.13.0" \ "scipy==1.18.0" - - name: Install pinned GFortran + - name: Install pinned GFortran and LAPACK link dependencies shell: bash run: | + packages=(libblas-dev liblapack-dev) if ! command -v "$PRIK_GFORTRAN_BINARY" >/dev/null 2>&1; then - sudo apt-get update - sudo apt-get install --yes "$PRIK_GFORTRAN_PACKAGE" + packages+=("$PRIK_GFORTRAN_PACKAGE") fi + sudo apt-get update + sudo apt-get install --yes "${packages[@]}" compiler_dir="$RUNNER_TEMP/prik-gfortran" mkdir -p "$compiler_dir" ln -sf "$(command -v "$PRIK_GFORTRAN_BINARY")" "$compiler_dir/gfortran" diff --git a/examples/lapack/README.md b/examples/lapack/README.md index 8fd32d8f9..6e9710611 100644 --- a/examples/lapack/README.md +++ b/examples/lapack/README.md @@ -35,6 +35,7 @@ same Meson, Ninja, and SciPy versions used by the dedicated BLAS/LAPACK CI lane before running this example: ```console +sudo apt-get install libblas-dev liblapack-dev python3 -m pip install "meson==1.11.2" "ninja==1.13.0" "scipy==1.18.0" ``` @@ -47,8 +48,9 @@ It performs these operations once: cached shared library; 3. build one PRIK extension from the complete generated contract and shared library; -4. build one raw f2py comparison surface for the reviewed 127 routines, linked - to that same complete native library; and +4. independently build one raw f2py comparison surface from the 125 reviewed + f2py-compatible routine sources and their minimal module dependency, linking unselected + LAPACK and BLAS helper symbols from the system development libraries; and 5. reuse the three imported comparison surfaces for every correctness file. The contract-generation command is: @@ -63,28 +65,52 @@ f2py command assembled by `conftest.py` is equivalent to: ```console python3 -m numpy.f2py -c -m f2py_reference_lapack_example \ - \ - \ + examples/lapack/native/la_constants.f90 \ + \ + only: : \ + --dep lapack --dep blas \ + --f2cmap /tmp/prik-lapack/.f2py_f2cmap \ --build-dir /tmp/prik-lapack/f2py --f77flags=-O0 --f90flags=-O0 --opt=-O0 ``` +`dlartg.f90` imports the `LA_CONSTANTS` module and declares its arguments as +`REAL(wp)`. The f2py build therefore includes `la_constants.f90` as a build-only +dependency and supplies a kind map that resolves `wp` to C `double`. The +`only:` list makes the 125 f2py-compatible routine wrappers explicit; module support metadata +is not counted as a selected routine. The dependency is compiled only to +satisfy f2py's standalone selected-source build. f2py does not compile or link +PRIK's complete 2,062-source native artifact. The reviewed implementations come +from `examples/lapack/native/`; only their unselected transitive LAPACK and BLAS +dependencies come from the system libraries. + Build products stay in pytest temporary/cache directories. Failures report the compiler identity, command, stdout, and stderr. Neither build dirties the repository. The fixtures import the complete PRIK module, the raw f2py module, and `scipy.linalg.lapack`. Character flags are Python `str` through PRIK and -`bytes` through SciPy/f2py. PRIK and raw f2py retain native argument ordering; -SciPy projects arrays and optional arguments into its documented Python API. +`bytes` through SciPy/f2py. PRIK retains the complete native argument order. +Raw f2py retains the order of the arguments it exposes, but infers and hides +leading dimensions and a few other shape-only scalar arguments; each visible +f2py call follows the generated wrapper signature. SciPy projects arrays and +optional arguments into its documented Python API. The Reference LAPACK subroutines do not declare Fortran `intent`, so raw f2py does not project their scalar writebacks. It still exposes in-place array -mutation, which provides enough output for the independent oracle in 114 of -the 123 subroutines; the four LAPACK functions return their values normally. Nine -subroutines have an essential scalar-only result, or need an unprojected scalar -to validate their mutated vector, and are explicitly recorded in -`F2PY_NUMERICAL_LIMITATIONS`. All 127 selected names must still be exported by -the one f2py comparison module. +mutation, which provides enough output for the independent oracle in 112 of +the 121 exported subroutines; the four exported LAPACK functions return their +values normally. Nine subroutines have an essential scalar-only result, or need +an unprojected scalar to validate their mutated vector, and are explicitly +recorded in `F2PY_NUMERICAL_LIMITATIONS`. + +`dgees` and `dgges` remain in the 127-routine correctness inventory but are +recorded in `F2PY_EXPORT_LIMITATIONS`. Their Reference LAPACK interfaces accept +external selection callbacks. From the unannotated implementation sources, +NumPy f2py 2.5.1 generates incomplete callback declarations (`select_t` and +`selctg_t`) and invalid C wrapper code. Those two routines are therefore +validated through PRIK, SciPy, and independent Schur reconstruction without a +raw-f2py call; the remaining 125 selected names must be exported by the one +f2py comparison module. The nine reviewed limitations are: @@ -109,15 +135,28 @@ pivot ties may choose another valid permutation. Tests therefore use residuals, subspaces, factor reconstruction, and orthogonality instead of byte equality where the contract permits freedom. -All numerical inputs use `dtype=np.float64`. `assert_allclose_float64` scales -tolerance with double-precision epsilon and operation length. Residual checks -also scale by matrix and solution norms. Integer results, `INFO`, shapes, dtypes, -pivot bounds, and untouched sentinel storage use exact comparisons. +All numerical arrays use `dtype=np.float64`. PRIK exposes the native scalar +contract exactly, so its visible calls use `np.int32(...)` for LAPACK `INTEGER` +arguments, `np.float64(...)` for scalar `DOUBLE PRECISION` arguments, and +`np.bool_(...)` for scalar `LOGICAL` arguments. SciPy and f2py calls retain their +own accepted Python conventions beside the PRIK call. `assert_allclose_float64` +scales tolerance with double-precision epsilon and operation length. Residual +checks also scale by matrix and solution norms. Integer results, `INFO`, shapes, +dtypes, pivot bounds, and untouched sentinel storage use exact comparisons. + +`DTGSEN` and `DTRSEN` accept default-Fortran `LOGICAL` selection arrays. The +pinned GFortran ABI stores each such element in four bytes, while PRIK's Python +surface accepts a NumPy bool buffer. `gfortran_logical_mask` makes that genuine +ABI difference explicit by placing each truth byte at the start of its native +four-byte cell. The two affected calls remain visible, independently validate +the requested reorder, and are recorded in `PRIK_ABI_ADAPTERS` rather than +silently treating an ordinary two-byte NumPy mask as native storage. ## Arrays, storage, workspaces, and indexes Matrices are explicitly Fortran contiguous where the native contract requires -column-major storage. Leading dimensions remain visible in PRIK/f2py calls. +column-major storage. Leading dimensions remain visible in PRIK calls and are +omitted only where the generated f2py signature explicitly infers them. Tests use NaNs or sentinel values in unused triangles and padding, then prove that those locations remain untouched. Helpers reconstruct general band, symmetric band, tridiagonal, packed, triangular, and rectangular-full-packed @@ -130,9 +169,11 @@ Invalid argument calls that could route through `XERBLA` are not made in-process Native LAPACK pivots and positions are one-based. PRIK and the raw f2py surface preserve native values. SciPy converts several low-level pivot/index APIs to -zero-based values; each affected test performs the conversion beside the call. -The inventory marks every pivot/index-bearing routine so a new conversion -cannot be hidden in a generic adapter. +zero-based values, but preserves one-based `JPVT` for `DGELSY`/`DGEQP3`, one-based +`IPIV` for the general-tridiagonal `DGTTRF`/`DGTTRS` family, and one-based Schur +reorder positions for `DTGEXC`/`DTREXC`. Each affected test keeps the observed +convention beside the call. The inventory marks every pivot/index-bearing +routine so a new conversion cannot be hidden in a generic adapter. ## Run and diagnose @@ -173,9 +214,11 @@ documented totals. | Explicit correctness tests | 127 | | PRIK exports required in CI | 127 | | SciPy exports used | 127 | -| f2py exports required in CI | 127 | -| Routines satisfying the independent oracle through f2py | 118 | +| f2py exports required in CI | 125 | +| Routines satisfying the independent oracle through f2py | 116 | +| Documented raw-f2py export limitations | 2 | | Documented raw-f2py numerical projection limitations | 9 | +| Documented PRIK default-LOGICAL ABI adapters | 2 | | Documented unsupported/skipped routines | 0 | Runtime success, f2py projection limitations, and any PRIK failures are CI @@ -200,8 +243,10 @@ def test_dgesv_solves_general_system(prik_lapack, scipy_lapack, f2py_lapack): prik_piv = np.empty(2, dtype=np.int32) f2py_piv = np.empty(2, dtype=np.int32) - prik_scalars = prik_lapack.dgesv(2, 1, prik_a, 2, prik_piv, prik_b, 2, 0) - f2py_result = f2py_lapack.dgesv(2, 1, f2py_a, 2, f2py_piv, f2py_b, 2, 0) + prik_scalars = prik_lapack.dgesv( + np.int32(2), np.int32(1), prik_a, np.int32(2), prik_piv, prik_b, np.int32(2), np.int32(0) + ) + f2py_result = f2py_lapack.dgesv(2, 1, f2py_a, f2py_piv, f2py_b, 0) scipy_lu, scipy_piv, scipy_x, scipy_info = scipy_lapack.dgesv( original_a.copy(order="F"), original_b.copy(order="F") ) @@ -234,8 +279,8 @@ def test_dgetrf_reconstructs_pivoted_lu(prik_lapack, scipy_lapack, f2py_lapack): prik_piv = np.empty(2, dtype=np.int32) f2py_piv = np.empty(2, dtype=np.int32) - prik_scalars = prik_lapack.dgetrf(2, 2, prik_a, 2, prik_piv, 0) - f2py_result = f2py_lapack.dgetrf(2, 2, f2py_a, 2, f2py_piv, 0) + prik_scalars = prik_lapack.dgetrf(np.int32(2), np.int32(2), prik_a, np.int32(2), prik_piv, np.int32(0)) + f2py_result = f2py_lapack.dgetrf(2, 2, f2py_a, f2py_piv, 0) scipy_lu, scipy_piv, scipy_info = scipy_lapack.dgetrf(original.copy(order="F")) assert prik_scalars == (2, 2, 2, 0) @@ -260,8 +305,8 @@ def test_dpotrf_reconstructs_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): stored = np.array([[4.0, np.nan], [1.0, 3.0]], dtype=np.float64, order="F") prik_a, f2py_a = column_major(stored), column_major(stored) - prik_scalars = prik_lapack.dpotrf("L", 2, prik_a, 2, 0) - f2py_result = f2py_lapack.dpotrf(b"L", 2, f2py_a, 2, 0) + prik_scalars = prik_lapack.dpotrf("L", np.int32(2), prik_a, np.int32(2), np.int32(0)) + f2py_result = f2py_lapack.dpotrf(b"L", 2, f2py_a, 0) scipy_factor, scipy_info = scipy_lapack.dpotrf(stored.copy(order="F"), lower=1, clean=0) assert prik_scalars == (2, 2, 0) @@ -289,8 +334,10 @@ def test_dgeqrf_reconstructs_qr_factorization(prik_lapack, scipy_lapack, f2py_la prik_tau = np.empty(2, dtype=np.float64) f2py_tau = np.empty(2, dtype=np.float64) - prik_scalars = prik_lapack.dgeqrf(3, 2, prik_a, 3, prik_tau, np.empty(16), 16, 0) - f2py_result = f2py_lapack.dgeqrf(3, 2, f2py_a, 3, f2py_tau, np.empty(16), 16, 0) + prik_scalars = prik_lapack.dgeqrf( + np.int32(3), np.int32(2), prik_a, np.int32(3), prik_tau, np.empty(16), np.int32(16), np.int32(0) + ) + f2py_result = f2py_lapack.dgeqrf(3, 2, f2py_a, f2py_tau, np.empty(16), 16, 0) scipy_qr, scipy_tau, _scipy_work, scipy_info = scipy_lapack.dgeqrf(matrix.copy(order="F"), lwork=16) assert prik_scalars == (3, 2, 3, 16, 0) @@ -318,8 +365,10 @@ def test_dsyev_returns_orthonormal_eigenvectors(prik_lapack, scipy_lapack, f2py_ prik_w = np.empty(2, dtype=np.float64) f2py_w = np.empty(2, dtype=np.float64) - prik_scalars = prik_lapack.dsyev("V", "U", 2, prik_vectors, 2, prik_w, np.empty(16), 16, 0) - f2py_result = f2py_lapack.dsyev(b"V", b"U", 2, f2py_vectors, 2, f2py_w, np.empty(16), 16, 0) + prik_scalars = prik_lapack.dsyev( + "V", "U", np.int32(2), prik_vectors, np.int32(2), prik_w, np.empty(16), np.int32(16), np.int32(0) + ) + f2py_result = f2py_lapack.dsyev(b"V", b"U", 2, f2py_vectors, f2py_w, np.empty(16), 16, 0) scipy_w, scipy_vectors, scipy_info = scipy_lapack.dsyev(matrix.copy(order="F"), compute_v=1, lower=0, lwork=16) assert prik_scalars == (2, 2, 16, 0) @@ -346,8 +395,23 @@ def test_dgesvd_reconstructs_matrix(prik_lapack, scipy_lapack, f2py_lapack): prik_u, f2py_u = column_major(np.zeros((3, 3))), column_major(np.zeros((3, 3))) prik_vt, f2py_vt = column_major(np.zeros((2, 2))), column_major(np.zeros((2, 2))) - prik_scalars = prik_lapack.dgesvd("A", "A", 3, 2, prik_a, 3, prik_s, prik_u, 3, prik_vt, 2, np.empty(32), 32, 0) - f2py_result = f2py_lapack.dgesvd(b"A", b"A", 3, 2, f2py_a, 3, f2py_s, f2py_u, 3, f2py_vt, 2, np.empty(32), 32, 0) + prik_scalars = prik_lapack.dgesvd( + "A", + "A", + np.int32(3), + np.int32(2), + prik_a, + np.int32(3), + prik_s, + prik_u, + np.int32(3), + prik_vt, + np.int32(2), + np.empty(32), + np.int32(32), + np.int32(0), + ) + f2py_result = f2py_lapack.dgesvd(b"A", b"A", 3, 2, f2py_a, f2py_s, f2py_u, f2py_vt, np.empty(32), 32, 0) scipy_u, scipy_s, scipy_vt, scipy_info = scipy_lapack.dgesvd( matrix.copy(order="F"), compute_uv=1, full_matrices=1, lwork=32 ) @@ -379,8 +443,10 @@ def test_dtbtrs_solves_triangular_band_system(prik_lapack, scipy_lapack, f2py_la expected = np.array([[1.0], [2.0]], dtype=np.float64) prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dtbtrs("U", "N", "N", 2, 1, 1, band, 2, prik_b, 2, 0) - f2py_result = f2py_lapack.dtbtrs(b"U", b"N", b"N", 2, 1, 1, band, 2, f2py_b, 2, 0) + prik_scalars = prik_lapack.dtbtrs( + "U", "N", "N", np.int32(2), np.int32(1), np.int32(1), band, np.int32(2), prik_b, np.int32(2), np.int32(0) + ) + f2py_result = f2py_lapack.dtbtrs(b"U", b"N", b"N", 2, 1, 1, band, f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dtbtrs(band, rhs.copy(order="F"), uplo=b"U", trans=b"N", diag=b"N") assert f2py_result is None @@ -400,10 +466,18 @@ def test_dgecon_estimates_reciprocal_condition(prik_lapack, scipy_lapack, f2py_l expected = 1.0 prik_scalars = prik_lapack.dgecon( - "1", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 + "1", + np.int32(1), + factor.copy(order="F"), + np.int32(1), + np.float64(4.0), + np.float64(0.0), + np.empty(4), + np.empty(1, dtype=np.int32), + np.int32(0), ) f2py_result = f2py_lapack.dgecon( - b"1", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 + b"1", 1, factor.copy(order="F"), 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 ) scipy_rcond, scipy_info = scipy_lapack.dgecon(factor.copy(order="F"), 4.0, norm=b"1") diff --git a/examples/lapack/conftest.py b/examples/lapack/conftest.py index b937c9c6d..bee593fa3 100644 --- a/examples/lapack/conftest.py +++ b/examples/lapack/conftest.py @@ -21,6 +21,9 @@ NATIVE_ROOT = EXAMPLE_ROOT / "native" BUILD_FLAGS = "-O0" FORTRAN_SUFFIXES = (".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn") +F2PY_BUILD_DEPENDENCIES = ("la_constants.f90",) +F2PY_KIND_MAP = "{'real': {'wp': 'double'}}\n" +F2PY_LINK_DEPENDENCIES = ("lapack", "blas") @dataclass(frozen=True) @@ -91,6 +94,45 @@ def _selected_source(routine: str) -> Path: return matches[0] +def _f2py_source_plan() -> tuple[Path, ...]: + """Return reviewed implementations plus their minimal compile dependency.""" + dependencies = tuple(NATIVE_ROOT / name for name in F2PY_BUILD_DEPENDENCIES) + missing_dependencies = [str(path) for path in dependencies if not path.is_file()] + if missing_dependencies: + pytest.fail(f"missing f2py build dependencies: {missing_dependencies}") + selected = tuple(_selected_source(name) for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) + return dependencies + selected + + +def _f2py_build_command(workdir: Path) -> tuple[str, ...]: + """Build only reviewed implementations and link external helper symbols.""" + module_name = "f2py_reference_lapack_example" + f2cmap = workdir / ".f2py_f2cmap" + f2cmap.write_text(F2PY_KIND_MAP, encoding="utf-8") + selected_routines = tuple(name for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) + link_dependencies = tuple(item for dependency in F2PY_LINK_DEPENDENCIES for item in ("--dep", dependency)) + return ( + sys.executable, + "-m", + "numpy.f2py", + "-c", + "-m", + module_name, + *(str(source) for source in _f2py_source_plan()), + "only:", + *selected_routines, + ":", + *link_dependencies, + "--f2cmap", + str(f2cmap), + "--build-dir", + str(workdir / "generated"), + f"--f77flags={BUILD_FLAGS}", + f"--f90flags={BUILD_FLAGS}", + f"--opt={BUILD_FLAGS}", + ) + + @pytest.fixture(scope="session") def prik_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltLapack: """Build the one complete PRIK LAPACK wrapper through the established path.""" @@ -134,27 +176,11 @@ def prik_lapack(prik_build: BuiltLapack): @pytest.fixture(scope="session") def f2py_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltLapack: - """Build one raw f2py comparison surface linked to the complete library.""" + """Build one raw f2py surface from only the reviewed implementations.""" compiler = full._compiler() workdir = tmp_path_factory.mktemp("f2py-reference-lapack-example") - shared = full._cached_native_shared_library("lapack") module_name = "f2py_reference_lapack_example" - selected_sources = tuple(_selected_source(name) for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) - command = ( - sys.executable, - "-m", - "numpy.f2py", - "-c", - "-m", - module_name, - *(str(source) for source in selected_sources), - str(shared), - "--build-dir", - str(workdir / "generated"), - f"--f77flags={BUILD_FLAGS}", - f"--f90flags={BUILD_FLAGS}", - f"--opt={BUILD_FLAGS}", - ) + command = _f2py_build_command(workdir) result = _run_build(command, workdir, compiler) return BuiltLapack( module=_import_built_module(module_name, workdir), diff --git a/examples/lapack/helpers.py b/examples/lapack/helpers.py index fdbc90155..5d5a5f458 100644 --- a/examples/lapack/helpers.py +++ b/examples/lapack/helpers.py @@ -53,6 +53,13 @@ def native_pivots(scipy_pivots: np.ndarray) -> np.ndarray: return np.asarray(scipy_pivots, dtype=np.int32) + np.int32(1) +def gfortran_logical_mask(values) -> np.ndarray: + """Represent a default-GFortran LOGICAL vector through PRIK's bool buffer ABI.""" + logical_bytes = np.zeros(len(values) * np.dtype(np.int32).itemsize, dtype=np.bool_) + logical_bytes[:: np.dtype(np.int32).itemsize] = np.asarray(values, dtype=np.bool_) + return logical_bytes + + def pivot_matrix(pivots: np.ndarray, size: int, *, one_based: bool) -> np.ndarray: """Build the row permutation represented by sequential LAPACK pivots.""" permutation = np.eye(size, dtype=np.float64) diff --git a/examples/lapack/routine_inventory.py b/examples/lapack/routine_inventory.py index aee554f1e..2cad7e845 100644 --- a/examples/lapack/routine_inventory.py +++ b/examples/lapack/routine_inventory.py @@ -447,6 +447,16 @@ "svd": "SVD/CSD reconstruction, orthogonality, or secular equation", } +F2PY_EXPORT_LIMITATIONS = { + "dgees": "NumPy f2py 2.5.1 generates an incomplete select callback declaration from the unannotated source", + "dgges": "NumPy f2py 2.5.1 generates an incomplete selctg callback declaration from the unannotated source", +} + +PRIK_ABI_ADAPTERS = { + "dtgsen": "GFortran default-LOGICAL selection storage is four bytes per element while PRIK accepts a NumPy bool buffer", + "dtrsen": "GFortran default-LOGICAL selection storage is four bytes per element while PRIK accepts a NumPy bool buffer", +} + @dataclass(frozen=True) class RoutineSpec: @@ -456,6 +466,7 @@ class RoutineSpec: source_file: str scipy_name: str prik_export: str + prik_adapter: str f2py_export: str f2py_limitation: str family: str @@ -473,13 +484,17 @@ class RoutineSpec: source_file=f"{name}.f90" if name == "dlartg" else f"{name}.f", scipy_name=name, prik_export=name, + prik_adapter=PRIK_ABI_ADAPTERS.get(name, "none"), f2py_export=name, - f2py_limitation=F2PY_NUMERICAL_LIMITATIONS.get( + f2py_limitation=F2PY_EXPORT_LIMITATIONS.get( name, - ( - "raw f2py exposes array mutation but not scalar subroutine writebacks from the intent-free source" - if name not in F2PY_FUNCTION_RESULTS - else "none" + F2PY_NUMERICAL_LIMITATIONS.get( + name, + ( + "raw f2py exposes array mutation but not scalar subroutine writebacks from the intent-free source" + if name not in F2PY_FUNCTION_RESULTS + else "none" + ), ), ), family=ROUTINE_FAMILIES[name], @@ -500,6 +515,3 @@ class RoutineSpec: ) for name in ROUTINES } - -# Populate only after a missing raw f2py export has been reproduced in CI. -F2PY_EXPORT_LIMITATIONS: dict[str, str] = {} diff --git a/examples/lapack/test_auxiliary.py b/examples/lapack/test_auxiliary.py index f5bc3db08..4f3756e21 100644 --- a/examples/lapack/test_auxiliary.py +++ b/examples/lapack/test_auxiliary.py @@ -30,8 +30,10 @@ def test_dlangb_computes_frobenius_norm_of_band_storage(prik_lapack, scipy_lapac f2py_ab = prik_ab.copy(order="F") scipy_ab = prik_ab.copy(order="F") - prik_result = prik_lapack.dlangb("F", 3, 1, 1, prik_ab, 3, np.empty(3, dtype=np.float64)) - f2py_value = f2py_lapack.dlangb(b"F", 3, 1, 1, f2py_ab, 3, np.empty(3, dtype=np.float64)) + prik_result = prik_lapack.dlangb( + "F", np.int32(3), np.int32(1), np.int32(1), prik_ab, np.int32(3), np.empty(3, dtype=np.float64) + ) + f2py_value = f2py_lapack.dlangb(b"F", 3, 1, 1, f2py_ab, np.empty(3, dtype=np.float64)) scipy_value = scipy_lapack.dlangb(b"F", 1, 1, scipy_ab) assert prik_result[1:] == (3, 1, 1, 3) @@ -45,8 +47,8 @@ def test_dlange_computes_one_norm(prik_lapack, scipy_lapack, f2py_lapack): expected = 11.0 work = np.empty(3, dtype=np.float64) - prik_result = prik_lapack.dlange("1", 3, 2, matrix.copy(order="F"), 3, work.copy()) - f2py_value = f2py_lapack.dlange(b"1", 3, 2, matrix.copy(order="F"), 3, work.copy()) + prik_result = prik_lapack.dlange("1", np.int32(3), np.int32(2), matrix.copy(order="F"), np.int32(3), work.copy()) + f2py_value = f2py_lapack.dlange(b"1", 3, 2, matrix.copy(order="F"), work.copy()) scipy_value = scipy_lapack.dlange(b"1", matrix.copy(order="F")) assert prik_result[1:] == (3, 2, 3) @@ -60,8 +62,10 @@ def test_dlantr_ignores_unused_triangle_and_unit_diagonal(prik_lapack, scipy_lap expected = float(np.sqrt(1.0 + 4.0 + 1.0 + 1.0 + 9.0 + 1.0)) work = np.empty(3, dtype=np.float64) - prik_result = prik_lapack.dlantr("F", "U", "U", 3, 3, stored.copy(order="F"), 3, work.copy()) - f2py_value = f2py_lapack.dlantr(b"F", b"U", b"U", 3, 3, stored.copy(order="F"), 3, work.copy()) + prik_result = prik_lapack.dlantr( + "F", "U", "U", np.int32(3), np.int32(3), stored.copy(order="F"), np.int32(3), work.copy() + ) + f2py_value = f2py_lapack.dlantr(b"F", b"U", b"U", 3, 3, stored.copy(order="F"), work.copy()) scipy_value = scipy_lapack.dlantr(b"F", stored.copy(order="F"), uplo=b"U", diag=b"U") assert prik_result[1:] == (3, 3, 3) @@ -78,8 +82,10 @@ def test_dlarf_applies_householder_reflector_from_left(prik_lapack, scipy_lapack expected = reflector @ original prik_c, f2py_c = column_major(original), column_major(original) - prik_scalars = prik_lapack.dlarf("L", 2, 2, vector, 1, tau, prik_c, 2, np.empty(2)) - f2py_result = f2py_lapack.dlarf(b"L", 2, 2, vector, 1, tau, f2py_c, 2, np.empty(2)) + prik_scalars = prik_lapack.dlarf( + "L", np.int32(2), np.int32(2), vector, np.int32(1), np.float64(tau), prik_c, np.int32(2), np.empty(2) + ) + f2py_result = f2py_lapack.dlarf(b"L", 2, 2, vector, 1, tau, f2py_c, np.empty(2)) scipy_c = scipy_lapack.dlarf(vector, tau, original.copy(order="F"), np.empty(2), side=b"L") assert prik_scalars == (2, 2, 1, tau, 2) @@ -94,7 +100,7 @@ def test_dlarfg_constructs_a_valid_householder_reflector(prik_lapack, scipy_lapa original_x = np.array([3.0, 0.0], dtype=np.float64) prik_x, f2py_x = original_x.copy(), original_x.copy() - prik_scalars = prik_lapack.dlarfg(3, alpha, prik_x, 1, 0.0) + prik_scalars = prik_lapack.dlarfg(np.int32(3), np.float64(alpha), prik_x, np.int32(1), np.float64(0.0)) f2py_result = f2py_lapack.dlarfg(3, alpha, f2py_x, 1, 0.0) scipy_beta, scipy_x, scipy_tau = scipy_lapack.dlarfg(3, alpha, original_x.copy()) @@ -113,7 +119,7 @@ def test_dlarfg_constructs_a_valid_householder_reflector(prik_lapack, scipy_lapa def test_dlartg_constructs_a_givens_rotation(prik_lapack, scipy_lapack, f2py_lapack): f, g = 3.0, 4.0 - prik_scalars = prik_lapack.dlartg(f, g, 0.0, 0.0, 0.0) + prik_scalars = prik_lapack.dlartg(np.float64(f), np.float64(g), np.float64(0.0), np.float64(0.0), np.float64(0.0)) f2py_result = f2py_lapack.dlartg(f, g, 0.0, 0.0, 0.0) scipy_c, scipy_s, scipy_r = scipy_lapack.dlartg(f, g) @@ -132,8 +138,10 @@ def test_dlaswp_applies_native_one_based_row_pivots(prik_lapack, scipy_lapack, f expected = original[[2, 0, 1], :] prik_a, f2py_a = column_major(original), column_major(original) - prik_scalars = prik_lapack.dlaswp(2, prik_a, 3, 1, 2, native_ipiv, 1) - f2py_result = f2py_lapack.dlaswp(2, f2py_a, 3, 1, 2, native_ipiv, 1) + prik_scalars = prik_lapack.dlaswp( + np.int32(2), prik_a, np.int32(3), np.int32(1), np.int32(2), native_ipiv, np.int32(1) + ) + f2py_result = f2py_lapack.dlaswp(2, f2py_a, 1, 2, native_ipiv, 1) scipy_a = scipy_lapack.dlaswp(original.copy(order="F"), scipy_pivots, k1=0, k2=1) assert prik_scalars == (2, 3, 1, 2, 1) diff --git a/examples/lapack/test_eigen_generalized.py b/examples/lapack/test_eigen_generalized.py index 40e45f73f..714e99517 100644 --- a/examples/lapack/test_eigen_generalized.py +++ b/examples/lapack/test_eigen_generalized.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from .helpers import assert_allclose_float64, assert_orthogonal +from .helpers import assert_allclose_float64, assert_orthogonal, gfortran_logical_mask pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] @@ -24,60 +24,35 @@ def _assert_generalized_eigenpairs(a, b, values, vectors): assert_allclose_float64(vectors.T @ b @ vectors, np.eye(2), operation_size=2) -def test_dgges_computes_generalized_real_schur_form(prik_lapack, scipy_lapack, f2py_lapack): +def test_dgges_computes_generalized_real_schur_form(prik_lapack, scipy_lapack): original_a, original_b = _generalized_problem() - prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") - prik_b, f2py_b = original_b.copy(order="F"), original_b.copy(order="F") + prik_a = original_a.copy(order="F") + prik_b = original_b.copy(order="F") prik_ar, prik_ai, prik_beta = np.empty(2), np.empty(2), np.empty(2) - f2py_ar, f2py_ai, f2py_beta = np.empty(2), np.empty(2), np.empty(2) prik_vsl, prik_vsr = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") - f2py_vsl, f2py_vsr = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") prik_scalars = prik_lapack.dgges( "V", "V", "N", - False, - 2, + np.bool_(False), + np.int32(2), prik_a, - 2, + np.int32(2), prik_b, - 2, - 0, + np.int32(2), + np.int32(0), prik_ar, prik_ai, prik_beta, prik_vsl, - 2, + np.int32(2), prik_vsr, - 2, + np.int32(2), np.empty(64), - 64, + np.int32(64), np.zeros(2, dtype=np.bool_), - 0, - ) - f2py_result = f2py_lapack.dgges( - b"V", - b"V", - b"N", - lambda _ar, _ai, _beta: 0, - 2, - f2py_a, - 2, - f2py_b, - 2, - 0, - f2py_ar, - f2py_ai, - f2py_beta, - f2py_vsl, - 2, - f2py_vsr, - 2, - np.empty(64), - 64, - np.zeros(2, dtype=np.int32), - 0, + np.int32(0), ) scipy_a, scipy_b, scipy_sdim, scipy_ar, scipy_ai, scipy_beta, scipy_vsl, scipy_vsr, _work, scipy_info = ( scipy_lapack.dgges( @@ -91,12 +66,10 @@ def test_dgges_computes_generalized_real_schur_form(prik_lapack, scipy_lapack, f ) ) - assert f2py_result is None assert prik_scalars[-1] == scipy_info == 0 assert prik_scalars[4] == scipy_sdim == 0 for s, t, ar, ai, beta, q, z in ( (prik_a, prik_b, prik_ar, prik_ai, prik_beta, prik_vsl, prik_vsr), - (f2py_a, f2py_b, f2py_ar, f2py_ai, f2py_beta, f2py_vsl, f2py_vsr), (scipy_a, scipy_b, scipy_ar, scipy_ai, scipy_beta, scipy_vsl, scipy_vsr), ): assert_orthogonal(q) @@ -117,10 +90,26 @@ def test_dggev_computes_generalized_right_eigenvectors(prik_lapack, scipy_lapack f2py_vl, f2py_vr = np.empty((1, 2), order="F"), np.empty((2, 2), order="F") prik_scalars = prik_lapack.dggev( - "N", "V", 2, prik_a, 2, prik_b, 2, prik_ar, prik_ai, prik_beta, prik_vl, 1, prik_vr, 2, np.empty(64), 64, 0 + "N", + "V", + np.int32(2), + prik_a, + np.int32(2), + prik_b, + np.int32(2), + prik_ar, + prik_ai, + prik_beta, + prik_vl, + np.int32(1), + prik_vr, + np.int32(2), + np.empty(64), + np.int32(64), + np.int32(0), ) f2py_result = f2py_lapack.dggev( - b"N", b"V", 2, f2py_a, 2, f2py_b, 2, f2py_ar, f2py_ai, f2py_beta, f2py_vl, 1, f2py_vr, 2, np.empty(64), 64, 0 + b"N", b"V", 2, f2py_a, f2py_b, f2py_ar, f2py_ai, f2py_beta, f2py_vl, f2py_vr, np.empty(64), 64, 0 ) scipy_ar, scipy_ai, scipy_beta, _vl, scipy_vr, _work, scipy_info = scipy_lapack.dggev( a.copy(order="F"), b.copy(order="F"), compute_vl=0, compute_vr=1, lwork=64 @@ -144,8 +133,10 @@ def test_dsygst_reduces_symmetric_generalized_problem(prik_lapack, scipy_lapack, expected = np.diag([2.0, 3.0]) prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") - prik_scalars = prik_lapack.dsygst(1, "U", 2, prik_a, 2, cholesky, 2, 0) - f2py_result = f2py_lapack.dsygst(1, b"U", 2, f2py_a, 2, cholesky, 2, 0) + prik_scalars = prik_lapack.dsygst( + np.int32(1), "U", np.int32(2), prik_a, np.int32(2), cholesky, np.int32(2), np.int32(0) + ) + f2py_result = f2py_lapack.dsygst(1, b"U", 2, f2py_a, cholesky, 0) scipy_a, scipy_info = scipy_lapack.dsygst(a.copy(order="F"), cholesky, itype=1, lower=0) assert f2py_result is None @@ -162,8 +153,21 @@ def test_dsygv_solves_symmetric_generalized_eigenproblem(prik_lapack, scipy_lapa prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") prik_w, f2py_w = np.empty(2), np.empty(2) - prik_scalars = prik_lapack.dsygv(1, "V", "U", 2, prik_a, 2, prik_b, 2, prik_w, np.empty(64), 64, 0) - f2py_result = f2py_lapack.dsygv(1, b"V", b"U", 2, f2py_a, 2, f2py_b, 2, f2py_w, np.empty(64), 64, 0) + prik_scalars = prik_lapack.dsygv( + np.int32(1), + "V", + "U", + np.int32(2), + prik_a, + np.int32(2), + prik_b, + np.int32(2), + prik_w, + np.empty(64), + np.int32(64), + np.int32(0), + ) + f2py_result = f2py_lapack.dsygv(1, b"V", b"U", 2, f2py_a, f2py_b, f2py_w, np.empty(64), 64, 0) scipy_w, scipy_v, scipy_info = scipy_lapack.dsygv( a.copy(order="F"), b.copy(order="F"), itype=1, jobz=b"V", uplo=b"U", lwork=64 ) @@ -182,10 +186,23 @@ def test_dsygvd_solves_divide_and_conquer_generalized_problem(prik_lapack, scipy prik_w, f2py_w = np.empty(2), np.empty(2) prik_scalars = prik_lapack.dsygvd( - 1, "V", "U", 2, prik_a, 2, prik_b, 2, prik_w, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + np.int32(1), + "V", + "U", + np.int32(2), + prik_a, + np.int32(2), + prik_b, + np.int32(2), + prik_w, + np.empty(64), + np.int32(64), + np.empty(32, dtype=np.int32), + np.int32(32), + np.int32(0), ) f2py_result = f2py_lapack.dsygvd( - 1, b"V", b"U", 2, f2py_a, 2, f2py_b, 2, f2py_w, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + 1, b"V", b"U", 2, f2py_a, f2py_b, f2py_w, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 ) scipy_w, scipy_v, scipy_info = scipy_lapack.dsygvd( a.copy(order="F"), b.copy(order="F"), itype=1, jobz=b"V", uplo=b"U", lwork=64, liwork=32 @@ -207,29 +224,29 @@ def test_dsygvx_selects_generalized_eigenpairs(prik_lapack, scipy_lapack, f2py_l prik_ifail, f2py_ifail = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) prik_scalars = prik_lapack.dsygvx( - 1, + np.int32(1), "V", "I", "U", - 2, + np.int32(2), prik_a, - 2, + np.int32(2), prik_b, - 2, - 0.0, - 0.0, - 1, - 2, - 0.0, - 0, + np.int32(2), + np.float64(0.0), + np.float64(0.0), + np.int32(1), + np.int32(2), + np.float64(0.0), + np.int32(0), prik_w, prik_z, - 2, + np.int32(2), np.empty(64), - 64, + np.int32(64), np.empty(10, dtype=np.int32), prik_ifail, - 0, + np.int32(0), ) f2py_result = f2py_lapack.dsygvx( 1, @@ -238,9 +255,7 @@ def test_dsygvx_selects_generalized_eigenpairs(prik_lapack, scipy_lapack, f2py_l b"U", 2, f2py_a, - 2, f2py_b, - 2, 0.0, 0.0, 1, @@ -249,7 +264,6 @@ def test_dsygvx_selects_generalized_eigenpairs(prik_lapack, scipy_lapack, f2py_l 0, f2py_w, f2py_z, - 2, np.empty(64), 64, np.empty(10, dtype=np.int32), @@ -279,16 +293,31 @@ def test_dtgexc_reorders_generalized_schur_blocks(prik_lapack, scipy_lapack, f2p prik_z, f2py_z = identity.copy(order="F"), identity.copy(order="F") prik_scalars = prik_lapack.dtgexc( - True, True, 2, prik_a, 2, prik_b, 2, prik_q, 2, prik_z, 2, 1, 2, np.empty(64), 64, 0 + np.bool_(True), + np.bool_(True), + np.int32(2), + prik_a, + np.int32(2), + prik_b, + np.int32(2), + prik_q, + np.int32(2), + prik_z, + np.int32(2), + np.int32(1), + np.int32(2), + np.empty(64), + np.int32(64), + np.int32(0), ) - f2py_result = f2py_lapack.dtgexc(1, 1, 2, f2py_a, 2, f2py_b, 2, f2py_q, 2, f2py_z, 2, 1, 2, np.empty(64), 64, 0) + f2py_result = f2py_lapack.dtgexc(1, 1, 2, f2py_a, f2py_b, f2py_q, f2py_z, 1, 2, np.empty(64), 64, 0) scipy_a, scipy_b, scipy_q, scipy_z, _work, scipy_info = scipy_lapack.dtgexc( a.copy(order="F"), b.copy(order="F"), identity.copy(order="F"), identity.copy(order="F"), - 0, 1, + 2, wantq=1, wantz=1, lwork=64, @@ -310,6 +339,7 @@ def test_dtgsen_reorders_selected_generalized_eigenvalue(prik_lapack, scipy_lapa a, b = _generalized_problem() identity = np.eye(2, dtype=np.float64, order="F") selection = np.array([False, True], dtype=np.bool_) + prik_selection = gfortran_logical_mask(selection) prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") prik_q, f2py_q = identity.copy(order="F"), identity.copy(order="F") @@ -319,31 +349,31 @@ def test_dtgsen_reorders_selected_generalized_eigenvalue(prik_lapack, scipy_lapa prik_dif, f2py_dif = np.empty(2), np.empty(2) prik_scalars = prik_lapack.dtgsen( - 0, - True, - True, - selection, - 2, + np.int32(0), + np.bool_(True), + np.bool_(True), + prik_selection, + np.int32(2), prik_a, - 2, + np.int32(2), prik_b, - 2, + np.int32(2), prik_ar, prik_ai, prik_beta, prik_q, - 2, + np.int32(2), prik_z, - 2, - 0, - 0.0, - 0.0, + np.int32(2), + np.int32(0), + np.float64(0.0), + np.float64(0.0), prik_dif, np.empty(64), - 64, + np.int32(64), np.empty(16, dtype=np.int32), - 16, - 0, + np.int32(16), + np.int32(0), ) f2py_result = f2py_lapack.dtgsen( 0, @@ -352,16 +382,12 @@ def test_dtgsen_reorders_selected_generalized_eigenvalue(prik_lapack, scipy_lapa selection.astype(np.int32), 2, f2py_a, - 2, f2py_b, - 2, f2py_ar, f2py_ai, f2py_beta, f2py_q, - 2, f2py_z, - 2, 0, 0.0, 0.0, @@ -413,51 +439,30 @@ def test_dtgsyl_solves_generalized_sylvester_equations(prik_lapack, scipy_lapack prik_scalars = prik_lapack.dtgsyl( "N", - 0, - 1, - 1, + np.int32(0), + np.int32(1), + np.int32(1), a, - 1, + np.int32(1), b, - 1, + np.int32(1), prik_c, - 1, + np.int32(1), d, - 1, + np.int32(1), e, - 1, + np.int32(1), prik_f, - 1, - 0.0, - 0.0, + np.int32(1), + np.float64(0.0), + np.float64(0.0), np.empty(8), - 8, + np.int32(8), np.empty(2, dtype=np.int32), - 0, + np.int32(0), ) f2py_result = f2py_lapack.dtgsyl( - b"N", - 0, - 1, - 1, - a, - 1, - b, - 1, - f2py_c, - 1, - d, - 1, - e, - 1, - f2py_f, - 1, - 0.0, - 0.0, - np.empty(8), - 8, - np.empty(2, dtype=np.int32), - 0, + b"N", 0, 1, 1, a, b, f2py_c, d, e, f2py_f, 0.0, 0.0, np.empty(8), 8, np.empty(2, dtype=np.int32), 0 ) scipy_r, scipy_l, scipy_scale, scipy_dif, scipy_info = scipy_lapack.dtgsyl( a, b, c.copy(order="F"), d, e, f.copy(order="F"), trans=b"N", ijob=0, lwork=8 diff --git a/examples/lapack/test_eigen_nonsymmetric.py b/examples/lapack/test_eigen_nonsymmetric.py index 7977204cf..c7467474d 100644 --- a/examples/lapack/test_eigen_nonsymmetric.py +++ b/examples/lapack/test_eigen_nonsymmetric.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from .helpers import assert_allclose_float64, assert_orthogonal +from .helpers import assert_allclose_float64, assert_orthogonal, gfortran_logical_mask pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] @@ -16,8 +16,10 @@ def test_dgebal_preserves_eigenvalues_while_balancing(prik_lapack, scipy_lapack, prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") prik_scale, f2py_scale = np.empty(2), np.empty(2) - prik_scalars = prik_lapack.dgebal("B", 2, prik_a, 2, 0, 0, prik_scale, 0) - f2py_result = f2py_lapack.dgebal(b"B", 2, f2py_a, 2, 0, 0, f2py_scale, 0) + prik_scalars = prik_lapack.dgebal( + "B", np.int32(2), prik_a, np.int32(2), np.int32(0), np.int32(0), prik_scale, np.int32(0) + ) + f2py_result = f2py_lapack.dgebal(b"B", 2, f2py_a, 0, 0, f2py_scale, 0) scipy_a, scipy_lo, scipy_hi, scipy_scale, scipy_info = scipy_lapack.dgebal( matrix.copy(order="F"), scale=1, permute=1 ) @@ -33,43 +35,37 @@ def test_dgebal_preserves_eigenvalues_while_balancing(prik_lapack, scipy_lapack, assert_allclose_float64(f2py_scale, scipy_scale) -def test_dgees_computes_real_schur_decomposition(prik_lapack, scipy_lapack, f2py_lapack): +def test_dgees_computes_real_schur_decomposition(prik_lapack, scipy_lapack): matrix = np.array([[1.0, 2.0], [0.0, 3.0]], dtype=np.float64, order="F") - prik_t, f2py_t = matrix.copy(order="F"), matrix.copy(order="F") + prik_t = matrix.copy(order="F") prik_wr, prik_wi = np.empty(2), np.empty(2) - f2py_wr, f2py_wi = np.empty(2), np.empty(2) - prik_vs, f2py_vs = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") + prik_vs = np.empty((2, 2), order="F") prik_scalars = prik_lapack.dgees( - "V", "N", False, 2, prik_t, 2, 0, prik_wr, prik_wi, prik_vs, 2, np.empty(64), 64, np.zeros(2, dtype=np.bool_), 0 - ) - f2py_result = f2py_lapack.dgees( - b"V", - b"N", - lambda _wr, _wi: 0, - 2, - f2py_t, - 2, - 0, - f2py_wr, - f2py_wi, - f2py_vs, - 2, + "V", + "N", + np.bool_(False), + np.int32(2), + prik_t, + np.int32(2), + np.int32(0), + prik_wr, + prik_wi, + prik_vs, + np.int32(2), np.empty(64), - 64, - np.zeros(2, dtype=np.int32), - 0, + np.int32(64), + np.zeros(2, dtype=np.bool_), + np.int32(0), ) scipy_t, scipy_sdim, scipy_wr, scipy_wi, scipy_vs, _work, scipy_info = scipy_lapack.dgees( lambda _wr, _wi: 0, matrix.copy(order="F"), compute_v=1, sort_t=0, lwork=64 ) - assert f2py_result is None assert prik_scalars[-1] == scipy_info == 0 assert prik_scalars[3] == scipy_sdim == 0 for t, vs, wr, wi in ( (prik_t, prik_vs, prik_wr, prik_wi), - (f2py_t, f2py_vs, f2py_wr, f2py_wi), (scipy_t, scipy_vs, scipy_wr, scipy_wi), ): assert_orthogonal(vs) @@ -87,11 +83,22 @@ def test_dgeev_returns_right_eigenvectors(prik_lapack, scipy_lapack, f2py_lapack f2py_vl, f2py_vr = np.empty((1, 2), order="F"), np.empty((2, 2), order="F") prik_scalars = prik_lapack.dgeev( - "N", "V", 2, prik_a, 2, prik_wr, prik_wi, prik_vl, 1, prik_vr, 2, np.empty(64), 64, 0 - ) - f2py_result = f2py_lapack.dgeev( - b"N", b"V", 2, f2py_a, 2, f2py_wr, f2py_wi, f2py_vl, 1, f2py_vr, 2, np.empty(64), 64, 0 + "N", + "V", + np.int32(2), + prik_a, + np.int32(2), + prik_wr, + prik_wi, + prik_vl, + np.int32(1), + prik_vr, + np.int32(2), + np.empty(64), + np.int32(64), + np.int32(0), ) + f2py_result = f2py_lapack.dgeev(b"N", b"V", 2, f2py_a, f2py_wr, f2py_wi, f2py_vl, f2py_vr, np.empty(64), 64, 0) scipy_wr, scipy_wi, _vl, scipy_vr, scipy_info = scipy_lapack.dgeev( matrix.copy(order="F"), compute_vl=0, compute_vr=1, lwork=64 ) @@ -109,8 +116,10 @@ def test_dgehrd_reduces_matrix_to_upper_hessenberg(prik_lapack, scipy_lapack, f2 prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") prik_tau, f2py_tau = np.empty(1), np.empty(1) - prik_scalars = prik_lapack.dgehrd(2, 1, 2, prik_a, 2, prik_tau, np.empty(64), 64, 0) - f2py_result = f2py_lapack.dgehrd(2, 1, 2, f2py_a, 2, f2py_tau, np.empty(64), 64, 0) + prik_scalars = prik_lapack.dgehrd( + np.int32(2), np.int32(1), np.int32(2), prik_a, np.int32(2), prik_tau, np.empty(64), np.int32(64), np.int32(0) + ) + f2py_result = f2py_lapack.dgehrd(2, 1, 2, f2py_a, f2py_tau, np.empty(64), 64, 0) scipy_a, scipy_tau, scipy_info = scipy_lapack.dgehrd(matrix.copy(order="F"), lo=0, hi=1, lwork=64) assert f2py_result is None @@ -129,8 +138,10 @@ def test_dorghr_forms_hessenberg_similarity_transform(prik_lapack, scipy_lapack, assert factor_info == 0 prik_q, f2py_q = factor.copy(order="F"), factor.copy(order="F") - prik_scalars = prik_lapack.dorghr(2, 1, 2, prik_q, 2, tau, np.empty(64), 64, 0) - f2py_result = f2py_lapack.dorghr(2, 1, 2, f2py_q, 2, tau, np.empty(64), 64, 0) + prik_scalars = prik_lapack.dorghr( + np.int32(2), np.int32(1), np.int32(2), prik_q, np.int32(2), tau, np.empty(64), np.int32(64), np.int32(0) + ) + f2py_result = f2py_lapack.dorghr(2, 1, 2, f2py_q, tau, np.empty(64), 64, 0) scipy_q, scipy_info = scipy_lapack.dorghr(factor.copy(order="F"), tau, lo=0, hi=1, lwork=64) assert f2py_result is None @@ -146,9 +157,11 @@ def test_dtrexc_reorders_real_schur_blocks(prik_lapack, scipy_lapack, f2py_lapac prik_t, f2py_t = schur.copy(order="F"), schur.copy(order="F") prik_q, f2py_q = identity.copy(order="F"), identity.copy(order="F") - prik_scalars = prik_lapack.dtrexc("V", 2, prik_t, 2, prik_q, 2, 1, 2, np.empty(2), 0) - f2py_result = f2py_lapack.dtrexc(b"V", 2, f2py_t, 2, f2py_q, 2, 1, 2, np.empty(2), 0) - scipy_t, scipy_q, scipy_info = scipy_lapack.dtrexc(schur.copy(order="F"), identity.copy(order="F"), 0, 1, wantq=1) + prik_scalars = prik_lapack.dtrexc( + "V", np.int32(2), prik_t, np.int32(2), prik_q, np.int32(2), np.int32(1), np.int32(2), np.empty(2), np.int32(0) + ) + f2py_result = f2py_lapack.dtrexc(b"V", 2, f2py_t, f2py_q, 1, 2, np.empty(2), 0) + scipy_t, scipy_q, scipy_info = scipy_lapack.dtrexc(schur.copy(order="F"), identity.copy(order="F"), 1, 2, wantq=1) assert f2py_result is None assert prik_scalars[-1] == scipy_info == 0 @@ -166,26 +179,27 @@ def test_dtrsen_reorders_selected_schur_eigenvalue(prik_lapack, scipy_lapack, f2 prik_wr, prik_wi = np.empty(2), np.empty(2) f2py_wr, f2py_wi = np.empty(2), np.empty(2) selection = np.array([False, True], dtype=np.bool_) + prik_selection = gfortran_logical_mask(selection) prik_scalars = prik_lapack.dtrsen( "N", "V", - selection, - 2, + prik_selection, + np.int32(2), prik_t, - 2, + np.int32(2), prik_q, - 2, + np.int32(2), prik_wr, prik_wi, - 0, - 0.0, - 0.0, + np.int32(0), + np.float64(0.0), + np.float64(0.0), np.empty(8), - 8, + np.int32(8), np.empty(2, dtype=np.int32), - 2, - 0, + np.int32(2), + np.int32(0), ) f2py_result = f2py_lapack.dtrsen( b"N", @@ -193,9 +207,7 @@ def test_dtrsen_reorders_selected_schur_eigenvalue(prik_lapack, scipy_lapack, f2 selection.astype(np.int32), 2, f2py_t, - 2, f2py_q, - 2, f2py_wr, f2py_wi, 0, @@ -236,8 +248,22 @@ def test_dtrsyl_solves_sylvester_equation(prik_lapack, scipy_lapack, f2py_lapack c = np.array([[10.0]], dtype=np.float64, order="F") prik_c, f2py_c = c.copy(order="F"), c.copy(order="F") - prik_scalars = prik_lapack.dtrsyl("N", "N", 1, 1, 1, a, 1, b, 1, prik_c, 1, 0.0, 0) - f2py_result = f2py_lapack.dtrsyl(b"N", b"N", 1, 1, 1, a, 1, b, 1, f2py_c, 1, 0.0, 0) + prik_scalars = prik_lapack.dtrsyl( + "N", + "N", + np.int32(1), + np.int32(1), + np.int32(1), + a, + np.int32(1), + b, + np.int32(1), + prik_c, + np.int32(1), + np.float64(0.0), + np.int32(0), + ) + f2py_result = f2py_lapack.dtrsyl(b"N", b"N", 1, 1, 1, a, b, f2py_c, 0.0, 0) scipy_x, scipy_scale, scipy_info = scipy_lapack.dtrsyl(a, b, c.copy(order="F"), trana=b"N", tranb=b"N", isgn=1) assert f2py_result is None diff --git a/examples/lapack/test_eigen_symmetric.py b/examples/lapack/test_eigen_symmetric.py index bebbfff66..1fde5d207 100644 --- a/examples/lapack/test_eigen_symmetric.py +++ b/examples/lapack/test_eigen_symmetric.py @@ -30,15 +30,16 @@ def test_dpteqr_diagonalizes_positive_definite_tridiagonal(prik_lapack, scipy_la prik_e, f2py_e = offdiag.copy(), offdiag.copy() prik_z, f2py_z = np.eye(2, dtype=np.float64, order="F"), np.eye(2, dtype=np.float64, order="F") - prik_scalars = prik_lapack.dpteqr("I", 2, prik_d, prik_e, prik_z, 2, np.empty(8), 0) - f2py_result = f2py_lapack.dpteqr(b"I", 2, f2py_d, f2py_e, f2py_z, 2, np.empty(8), 0) + prik_scalars = prik_lapack.dpteqr("I", np.int32(2), prik_d, prik_e, prik_z, np.int32(2), np.empty(8), np.int32(0)) + f2py_result = f2py_lapack.dpteqr(b"I", 2, f2py_d, f2py_e, f2py_z, np.empty(8), 0) scipy_d, _scipy_e, scipy_z, scipy_info = scipy_lapack.dpteqr(diagonal, offdiag, np.eye(2, order="F"), compute_z=1) assert f2py_result is None assert prik_scalars[-1] == scipy_info == 0 - _assert_eigensystem(matrix, prik_d, prik_z) - _assert_eigensystem(matrix, f2py_d, f2py_z) - _assert_eigensystem(matrix, scipy_d, scipy_z) + # DPTEQR's contract returns eigenvalues (and matching vectors) in descending order. + _assert_eigensystem(matrix, prik_d[::-1], prik_z[:, ::-1]) + _assert_eigensystem(matrix, f2py_d[::-1], f2py_z[:, ::-1]) + _assert_eigensystem(matrix, scipy_d[::-1], scipy_z[:, ::-1]) def test_dsbev_diagonalizes_symmetric_band_matrix(prik_lapack, scipy_lapack, f2py_lapack): @@ -48,8 +49,10 @@ def test_dsbev_diagonalizes_symmetric_band_matrix(prik_lapack, scipy_lapack, f2p prik_w, f2py_w = np.empty(2), np.empty(2) prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") - prik_scalars = prik_lapack.dsbev("V", "U", 2, 1, prik_ab, 2, prik_w, prik_z, 2, np.empty(6), 0) - f2py_result = f2py_lapack.dsbev(b"V", b"U", 2, 1, f2py_ab, 2, f2py_w, f2py_z, 2, np.empty(6), 0) + prik_scalars = prik_lapack.dsbev( + "V", "U", np.int32(2), np.int32(1), prik_ab, np.int32(2), prik_w, prik_z, np.int32(2), np.empty(6), np.int32(0) + ) + f2py_result = f2py_lapack.dsbev(b"V", b"U", 2, 1, f2py_ab, f2py_w, f2py_z, np.empty(6), 0) scipy_w, scipy_z, scipy_info = scipy_lapack.dsbev(band.copy(order="F"), compute_v=1, lower=0) assert f2py_result is None @@ -67,10 +70,23 @@ def test_dsbevd_diagonalizes_band_matrix_by_divide_and_conquer(prik_lapack, scip prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") prik_scalars = prik_lapack.dsbevd( - "V", "U", 2, 1, prik_ab, 2, prik_w, prik_z, 2, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + "V", + "U", + np.int32(2), + np.int32(1), + prik_ab, + np.int32(2), + prik_w, + prik_z, + np.int32(2), + np.empty(64), + np.int32(64), + np.empty(32, dtype=np.int32), + np.int32(32), + np.int32(0), ) f2py_result = f2py_lapack.dsbevd( - b"V", b"U", 2, 1, f2py_ab, 2, f2py_w, f2py_z, 2, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + b"V", b"U", 2, 1, f2py_ab, f2py_w, f2py_z, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 ) scipy_w, scipy_z, scipy_info = scipy_lapack.dsbevd(band.copy(order="F"), compute_v=1, lower=0, liwork=32) @@ -93,25 +109,25 @@ def test_dsbevx_selects_all_symmetric_band_eigenpairs(prik_lapack, scipy_lapack, "V", "A", "U", - 2, - 1, + np.int32(2), + np.int32(1), prik_ab, - 2, + np.int32(2), np.empty((2, 2), order="F"), - 2, - 0.0, - 0.0, - 1, - 2, - 0.0, - 0, + np.int32(2), + np.float64(0.0), + np.float64(0.0), + np.int32(1), + np.int32(2), + np.float64(0.0), + np.int32(0), prik_w, prik_z, - 2, + np.int32(2), np.empty(14), np.empty(10, dtype=np.int32), prik_ifail, - 0, + np.int32(0), ) f2py_result = f2py_lapack.dsbevx( b"V", @@ -120,9 +136,7 @@ def test_dsbevx_selects_all_symmetric_band_eigenpairs(prik_lapack, scipy_lapack, 2, 1, f2py_ab, - 2, np.empty((2, 2), order="F"), - 2, 0.0, 0.0, 1, @@ -131,7 +145,6 @@ def test_dsbevx_selects_all_symmetric_band_eigenpairs(prik_lapack, scipy_lapack, 0, f2py_w, f2py_z, - 2, np.empty(14), np.empty(10, dtype=np.int32), f2py_ifail, @@ -160,22 +173,22 @@ def test_dstebz_bisects_tridiagonal_eigenvalues(prik_lapack, scipy_lapack, f2py_ prik_scalars = prik_lapack.dstebz( "A", "E", - 2, - 0.0, - 0.0, - 1, - 2, - 0.0, + np.int32(2), + np.float64(0.0), + np.float64(0.0), + np.int32(1), + np.int32(2), + np.float64(0.0), diagonal, offdiag, - 0, - 0, + np.int32(0), + np.int32(0), prik_w, prik_iblock, prik_isplit, np.empty(8), np.empty(6, dtype=np.int32), - 0, + np.int32(0), ) f2py_result = f2py_lapack.dstebz( b"A", @@ -221,19 +234,19 @@ def test_dstein_computes_tridiagonal_eigenvectors(prik_lapack, scipy_lapack, f2p prik_ifail, f2py_ifail = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) prik_scalars = prik_lapack.dstein( - 2, + np.int32(2), diagonal, offdiag, - 2, + np.int32(2), values, iblock, isplit, prik_z, - 2, + np.int32(2), np.empty(10), np.empty(2, dtype=np.int32), prik_ifail, - 0, + np.int32(0), ) f2py_result = f2py_lapack.dstein( 2, @@ -244,7 +257,6 @@ def test_dstein_computes_tridiagonal_eigenvectors(prik_lapack, scipy_lapack, f2p iblock, isplit, f2py_z, - 2, np.empty(10), np.empty(2, dtype=np.int32), f2py_ifail, @@ -272,25 +284,25 @@ def test_dstemr_computes_robust_tridiagonal_eigenpairs(prik_lapack, scipy_lapack prik_scalars = prik_lapack.dstemr( "V", "A", - 2, + np.int32(2), prik_d, prik_e, - 0.0, - 0.0, - 1, - 2, - 0, + np.float64(0.0), + np.float64(0.0), + np.int32(1), + np.int32(2), + np.int32(0), prik_w, prik_z, - 2, - 2, + np.int32(2), + np.int32(2), prik_support, - True, + np.bool_(True), np.empty(128), - 128, + np.int32(128), np.empty(64, dtype=np.int32), - 64, - 0, + np.int32(64), + np.int32(0), ) f2py_result = f2py_lapack.dstemr( b"V", @@ -306,7 +318,6 @@ def test_dstemr_computes_robust_tridiagonal_eigenpairs(prik_lapack, scipy_lapack f2py_w, f2py_z, 2, - 2, f2py_support, 1, np.empty(128), @@ -321,7 +332,7 @@ def test_dstemr_computes_robust_tridiagonal_eigenpairs(prik_lapack, scipy_lapack assert f2py_result is None assert prik_scalars[-1] == scipy_info == 0 - assert prik_scalars[8] == scipy_m == 2 + assert prik_scalars[5] == scipy_m == 2 _assert_eigensystem(matrix, prik_w, prik_z) _assert_eigensystem(matrix, f2py_w, f2py_z) _assert_eigensystem(matrix, scipy_w, scipy_z) @@ -332,7 +343,7 @@ def test_dsterf_computes_tridiagonal_eigenvalues(prik_lapack, scipy_lapack, f2py prik_d, f2py_d = diagonal.copy(), diagonal.copy() prik_e, f2py_e = offdiag.copy(), offdiag.copy() - prik_scalars = prik_lapack.dsterf(2, prik_d, prik_e, 0) + prik_scalars = prik_lapack.dsterf(np.int32(2), prik_d, prik_e, np.int32(0)) f2py_result = f2py_lapack.dsterf(2, f2py_d, f2py_e, 0) scipy_values, scipy_info = scipy_lapack.dsterf(diagonal, offdiag) @@ -349,8 +360,8 @@ def test_dstev_computes_tridiagonal_eigenpairs(prik_lapack, scipy_lapack, f2py_l prik_e, f2py_e = offdiag.copy(), offdiag.copy() prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") - prik_scalars = prik_lapack.dstev("V", 2, prik_d, prik_e, prik_z, 2, np.empty(4), 0) - f2py_result = f2py_lapack.dstev(b"V", 2, f2py_d, f2py_e, f2py_z, 2, np.empty(4), 0) + prik_scalars = prik_lapack.dstev("V", np.int32(2), prik_d, prik_e, prik_z, np.int32(2), np.empty(4), np.int32(0)) + f2py_result = f2py_lapack.dstev(b"V", 2, f2py_d, f2py_e, f2py_z, np.empty(4), 0) scipy_values, scipy_z, scipy_info = scipy_lapack.dstev(diagonal, offdiag, compute_v=1) assert f2py_result is None @@ -367,10 +378,20 @@ def test_dstevd_computes_divide_and_conquer_tridiagonal_eigenpairs(prik_lapack, prik_z, f2py_z = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") prik_scalars = prik_lapack.dstevd( - "V", 2, prik_d, prik_e, prik_z, 2, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + "V", + np.int32(2), + prik_d, + prik_e, + prik_z, + np.int32(2), + np.empty(64), + np.int32(64), + np.empty(32, dtype=np.int32), + np.int32(32), + np.int32(0), ) f2py_result = f2py_lapack.dstevd( - b"V", 2, f2py_d, f2py_e, f2py_z, 2, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + b"V", 2, f2py_d, f2py_e, f2py_z, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 ) scipy_values, scipy_z, scipy_info = scipy_lapack.dstevd(diagonal, offdiag, compute_v=1, lwork=64, liwork=32) @@ -388,8 +409,10 @@ def test_dsyev_returns_orthonormal_eigenvectors(prik_lapack, scipy_lapack, f2py_ prik_w = np.empty(2, dtype=np.float64) f2py_w = np.empty(2, dtype=np.float64) - prik_scalars = prik_lapack.dsyev("V", "U", 2, prik_vectors, 2, prik_w, np.empty(16), 16, 0) - f2py_result = f2py_lapack.dsyev(b"V", b"U", 2, f2py_vectors, 2, f2py_w, np.empty(16), 16, 0) + prik_scalars = prik_lapack.dsyev( + "V", "U", np.int32(2), prik_vectors, np.int32(2), prik_w, np.empty(16), np.int32(16), np.int32(0) + ) + f2py_result = f2py_lapack.dsyev(b"V", b"U", 2, f2py_vectors, f2py_w, np.empty(16), 16, 0) scipy_w, scipy_vectors, scipy_info = scipy_lapack.dsyev(matrix.copy(order="F"), compute_v=1, lower=0, lwork=16) assert prik_scalars == (2, 2, 16, 0) @@ -411,10 +434,20 @@ def test_dsyevd_computes_divide_and_conquer_symmetric_eigenpairs(prik_lapack, sc prik_w, f2py_w = np.empty(2), np.empty(2) prik_scalars = prik_lapack.dsyevd( - "V", "U", 2, prik_a, 2, prik_w, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + "V", + "U", + np.int32(2), + prik_a, + np.int32(2), + prik_w, + np.empty(64), + np.int32(64), + np.empty(32, dtype=np.int32), + np.int32(32), + np.int32(0), ) f2py_result = f2py_lapack.dsyevd( - b"V", b"U", 2, f2py_a, 2, f2py_w, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 + b"V", b"U", 2, f2py_a, f2py_w, np.empty(64), 64, np.empty(32, dtype=np.int32), 32, 0 ) scipy_w, scipy_a, scipy_info = scipy_lapack.dsyevd( matrix.copy(order="F"), compute_v=1, lower=0, lwork=64, liwork=32 @@ -438,24 +471,24 @@ def test_dsyevr_selects_symmetric_eigenpairs_by_index(prik_lapack, scipy_lapack, "V", "I", "U", - 2, + np.int32(2), prik_a, - 2, - 0.0, - 0.0, - 1, - 2, - 0.0, - 0, + np.int32(2), + np.float64(0.0), + np.float64(0.0), + np.int32(1), + np.int32(2), + np.float64(0.0), + np.int32(0), prik_w, prik_z, - 2, + np.int32(2), prik_support, np.empty(128), - 128, + np.int32(128), np.empty(64, dtype=np.int32), - 64, - 0, + np.int32(64), + np.int32(0), ) f2py_result = f2py_lapack.dsyevr( b"V", @@ -463,7 +496,6 @@ def test_dsyevr_selects_symmetric_eigenpairs_by_index(prik_lapack, scipy_lapack, b"U", 2, f2py_a, - 2, 0.0, 0.0, 1, @@ -472,7 +504,6 @@ def test_dsyevr_selects_symmetric_eigenpairs_by_index(prik_lapack, scipy_lapack, 0, f2py_w, f2py_z, - 2, f2py_support, np.empty(128), 128, @@ -503,23 +534,23 @@ def test_dsyevx_selects_symmetric_eigenpairs_by_value(prik_lapack, scipy_lapack, "V", "V", "U", - 2, + np.int32(2), prik_a, - 2, - 1.5, - 3.5, - 1, - 2, - 0.0, - 0, + np.int32(2), + np.float64(1.5), + np.float64(3.5), + np.int32(1), + np.int32(2), + np.float64(0.0), + np.int32(0), prik_w, prik_z, - 2, + np.int32(2), np.empty(64), - 64, + np.int32(64), np.empty(10, dtype=np.int32), prik_ifail, - 0, + np.int32(0), ) f2py_result = f2py_lapack.dsyevx( b"V", @@ -527,7 +558,6 @@ def test_dsyevx_selects_symmetric_eigenpairs_by_value(prik_lapack, scipy_lapack, b"U", 2, f2py_a, - 2, 1.5, 3.5, 1, @@ -536,7 +566,6 @@ def test_dsyevx_selects_symmetric_eigenpairs_by_value(prik_lapack, scipy_lapack, 0, f2py_w, f2py_z, - 2, np.empty(64), 64, np.empty(10, dtype=np.int32), @@ -564,8 +593,10 @@ def test_dsytrd_reduces_symmetric_matrix_to_tridiagonal(prik_lapack, scipy_lapac prik_e, f2py_e = np.empty(1), np.empty(1) prik_tau, f2py_tau = np.empty(1), np.empty(1) - prik_scalars = prik_lapack.dsytrd("U", 2, prik_a, 2, prik_d, prik_e, prik_tau, np.empty(64), 64, 0) - f2py_result = f2py_lapack.dsytrd(b"U", 2, f2py_a, 2, f2py_d, f2py_e, f2py_tau, np.empty(64), 64, 0) + prik_scalars = prik_lapack.dsytrd( + "U", np.int32(2), prik_a, np.int32(2), prik_d, prik_e, prik_tau, np.empty(64), np.int32(64), np.int32(0) + ) + f2py_result = f2py_lapack.dsytrd(b"U", 2, f2py_a, f2py_d, f2py_e, f2py_tau, np.empty(64), 64, 0) scipy_a, scipy_d, scipy_e, scipy_tau, scipy_info = scipy_lapack.dsytrd(matrix.copy(order="F"), lower=0, lwork=64) assert f2py_result is None diff --git a/examples/lapack/test_least_squares.py b/examples/lapack/test_least_squares.py index 871f5ab72..f4196ebff 100644 --- a/examples/lapack/test_least_squares.py +++ b/examples/lapack/test_least_squares.py @@ -34,8 +34,20 @@ def test_dgels_solves_full_rank_least_squares(prik_lapack, scipy_lapack, f2py_la prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dgels("N", 3, 2, 1, prik_a, 3, prik_b, 3, np.empty(64), 64, 0) - f2py_result = f2py_lapack.dgels(b"N", 3, 2, 1, f2py_a, 3, f2py_b, 3, np.empty(64), 64, 0) + prik_scalars = prik_lapack.dgels( + "N", + np.int32(3), + np.int32(2), + np.int32(1), + prik_a, + np.int32(3), + prik_b, + np.int32(3), + np.empty(64), + np.int32(64), + np.int32(0), + ) + f2py_result = f2py_lapack.dgels(b"N", 3, 2, 1, f2py_a, f2py_b, np.empty(64), 64, 0) _factor, scipy_b, scipy_info = scipy_lapack.dgels(matrix.copy(order="F"), rhs.copy(order="F"), trans=b"N", lwork=64) assert f2py_result is None @@ -52,13 +64,26 @@ def test_dgelsd_solves_rank_revealing_least_squares(prik_lapack, scipy_lapack, f prik_s, f2py_s = np.empty(2), np.empty(2) prik_scalars = prik_lapack.dgelsd( - 3, 2, 1, prik_a, 3, prik_b, 3, prik_s, -1.0, 0, np.empty(128), 128, np.empty(128, dtype=np.int32), 0 + np.int32(3), + np.int32(2), + np.int32(1), + prik_a, + np.int32(3), + prik_b, + np.int32(3), + prik_s, + np.float64(-1.0), + np.int32(0), + np.empty(802), + np.int32(802), + np.empty(128, dtype=np.int32), + np.int32(0), ) f2py_result = f2py_lapack.dgelsd( - 3, 2, 1, f2py_a, 3, f2py_b, 3, f2py_s, -1.0, 0, np.empty(128), 128, np.empty(128, dtype=np.int32), 0 + 3, 2, 1, f2py_a, f2py_b, f2py_s, -1.0, 0, np.empty(802), 802, np.empty(128, dtype=np.int32), 0 ) scipy_x, scipy_s, scipy_rank, scipy_info = scipy_lapack.dgelsd( - matrix.copy(order="F"), rhs.copy(order="F"), 128, 128, cond=-1.0 + matrix.copy(order="F"), rhs.copy(order="F"), 802, 128, cond=-1.0 ) assert f2py_result is None @@ -77,8 +102,22 @@ def test_dgelss_solves_svd_least_squares(prik_lapack, scipy_lapack, f2py_lapack) prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") prik_s, f2py_s = np.empty(2), np.empty(2) - prik_scalars = prik_lapack.dgelss(3, 2, 1, prik_a, 3, prik_b, 3, prik_s, -1.0, 0, np.empty(128), 128, 0) - f2py_result = f2py_lapack.dgelss(3, 2, 1, f2py_a, 3, f2py_b, 3, f2py_s, -1.0, 0, np.empty(128), 128, 0) + prik_scalars = prik_lapack.dgelss( + np.int32(3), + np.int32(2), + np.int32(1), + prik_a, + np.int32(3), + prik_b, + np.int32(3), + prik_s, + np.float64(-1.0), + np.int32(0), + np.empty(128), + np.int32(128), + np.int32(0), + ) + f2py_result = f2py_lapack.dgelss(3, 2, 1, f2py_a, f2py_b, f2py_s, -1.0, 0, np.empty(128), 128, 0) _v, scipy_x, scipy_s, scipy_rank, _work, scipy_info = scipy_lapack.dgelss( matrix.copy(order="F"), rhs.copy(order="F"), cond=-1.0, lwork=128 ) @@ -99,8 +138,22 @@ def test_dgelsy_solves_pivoted_rank_revealing_least_squares(prik_lapack, scipy_l prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") prik_jpvt, f2py_jpvt = np.zeros(2, dtype=np.int32), np.zeros(2, dtype=np.int32) - prik_scalars = prik_lapack.dgelsy(3, 2, 1, prik_a, 3, prik_b, 3, prik_jpvt, -1.0, 0, np.empty(128), 128, 0) - f2py_result = f2py_lapack.dgelsy(3, 2, 1, f2py_a, 3, f2py_b, 3, f2py_jpvt, -1.0, 0, np.empty(128), 128, 0) + prik_scalars = prik_lapack.dgelsy( + np.int32(3), + np.int32(2), + np.int32(1), + prik_a, + np.int32(3), + prik_b, + np.int32(3), + prik_jpvt, + np.float64(-1.0), + np.int32(0), + np.empty(128), + np.int32(128), + np.int32(0), + ) + f2py_result = f2py_lapack.dgelsy(3, 2, 1, f2py_a, f2py_b, f2py_jpvt, -1.0, 0, np.empty(128), 128, 0) _v, scipy_x, scipy_jpvt, scipy_rank, scipy_info = scipy_lapack.dgelsy( matrix.copy(order="F"), rhs.copy(order="F"), np.zeros(2, dtype=np.int32), -1.0, 128 ) @@ -111,8 +164,9 @@ def test_dgelsy_solves_pivoted_rank_revealing_least_squares(prik_lapack, scipy_l for solution in (prik_b[:2], f2py_b[:2], scipy_x[:2]): assert_allclose_float64(solution, expected, operation_size=3) _assert_least_squares(matrix, rhs, solution) - np.testing.assert_array_equal(prik_jpvt, scipy_jpvt + 1) - np.testing.assert_array_equal(f2py_jpvt, scipy_jpvt + 1) + # SciPy preserves LAPACK's one-based JPVT convention for DGELSY. + np.testing.assert_array_equal(prik_jpvt, scipy_jpvt) + np.testing.assert_array_equal(f2py_jpvt, scipy_jpvt) def test_dgglse_solves_equality_constrained_least_squares(prik_lapack, scipy_lapack, f2py_lapack): @@ -124,28 +178,26 @@ def test_dgglse_solves_equality_constrained_least_squares(prik_lapack, scipy_lap prik_x, f2py_x = np.empty(2), np.empty(2) prik_scalars = prik_lapack.dgglse( - 2, - 2, - 1, + np.int32(2), + np.int32(2), + np.int32(1), matrix.copy(order="F"), - 2, + np.int32(2), constraint.copy(order="F"), - 1, + np.int32(1), target.copy(), constrained_value.copy(), prik_x, np.empty(128), - 128, - 0, + np.int32(128), + np.int32(0), ) f2py_result = f2py_lapack.dgglse( 2, 2, 1, matrix.copy(order="F"), - 2, constraint.copy(order="F"), - 1, target.copy(), constrained_value.copy(), f2py_x, diff --git a/examples/lapack/test_linear_banded_tridiagonal.py b/examples/lapack/test_linear_banded_tridiagonal.py index e5e50b65e..5b1597c02 100644 --- a/examples/lapack/test_linear_banded_tridiagonal.py +++ b/examples/lapack/test_linear_banded_tridiagonal.py @@ -25,15 +25,35 @@ def _general_tridiagonal(): return lower, diagonal, upper, rhs, expected +def _general_tridiagonal_factorization(): + lower = np.array([1.0, 1.0], dtype=np.float64) + diagonal = np.array([4.0, 3.0, 2.0], dtype=np.float64) + upper = np.array([1.0, 1.0], dtype=np.float64) + rhs = np.array([[6.0], [10.0], [8.0]], dtype=np.float64, order="F") + expected = np.array([[1.0], [2.0], [3.0]], dtype=np.float64) + return lower, diagonal, upper, rhs, expected + + def test_dgbcon_estimates_general_band_condition(prik_lapack, scipy_lapack, f2py_lapack): factor = np.array([[4.0]], dtype=np.float64, order="F") native_ipiv = np.array([1], dtype=np.int32) prik_scalars = prik_lapack.dgbcon( - "1", 1, 0, 0, factor.copy(order="F"), 1, native_ipiv, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 + "1", + np.int32(1), + np.int32(0), + np.int32(0), + factor.copy(order="F"), + np.int32(1), + native_ipiv, + np.float64(4.0), + np.float64(0.0), + np.empty(3), + np.empty(1, dtype=np.int32), + np.int32(0), ) f2py_result = f2py_lapack.dgbcon( - b"1", 1, 0, 0, factor.copy(order="F"), 1, native_ipiv, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 + b"1", 1, 0, 0, factor.copy(order="F"), native_ipiv, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 ) scipy_rcond, scipy_info = scipy_lapack.dgbcon(0, 0, factor.copy(order="F"), np.array([0], dtype=np.int32), 4.0) @@ -48,8 +68,19 @@ def test_dgbsv_solves_general_band_system(prik_lapack, scipy_lapack, f2py_lapack prik_b, f2py_b = np.array([[8.0]], order="F"), np.array([[8.0]], order="F") prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) - prik_scalars = prik_lapack.dgbsv(1, 0, 0, 1, prik_ab, 1, prik_piv, prik_b, 1, 0) - f2py_result = f2py_lapack.dgbsv(1, 0, 0, 1, f2py_ab, 1, f2py_piv, f2py_b, 1, 0) + prik_scalars = prik_lapack.dgbsv( + np.int32(1), + np.int32(0), + np.int32(0), + np.int32(1), + prik_ab, + np.int32(1), + prik_piv, + prik_b, + np.int32(1), + np.int32(0), + ) + f2py_result = f2py_lapack.dgbsv(1, 0, 0, 1, f2py_ab, f2py_piv, f2py_b, 0) scipy_lu, scipy_piv, scipy_x, scipy_info = scipy_lapack.dgbsv( 0, 0, np.array([[4.0]], order="F"), np.array([[8.0]], order="F") ) @@ -70,8 +101,10 @@ def test_dgbtrf_factorizes_general_band_matrix(prik_lapack, scipy_lapack, f2py_l prik_ab, f2py_ab = band.copy(order="F"), band.copy(order="F") prik_piv, f2py_piv = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) - prik_scalars = prik_lapack.dgbtrf(2, 2, 1, 1, prik_ab, 4, prik_piv, 0) - f2py_result = f2py_lapack.dgbtrf(2, 2, 1, 1, f2py_ab, 4, f2py_piv, 0) + prik_scalars = prik_lapack.dgbtrf( + np.int32(2), np.int32(2), np.int32(1), np.int32(1), prik_ab, np.int32(4), prik_piv, np.int32(0) + ) + f2py_result = f2py_lapack.dgbtrf(2, 2, 1, 1, f2py_ab, f2py_piv, 0) scipy_lu, scipy_piv, scipy_info = scipy_lapack.dgbtrf(band.copy(order="F"), 1, 1) assert f2py_result is None @@ -91,8 +124,20 @@ def test_dgbtrs_solves_from_general_band_lu(prik_lapack, scipy_lapack, f2py_lapa rhs = np.array([[6.0], [7.0]], dtype=np.float64, order="F") prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dgbtrs("N", 2, 1, 1, 1, scipy_lu.copy(order="F"), 4, native_ipiv, prik_b, 2, 0) - f2py_result = f2py_lapack.dgbtrs(b"N", 2, 1, 1, 1, scipy_lu.copy(order="F"), 4, native_ipiv, f2py_b, 2, 0) + prik_scalars = prik_lapack.dgbtrs( + "N", + np.int32(2), + np.int32(1), + np.int32(1), + np.int32(1), + scipy_lu.copy(order="F"), + np.int32(4), + native_ipiv, + prik_b, + np.int32(2), + np.int32(0), + ) + f2py_result = f2py_lapack.dgbtrs(b"N", 2, 1, 1, 1, scipy_lu.copy(order="F"), native_ipiv, f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dgbtrs(scipy_lu, 1, 1, rhs.copy(order="F"), scipy_piv) assert f2py_result is None @@ -103,7 +148,7 @@ def test_dgbtrs_solves_from_general_band_lu(prik_lapack, scipy_lapack, f2py_lapa def test_dgtcon_estimates_tridiagonal_condition(prik_lapack, scipy_lapack, f2py_lapack): - lower, diagonal, upper, _rhs, _expected = _general_tridiagonal() + lower, diagonal, upper, _rhs, _expected = _general_tridiagonal_factorization() scipy_dl, scipy_d, scipy_du, scipy_du2, scipy_piv, factor_info = scipy_lapack.dgttrf(lower, diagonal, upper) assert factor_info == 0 native_ipiv = native_pivots(scipy_piv) @@ -111,21 +156,21 @@ def test_dgtcon_estimates_tridiagonal_condition(prik_lapack, scipy_lapack, f2py_ prik_scalars = prik_lapack.dgtcon( "1", - 2, + np.int32(3), scipy_dl, scipy_d, scipy_du, scipy_du2, native_ipiv, - anorm, - 0.0, - np.empty(4), - np.empty(2, dtype=np.int32), - 0, + np.float64(anorm), + np.float64(0.0), + np.empty(6), + np.empty(3, dtype=np.int32), + np.int32(0), ) f2py_result = f2py_lapack.dgtcon( b"1", - 2, + 3, scipy_dl, scipy_d, scipy_du, @@ -133,15 +178,15 @@ def test_dgtcon_estimates_tridiagonal_condition(prik_lapack, scipy_lapack, f2py_ native_ipiv, anorm, 0.0, - np.empty(4), - np.empty(2, dtype=np.int32), + np.empty(6), + np.empty(3, dtype=np.int32), 0, ) scipy_rcond, scipy_info = scipy_lapack.dgtcon(scipy_dl, scipy_d, scipy_du, scipy_du2, scipy_piv, anorm) assert f2py_result is None assert prik_scalars[-1] == scipy_info == 0 - assert_allclose_float64(prik_scalars[-2], scipy_rcond, operation_size=2) + assert_allclose_float64(prik_scalars[-2], scipy_rcond, operation_size=3) assert 0.0 < scipy_rcond <= 1.0 @@ -151,8 +196,10 @@ def test_dgtsv_solves_general_tridiagonal_system(prik_lapack, scipy_lapack, f2py f2py_dl, f2py_d, f2py_du = lower.copy(), diagonal.copy(), upper.copy() prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dgtsv(2, 1, prik_dl, prik_d, prik_du, prik_b, 2, 0) - f2py_result = f2py_lapack.dgtsv(2, 1, f2py_dl, f2py_d, f2py_du, f2py_b, 2, 0) + prik_scalars = prik_lapack.dgtsv( + np.int32(2), np.int32(1), prik_dl, prik_d, prik_du, prik_b, np.int32(2), np.int32(0) + ) + f2py_result = f2py_lapack.dgtsv(2, 1, f2py_dl, f2py_d, f2py_du, f2py_b, 0) _du2, _d, _du, scipy_x, scipy_info = scipy_lapack.dgtsv(lower, diagonal, upper, rhs.copy(order="F")) assert f2py_result is None @@ -176,8 +223,8 @@ def test_dgtsvx_solves_and_bounds_tridiagonal_error(prik_lapack, scipy_lapack, f prik_scalars = prik_lapack.dgtsvx( "N", "N", - 2, - 1, + np.int32(2), + np.int32(1), lower, diagonal, upper, @@ -187,15 +234,15 @@ def test_dgtsvx_solves_and_bounds_tridiagonal_error(prik_lapack, scipy_lapack, f prik_du2, prik_piv, rhs.copy(order="F"), - 2, + np.int32(2), prik_x, - 2, - 0.0, + np.int32(2), + np.float64(0.0), prik_ferr, prik_berr, np.empty(6), np.empty(2, dtype=np.int32), - 0, + np.int32(0), ) f2py_result = f2py_lapack.dgtsvx( b"N", @@ -211,9 +258,7 @@ def test_dgtsvx_solves_and_bounds_tridiagonal_error(prik_lapack, scipy_lapack, f f2py_du2, f2py_piv, rhs.copy(order="F"), - 2, f2py_x, - 2, 0.0, f2py_ferr, f2py_berr, @@ -236,14 +281,14 @@ def test_dgtsvx_solves_and_bounds_tridiagonal_error(prik_lapack, scipy_lapack, f def test_dgttrf_factorizes_general_tridiagonal_matrix(prik_lapack, scipy_lapack, f2py_lapack): - lower, diagonal, upper, _rhs, _expected = _general_tridiagonal() + lower, diagonal, upper, _rhs, _expected = _general_tridiagonal_factorization() prik_dl, prik_d, prik_du = lower.copy(), diagonal.copy(), upper.copy() f2py_dl, f2py_d, f2py_du = lower.copy(), diagonal.copy(), upper.copy() - prik_du2, f2py_du2 = np.empty(0), np.empty(0) - prik_piv, f2py_piv = np.empty(2, dtype=np.int32), np.empty(2, dtype=np.int32) + prik_du2, f2py_du2 = np.empty(1), np.empty(1) + prik_piv, f2py_piv = np.empty(3, dtype=np.int32), np.empty(3, dtype=np.int32) - prik_scalars = prik_lapack.dgttrf(2, prik_dl, prik_d, prik_du, prik_du2, prik_piv, 0) - f2py_result = f2py_lapack.dgttrf(2, f2py_dl, f2py_d, f2py_du, f2py_du2, f2py_piv, 0) + prik_scalars = prik_lapack.dgttrf(np.int32(3), prik_dl, prik_d, prik_du, prik_du2, prik_piv, np.int32(0)) + f2py_result = f2py_lapack.dgttrf(3, f2py_dl, f2py_d, f2py_du, f2py_du2, f2py_piv, 0) scipy_dl, scipy_d, scipy_du, _scipy_du2, scipy_piv, scipy_info = scipy_lapack.dgttrf(lower, diagonal, upper) assert f2py_result is None @@ -254,26 +299,30 @@ def test_dgttrf_factorizes_general_tridiagonal_matrix(prik_lapack, scipy_lapack, assert_allclose_float64(f2py_dl, scipy_dl) assert_allclose_float64(f2py_d, scipy_d) assert_allclose_float64(f2py_du, scipy_du) - np.testing.assert_array_equal(prik_piv, native_pivots(scipy_piv)) - np.testing.assert_array_equal(f2py_piv, native_pivots(scipy_piv)) + # SciPy preserves LAPACK's one-based IPIV convention for DGTTRF. + np.testing.assert_array_equal(prik_piv, scipy_piv) + np.testing.assert_array_equal(f2py_piv, scipy_piv) def test_dgttrs_solves_from_tridiagonal_lu(prik_lapack, scipy_lapack, f2py_lapack): - lower, diagonal, upper, rhs, expected = _general_tridiagonal() + lower, diagonal, upper, rhs, expected = _general_tridiagonal_factorization() dl, d, du, du2, scipy_piv, factor_info = scipy_lapack.dgttrf(lower, diagonal, upper) assert factor_info == 0 - native_ipiv = native_pivots(scipy_piv) + # DGTTRF/DGTTRS preserve native one-based pivots across all three wrappers. + native_ipiv = scipy_piv.copy() prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dgttrs("N", 2, 1, dl, d, du, du2, native_ipiv, prik_b, 2, 0) - f2py_result = f2py_lapack.dgttrs(b"N", 2, 1, dl, d, du, du2, native_ipiv, f2py_b, 2, 0) + prik_scalars = prik_lapack.dgttrs( + "N", np.int32(3), np.int32(1), dl, d, du, du2, native_ipiv, prik_b, np.int32(3), np.int32(0) + ) + f2py_result = f2py_lapack.dgttrs(b"N", 3, 1, dl, d, du, du2, native_ipiv, f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dgttrs(dl, d, du, du2, scipy_piv, rhs.copy(order="F")) assert f2py_result is None assert prik_scalars[-1] == scipy_info == 0 - assert_allclose_float64(prik_b, expected, operation_size=2) - assert_allclose_float64(f2py_b, expected, operation_size=2) - assert_allclose_float64(scipy_x, expected, operation_size=2) + assert_allclose_float64(prik_b, expected, operation_size=3) + assert_allclose_float64(f2py_b, expected, operation_size=3) + assert_allclose_float64(scipy_x, expected, operation_size=3) def test_dpbsv_solves_positive_definite_band_system(prik_lapack, scipy_lapack, f2py_lapack): @@ -283,8 +332,10 @@ def test_dpbsv_solves_positive_definite_band_system(prik_lapack, scipy_lapack, f prik_ab, f2py_ab = band.copy(order="F"), band.copy(order="F") prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dpbsv("U", 2, 1, 1, prik_ab, 2, prik_b, 2, 0) - f2py_result = f2py_lapack.dpbsv(b"U", 2, 1, 1, f2py_ab, 2, f2py_b, 2, 0) + prik_scalars = prik_lapack.dpbsv( + "U", np.int32(2), np.int32(1), np.int32(1), prik_ab, np.int32(2), prik_b, np.int32(2), np.int32(0) + ) + f2py_result = f2py_lapack.dpbsv(b"U", 2, 1, 1, f2py_ab, f2py_b, 0) scipy_factor, scipy_x, scipy_info = scipy_lapack.dpbsv(band.copy(order="F"), rhs.copy(order="F")) assert f2py_result is None @@ -301,8 +352,8 @@ def test_dpbtrf_factorizes_positive_definite_band_matrix(prik_lapack, scipy_lapa band = symmetric_band_storage(matrix, 1, lower=False) prik_ab, f2py_ab = band.copy(order="F"), band.copy(order="F") - prik_scalars = prik_lapack.dpbtrf("U", 2, 1, prik_ab, 2, 0) - f2py_result = f2py_lapack.dpbtrf(b"U", 2, 1, f2py_ab, 2, 0) + prik_scalars = prik_lapack.dpbtrf("U", np.int32(2), np.int32(1), prik_ab, np.int32(2), np.int32(0)) + f2py_result = f2py_lapack.dpbtrf(b"U", 2, 1, f2py_ab, 0) scipy_factor, scipy_info = scipy_lapack.dpbtrf(band.copy(order="F")) assert f2py_result is None @@ -319,8 +370,10 @@ def test_dpbtrs_solves_from_positive_definite_band_factor(prik_lapack, scipy_lap rhs = np.array([[6.0], [7.0]], dtype=np.float64, order="F") prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dpbtrs("U", 2, 1, 1, factor, 2, prik_b, 2, 0) - f2py_result = f2py_lapack.dpbtrs(b"U", 2, 1, 1, factor, 2, f2py_b, 2, 0) + prik_scalars = prik_lapack.dpbtrs( + "U", np.int32(2), np.int32(1), np.int32(1), factor, np.int32(2), prik_b, np.int32(2), np.int32(0) + ) + f2py_result = f2py_lapack.dpbtrs(b"U", 2, 1, 1, factor, f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dpbtrs(factor, rhs.copy(order="F")) assert f2py_result is None @@ -337,8 +390,8 @@ def test_dptsv_solves_spd_tridiagonal_system(prik_lapack, scipy_lapack, f2py_lap prik_e, f2py_e = upper.copy(), upper.copy() prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dptsv(2, 1, prik_d, prik_e, prik_b, 2, 0) - f2py_result = f2py_lapack.dptsv(2, 1, f2py_d, f2py_e, f2py_b, 2, 0) + prik_scalars = prik_lapack.dptsv(np.int32(2), np.int32(1), prik_d, prik_e, prik_b, np.int32(2), np.int32(0)) + f2py_result = f2py_lapack.dptsv(2, 1, f2py_d, f2py_e, f2py_b, 0) _d, _e, scipy_x, scipy_info = scipy_lapack.dptsv(diagonal, upper, rhs.copy(order="F")) assert f2py_result is None @@ -358,21 +411,21 @@ def test_dptsvx_solves_and_bounds_spd_tridiagonal_error(prik_lapack, scipy_lapac prik_scalars = prik_lapack.dptsvx( "N", - 2, - 1, + np.int32(2), + np.int32(1), diagonal, offdiag, prik_df, prik_ef, rhs.copy(order="F"), - 2, + np.int32(2), prik_x, - 2, - 0.0, + np.int32(2), + np.float64(0.0), prik_ferr, prik_berr, np.empty(4), - 0, + np.int32(0), ) f2py_result = f2py_lapack.dptsvx( b"N", @@ -383,9 +436,7 @@ def test_dptsvx_solves_and_bounds_spd_tridiagonal_error(prik_lapack, scipy_lapac f2py_df, f2py_ef, rhs.copy(order="F"), - 2, f2py_x, - 2, 0.0, f2py_ferr, f2py_berr, @@ -411,7 +462,7 @@ def test_dpttrf_factorizes_spd_tridiagonal_matrix(prik_lapack, scipy_lapack, f2p prik_d, f2py_d = diagonal.copy(), diagonal.copy() prik_e, f2py_e = offdiag.copy(), offdiag.copy() - prik_scalars = prik_lapack.dpttrf(2, prik_d, prik_e, 0) + prik_scalars = prik_lapack.dpttrf(np.int32(2), prik_d, prik_e, np.int32(0)) f2py_result = f2py_lapack.dpttrf(2, f2py_d, f2py_e, 0) scipy_d, scipy_e, scipy_info = scipy_lapack.dpttrf(diagonal, offdiag) @@ -429,8 +480,8 @@ def test_dpttrs_solves_from_spd_tridiagonal_factor(prik_lapack, scipy_lapack, f2 assert factor_info == 0 prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dpttrs(2, 1, factor_d, factor_e, prik_b, 2, 0) - f2py_result = f2py_lapack.dpttrs(2, 1, factor_d, factor_e, f2py_b, 2, 0) + prik_scalars = prik_lapack.dpttrs(np.int32(2), np.int32(1), factor_d, factor_e, prik_b, np.int32(2), np.int32(0)) + f2py_result = f2py_lapack.dpttrs(2, 1, factor_d, factor_e, f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dpttrs(factor_d, factor_e, rhs.copy(order="F")) assert f2py_result is None @@ -447,8 +498,10 @@ def test_dtbtrs_solves_triangular_band_system(prik_lapack, scipy_lapack, f2py_la expected = np.array([[1.0], [2.0]], dtype=np.float64) prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dtbtrs("U", "N", "N", 2, 1, 1, band, 2, prik_b, 2, 0) - f2py_result = f2py_lapack.dtbtrs(b"U", b"N", b"N", 2, 1, 1, band, 2, f2py_b, 2, 0) + prik_scalars = prik_lapack.dtbtrs( + "U", "N", "N", np.int32(2), np.int32(1), np.int32(1), band, np.int32(2), prik_b, np.int32(2), np.int32(0) + ) + f2py_result = f2py_lapack.dtbtrs(b"U", b"N", b"N", 2, 1, 1, band, f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dtbtrs(band, rhs.copy(order="F"), uplo=b"U", trans=b"N", diag=b"N") assert f2py_result is None diff --git a/examples/lapack/test_linear_general.py b/examples/lapack/test_linear_general.py index 5e5700c44..b00058efb 100644 --- a/examples/lapack/test_linear_general.py +++ b/examples/lapack/test_linear_general.py @@ -25,10 +25,18 @@ def test_dgecon_estimates_reciprocal_condition(prik_lapack, scipy_lapack, f2py_l expected = 1.0 prik_scalars = prik_lapack.dgecon( - "1", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 + "1", + np.int32(1), + factor.copy(order="F"), + np.int32(1), + np.float64(4.0), + np.float64(0.0), + np.empty(4), + np.empty(1, dtype=np.int32), + np.int32(0), ) f2py_result = f2py_lapack.dgecon( - b"1", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 + b"1", 1, factor.copy(order="F"), 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 ) scipy_rcond, scipy_info = scipy_lapack.dgecon(factor.copy(order="F"), 4.0, norm=b"1") @@ -43,8 +51,19 @@ def test_dgeequ_computes_row_and_column_scaling(prik_lapack, scipy_lapack, f2py_ prik_r, prik_c = np.empty(1), np.empty(1) f2py_r, f2py_c = np.empty(1), np.empty(1) - prik_scalars = prik_lapack.dgeequ(1, 1, matrix.copy(order="F"), 1, prik_r, prik_c, 0.0, 0.0, 0.0, 0) - f2py_result = f2py_lapack.dgeequ(1, 1, matrix.copy(order="F"), 1, f2py_r, f2py_c, 0.0, 0.0, 0.0, 0) + prik_scalars = prik_lapack.dgeequ( + np.int32(1), + np.int32(1), + matrix.copy(order="F"), + np.int32(1), + prik_r, + prik_c, + np.float64(0.0), + np.float64(0.0), + np.float64(0.0), + np.int32(0), + ) + f2py_result = f2py_lapack.dgeequ(1, 1, matrix.copy(order="F"), f2py_r, f2py_c, 0.0, 0.0, 0.0, 0) scipy_r, scipy_c, scipy_rowcnd, scipy_colcnd, scipy_amax, scipy_info = scipy_lapack.dgeequ(matrix) assert f2py_result is None @@ -63,8 +82,19 @@ def test_dgeequb_computes_radix_scaling(prik_lapack, scipy_lapack, f2py_lapack): prik_r, prik_c = np.empty(1), np.empty(1) f2py_r, f2py_c = np.empty(1), np.empty(1) - prik_scalars = prik_lapack.dgeequb(1, 1, matrix.copy(order="F"), 1, prik_r, prik_c, 0.0, 0.0, 0.0, 0) - f2py_result = f2py_lapack.dgeequb(1, 1, matrix.copy(order="F"), 1, f2py_r, f2py_c, 0.0, 0.0, 0.0, 0) + prik_scalars = prik_lapack.dgeequb( + np.int32(1), + np.int32(1), + matrix.copy(order="F"), + np.int32(1), + prik_r, + prik_c, + np.float64(0.0), + np.float64(0.0), + np.float64(0.0), + np.int32(0), + ) + f2py_result = f2py_lapack.dgeequb(1, 1, matrix.copy(order="F"), f2py_r, f2py_c, 0.0, 0.0, 0.0, 0) scipy_r, scipy_c, scipy_rowcnd, scipy_colcnd, scipy_amax, scipy_info = scipy_lapack.dgeequb(matrix) assert f2py_result is None @@ -82,8 +112,10 @@ def test_dgesc2_solves_complete_pivot_lu_system(prik_lapack, scipy_lapack, f2py_ native_ipiv = np.array([1], dtype=np.int32) prik_rhs, f2py_rhs = np.array([8.0]), np.array([8.0]) - prik_scalars = prik_lapack.dgesc2(1, factor.copy(order="F"), 1, prik_rhs, native_ipiv, native_ipiv, 0.0) - f2py_result = f2py_lapack.dgesc2(1, factor.copy(order="F"), 1, f2py_rhs, native_ipiv, native_ipiv, 0.0) + prik_scalars = prik_lapack.dgesc2( + np.int32(1), factor.copy(order="F"), np.int32(1), prik_rhs, native_ipiv, native_ipiv, np.float64(0.0) + ) + f2py_result = f2py_lapack.dgesc2(1, factor.copy(order="F"), f2py_rhs, native_ipiv, native_ipiv, 0.0) scipy_x, scipy_scale = scipy_lapack.dgesc2( factor.copy(order="F"), np.array([8.0]), np.array([0], dtype=np.int32), np.array([0], dtype=np.int32) ) @@ -107,26 +139,26 @@ def test_dgesvx_solves_and_reports_error_bounds(prik_lapack, scipy_lapack, f2py_ prik_scalars = prik_lapack.dgesvx( "N", "N", - 1, - 1, + np.int32(1), + np.int32(1), matrix.copy(order="F"), - 1, + np.int32(1), prik_af, - 1, + np.int32(1), prik_piv, "N", np.ones(1), np.ones(1), rhs.copy(order="F"), - 1, + np.int32(1), prik_x, - 1, - 0.0, + np.int32(1), + np.float64(0.0), prik_ferr, prik_berr, np.empty(4), np.empty(1, dtype=np.int32), - 0, + np.int32(0), ) f2py_result = f2py_lapack.dgesvx( b"N", @@ -134,17 +166,13 @@ def test_dgesvx_solves_and_reports_error_bounds(prik_lapack, scipy_lapack, f2py_ 1, 1, matrix.copy(order="F"), - 1, f2py_af, - 1, f2py_piv, b"N", np.ones(1), np.ones(1), rhs.copy(order="F"), - 1, f2py_x, - 1, 0.0, f2py_ferr, f2py_berr, @@ -176,8 +204,8 @@ def test_dgetc2_factorizes_with_complete_pivoting(prik_lapack, scipy_lapack, f2p prik_ipiv, prik_jpiv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) f2py_ipiv, f2py_jpiv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) - prik_scalars = prik_lapack.dgetc2(1, prik_a, 1, prik_ipiv, prik_jpiv, 0) - f2py_result = f2py_lapack.dgetc2(1, f2py_a, 1, f2py_ipiv, f2py_jpiv, 0) + prik_scalars = prik_lapack.dgetc2(np.int32(1), prik_a, np.int32(1), prik_ipiv, prik_jpiv, np.int32(0)) + f2py_result = f2py_lapack.dgetc2(1, f2py_a, f2py_ipiv, f2py_jpiv, 0) scipy_lu, scipy_ipiv, scipy_jpiv, scipy_info = scipy_lapack.dgetc2(matrix.copy(order="F")) assert f2py_result is None @@ -194,8 +222,10 @@ def test_dgetri_inverts_lu_factorization(prik_lapack, scipy_lapack, f2py_lapack) native_ipiv = np.array([1], dtype=np.int32) prik_a, f2py_a = factor.copy(order="F"), factor.copy(order="F") - prik_scalars = prik_lapack.dgetri(1, prik_a, 1, native_ipiv, np.empty(8), 8, 0) - f2py_result = f2py_lapack.dgetri(1, f2py_a, 1, native_ipiv, np.empty(8), 8, 0) + prik_scalars = prik_lapack.dgetri( + np.int32(1), prik_a, np.int32(1), native_ipiv, np.empty(8), np.int32(8), np.int32(0) + ) + f2py_result = f2py_lapack.dgetri(1, f2py_a, native_ipiv, np.empty(8), 8, 0) scipy_inverse, scipy_info = scipy_lapack.dgetri(factor.copy(order="F"), np.array([0], dtype=np.int32), lwork=8) assert f2py_result is None @@ -215,8 +245,10 @@ def test_dgesv_solves_general_system(prik_lapack, scipy_lapack, f2py_lapack): prik_piv = np.empty(2, dtype=np.int32) f2py_piv = np.empty(2, dtype=np.int32) - prik_scalars = prik_lapack.dgesv(2, 1, prik_a, 2, prik_piv, prik_b, 2, 0) - f2py_result = f2py_lapack.dgesv(2, 1, f2py_a, 2, f2py_piv, f2py_b, 2, 0) + prik_scalars = prik_lapack.dgesv( + np.int32(2), np.int32(1), prik_a, np.int32(2), prik_piv, prik_b, np.int32(2), np.int32(0) + ) + f2py_result = f2py_lapack.dgesv(2, 1, f2py_a, f2py_piv, f2py_b, 0) scipy_lu, scipy_piv, scipy_x, scipy_info = scipy_lapack.dgesv( original_a.copy(order="F"), original_b.copy(order="F") ) @@ -245,8 +277,8 @@ def test_dgetrf_reconstructs_pivoted_lu(prik_lapack, scipy_lapack, f2py_lapack): prik_piv = np.empty(2, dtype=np.int32) f2py_piv = np.empty(2, dtype=np.int32) - prik_scalars = prik_lapack.dgetrf(2, 2, prik_a, 2, prik_piv, 0) - f2py_result = f2py_lapack.dgetrf(2, 2, f2py_a, 2, f2py_piv, 0) + prik_scalars = prik_lapack.dgetrf(np.int32(2), np.int32(2), prik_a, np.int32(2), prik_piv, np.int32(0)) + f2py_result = f2py_lapack.dgetrf(2, 2, f2py_a, f2py_piv, 0) scipy_lu, scipy_piv, scipy_info = scipy_lapack.dgetrf(original.copy(order="F")) assert prik_scalars == (2, 2, 2, 0) @@ -272,8 +304,10 @@ def test_dgetrs_solves_from_native_lu(prik_lapack, scipy_lapack, f2py_lapack): prik_lu, f2py_lu = column_major(scipy_lu), column_major(scipy_lu) prik_b, f2py_b = column_major(original_b), column_major(original_b) - prik_scalars = prik_lapack.dgetrs("N", 2, 1, prik_lu, 2, native_ipiv.copy(), prik_b, 2, 0) - f2py_result = f2py_lapack.dgetrs(b"N", 2, 1, f2py_lu, 2, native_ipiv.copy(), f2py_b, 2, 0) + prik_scalars = prik_lapack.dgetrs( + "N", np.int32(2), np.int32(1), prik_lu, np.int32(2), native_ipiv.copy(), prik_b, np.int32(2), np.int32(0) + ) + f2py_result = f2py_lapack.dgetrs(b"N", 2, 1, f2py_lu, native_ipiv.copy(), f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dgetrs(scipy_lu, scipy_piv, original_b.copy(order="F"), trans=0) assert prik_scalars == (2, 1, 2, 2, 0) diff --git a/examples/lapack/test_linear_positive_definite.py b/examples/lapack/test_linear_positive_definite.py index 68eca860b..1653e5699 100644 --- a/examples/lapack/test_linear_positive_definite.py +++ b/examples/lapack/test_linear_positive_definite.py @@ -15,8 +15,8 @@ def test_dlauum_forms_triangular_product(prik_lapack, scipy_lapack, f2py_lapack) triangular = np.array([[2.0]], dtype=np.float64, order="F") prik_a, f2py_a = triangular.copy(order="F"), triangular.copy(order="F") - prik_scalars = prik_lapack.dlauum("U", 1, prik_a, 1, 0) - f2py_result = f2py_lapack.dlauum(b"U", 1, f2py_a, 1, 0) + prik_scalars = prik_lapack.dlauum("U", np.int32(1), prik_a, np.int32(1), np.int32(0)) + f2py_result = f2py_lapack.dlauum(b"U", 1, f2py_a, 0) scipy_a, scipy_info = scipy_lapack.dlauum(triangular.copy(order="F")) assert f2py_result is None @@ -29,7 +29,7 @@ def test_dlauum_forms_triangular_product(prik_lapack, scipy_lapack, f2py_lapack) def test_dpftrf_factorizes_rfp_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): prik_a, f2py_a = np.array([4.0]), np.array([4.0]) - prik_scalars = prik_lapack.dpftrf("N", "U", 1, prik_a, 0) + prik_scalars = prik_lapack.dpftrf("N", "U", np.int32(1), prik_a, np.int32(0)) f2py_result = f2py_lapack.dpftrf(b"N", b"U", 1, f2py_a, 0) scipy_a, scipy_info = scipy_lapack.dpftrf(1, np.array([4.0]), transr=b"N", uplo=b"U") @@ -43,7 +43,7 @@ def test_dpftrf_factorizes_rfp_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack def test_dpftri_inverts_rfp_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapack): prik_a, f2py_a = np.array([2.0]), np.array([2.0]) - prik_scalars = prik_lapack.dpftri("N", "U", 1, prik_a, 0) + prik_scalars = prik_lapack.dpftri("N", "U", np.int32(1), prik_a, np.int32(0)) f2py_result = f2py_lapack.dpftri(b"N", b"U", 1, f2py_a, 0) scipy_a, scipy_info = scipy_lapack.dpftri(1, np.array([2.0]), transr=b"N", uplo=b"U") @@ -59,8 +59,8 @@ def test_dpftrs_solves_from_rfp_cholesky_factor(prik_lapack, scipy_lapack, f2py_ prik_b = np.array([[8.0]], dtype=np.float64, order="F") f2py_b = prik_b.copy(order="F") - prik_scalars = prik_lapack.dpftrs("N", "U", 1, 1, factor, prik_b, 1, 0) - f2py_result = f2py_lapack.dpftrs(b"N", b"U", 1, 1, factor, f2py_b, 1, 0) + prik_scalars = prik_lapack.dpftrs("N", "U", np.int32(1), np.int32(1), factor, prik_b, np.int32(1), np.int32(0)) + f2py_result = f2py_lapack.dpftrs(b"N", b"U", 1, 1, factor, f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dpftrs(1, factor, np.array([[8.0]], order="F")) assert f2py_result is None @@ -74,10 +74,18 @@ def test_dpocon_estimates_spd_reciprocal_condition(prik_lapack, scipy_lapack, f2 factor = np.array([[2.0]], dtype=np.float64, order="F") prik_scalars = prik_lapack.dpocon( - "U", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 + "U", + np.int32(1), + factor.copy(order="F"), + np.int32(1), + np.float64(4.0), + np.float64(0.0), + np.empty(3), + np.empty(1, dtype=np.int32), + np.int32(0), ) f2py_result = f2py_lapack.dpocon( - b"U", 1, factor.copy(order="F"), 1, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 + b"U", 1, factor.copy(order="F"), 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 ) scipy_rcond, scipy_info = scipy_lapack.dpocon(factor.copy(order="F"), 4.0, uplo=b"U") @@ -93,8 +101,10 @@ def test_dposv_solves_spd_system(prik_lapack, scipy_lapack, f2py_lapack): prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dposv("U", 1, 1, prik_a, 1, prik_b, 1, 0) - f2py_result = f2py_lapack.dposv(b"U", 1, 1, f2py_a, 1, f2py_b, 1, 0) + prik_scalars = prik_lapack.dposv( + "U", np.int32(1), np.int32(1), prik_a, np.int32(1), prik_b, np.int32(1), np.int32(0) + ) + f2py_result = f2py_lapack.dposv(b"U", 1, 1, f2py_a, f2py_b, 0) scipy_factor, scipy_x, scipy_info = scipy_lapack.dposv(matrix.copy(order="F"), rhs.copy(order="F")) assert f2py_result is None @@ -117,24 +127,24 @@ def test_dposvx_solves_and_bounds_spd_error(prik_lapack, scipy_lapack, f2py_lapa prik_scalars = prik_lapack.dposvx( "N", "U", - 1, - 1, + np.int32(1), + np.int32(1), matrix.copy(order="F"), - 1, + np.int32(1), prik_af, - 1, + np.int32(1), "N", np.ones(1), rhs.copy(order="F"), - 1, + np.int32(1), prik_x, - 1, - 0.0, + np.int32(1), + np.float64(0.0), prik_ferr, prik_berr, np.empty(3), np.empty(1, dtype=np.int32), - 0, + np.int32(0), ) f2py_result = f2py_lapack.dposvx( b"N", @@ -142,15 +152,11 @@ def test_dposvx_solves_and_bounds_spd_error(prik_lapack, scipy_lapack, f2py_lapa 1, 1, matrix.copy(order="F"), - 1, f2py_af, - 1, b"N", np.ones(1), rhs.copy(order="F"), - 1, f2py_x, - 1, 0.0, f2py_ferr, f2py_berr, @@ -179,8 +185,8 @@ def test_dpotrf_reconstructs_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): stored = np.array([[4.0, np.nan], [1.0, 3.0]], dtype=np.float64, order="F") prik_a, f2py_a = column_major(stored), column_major(stored) - prik_scalars = prik_lapack.dpotrf("L", 2, prik_a, 2, 0) - f2py_result = f2py_lapack.dpotrf(b"L", 2, f2py_a, 2, 0) + prik_scalars = prik_lapack.dpotrf("L", np.int32(2), prik_a, np.int32(2), np.int32(0)) + f2py_result = f2py_lapack.dpotrf(b"L", 2, f2py_a, 0) scipy_factor, scipy_info = scipy_lapack.dpotrf(stored.copy(order="F"), lower=1, clean=0) assert prik_scalars == (2, 2, 0) @@ -202,8 +208,8 @@ def test_dpotri_inverts_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapack): factor = np.array([[2.0]], dtype=np.float64, order="F") prik_a, f2py_a = factor.copy(order="F"), factor.copy(order="F") - prik_scalars = prik_lapack.dpotri("U", 1, prik_a, 1, 0) - f2py_result = f2py_lapack.dpotri(b"U", 1, f2py_a, 1, 0) + prik_scalars = prik_lapack.dpotri("U", np.int32(1), prik_a, np.int32(1), np.int32(0)) + f2py_result = f2py_lapack.dpotri(b"U", 1, f2py_a, 0) scipy_inverse, scipy_info = scipy_lapack.dpotri(factor.copy(order="F")) assert f2py_result is None @@ -218,8 +224,10 @@ def test_dpotrs_solves_from_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapa rhs = np.array([[8.0]], dtype=np.float64, order="F") prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dpotrs("U", 1, 1, factor.copy(order="F"), 1, prik_b, 1, 0) - f2py_result = f2py_lapack.dpotrs(b"U", 1, 1, factor.copy(order="F"), 1, f2py_b, 1, 0) + prik_scalars = prik_lapack.dpotrs( + "U", np.int32(1), np.int32(1), factor.copy(order="F"), np.int32(1), prik_b, np.int32(1), np.int32(0) + ) + f2py_result = f2py_lapack.dpotrs(b"U", 1, 1, factor.copy(order="F"), f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dpotrs(factor.copy(order="F"), rhs.copy(order="F")) assert f2py_result is None @@ -232,7 +240,16 @@ def test_dpotrs_solves_from_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapa def test_dppcon_estimates_packed_spd_condition(prik_lapack, scipy_lapack, f2py_lapack): factor = np.array([2.0]) - prik_scalars = prik_lapack.dppcon("U", 1, factor, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0) + prik_scalars = prik_lapack.dppcon( + "U", + np.int32(1), + factor, + np.float64(4.0), + np.float64(0.0), + np.empty(3), + np.empty(1, dtype=np.int32), + np.int32(0), + ) f2py_result = f2py_lapack.dppcon(b"U", 1, factor, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0) scipy_rcond, scipy_info = scipy_lapack.dppcon(1, factor, 4.0) @@ -247,8 +264,8 @@ def test_dppsv_solves_packed_spd_system(prik_lapack, scipy_lapack, f2py_lapack): prik_b = np.array([[8.0]], dtype=np.float64, order="F") f2py_b = prik_b.copy(order="F") - prik_scalars = prik_lapack.dppsv("U", 1, 1, prik_ap, prik_b, 1, 0) - f2py_result = f2py_lapack.dppsv(b"U", 1, 1, f2py_ap, f2py_b, 1, 0) + prik_scalars = prik_lapack.dppsv("U", np.int32(1), np.int32(1), prik_ap, prik_b, np.int32(1), np.int32(0)) + f2py_result = f2py_lapack.dppsv(b"U", 1, 1, f2py_ap, f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dppsv(1, np.array([4.0]), np.array([[8.0]], order="F")) assert f2py_result is None @@ -263,7 +280,7 @@ def test_dppsv_solves_packed_spd_system(prik_lapack, scipy_lapack, f2py_lapack): def test_dpptrf_factorizes_packed_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): prik_ap, f2py_ap = np.array([4.0]), np.array([4.0]) - prik_scalars = prik_lapack.dpptrf("U", 1, prik_ap, 0) + prik_scalars = prik_lapack.dpptrf("U", np.int32(1), prik_ap, np.int32(0)) f2py_result = f2py_lapack.dpptrf(b"U", 1, f2py_ap, 0) scipy_ap, scipy_info = scipy_lapack.dpptrf(1, np.array([4.0])) @@ -277,7 +294,7 @@ def test_dpptrf_factorizes_packed_spd_matrix(prik_lapack, scipy_lapack, f2py_lap def test_dpptri_inverts_packed_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapack): prik_ap, f2py_ap = np.array([2.0]), np.array([2.0]) - prik_scalars = prik_lapack.dpptri("U", 1, prik_ap, 0) + prik_scalars = prik_lapack.dpptri("U", np.int32(1), prik_ap, np.int32(0)) f2py_result = f2py_lapack.dpptri(b"U", 1, f2py_ap, 0) scipy_ap, scipy_info = scipy_lapack.dpptri(1, np.array([2.0])) @@ -293,8 +310,8 @@ def test_dpptrs_solves_from_packed_cholesky_factor(prik_lapack, scipy_lapack, f2 prik_b = np.array([[8.0]], dtype=np.float64, order="F") f2py_b = prik_b.copy(order="F") - prik_scalars = prik_lapack.dpptrs("U", 1, 1, factor, prik_b, 1, 0) - f2py_result = f2py_lapack.dpptrs(b"U", 1, 1, factor, f2py_b, 1, 0) + prik_scalars = prik_lapack.dpptrs("U", np.int32(1), np.int32(1), factor, prik_b, np.int32(1), np.int32(0)) + f2py_result = f2py_lapack.dpptrs(b"U", 1, 1, factor, f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dpptrs(1, factor, np.array([[8.0]], order="F")) assert f2py_result is None @@ -309,8 +326,10 @@ def test_dpstf2_reconstructs_pivoted_cholesky(prik_lapack, scipy_lapack, f2py_la prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) - prik_scalars = prik_lapack.dpstf2("U", 1, prik_a, 1, prik_piv, 0, -1.0, np.empty(2), 0) - f2py_result = f2py_lapack.dpstf2(b"U", 1, f2py_a, 1, f2py_piv, 0, -1.0, np.empty(2), 0) + prik_scalars = prik_lapack.dpstf2( + "U", np.int32(1), prik_a, np.int32(1), prik_piv, np.int32(0), np.float64(-1.0), np.empty(2), np.int32(0) + ) + f2py_result = f2py_lapack.dpstf2(b"U", f2py_a, f2py_piv, 0, -1.0, np.empty(2), 0) scipy_a, _scipy_piv, scipy_rank, scipy_info = scipy_lapack.dpstf2(matrix.copy(order="F")) assert f2py_result is None @@ -328,8 +347,10 @@ def test_dpstrf_reconstructs_blocked_pivoted_cholesky(prik_lapack, scipy_lapack, prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) - prik_scalars = prik_lapack.dpstrf("U", 1, prik_a, 1, prik_piv, 0, -1.0, np.empty(2), 0) - f2py_result = f2py_lapack.dpstrf(b"U", 1, f2py_a, 1, f2py_piv, 0, -1.0, np.empty(2), 0) + prik_scalars = prik_lapack.dpstrf( + "U", np.int32(1), prik_a, np.int32(1), prik_piv, np.int32(0), np.float64(-1.0), np.empty(2), np.int32(0) + ) + f2py_result = f2py_lapack.dpstrf(b"U", f2py_a, f2py_piv, 0, -1.0, np.empty(2), 0) scipy_a, _scipy_piv, scipy_rank, scipy_info = scipy_lapack.dpstrf(matrix.copy(order="F")) assert f2py_result is None @@ -347,8 +368,10 @@ def test_dsfrk_updates_spd_matrix_in_rfp_storage(prik_lapack, scipy_lapack, f2py prik_c, f2py_c = np.array([1.0]), np.array([1.0]) expected = np.array([14.0]) - prik_scalars = prik_lapack.dsfrk("N", "U", "N", 1, 2, 1.0, matrix, 1, 1.0, prik_c) - f2py_result = f2py_lapack.dsfrk(b"N", b"U", b"N", 1, 2, 1.0, matrix, 1, 1.0, f2py_c) + prik_scalars = prik_lapack.dsfrk( + "N", "U", "N", np.int32(1), np.int32(2), np.float64(1.0), matrix, np.int32(1), np.float64(1.0), prik_c + ) + f2py_result = f2py_lapack.dsfrk(b"N", b"U", b"N", 1, 2, 1.0, matrix, 1.0, f2py_c) scipy_c = scipy_lapack.dsfrk(1, 2, 1.0, matrix, 1.0, np.array([1.0])) assert f2py_result is None diff --git a/examples/lapack/test_linear_symmetric_indefinite.py b/examples/lapack/test_linear_symmetric_indefinite.py index 2acb3be71..c3bba0c96 100644 --- a/examples/lapack/test_linear_symmetric_indefinite.py +++ b/examples/lapack/test_linear_symmetric_indefinite.py @@ -20,10 +20,19 @@ def test_dsycon_estimates_symmetric_reciprocal_condition(prik_lapack, scipy_lapa factor, native_ipiv = _negative_scalar_factor() prik_scalars = prik_lapack.dsycon( - "U", 1, factor.copy(order="F"), 1, native_ipiv, 4.0, 0.0, np.empty(2), np.empty(1, dtype=np.int32), 0 + "U", + np.int32(1), + factor.copy(order="F"), + np.int32(1), + native_ipiv, + np.float64(4.0), + np.float64(0.0), + np.empty(2), + np.empty(1, dtype=np.int32), + np.int32(0), ) f2py_result = f2py_lapack.dsycon( - b"U", 1, factor.copy(order="F"), 1, native_ipiv, 4.0, 0.0, np.empty(2), np.empty(1, dtype=np.int32), 0 + b"U", 1, factor.copy(order="F"), native_ipiv, 4.0, 0.0, np.empty(2), np.empty(1, dtype=np.int32), 0 ) scipy_rcond, scipy_info = scipy_lapack.dsycon(factor.copy(order="F"), native_ipiv, 4.0) @@ -38,8 +47,8 @@ def test_dsyconv_converts_bunch_kaufman_storage(prik_lapack, scipy_lapack, f2py_ prik_a, f2py_a = factor.copy(order="F"), factor.copy(order="F") prik_e, f2py_e = np.full(1, np.nan), np.full(1, np.nan) - prik_scalars = prik_lapack.dsyconv("U", "C", 1, prik_a, 1, native_ipiv, prik_e, 0) - f2py_result = f2py_lapack.dsyconv(b"U", b"C", 1, f2py_a, 1, native_ipiv, f2py_e, 0) + prik_scalars = prik_lapack.dsyconv("U", "C", np.int32(1), prik_a, np.int32(1), native_ipiv, prik_e, np.int32(0)) + f2py_result = f2py_lapack.dsyconv(b"U", b"C", 1, f2py_a, native_ipiv, f2py_e, 0) scipy_a, scipy_e, scipy_info = scipy_lapack.dsyconv(factor.copy(order="F"), native_ipiv, lower=0, way=0) assert f2py_result is None @@ -54,8 +63,18 @@ def test_dsyequb_scales_symmetric_matrix(prik_lapack, scipy_lapack, f2py_lapack) matrix = np.array([[4.0]], dtype=np.float64, order="F") prik_s, f2py_s = np.empty(1), np.empty(1) - prik_scalars = prik_lapack.dsyequb("U", 1, matrix.copy(order="F"), 1, prik_s, 0.0, 0.0, np.empty(3), 0) - f2py_result = f2py_lapack.dsyequb(b"U", 1, matrix.copy(order="F"), 1, f2py_s, 0.0, 0.0, np.empty(3), 0) + prik_scalars = prik_lapack.dsyequb( + "U", + np.int32(1), + matrix.copy(order="F"), + np.int32(1), + prik_s, + np.float64(0.0), + np.float64(0.0), + np.empty(3), + np.int32(0), + ) + f2py_result = f2py_lapack.dsyequb(b"U", 1, matrix.copy(order="F"), f2py_s, 0.0, 0.0, np.empty(3), 0) scipy_s, scipy_scond, scipy_amax, scipy_info = scipy_lapack.dsyequb(matrix.copy(order="F")) assert f2py_result is None @@ -73,8 +92,20 @@ def test_dsysv_solves_symmetric_indefinite_system(prik_lapack, scipy_lapack, f2p prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) - prik_scalars = prik_lapack.dsysv("U", 1, 1, prik_a, 1, prik_piv, prik_b, 1, np.empty(8), 8, 0) - f2py_result = f2py_lapack.dsysv(b"U", 1, 1, f2py_a, 1, f2py_piv, f2py_b, 1, np.empty(8), 8, 0) + prik_scalars = prik_lapack.dsysv( + "U", + np.int32(1), + np.int32(1), + prik_a, + np.int32(1), + prik_piv, + prik_b, + np.int32(1), + np.empty(8), + np.int32(8), + np.int32(0), + ) + f2py_result = f2py_lapack.dsysv(b"U", 1, 1, f2py_a, f2py_piv, f2py_b, np.empty(8), 8, 0) scipy_factor, _scipy_piv, scipy_x, scipy_info = scipy_lapack.dsysv( matrix.copy(order="F"), rhs.copy(order="F"), lwork=8 ) @@ -101,24 +132,24 @@ def test_dsysvx_solves_and_bounds_symmetric_error(prik_lapack, scipy_lapack, f2p prik_scalars = prik_lapack.dsysvx( "N", "U", - 1, - 1, + np.int32(1), + np.int32(1), matrix.copy(order="F"), - 1, + np.int32(1), prik_af, - 1, + np.int32(1), prik_piv, rhs.copy(order="F"), - 1, + np.int32(1), prik_x, - 1, - 0.0, + np.int32(1), + np.float64(0.0), prik_ferr, prik_berr, np.empty(3), - 3, + np.int32(3), np.empty(1, dtype=np.int32), - 0, + np.int32(0), ) f2py_result = f2py_lapack.dsysvx( b"N", @@ -126,14 +157,10 @@ def test_dsysvx_solves_and_bounds_symmetric_error(prik_lapack, scipy_lapack, f2p 1, 1, matrix.copy(order="F"), - 1, f2py_af, - 1, f2py_piv, rhs.copy(order="F"), - 1, f2py_x, - 1, 0.0, f2py_ferr, f2py_berr, @@ -163,8 +190,8 @@ def test_dsytf2_factorizes_symmetric_indefinite_matrix(prik_lapack, scipy_lapack prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) - prik_scalars = prik_lapack.dsytf2("U", 1, prik_a, 1, prik_piv, 0) - f2py_result = f2py_lapack.dsytf2(b"U", 1, f2py_a, 1, f2py_piv, 0) + prik_scalars = prik_lapack.dsytf2("U", np.int32(1), prik_a, np.int32(1), prik_piv, np.int32(0)) + f2py_result = f2py_lapack.dsytf2(b"U", 1, f2py_a, f2py_piv, 0) scipy_factor, _scipy_piv, scipy_info = scipy_lapack.dsytf2(matrix.copy(order="F")) assert f2py_result is None @@ -181,8 +208,10 @@ def test_dsytrf_factorizes_symmetric_indefinite_matrix(prik_lapack, scipy_lapack prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") prik_piv, f2py_piv = np.empty(1, dtype=np.int32), np.empty(1, dtype=np.int32) - prik_scalars = prik_lapack.dsytrf("U", 1, prik_a, 1, prik_piv, np.empty(8), 8, 0) - f2py_result = f2py_lapack.dsytrf(b"U", 1, f2py_a, 1, f2py_piv, np.empty(8), 8, 0) + prik_scalars = prik_lapack.dsytrf( + "U", np.int32(1), prik_a, np.int32(1), prik_piv, np.empty(8), np.int32(8), np.int32(0) + ) + f2py_result = f2py_lapack.dsytrf(b"U", 1, f2py_a, f2py_piv, np.empty(8), 8, 0) scipy_factor, _scipy_piv, scipy_info = scipy_lapack.dsytrf(matrix.copy(order="F"), lwork=8) assert f2py_result is None @@ -197,8 +226,8 @@ def test_dsytri_inverts_symmetric_indefinite_factor(prik_lapack, scipy_lapack, f factor, native_ipiv = _negative_scalar_factor() prik_a, f2py_a = factor.copy(order="F"), factor.copy(order="F") - prik_scalars = prik_lapack.dsytri("U", 1, prik_a, 1, native_ipiv, np.empty(1), 0) - f2py_result = f2py_lapack.dsytri(b"U", 1, f2py_a, 1, native_ipiv, np.empty(1), 0) + prik_scalars = prik_lapack.dsytri("U", np.int32(1), prik_a, np.int32(1), native_ipiv, np.empty(1), np.int32(0)) + f2py_result = f2py_lapack.dsytri(b"U", 1, f2py_a, native_ipiv, np.empty(1), 0) scipy_inverse, scipy_info = scipy_lapack.dsytri(factor.copy(order="F"), native_ipiv) assert f2py_result is None @@ -213,8 +242,18 @@ def test_dsytrs_solves_from_symmetric_indefinite_factor(prik_lapack, scipy_lapac rhs = np.array([[8.0]], dtype=np.float64, order="F") prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dsytrs("U", 1, 1, factor.copy(order="F"), 1, native_ipiv, prik_b, 1, 0) - f2py_result = f2py_lapack.dsytrs(b"U", 1, 1, factor.copy(order="F"), 1, native_ipiv, f2py_b, 1, 0) + prik_scalars = prik_lapack.dsytrs( + "U", + np.int32(1), + np.int32(1), + factor.copy(order="F"), + np.int32(1), + native_ipiv, + prik_b, + np.int32(1), + np.int32(0), + ) + f2py_result = f2py_lapack.dsytrs(b"U", 1, 1, factor.copy(order="F"), native_ipiv, f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dsytrs(factor.copy(order="F"), native_ipiv, rhs.copy(order="F")) assert f2py_result is None diff --git a/examples/lapack/test_linear_triangular.py b/examples/lapack/test_linear_triangular.py index e0fcb2365..f79a60f47 100644 --- a/examples/lapack/test_linear_triangular.py +++ b/examples/lapack/test_linear_triangular.py @@ -26,8 +26,10 @@ def test_dtfsm_solves_with_rfp_triangular_factor(prik_lapack, scipy_lapack, f2py expected = np.array([[1.0], [2.0]], dtype=np.float64) prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dtfsm("N", "L", "U", "N", "N", 2, 1, 1.0, rfp, prik_b, 2) - f2py_result = f2py_lapack.dtfsm(b"N", b"L", b"U", b"N", b"N", 2, 1, 1.0, rfp, f2py_b, 2) + prik_scalars = prik_lapack.dtfsm( + "N", "L", "U", "N", "N", np.int32(2), np.int32(1), np.float64(1.0), rfp, prik_b, np.int32(2) + ) + f2py_result = f2py_lapack.dtfsm(b"N", b"L", b"U", b"N", b"N", 2, 1, 1.0, rfp, f2py_b) scipy_x = scipy_lapack.dtfsm( 1.0, rfp, rhs.copy(order="F"), transr=b"N", side=b"L", uplo=b"U", trans=b"N", diag=b"N" ) @@ -46,7 +48,7 @@ def test_dtfttp_converts_rfp_to_packed(prik_lapack, scipy_lapack, f2py_lapack): assert convert_info == 0 prik_ap, f2py_ap = np.empty(3), np.empty(3) - prik_scalars = prik_lapack.dtfttp("N", "U", 2, rfp, prik_ap, 0) + prik_scalars = prik_lapack.dtfttp("N", "U", np.int32(2), rfp, prik_ap, np.int32(0)) f2py_result = f2py_lapack.dtfttp(b"N", b"U", 2, rfp, f2py_ap, 0) scipy_ap, scipy_info = scipy_lapack.dtfttp(2, rfp, transr=b"N", uplo=b"U") @@ -64,8 +66,8 @@ def test_dtfttr_converts_rfp_to_full_triangular(prik_lapack, scipy_lapack, f2py_ prik_a = np.full((2, 2), np.nan, dtype=np.float64, order="F") f2py_a = prik_a.copy(order="F") - prik_scalars = prik_lapack.dtfttr("N", "U", 2, rfp, prik_a, 2, 0) - f2py_result = f2py_lapack.dtfttr(b"N", b"U", 2, rfp, f2py_a, 2, 0) + prik_scalars = prik_lapack.dtfttr("N", "U", np.int32(2), rfp, prik_a, np.int32(2), np.int32(0)) + f2py_result = f2py_lapack.dtfttr(b"N", b"U", 2, rfp, f2py_a, 0) scipy_a, scipy_info = scipy_lapack.dtfttr(2, rfp, transr=b"N", uplo=b"U") assert f2py_result is None @@ -81,7 +83,7 @@ def test_dtpttf_converts_packed_to_rfp(prik_lapack, scipy_lapack, f2py_lapack): _logical, _stored, packed = _upper_triangular() prik_rfp, f2py_rfp = np.empty(3), np.empty(3) - prik_scalars = prik_lapack.dtpttf("N", "U", 2, packed, prik_rfp, 0) + prik_scalars = prik_lapack.dtpttf("N", "U", np.int32(2), packed, prik_rfp, np.int32(0)) f2py_result = f2py_lapack.dtpttf(b"N", b"U", 2, packed, f2py_rfp, 0) scipy_rfp, scipy_info = scipy_lapack.dtpttf(2, packed, transr=b"N", uplo=b"U") @@ -96,8 +98,8 @@ def test_dtpttr_converts_packed_to_full_triangular(prik_lapack, scipy_lapack, f2 prik_a = np.full((2, 2), np.nan, dtype=np.float64, order="F") f2py_a = prik_a.copy(order="F") - prik_scalars = prik_lapack.dtpttr("U", 2, packed, prik_a, 2, 0) - f2py_result = f2py_lapack.dtpttr(b"U", 2, packed, f2py_a, 2, 0) + prik_scalars = prik_lapack.dtpttr("U", np.int32(2), packed, prik_a, np.int32(2), np.int32(0)) + f2py_result = f2py_lapack.dtpttr(b"U", 2, packed, f2py_a, 0) scipy_a, scipy_info = scipy_lapack.dtpttr(2, packed, uplo=b"U") assert f2py_result is None @@ -113,10 +115,19 @@ def test_dtrcon_estimates_triangular_reciprocal_condition(prik_lapack, scipy_lap _logical, stored, _packed = _upper_triangular() prik_scalars = prik_lapack.dtrcon( - "1", "U", "N", 2, stored.copy(order="F"), 2, 0.0, np.empty(6), np.empty(2, dtype=np.int32), 0 + "1", + "U", + "N", + np.int32(2), + stored.copy(order="F"), + np.int32(2), + np.float64(0.0), + np.empty(6), + np.empty(2, dtype=np.int32), + np.int32(0), ) f2py_result = f2py_lapack.dtrcon( - b"1", b"U", b"N", 2, stored.copy(order="F"), 2, 0.0, np.empty(6), np.empty(2, dtype=np.int32), 0 + b"1", b"U", b"N", 2, stored.copy(order="F"), 0.0, np.empty(6), np.empty(2, dtype=np.int32), 0 ) scipy_rcond, scipy_info = scipy_lapack.dtrcon(stored.copy(order="F"), norm=b"1", uplo=b"U", diag=b"N") @@ -130,8 +141,8 @@ def test_dtrtri_inverts_triangular_matrix(prik_lapack, scipy_lapack, f2py_lapack logical, stored, _packed = _upper_triangular() prik_a, f2py_a = stored.copy(order="F"), stored.copy(order="F") - prik_scalars = prik_lapack.dtrtri("U", "N", 2, prik_a, 2, 0) - f2py_result = f2py_lapack.dtrtri(b"U", b"N", 2, f2py_a, 2, 0) + prik_scalars = prik_lapack.dtrtri("U", "N", np.int32(2), prik_a, np.int32(2), np.int32(0)) + f2py_result = f2py_lapack.dtrtri(b"U", b"N", 2, f2py_a, 0) scipy_a, scipy_info = scipy_lapack.dtrtri(stored.copy(order="F"), lower=0, unitdiag=0) assert f2py_result is None @@ -147,8 +158,10 @@ def test_dtrtrs_solves_triangular_system(prik_lapack, scipy_lapack, f2py_lapack) expected = np.array([[1.0], [2.0]], dtype=np.float64) prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") - prik_scalars = prik_lapack.dtrtrs("U", "N", "N", 2, 1, stored.copy(order="F"), 2, prik_b, 2, 0) - f2py_result = f2py_lapack.dtrtrs(b"U", b"N", b"N", 2, 1, stored.copy(order="F"), 2, f2py_b, 2, 0) + prik_scalars = prik_lapack.dtrtrs( + "U", "N", "N", np.int32(2), np.int32(1), stored.copy(order="F"), np.int32(2), prik_b, np.int32(2), np.int32(0) + ) + f2py_result = f2py_lapack.dtrtrs(b"U", b"N", b"N", 2, 1, stored.copy(order="F"), f2py_b, 0) scipy_x, scipy_info = scipy_lapack.dtrtrs(stored.copy(order="F"), rhs.copy(order="F"), lower=0, trans=0, unitdiag=0) assert f2py_result is None @@ -163,8 +176,8 @@ def test_dtrttf_converts_full_triangular_to_rfp(prik_lapack, scipy_lapack, f2py_ _logical, stored, _packed = _upper_triangular() prik_rfp, f2py_rfp = np.empty(3), np.empty(3) - prik_scalars = prik_lapack.dtrttf("N", "U", 2, stored.copy(order="F"), 2, prik_rfp, 0) - f2py_result = f2py_lapack.dtrttf(b"N", b"U", 2, stored.copy(order="F"), 2, f2py_rfp, 0) + prik_scalars = prik_lapack.dtrttf("N", "U", np.int32(2), stored.copy(order="F"), np.int32(2), prik_rfp, np.int32(0)) + f2py_result = f2py_lapack.dtrttf(b"N", b"U", 2, stored.copy(order="F"), f2py_rfp, 0) scipy_rfp, scipy_info = scipy_lapack.dtrttf(stored.copy(order="F"), transr=b"N", uplo=b"U") assert f2py_result is None @@ -177,8 +190,8 @@ def test_dtrttp_converts_full_triangular_to_packed(prik_lapack, scipy_lapack, f2 _logical, stored, expected_packed = _upper_triangular() prik_ap, f2py_ap = np.empty(3), np.empty(3) - prik_scalars = prik_lapack.dtrttp("U", 2, stored.copy(order="F"), 2, prik_ap, 0) - f2py_result = f2py_lapack.dtrttp(b"U", 2, stored.copy(order="F"), 2, f2py_ap, 0) + prik_scalars = prik_lapack.dtrttp("U", np.int32(2), stored.copy(order="F"), np.int32(2), prik_ap, np.int32(0)) + f2py_result = f2py_lapack.dtrttp(b"U", 2, stored.copy(order="F"), f2py_ap, 0) scipy_ap, scipy_info = scipy_lapack.dtrttp(stored.copy(order="F"), uplo=b"U") assert f2py_result is None diff --git a/examples/lapack/test_orthogonal_factorizations.py b/examples/lapack/test_orthogonal_factorizations.py index d469062ea..9b31f85db 100644 --- a/examples/lapack/test_orthogonal_factorizations.py +++ b/examples/lapack/test_orthogonal_factorizations.py @@ -21,8 +21,23 @@ def test_dgemqrt_applies_compact_wy_reflector(prik_lapack, scipy_lapack, f2py_la expected = q @ target prik_c, f2py_c = target.copy(order="F"), target.copy(order="F") - prik_scalars = prik_lapack.dgemqrt("L", "N", 2, 1, 1, 1, factor, 2, compact_t, 1, prik_c, 2, np.empty(1), 0) - f2py_result = f2py_lapack.dgemqrt(b"L", b"N", 2, 1, 1, 1, factor, 2, compact_t, 1, f2py_c, 2, np.empty(1), 0) + prik_scalars = prik_lapack.dgemqrt( + "L", + "N", + np.int32(2), + np.int32(1), + np.int32(1), + np.int32(1), + factor, + np.int32(2), + compact_t, + np.int32(1), + prik_c, + np.int32(2), + np.empty(1), + np.int32(0), + ) + f2py_result = f2py_lapack.dgemqrt(b"L", b"N", 2, 1, 1, 1, factor, compact_t, f2py_c, np.empty(1), 0) scipy_c, scipy_info = scipy_lapack.dgemqrt(factor, compact_t, target.copy(order="F"), side=b"L", trans=b"N") assert f2py_result is None @@ -38,8 +53,10 @@ def test_dgeqp3_reconstructs_column_pivoted_qr(prik_lapack, scipy_lapack, f2py_l prik_jpvt, f2py_jpvt = np.zeros(2, dtype=np.int32), np.zeros(2, dtype=np.int32) prik_tau, f2py_tau = np.empty(2), np.empty(2) - prik_scalars = prik_lapack.dgeqp3(3, 2, prik_a, 3, prik_jpvt, prik_tau, np.empty(64), 64, 0) - f2py_result = f2py_lapack.dgeqp3(3, 2, f2py_a, 3, f2py_jpvt, f2py_tau, np.empty(64), 64, 0) + prik_scalars = prik_lapack.dgeqp3( + np.int32(3), np.int32(2), prik_a, np.int32(3), prik_jpvt, prik_tau, np.empty(64), np.int32(64), np.int32(0) + ) + f2py_result = f2py_lapack.dgeqp3(3, 2, f2py_a, f2py_jpvt, f2py_tau, np.empty(64), 64, 0) scipy_qr, scipy_jpvt, _scipy_tau, _work, scipy_info = scipy_lapack.dgeqp3(matrix.copy(order="F"), lwork=64) assert f2py_result is None @@ -50,8 +67,9 @@ def test_dgeqp3_reconstructs_column_pivoted_qr(prik_lapack, scipy_lapack, f2py_l assert_allclose_float64(q @ r, matrix[:, pivots - 1], operation_size=3) assert_allclose_float64(prik_a, scipy_qr, operation_size=3) assert_allclose_float64(f2py_a, scipy_qr, operation_size=3) - np.testing.assert_array_equal(prik_jpvt, scipy_jpvt + 1) - np.testing.assert_array_equal(f2py_jpvt, scipy_jpvt + 1) + # SciPy preserves LAPACK's one-based JPVT convention for DGEQP3. + np.testing.assert_array_equal(prik_jpvt, scipy_jpvt) + np.testing.assert_array_equal(f2py_jpvt, scipy_jpvt) def test_dgeqrf_reconstructs_qr_factorization(prik_lapack, scipy_lapack, f2py_lapack): @@ -60,8 +78,10 @@ def test_dgeqrf_reconstructs_qr_factorization(prik_lapack, scipy_lapack, f2py_la prik_tau = np.empty(2, dtype=np.float64) f2py_tau = np.empty(2, dtype=np.float64) - prik_scalars = prik_lapack.dgeqrf(3, 2, prik_a, 3, prik_tau, np.empty(16), 16, 0) - f2py_result = f2py_lapack.dgeqrf(3, 2, f2py_a, 3, f2py_tau, np.empty(16), 16, 0) + prik_scalars = prik_lapack.dgeqrf( + np.int32(3), np.int32(2), prik_a, np.int32(3), prik_tau, np.empty(16), np.int32(16), np.int32(0) + ) + f2py_result = f2py_lapack.dgeqrf(3, 2, f2py_a, f2py_tau, np.empty(16), 16, 0) scipy_qr, scipy_tau, _scipy_work, scipy_info = scipy_lapack.dgeqrf(matrix.copy(order="F"), lwork=16) assert prik_scalars == (3, 2, 3, 16, 0) @@ -83,8 +103,10 @@ def test_dgeqrfp_reconstructs_qr_with_nonnegative_diagonal(prik_lapack, scipy_la prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") prik_tau, f2py_tau = np.empty(2), np.empty(2) - prik_scalars = prik_lapack.dgeqrfp(3, 2, prik_a, 3, prik_tau, np.empty(64), 64, 0) - f2py_result = f2py_lapack.dgeqrfp(3, 2, f2py_a, 3, f2py_tau, np.empty(64), 64, 0) + prik_scalars = prik_lapack.dgeqrfp( + np.int32(3), np.int32(2), prik_a, np.int32(3), prik_tau, np.empty(64), np.int32(64), np.int32(0) + ) + f2py_result = f2py_lapack.dgeqrfp(3, 2, f2py_a, f2py_tau, np.empty(64), 64, 0) scipy_qr, scipy_tau, scipy_info = scipy_lapack.dgeqrfp(matrix.copy(order="F"), lwork=64) assert f2py_result is None @@ -101,8 +123,10 @@ def test_dgeqrt_reconstructs_compact_wy_qr(prik_lapack, scipy_lapack, f2py_lapac prik_a, f2py_a = original.copy(order="F"), original.copy(order="F") prik_t, f2py_t = np.empty((1, 1), order="F"), np.empty((1, 1), order="F") - prik_scalars = prik_lapack.dgeqrt(2, 1, 1, prik_a, 2, prik_t, 1, np.empty(1), 0) - f2py_result = f2py_lapack.dgeqrt(2, 1, 1, f2py_a, 2, f2py_t, 1, np.empty(1), 0) + prik_scalars = prik_lapack.dgeqrt( + np.int32(2), np.int32(1), np.int32(1), prik_a, np.int32(2), prik_t, np.int32(1), np.empty(1), np.int32(0) + ) + f2py_result = f2py_lapack.dgeqrt(2, 1, 1, f2py_a, f2py_t, np.empty(1), 0) scipy_a, scipy_t, scipy_info = scipy_lapack.dgeqrt(1, original.copy(order="F")) assert f2py_result is None @@ -119,8 +143,10 @@ def test_dgerqf_reconstructs_rq_factorization(prik_lapack, scipy_lapack, f2py_la prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") prik_tau, f2py_tau = np.empty(1), np.empty(1) - prik_scalars = prik_lapack.dgerqf(1, 2, prik_a, 1, prik_tau, np.empty(64), 64, 0) - f2py_result = f2py_lapack.dgerqf(1, 2, f2py_a, 1, f2py_tau, np.empty(64), 64, 0) + prik_scalars = prik_lapack.dgerqf( + np.int32(1), np.int32(2), prik_a, np.int32(1), prik_tau, np.empty(64), np.int32(64), np.int32(0) + ) + f2py_result = f2py_lapack.dgerqf(1, 2, f2py_a, f2py_tau, np.empty(64), 64, 0) scipy_rq, scipy_tau, _work, scipy_info = scipy_lapack.dgerqf(matrix.copy(order="F"), lwork=64) assert f2py_result is None @@ -138,8 +164,10 @@ def test_dorgqr_forms_explicit_orthogonal_q(prik_lapack, scipy_lapack, f2py_lapa r = np.triu(factor[:2, :]) prik_q, f2py_q = column_major(factor), column_major(factor) - prik_scalars = prik_lapack.dorgqr(3, 2, 2, prik_q, 3, tau.copy(), np.empty(16), 16, 0) - f2py_result = f2py_lapack.dorgqr(3, 2, 2, f2py_q, 3, tau.copy(), np.empty(16), 16, 0) + prik_scalars = prik_lapack.dorgqr( + np.int32(3), np.int32(2), np.int32(2), prik_q, np.int32(3), tau.copy(), np.empty(16), np.int32(16), np.int32(0) + ) + f2py_result = f2py_lapack.dorgqr(3, 2, 2, f2py_q, tau.copy(), np.empty(16), 16, 0) scipy_q, _scipy_work, scipy_info = scipy_lapack.dorgqr(factor.copy(order="F"), tau.copy(), lwork=16) assert prik_scalars == (3, 2, 2, 3, 16, 0) @@ -159,8 +187,10 @@ def test_dorgrq_forms_explicit_row_orthogonal_q(prik_lapack, scipy_lapack, f2py_ r = factor[0, 1] prik_q, f2py_q = factor.copy(order="F"), factor.copy(order="F") - prik_scalars = prik_lapack.dorgrq(1, 2, 1, prik_q, 1, tau.copy(), np.empty(64), 64, 0) - f2py_result = f2py_lapack.dorgrq(1, 2, 1, f2py_q, 1, tau.copy(), np.empty(64), 64, 0) + prik_scalars = prik_lapack.dorgrq( + np.int32(1), np.int32(2), np.int32(1), prik_q, np.int32(1), tau.copy(), np.empty(64), np.int32(64), np.int32(0) + ) + f2py_result = f2py_lapack.dorgrq(1, 2, 1, f2py_q, tau.copy(), np.empty(64), 64, 0) scipy_q, _work, scipy_info = scipy_lapack.dorgrq(factor.copy(order="F"), tau.copy(), lwork=64) assert f2py_result is None @@ -174,13 +204,28 @@ def test_dormqr_applies_qr_reflectors(prik_lapack, scipy_lapack, f2py_lapack): source = np.array([[3.0], [4.0]], dtype=np.float64, order="F") factor, tau, _work, factor_info = scipy_lapack.dgeqrf(source.copy(order="F"), lwork=64) assert factor_info == 0 - q = qr_q_from_reflectors(factor, tau) + reflector = np.array([1.0, factor[1, 0]], dtype=np.float64) + q = np.eye(2, dtype=np.float64) - tau[0] * np.outer(reflector, reflector) target = np.array([[2.0], [1.0]], dtype=np.float64, order="F") expected = q @ target prik_c, f2py_c = target.copy(order="F"), target.copy(order="F") - prik_scalars = prik_lapack.dormqr("L", "N", 2, 1, 1, factor, 2, tau, prik_c, 2, np.empty(64), 64, 0) - f2py_result = f2py_lapack.dormqr(b"L", b"N", 2, 1, 1, factor, 2, tau, f2py_c, 2, np.empty(64), 64, 0) + prik_scalars = prik_lapack.dormqr( + "L", + "N", + np.int32(2), + np.int32(1), + np.int32(1), + factor, + np.int32(2), + tau, + prik_c, + np.int32(2), + np.empty(64), + np.int32(64), + np.int32(0), + ) + f2py_result = f2py_lapack.dormqr(b"L", b"N", 2, 1, 1, factor, tau, f2py_c, np.empty(64), 64, 0) scipy_c, _work, scipy_info = scipy_lapack.dormqr(b"L", b"N", factor, tau, target.copy(order="F"), 64) assert f2py_result is None @@ -200,8 +245,23 @@ def test_dormrz_applies_rz_reflector(prik_lapack, scipy_lapack, f2py_lapack): expected = target @ z prik_c, f2py_c = target.copy(order="F"), target.copy(order="F") - prik_scalars = prik_lapack.dormrz("R", "N", 1, 2, 1, 1, factor, 1, tau, prik_c, 1, np.empty(64), 64, 0) - f2py_result = f2py_lapack.dormrz(b"R", b"N", 1, 2, 1, 1, factor, 1, tau, f2py_c, 1, np.empty(64), 64, 0) + prik_scalars = prik_lapack.dormrz( + "R", + "N", + np.int32(1), + np.int32(2), + np.int32(1), + np.int32(1), + factor, + np.int32(1), + tau, + prik_c, + np.int32(1), + np.empty(64), + np.int32(64), + np.int32(0), + ) + f2py_result = f2py_lapack.dormrz(b"R", b"N", 1, 2, 1, 1, factor, tau, f2py_c, np.empty(64), 64, 0) scipy_c, scipy_info = scipy_lapack.dormrz(factor, tau, target.copy(order="F"), side=b"R", trans=b"N", lwork=64) assert f2py_result is None @@ -225,11 +285,25 @@ def test_dtpmqrt_applies_triangular_pentagonal_reflector(prik_lapack, scipy_lapa f2py_a, f2py_b = target_a.copy(order="F"), target_b.copy(order="F") prik_scalars = prik_lapack.dtpmqrt( - "L", "N", 1, 1, 1, 0, 1, factor_b, 1, compact_t, 1, prik_a, 1, prik_b, 1, np.empty(1), 0 - ) - f2py_result = f2py_lapack.dtpmqrt( - b"L", b"N", 1, 1, 1, 0, 1, factor_b, 1, compact_t, 1, f2py_a, 1, f2py_b, 1, np.empty(1), 0 + "L", + "N", + np.int32(1), + np.int32(1), + np.int32(1), + np.int32(0), + np.int32(1), + factor_b, + np.int32(1), + compact_t, + np.int32(1), + prik_a, + np.int32(1), + prik_b, + np.int32(1), + np.empty(1), + np.int32(0), ) + f2py_result = f2py_lapack.dtpmqrt(b"L", b"N", 1, 1, 1, 0, 1, factor_b, compact_t, f2py_a, f2py_b, np.empty(1), 0) scipy_a, scipy_b, scipy_info = scipy_lapack.dtpmqrt( 0, factor_b, compact_t, target_a.copy(order="F"), target_b.copy(order="F"), side=b"L", trans=b"N" ) @@ -248,8 +322,21 @@ def test_dtpqrt_reconstructs_triangular_pentagonal_qr(prik_lapack, scipy_lapack, prik_b, f2py_b = bottom.copy(order="F"), bottom.copy(order="F") prik_t, f2py_t = np.empty((1, 1), order="F"), np.empty((1, 1), order="F") - prik_scalars = prik_lapack.dtpqrt(1, 1, 0, 1, prik_a, 1, prik_b, 1, prik_t, 1, np.empty(1), 0) - f2py_result = f2py_lapack.dtpqrt(1, 1, 0, 1, f2py_a, 1, f2py_b, 1, f2py_t, 1, np.empty(1), 0) + prik_scalars = prik_lapack.dtpqrt( + np.int32(1), + np.int32(1), + np.int32(0), + np.int32(1), + prik_a, + np.int32(1), + prik_b, + np.int32(1), + prik_t, + np.int32(1), + np.empty(1), + np.int32(0), + ) + f2py_result = f2py_lapack.dtpqrt(1, 1, 0, 1, f2py_a, f2py_b, f2py_t, np.empty(1), 0) scipy_a, scipy_b, scipy_t, scipy_info = scipy_lapack.dtpqrt(0, 1, top.copy(order="F"), bottom.copy(order="F")) assert f2py_result is None @@ -269,8 +356,10 @@ def test_dtzrzf_reconstructs_rz_factorization(prik_lapack, scipy_lapack, f2py_la prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") prik_tau, f2py_tau = np.empty(1), np.empty(1) - prik_scalars = prik_lapack.dtzrzf(1, 2, prik_a, 1, prik_tau, np.empty(64), 64, 0) - f2py_result = f2py_lapack.dtzrzf(1, 2, f2py_a, 1, f2py_tau, np.empty(64), 64, 0) + prik_scalars = prik_lapack.dtzrzf( + np.int32(1), np.int32(2), prik_a, np.int32(1), prik_tau, np.empty(64), np.int32(64), np.int32(0) + ) + f2py_result = f2py_lapack.dtzrzf(1, 2, f2py_a, f2py_tau, np.empty(64), 64, 0) scipy_a, scipy_tau, scipy_info = scipy_lapack.dtzrzf(matrix.copy(order="F"), lwork=64) assert f2py_result is None diff --git a/examples/lapack/test_routine_coverage.py b/examples/lapack/test_routine_coverage.py index 5b3ce81fe..c08809359 100644 --- a/examples/lapack/test_routine_coverage.py +++ b/examples/lapack/test_routine_coverage.py @@ -7,6 +7,13 @@ import pytest +from .conftest import ( + F2PY_BUILD_DEPENDENCIES, + F2PY_KIND_MAP, + F2PY_LINK_DEPENDENCIES, + _f2py_build_command, + _f2py_source_plan, +) from .routine_inventory import ( EXPLICIT_TEST_NAMES, EXPECTED_LAPACK_ROOT_PROCEDURES, @@ -14,6 +21,7 @@ F2PY_EXPORT_LIMITATIONS, F2PY_FUNCTION_RESULTS, F2PY_NUMERICAL_LIMITATIONS, + PRIK_ABI_ADAPTERS, ROUTINE_FAMILIES, ROUTINE_GROUPS, ROUTINE_SPECS, @@ -99,6 +107,7 @@ def test_inventory_groups_form_one_complete_partition(): spec.source_file, spec.scipy_name, spec.prik_export, + spec.prik_adapter, spec.f2py_export, spec.f2py_limitation, spec.mutation, @@ -111,6 +120,25 @@ def test_inventory_groups_form_one_complete_partition(): assert set(ROUTINES) >= F2PY_FUNCTION_RESULTS assert set(F2PY_NUMERICAL_LIMITATIONS) <= set(ROUTINES) assert set(F2PY_EXPORT_LIMITATIONS) <= set(ROUTINES) + assert set(PRIK_ABI_ADAPTERS) <= set(ROUTINES) + + +def test_f2py_source_plan_includes_required_kind_module(tmp_path: Path): + """The selected build closes dependencies without consuming PRIK's library.""" + plan = _f2py_source_plan() + dependency_count = len(F2PY_BUILD_DEPENDENCIES) + assert tuple(path.name for path in plan[:dependency_count]) == F2PY_BUILD_DEPENDENCIES + assert {path.stem for path in plan[dependency_count:]} == set(ROUTINES) - set(F2PY_EXPORT_LIMITATIONS) + assert len(plan) == dependency_count + len(ROUTINES) - len(F2PY_EXPORT_LIMITATIONS) + assert F2PY_KIND_MAP == "{'real': {'wp': 'double'}}\n" + + command = _f2py_build_command(tmp_path) + dependency_values = tuple(command[index + 1] for index, value in enumerate(command) if value == "--dep") + assert dependency_values == F2PY_LINK_DEPENDENCIES + assert "only:" in command + assert ":" in command + assert not any("libprik_full_lapack" in value for value in command) + assert (tmp_path / ".f2py_f2cmap").read_text(encoding="utf-8") == F2PY_KIND_MAP def test_authoritative_native_source_boundary_is_complete_and_unique(): @@ -137,11 +165,13 @@ def test_selected_routines_have_one_explicit_named_test(): def test_selected_tests_keep_all_wrapper_calls_visible(): - """A named test only counts when it directly invokes all three surfaces.""" - expected_surfaces = {"prik_lapack", "scipy_lapack", "f2py_lapack"} + """Named tests invoke every available surface without hiding calls.""" owners = _explicit_test_owners() missing = {} for routine, [(test_name, path)] in owners.items(): + expected_surfaces = {"prik_lapack", "scipy_lapack"} + if routine not in F2PY_EXPORT_LIMITATIONS: + expected_surfaces.add("f2py_lapack") visible = _visible_wrapper_calls(path, test_name, routine) if visible != expected_surfaces: missing[routine] = sorted(expected_surfaces - visible) @@ -159,8 +189,11 @@ def test_documented_coverage_totals_match_inventory(): "PRIK exports required in CI": len(ROUTINES), "SciPy exports used": len(ROUTINES), "f2py exports required in CI": len(ROUTINES) - len(F2PY_EXPORT_LIMITATIONS), - "Routines satisfying the independent oracle through f2py": len(ROUTINES) - len(F2PY_NUMERICAL_LIMITATIONS), + "Routines satisfying the independent oracle through f2py": len(ROUTINES) + - len(set(F2PY_EXPORT_LIMITATIONS) | set(F2PY_NUMERICAL_LIMITATIONS)), + "Documented raw-f2py export limitations": len(F2PY_EXPORT_LIMITATIONS), "Documented raw-f2py numerical projection limitations": len(F2PY_NUMERICAL_LIMITATIONS), + "Documented PRIK default-LOGICAL ABI adapters": len(PRIK_ABI_ADAPTERS), "Documented unsupported/skipped routines": 0, } for label, count in expected_rows.items(): diff --git a/examples/lapack/test_svd.py b/examples/lapack/test_svd.py index bbe429cb3..b73603fbb 100644 --- a/examples/lapack/test_svd.py +++ b/examples/lapack/test_svd.py @@ -25,19 +25,19 @@ def test_dgejsv_reconstructs_matrix_with_jacobi_svd(prik_lapack, scipy_lapack, f "N", "N", "N", - 2, - 2, + np.int32(2), + np.int32(2), prik_a, - 2, + np.int32(2), prik_s, prik_u, - 2, + np.int32(2), prik_v, - 2, + np.int32(2), np.empty(128), - 128, + np.int32(128), np.empty(16, dtype=np.int32), - 0, + np.int32(0), ) f2py_result = f2py_lapack.dgejsv( b"A", @@ -47,16 +47,11 @@ def test_dgejsv_reconstructs_matrix_with_jacobi_svd(prik_lapack, scipy_lapack, f b"N", b"N", 2, - 2, f2py_a, - 2, f2py_s, f2py_u, - 2, f2py_v, - 2, np.empty(128), - 128, np.empty(16, dtype=np.int32), 0, ) @@ -81,10 +76,23 @@ def test_dgesdd_reconstructs_matrix_with_divide_and_conquer_svd(prik_lapack, sci prik_vt, f2py_vt = np.empty((2, 2), order="F"), np.empty((2, 2), order="F") prik_scalars = prik_lapack.dgesdd( - "A", 3, 2, prik_a, 3, prik_s, prik_u, 3, prik_vt, 2, np.empty(128), 128, np.empty(16, dtype=np.int32), 0 + "A", + np.int32(3), + np.int32(2), + prik_a, + np.int32(3), + prik_s, + prik_u, + np.int32(3), + prik_vt, + np.int32(2), + np.empty(128), + np.int32(128), + np.empty(16, dtype=np.int32), + np.int32(0), ) f2py_result = f2py_lapack.dgesdd( - b"A", 3, 2, f2py_a, 3, f2py_s, f2py_u, 3, f2py_vt, 2, np.empty(128), 128, np.empty(16, dtype=np.int32), 0 + b"A", 3, 2, f2py_a, f2py_s, f2py_u, f2py_vt, np.empty(128), 128, np.empty(16, dtype=np.int32), 0 ) scipy_u, scipy_s, scipy_vt, scipy_info = scipy_lapack.dgesdd( matrix.copy(order="F"), compute_uv=1, full_matrices=1, lwork=128 @@ -107,8 +115,23 @@ def test_dgesvd_reconstructs_matrix(prik_lapack, scipy_lapack, f2py_lapack): prik_u, f2py_u = column_major(np.zeros((3, 3))), column_major(np.zeros((3, 3))) prik_vt, f2py_vt = column_major(np.zeros((2, 2))), column_major(np.zeros((2, 2))) - prik_scalars = prik_lapack.dgesvd("A", "A", 3, 2, prik_a, 3, prik_s, prik_u, 3, prik_vt, 2, np.empty(32), 32, 0) - f2py_result = f2py_lapack.dgesvd(b"A", b"A", 3, 2, f2py_a, 3, f2py_s, f2py_u, 3, f2py_vt, 2, np.empty(32), 32, 0) + prik_scalars = prik_lapack.dgesvd( + "A", + "A", + np.int32(3), + np.int32(2), + prik_a, + np.int32(3), + prik_s, + prik_u, + np.int32(3), + prik_vt, + np.int32(2), + np.empty(32), + np.int32(32), + np.int32(0), + ) + f2py_result = f2py_lapack.dgesvd(b"A", b"A", 3, 2, f2py_a, f2py_s, f2py_u, f2py_vt, np.empty(32), 32, 0) scipy_u, scipy_s, scipy_vt, scipy_info = scipy_lapack.dgesvd( matrix.copy(order="F"), compute_uv=1, full_matrices=1, lwork=32 ) @@ -147,30 +170,30 @@ def test_dorcsd_decomposes_partitioned_orthogonal_matrix(prik_lapack, scipy_lapa "Y", "N", "O", - 2, - 1, - 1, + np.int32(2), + np.int32(1), + np.int32(1), prik_blocks[0], - 1, + np.int32(1), prik_blocks[1], - 1, + np.int32(1), prik_blocks[2], - 1, + np.int32(1), prik_blocks[3], - 1, + np.int32(1), prik_theta, prik_u1, - 1, + np.int32(1), prik_u2, - 1, + np.int32(1), prik_v1t, - 1, + np.int32(1), prik_v2t, - 1, + np.int32(1), np.empty(128), - 128, + np.int32(128), np.empty(16, dtype=np.int32), - 0, + np.int32(0), ) f2py_result = f2py_lapack.dorcsd( b"Y", @@ -183,22 +206,14 @@ def test_dorcsd_decomposes_partitioned_orthogonal_matrix(prik_lapack, scipy_lapa 1, 1, f2py_blocks[0], - 1, f2py_blocks[1], - 1, f2py_blocks[2], - 1, f2py_blocks[3], - 1, f2py_theta, f2py_u1, - 1, f2py_u2, - 1, f2py_v1t, - 1, f2py_v2t, - 1, np.empty(128), 128, np.empty(16, dtype=np.int32), @@ -229,7 +244,9 @@ def test_dlasd4_solves_rank_one_secular_equation(prik_lapack, scipy_lapack, f2py prik_delta, f2py_delta = np.empty(2), np.empty(2) prik_work, f2py_work = np.empty(2), np.empty(2) - prik_scalars = prik_lapack.dlasd4(2, 1, diagonal, update, prik_delta, rho, 0.0, prik_work, 0) + prik_scalars = prik_lapack.dlasd4( + np.int32(2), np.int32(1), diagonal, update, prik_delta, np.float64(rho), np.float64(0.0), prik_work, np.int32(0) + ) f2py_result = f2py_lapack.dlasd4(2, 1, diagonal, update, f2py_delta, rho, 0.0, f2py_work, 0) scipy_delta, scipy_sigma, scipy_work, scipy_info = scipy_lapack.dlasd4(0, diagonal, update, rho=rho) diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index 3a69cfa03..6141f3dd6 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -197,6 +197,8 @@ def test_full_real_library_nodes_have_one_dedicated_workflow() -> None: assert '"meson==1.11.2"' in dedicated_job assert '"ninja==1.13.0"' in dedicated_job assert '"scipy==1.18.0"' in dedicated_job + assert "libblas-dev" in dedicated_job + assert "liblapack-dev" in dedicated_job assert ( f'"{FULL_REAL_LIBRARY_TEST}::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[blas]"' in dedicated_job From a8c95535f01263bbd8e70e162336cb1e0b548217 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Sun, 2 Aug 2026 06:32:12 +0100 Subject: [PATCH 05/22] use unique names for jobs --- .github/workflows/blas-lapack.yml | 2 +- .github/workflows/claude.yml | 2 +- .github/workflows/coverage.yml | 2 +- .github/workflows/docs.yml | 6 +- .github/workflows/fortran-toolchain-smoke.yml | 8 +- .github/workflows/parser-reference-guard.yml | 2 +- .github/workflows/publish-to-pypi.yml | 4 +- .github/workflows/static-analysis.yml | 2 +- .github/workflows/tests.yml | 4 +- docs/developer/quality-assurance.md | 45 ++++-- docs/maintainer/ci-cd.md | 6 + .../architecture/test_test_suite_layout.py | 135 ++++++++++++------ 12 files changed, 150 insertions(+), 68 deletions(-) diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index ecfa9af06..ec915430e 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -15,7 +15,7 @@ env: jobs: real-library-wrappers: - name: Python 3.12 + name: BLAS + LAPACK correctness · Ubuntu 24.04 · Python 3.12 if: >- ${{ github.event_name != 'pull_request' || diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index abb2a877b..8aac281e1 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -12,7 +12,7 @@ on: jobs: claude: - name: Respond + name: Claude Code response if: | (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index adb1a833c..3e18eba29 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -15,7 +15,7 @@ env: jobs: coverage: - name: Python 3.12 + name: Coverage · Ubuntu 24.04 · Python 3.12 if: >- ${{ github.event_name != 'pull_request' || diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index aeee0abce..4d2d5a4d0 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -32,7 +32,7 @@ env: jobs: benchmark: - name: Benchmark + name: Documentation benchmark · Ubuntu 24.04 ARM64 · Python 3.12 if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' runs-on: ubuntu-24.04-arm timeout-minutes: 90 @@ -117,7 +117,7 @@ jobs: retention-days: 90 build: - name: Build + name: Documentation build · Ubuntu 24.04 · Python 3.12 needs: benchmark if: always() && (needs.benchmark.result == 'success' || needs.benchmark.result == 'skipped') runs-on: ubuntu-24.04 @@ -162,7 +162,7 @@ jobs: path: site deploy: - name: Deploy + name: Documentation deploy · GitHub Pages if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' environment: name: github-pages diff --git a/.github/workflows/fortran-toolchain-smoke.yml b/.github/workflows/fortran-toolchain-smoke.yml index b7823c4c3..5b99da6bd 100644 --- a/.github/workflows/fortran-toolchain-smoke.yml +++ b/.github/workflows/fortran-toolchain-smoke.yml @@ -22,7 +22,7 @@ env: jobs: toolchain-smoke: - name: ${{ matrix.display_name }} + name: Compiler smoke · ${{ matrix.display_name }} runs-on: ubuntu-24.04 timeout-minutes: 60 permissions: @@ -32,13 +32,13 @@ jobs: matrix: include: - toolchain: ifx - display_name: Linux · Intel IFX 2026.1.1 · Python 3.12 + display_name: Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12 environment: prik-ifx-2026.1.1 fortran_compiler: ifx c_compiler: icx cache_version: "2026.1.1-v2" - toolchain: flang - display_name: Linux · LLVM Flang 22.1.8 · Python 3.12 + display_name: Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12 environment: prik-flang-22.1.8 fortran_compiler: flang c_compiler: clang @@ -120,7 +120,7 @@ jobs: done macos-flang-smoke: - name: macOS 15 ARM64 · LLVM Flang · Python 3.12 + name: Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12 runs-on: macos-15 timeout-minutes: 60 permissions: diff --git a/.github/workflows/parser-reference-guard.yml b/.github/workflows/parser-reference-guard.yml index aed87abc9..8df5cbe9a 100644 --- a/.github/workflows/parser-reference-guard.yml +++ b/.github/workflows/parser-reference-guard.yml @@ -6,7 +6,7 @@ on: jobs: parser-reference-guard: - name: Guard + name: Parser reference guard · Ubuntu 24.04 if: > !contains(github.event.pull_request.labels.*.name, 'ignore-parser-reference-guard') && (github.event.action == 'opened' || diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 45a0bccda..88aba0902 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -13,7 +13,7 @@ permissions: jobs: build: - name: Build and validate distributions + name: PyPI distribution build · Ubuntu 24.04 · Python 3.12 runs-on: ubuntu-24.04 steps: - name: Checkout release tag @@ -73,7 +73,7 @@ jobs: retention-days: 7 publish: - name: Publish distributions + name: PyPI trusted publishing · pypi needs: build runs-on: ubuntu-24.04 environment: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index d2736bc7c..d9408a186 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -11,7 +11,7 @@ on: jobs: static-analysis: - name: Python 3.12 + name: Static analysis · Ubuntu 24.04 · Python 3.12 runs-on: ubuntu-24.04 permissions: contents: read diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f1ad8932e..e2836e74c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ env: jobs: test: - name: Python ${{ matrix.python-version }} + name: Unit tests · Ubuntu 24.04 · Python ${{ matrix.python-version }} runs-on: ubuntu-24.04 permissions: contents: read @@ -80,7 +80,7 @@ jobs: done macos: - name: macOS 15 ARM64 · Python 3.12 + name: Unit tests · macOS 15 ARM64 · Python 3.12 runs-on: macos-15 timeout-minutes: 120 permissions: diff --git a/docs/developer/quality-assurance.md b/docs/developer/quality-assurance.md index 5ecbb55e4..757ff5fb1 100644 --- a/docs/developer/quality-assurance.md +++ b/docs/developer/quality-assurance.md @@ -30,18 +30,39 @@ testing and pre-commit are not part of the active stack. | Manual triage | Full Radon reports and low-severity Bandit review | | Annual dependency review | Dependency vulnerability audit outside the routine per-change gate | -Active GitHub Actions checks use short `workflow / job` names: - -- `Documentation / Build` and `Documentation / Deploy`; -- `Smoke Tests / Intel IFX 2026.1.1 · Python 3.12` and - `Smoke Tests / LLVM Flang 22.1.8 · Python 3.12`; -- `Parser Reference / Guard`; -- `Static Analysis / Python 3.12`; -- `Tests / Python 3.10`, `Tests / Python 3.11`, and - `Tests / Python 3.12`; -- `BLAS + LAPACK / Python 3.12`; -- `Coverage / Python 3.12`; and -- `Claude Code / Respond` when the optional `@claude` integration is invoked. +Active GitHub Actions checks use stable `workflow / job` names. Every job name +is purpose-first and globally descriptive, so the ruleset selector never has +to distinguish several jobs called only `Python 3.12`. Matrix jobs include the +platform, toolchain, and Python-version axes that distinguish their checks. + +The pull-request quality checks are: + +- `Tests / Unit tests · Ubuntu 24.04 · Python 3.10`; +- `Tests / Unit tests · Ubuntu 24.04 · Python 3.11`; +- `Tests / Unit tests · Ubuntu 24.04 · Python 3.12`; +- `Tests / Unit tests · macOS 15 ARM64 · Python 3.12`; +- `Static Analysis / Static analysis · Ubuntu 24.04 · Python 3.12`; +- `BLAS + LAPACK / BLAS + LAPACK correctness · Ubuntu 24.04 · Python 3.12`; +- `Smoke Tests / Compiler smoke · Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12`; +- `Smoke Tests / Compiler smoke · Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12`; +- `Smoke Tests / Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12`; +- `Parser Reference / Parser reference guard · Ubuntu 24.04`; and +- `Documentation / Documentation build · Ubuntu 24.04 · Python 3.12` when + the documentation path filter matches. + +Other event-specific checks follow the same convention: + +- `Documentation / Documentation benchmark · Ubuntu 24.04 ARM64 · Python 3.12`; +- `Documentation / Documentation deploy · GitHub Pages`; +- `Coverage / Coverage · Ubuntu 24.04 · Python 3.12`; +- `Publish to PyPI / PyPI distribution build · Ubuntu 24.04 · Python 3.12`; +- `Publish to PyPI / PyPI trusted publishing · pypi`; and +- `Claude Code / Claude Code response` when the optional `@claude` + integration is invoked. + +Treat these strings as ruleset API. If a workflow or job display name changes, +replace the corresponding required-status-check entry in the repository +ruleset; do not retain an alias job for the previous name. ## Install diff --git a/docs/maintainer/ci-cd.md b/docs/maintainer/ci-cd.md index 592ec125a..48418f138 100644 --- a/docs/maintainer/ci-cd.md +++ b/docs/maintainer/ci-cd.md @@ -14,6 +14,12 @@ deployment. The documentation workflow builds the same filtered MkDocs site that maintainers can preview locally, uploads the generated `site/` directory, and deploys it through GitHub Pages. +Job display names are purpose-first and unique across the repository. Required +status checks must use the exact `workflow / job` contexts documented in the +[quality-assurance guide](../developer/quality-assurance.md). Because GitHub +treats a renamed check as a different context, update the repository ruleset +whenever either half of that name changes. + Packaging output under `build/` is generated, ignored, and must never be committed. In addition to keeping distribution artifacts out of the source tree, this ensures rename-aware quality gates compare the previous package diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index 6141f3dd6..9319c845c 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -9,15 +9,18 @@ REPO_ROOT = Path(__file__).parents[3] TEST_ROOT = REPO_ROOT / "tests" TEST_INDEX = TEST_ROOT / "README.md" +WORKFLOW_ROOT = REPO_ROOT / ".github/workflows" BLAS_LAPACK_WORKFLOW = REPO_ROOT / ".github/workflows/blas-lapack.yml" CLAUDE_WORKFLOW = REPO_ROOT / ".github/workflows/claude.yml" COVERAGE_WORKFLOW = REPO_ROOT / ".github/workflows/coverage.yml" CODECOV_CONFIG = REPO_ROOT / "codecov.yml" DOCS_WORKFLOW = REPO_ROOT / ".github/workflows/docs.yml" +FORTRAN_SMOKE_WORKFLOW = REPO_ROOT / ".github/workflows/fortran-toolchain-smoke.yml" PARSER_REFERENCE_WORKFLOW = REPO_ROOT / ".github/workflows/parser-reference-guard.yml" PUBLISH_WORKFLOW = REPO_ROOT / ".github/workflows/publish-to-pypi.yml" STATIC_ANALYSIS_WORKFLOW = REPO_ROOT / ".github/workflows/static-analysis.yml" TESTS_WORKFLOW = REPO_ROOT / ".github/workflows/tests.yml" +QUALITY_ASSURANCE_DOC = REPO_ROOT / "docs/developer/quality-assurance.md" PYPROJECT = REPO_ROOT / "pyproject.toml" CHANGELOG = REPO_ROOT / "CHANGELOG.md" MANIFEST = REPO_ROOT / "MANIFEST.in" @@ -115,6 +118,34 @@ def _maintained_path_reference_files() -> list[Path]: ) +def _github_action_job_display_names(workflow: Path) -> dict[str, str]: + names: dict[str, str] = {} + current_job: str | None = None + in_jobs = False + for line in workflow.read_text(encoding="utf-8").splitlines(): + if line == "jobs:": + in_jobs = True + continue + if not in_jobs: + continue + job_match = re.fullmatch(r" ([a-z0-9-]+):", line) + if job_match: + current_job = job_match.group(1) + continue + if current_job is not None and line.startswith(" name: "): + names[current_job] = line.removeprefix(" name: ") + return names + + +def _github_matrix_display_names(workflow: Path) -> tuple[str, ...]: + prefix = "display_name: " + return tuple( + line.strip().removeprefix(prefix) + for line in workflow.read_text(encoding="utf-8").splitlines() + if line.strip().startswith(prefix) + ) + + def test_pytest_modules_have_one_allowed_primary_owner() -> None: root_modules = sorted(path.name for path in TEST_ROOT.glob("test_*.py")) assert root_modules == [] @@ -248,48 +279,72 @@ def test_codecov_keeps_project_coverage_blocking_and_patch_coverage_informationa def test_active_github_action_jobs_use_purpose_first_display_names() -> None: expected = { - DOCS_WORKFLOW: ( - "name: Documentation", - " name: Benchmark", - " name: Build", - " name: Deploy", - ), - PARSER_REFERENCE_WORKFLOW: ( - "name: Parser Reference", - " name: Guard", - ), - STATIC_ANALYSIS_WORKFLOW: ( - "name: Static Analysis", - " name: Python 3.12", - ), - TESTS_WORKFLOW: ( - "name: Tests", - " name: Python ${{ matrix.python-version }}", - " name: macOS 15 ARM64 · Python 3.12", - ), - BLAS_LAPACK_WORKFLOW: ( - "name: BLAS + LAPACK", - " name: Python 3.12", - ), - COVERAGE_WORKFLOW: ( - "name: Coverage", - " name: Python 3.12", - ), - PUBLISH_WORKFLOW: ( - "name: Publish to PyPI", - " name: Build and validate distributions", - " name: Publish distributions", - ), - CLAUDE_WORKFLOW: ( - "name: Claude Code", - " name: Respond", - ), + BLAS_LAPACK_WORKFLOW: {"real-library-wrappers": "BLAS + LAPACK correctness · Ubuntu 24.04 · Python 3.12"}, + CLAUDE_WORKFLOW: {"claude": "Claude Code response"}, + COVERAGE_WORKFLOW: {"coverage": "Coverage · Ubuntu 24.04 · Python 3.12"}, + DOCS_WORKFLOW: { + "benchmark": "Documentation benchmark · Ubuntu 24.04 ARM64 · Python 3.12", + "build": "Documentation build · Ubuntu 24.04 · Python 3.12", + "deploy": "Documentation deploy · GitHub Pages", + }, + FORTRAN_SMOKE_WORKFLOW: { + "toolchain-smoke": "Compiler smoke · ${{ matrix.display_name }}", + "macos-flang-smoke": "Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12", + }, + PARSER_REFERENCE_WORKFLOW: {"parser-reference-guard": "Parser reference guard · Ubuntu 24.04"}, + PUBLISH_WORKFLOW: { + "build": "PyPI distribution build · Ubuntu 24.04 · Python 3.12", + "publish": "PyPI trusted publishing · pypi", + }, + STATIC_ANALYSIS_WORKFLOW: {"static-analysis": "Static analysis · Ubuntu 24.04 · Python 3.12"}, + TESTS_WORKFLOW: { + "test": "Unit tests · Ubuntu 24.04 · Python ${{ matrix.python-version }}", + "macos": "Unit tests · macOS 15 ARM64 · Python 3.12", + }, } - for workflow, names in expected.items(): - text = workflow.read_text(encoding="utf-8") - for name in names: - assert name in text + assert set(expected) == set(WORKFLOW_ROOT.glob("*.yml")) + assert {workflow: _github_action_job_display_names(workflow) for workflow in expected} == expected + + display_names = [name for jobs in expected.values() for name in jobs.values()] + assert len(display_names) == len(set(display_names)) + assert all(not re.fullmatch(r"Python(?:\s+.*)?", name) for name in display_names) + + smoke_matrix_names = _github_matrix_display_names(FORTRAN_SMOKE_WORKFLOW) + assert smoke_matrix_names == ( + "Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12", + "Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12", + ) + test_python_versions = ("3.10", "3.11", "3.12") + assert 'python-version: ["3.10", "3.11", "3.12"]' in TESTS_WORKFLOW.read_text(encoding="utf-8") + expanded_display_names = [name for name in display_names if "${{ matrix." not in name] + expanded_display_names.extend(f"Compiler smoke · {name}" for name in smoke_matrix_names) + expanded_display_names.extend(f"Unit tests · Ubuntu 24.04 · Python {version}" for version in test_python_versions) + assert len(expanded_display_names) == len(set(expanded_display_names)) + + documented_contexts = ( + "Tests / Unit tests · Ubuntu 24.04 · Python 3.10", + "Tests / Unit tests · Ubuntu 24.04 · Python 3.11", + "Tests / Unit tests · Ubuntu 24.04 · Python 3.12", + "Tests / Unit tests · macOS 15 ARM64 · Python 3.12", + "Static Analysis / Static analysis · Ubuntu 24.04 · Python 3.12", + "BLAS + LAPACK / BLAS + LAPACK correctness · Ubuntu 24.04 · Python 3.12", + "Smoke Tests / Compiler smoke · Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12", + "Smoke Tests / Compiler smoke · Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12", + "Smoke Tests / Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12", + "Parser Reference / Parser reference guard · Ubuntu 24.04", + "Documentation / Documentation build · Ubuntu 24.04 · Python 3.12", + "Documentation / Documentation benchmark · Ubuntu 24.04 ARM64 · Python 3.12", + "Documentation / Documentation deploy · GitHub Pages", + "Coverage / Coverage · Ubuntu 24.04 · Python 3.12", + "Publish to PyPI / PyPI distribution build · Ubuntu 24.04 · Python 3.12", + "Publish to PyPI / PyPI trusted publishing · pypi", + "Claude Code / Claude Code response", + ) + quality_assurance = QUALITY_ASSURANCE_DOC.read_text(encoding="utf-8") + assert len(documented_contexts) == len(set(documented_contexts)) + for context in documented_contexts: + assert f"`{context}`" in quality_assurance def test_pypi_package_identity_is_complete_and_consistent() -> None: From 769766f8906022c31a3749e33f5e110e2e5b5f46 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Sun, 2 Aug 2026 06:46:34 +0100 Subject: [PATCH 06/22] use unique names for jobs --- .github/workflows/blas-lapack.yml | 4 +- .github/workflows/claude.yml | 4 +- .github/workflows/coverage.yml | 4 +- .github/workflows/docs.yml | 6 +- .github/workflows/fortran-toolchain-smoke.yml | 2 +- .github/workflows/parser-reference-guard.yml | 2 +- .github/workflows/publish-to-pypi.yml | 2 +- .github/workflows/static-analysis.yml | 2 +- .github/workflows/tests.yml | 2 +- docs/developer/quality-assurance.md | 43 ++++++------ docs/maintainer/ci-cd.md | 3 +- .../architecture/test_test_suite_layout.py | 69 ++++++++++++------- 12 files changed, 82 insertions(+), 61 deletions(-) diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index ec915430e..7aa0cce9c 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -1,4 +1,4 @@ -name: BLAS + LAPACK +name: Native Libraries on: pull_request: @@ -15,7 +15,7 @@ env: jobs: real-library-wrappers: - name: BLAS + LAPACK correctness · Ubuntu 24.04 · Python 3.12 + name: BLAS + LAPACK · Ubuntu 24.04 · Python 3.12 if: >- ${{ github.event_name != 'pull_request' || diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 8aac281e1..c1521a8f6 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -1,4 +1,4 @@ -name: Claude Code +name: Repository Automation on: issue_comment: @@ -12,7 +12,7 @@ on: jobs: claude: - name: Claude Code response + name: Claude Code response to mention if: | (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3e18eba29..92e1e86a8 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,4 +1,4 @@ -name: Coverage +name: Quality Metrics on: push: @@ -15,7 +15,7 @@ env: jobs: coverage: - name: Coverage · Ubuntu 24.04 · Python 3.12 + name: Project coverage · Ubuntu 24.04 · Python 3.12 if: >- ${{ github.event_name != 'pull_request' || diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4d2d5a4d0..26b16c2f6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -32,7 +32,7 @@ env: jobs: benchmark: - name: Documentation benchmark · Ubuntu 24.04 ARM64 · Python 3.12 + name: Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12 if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' runs-on: ubuntu-24.04-arm timeout-minutes: 90 @@ -117,7 +117,7 @@ jobs: retention-days: 90 build: - name: Documentation build · Ubuntu 24.04 · Python 3.12 + name: Documentation site build · Ubuntu 24.04 · Python 3.12 needs: benchmark if: always() && (needs.benchmark.result == 'success' || needs.benchmark.result == 'skipped') runs-on: ubuntu-24.04 @@ -162,7 +162,7 @@ jobs: path: site deploy: - name: Documentation deploy · GitHub Pages + name: Documentation deployment · GitHub Pages if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' environment: name: github-pages diff --git a/.github/workflows/fortran-toolchain-smoke.yml b/.github/workflows/fortran-toolchain-smoke.yml index 5b99da6bd..9ed56b7d9 100644 --- a/.github/workflows/fortran-toolchain-smoke.yml +++ b/.github/workflows/fortran-toolchain-smoke.yml @@ -1,4 +1,4 @@ -name: Smoke Tests +name: Compiler Compatibility on: pull_request: diff --git a/.github/workflows/parser-reference-guard.yml b/.github/workflows/parser-reference-guard.yml index 8df5cbe9a..2a05f77a1 100644 --- a/.github/workflows/parser-reference-guard.yml +++ b/.github/workflows/parser-reference-guard.yml @@ -1,4 +1,4 @@ -name: Parser Reference +name: Contract Enforcement on: pull_request: diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 88aba0902..e2910e99a 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,4 +1,4 @@ -name: Publish to PyPI +name: Release Automation on: release: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index d9408a186..75154010e 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,4 +1,4 @@ -name: Static Analysis +name: Code Quality on: pull_request: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e2836e74c..316a99959 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Tests +name: Test Matrix on: pull_request: diff --git a/docs/developer/quality-assurance.md b/docs/developer/quality-assurance.md index 757ff5fb1..6123ccbda 100644 --- a/docs/developer/quality-assurance.md +++ b/docs/developer/quality-assurance.md @@ -30,34 +30,35 @@ testing and pre-commit are not part of the active stack. | Manual triage | Full Radon reports and low-severity Bandit review | | Annual dependency review | Dependency vulnerability audit outside the routine per-change gate | -Active GitHub Actions checks use stable `workflow / job` names. Every job name -is purpose-first and globally descriptive, so the ruleset selector never has -to distinguish several jobs called only `Python 3.12`. Matrix jobs include the -platform, toolchain, and Python-version axes that distinguish their checks. +Active GitHub Actions checks use stable `workflow / job` names. The workflow +name identifies the pipeline scope, while every job name independently +identifies the concrete check selected in repository rules. This avoids generic +job names such as `Python 3.12`. Matrix jobs include the platform, toolchain, +and Python-version axes that distinguish their checks. The pull-request quality checks are: -- `Tests / Unit tests · Ubuntu 24.04 · Python 3.10`; -- `Tests / Unit tests · Ubuntu 24.04 · Python 3.11`; -- `Tests / Unit tests · Ubuntu 24.04 · Python 3.12`; -- `Tests / Unit tests · macOS 15 ARM64 · Python 3.12`; -- `Static Analysis / Static analysis · Ubuntu 24.04 · Python 3.12`; -- `BLAS + LAPACK / BLAS + LAPACK correctness · Ubuntu 24.04 · Python 3.12`; -- `Smoke Tests / Compiler smoke · Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12`; -- `Smoke Tests / Compiler smoke · Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12`; -- `Smoke Tests / Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12`; -- `Parser Reference / Parser reference guard · Ubuntu 24.04`; and -- `Documentation / Documentation build · Ubuntu 24.04 · Python 3.12` when +- `Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.10`; +- `Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.11`; +- `Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.12`; +- `Test Matrix / Unit tests · macOS 15 ARM64 · Python 3.12`; +- `Code Quality / Static analysis · Ubuntu 24.04 · Python 3.12`; +- `Native Libraries / BLAS + LAPACK · Ubuntu 24.04 · Python 3.12`; +- `Compiler Compatibility / Compiler smoke · Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12`; +- `Compiler Compatibility / Compiler smoke · Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12`; +- `Compiler Compatibility / Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12`; +- `Contract Enforcement / Parser reference guard · Ubuntu 24.04`; and +- `Documentation / Documentation site build · Ubuntu 24.04 · Python 3.12` when the documentation path filter matches. Other event-specific checks follow the same convention: -- `Documentation / Documentation benchmark · Ubuntu 24.04 ARM64 · Python 3.12`; -- `Documentation / Documentation deploy · GitHub Pages`; -- `Coverage / Coverage · Ubuntu 24.04 · Python 3.12`; -- `Publish to PyPI / PyPI distribution build · Ubuntu 24.04 · Python 3.12`; -- `Publish to PyPI / PyPI trusted publishing · pypi`; and -- `Claude Code / Claude Code response` when the optional `@claude` +- `Documentation / Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12`; +- `Documentation / Documentation deployment · GitHub Pages`; +- `Quality Metrics / Project coverage · Ubuntu 24.04 · Python 3.12`; +- `Release Automation / PyPI distribution build · Ubuntu 24.04 · Python 3.12`; +- `Release Automation / PyPI trusted publishing · pypi`; and +- `Repository Automation / Claude Code response to mention` when the optional `@claude` integration is invoked. Treat these strings as ruleset API. If a workflow or job display name changes, diff --git a/docs/maintainer/ci-cd.md b/docs/maintainer/ci-cd.md index 48418f138..0a196b1d0 100644 --- a/docs/maintainer/ci-cd.md +++ b/docs/maintainer/ci-cd.md @@ -14,7 +14,8 @@ deployment. The documentation workflow builds the same filtered MkDocs site that maintainers can preview locally, uploads the generated `site/` directory, and deploys it through GitHub Pages. -Job display names are purpose-first and unique across the repository. Required +Workflow names identify a unique pipeline scope, and every job display name is +self-contained so it can be selected confidently as a required check. Required status checks must use the exact `workflow / job` contexts documented in the [quality-assurance guide](../developer/quality-assurance.md). Because GitHub treats a renamed check as a different context, update the repository ruleset diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index 9319c845c..5acb45bf1 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -137,6 +137,12 @@ def _github_action_job_display_names(workflow: Path) -> dict[str, str]: return names +def _github_action_workflow_name(workflow: Path) -> str: + first_line = workflow.read_text(encoding="utf-8").splitlines()[0] + assert first_line.startswith("name: ") + return first_line.removeprefix("name: ") + + def _github_matrix_display_names(workflow: Path) -> tuple[str, ...]: prefix = "display_name: " return tuple( @@ -277,15 +283,26 @@ def test_codecov_keeps_project_coverage_blocking_and_patch_coverage_informationa ) -def test_active_github_action_jobs_use_purpose_first_display_names() -> None: +def test_active_github_action_checks_use_distinct_workflow_scopes_and_job_names() -> None: + workflow_names = { + BLAS_LAPACK_WORKFLOW: "Native Libraries", + CLAUDE_WORKFLOW: "Repository Automation", + COVERAGE_WORKFLOW: "Quality Metrics", + DOCS_WORKFLOW: "Documentation", + FORTRAN_SMOKE_WORKFLOW: "Compiler Compatibility", + PARSER_REFERENCE_WORKFLOW: "Contract Enforcement", + PUBLISH_WORKFLOW: "Release Automation", + STATIC_ANALYSIS_WORKFLOW: "Code Quality", + TESTS_WORKFLOW: "Test Matrix", + } expected = { - BLAS_LAPACK_WORKFLOW: {"real-library-wrappers": "BLAS + LAPACK correctness · Ubuntu 24.04 · Python 3.12"}, - CLAUDE_WORKFLOW: {"claude": "Claude Code response"}, - COVERAGE_WORKFLOW: {"coverage": "Coverage · Ubuntu 24.04 · Python 3.12"}, + BLAS_LAPACK_WORKFLOW: {"real-library-wrappers": "BLAS + LAPACK · Ubuntu 24.04 · Python 3.12"}, + CLAUDE_WORKFLOW: {"claude": "Claude Code response to mention"}, + COVERAGE_WORKFLOW: {"coverage": "Project coverage · Ubuntu 24.04 · Python 3.12"}, DOCS_WORKFLOW: { - "benchmark": "Documentation benchmark · Ubuntu 24.04 ARM64 · Python 3.12", - "build": "Documentation build · Ubuntu 24.04 · Python 3.12", - "deploy": "Documentation deploy · GitHub Pages", + "benchmark": "Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12", + "build": "Documentation site build · Ubuntu 24.04 · Python 3.12", + "deploy": "Documentation deployment · GitHub Pages", }, FORTRAN_SMOKE_WORKFLOW: { "toolchain-smoke": "Compiler smoke · ${{ matrix.display_name }}", @@ -303,7 +320,9 @@ def test_active_github_action_jobs_use_purpose_first_display_names() -> None: }, } - assert set(expected) == set(WORKFLOW_ROOT.glob("*.yml")) + assert set(workflow_names) == set(expected) == set(WORKFLOW_ROOT.glob("*.yml")) + assert {workflow: _github_action_workflow_name(workflow) for workflow in workflow_names} == workflow_names + assert len(workflow_names.values()) == len(set(workflow_names.values())) assert {workflow: _github_action_job_display_names(workflow) for workflow in expected} == expected display_names = [name for jobs in expected.values() for name in jobs.values()] @@ -323,23 +342,23 @@ def test_active_github_action_jobs_use_purpose_first_display_names() -> None: assert len(expanded_display_names) == len(set(expanded_display_names)) documented_contexts = ( - "Tests / Unit tests · Ubuntu 24.04 · Python 3.10", - "Tests / Unit tests · Ubuntu 24.04 · Python 3.11", - "Tests / Unit tests · Ubuntu 24.04 · Python 3.12", - "Tests / Unit tests · macOS 15 ARM64 · Python 3.12", - "Static Analysis / Static analysis · Ubuntu 24.04 · Python 3.12", - "BLAS + LAPACK / BLAS + LAPACK correctness · Ubuntu 24.04 · Python 3.12", - "Smoke Tests / Compiler smoke · Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12", - "Smoke Tests / Compiler smoke · Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12", - "Smoke Tests / Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12", - "Parser Reference / Parser reference guard · Ubuntu 24.04", - "Documentation / Documentation build · Ubuntu 24.04 · Python 3.12", - "Documentation / Documentation benchmark · Ubuntu 24.04 ARM64 · Python 3.12", - "Documentation / Documentation deploy · GitHub Pages", - "Coverage / Coverage · Ubuntu 24.04 · Python 3.12", - "Publish to PyPI / PyPI distribution build · Ubuntu 24.04 · Python 3.12", - "Publish to PyPI / PyPI trusted publishing · pypi", - "Claude Code / Claude Code response", + "Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.10", + "Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.11", + "Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.12", + "Test Matrix / Unit tests · macOS 15 ARM64 · Python 3.12", + "Code Quality / Static analysis · Ubuntu 24.04 · Python 3.12", + "Native Libraries / BLAS + LAPACK · Ubuntu 24.04 · Python 3.12", + "Compiler Compatibility / Compiler smoke · Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12", + "Compiler Compatibility / Compiler smoke · Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12", + "Compiler Compatibility / Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12", + "Contract Enforcement / Parser reference guard · Ubuntu 24.04", + "Documentation / Documentation site build · Ubuntu 24.04 · Python 3.12", + "Documentation / Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12", + "Documentation / Documentation deployment · GitHub Pages", + "Quality Metrics / Project coverage · Ubuntu 24.04 · Python 3.12", + "Release Automation / PyPI distribution build · Ubuntu 24.04 · Python 3.12", + "Release Automation / PyPI trusted publishing · pypi", + "Repository Automation / Claude Code response to mention", ) quality_assurance = QUALITY_ASSURANCE_DOC.read_text(encoding="utf-8") assert len(documented_contexts) == len(set(documented_contexts)) From a7d14b0108243548a116e0c1be0fd97935dca427 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Sun, 2 Aug 2026 06:55:55 +0100 Subject: [PATCH 07/22] fix job expectation names --- tests/architecture/fortran/test_ci_toolchain_lanes.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/architecture/fortran/test_ci_toolchain_lanes.py b/tests/architecture/fortran/test_ci_toolchain_lanes.py index 2a5da52b3..5c3977acc 100644 --- a/tests/architecture/fortran/test_ci_toolchain_lanes.py +++ b/tests/architecture/fortran/test_ci_toolchain_lanes.py @@ -20,18 +20,18 @@ def test_workflow_declares_pinned_ifx_and_flang_pairs_on_ubuntu_2404() -> None: text = WORKFLOW.read_text(encoding="utf-8") - assert text.startswith("name: Smoke Tests\n") + assert text.startswith("name: Compiler Compatibility\n") assert "runs-on: ubuntu-24.04" in text assert 'PRIK_IFX_VERSION: "2026.1.1"' in text assert 'PRIK_FLANG_VERSION: "22.1.8"' in text assert 'PRIK_FLANG_RUNTIME_VERSION: "22.1.7"' in text for snippet in ( "- toolchain: ifx", - "display_name: Linux · Intel IFX 2026.1.1 · Python 3.12", + "display_name: Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12", "fortran_compiler: ifx", "c_compiler: icx", "- toolchain: flang", - "display_name: Linux · LLVM Flang 22.1.8 · Python 3.12", + "display_name: Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12", "fortran_compiler: flang", "c_compiler: clang", ): @@ -70,7 +70,7 @@ def test_macos_flang_lane_installs_a_coherent_pair_and_runs_strict_smoke() -> No macos_job = text.split(" macos-flang-smoke:\n", maxsplit=1)[1] for snippet in ( - "name: macOS 15 ARM64 · LLVM Flang · Python 3.12", + "name: Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12", "runs-on: macos-15", "brew install flang", 'flang_prefix="$(brew --prefix flang)"', @@ -97,7 +97,7 @@ def test_macos_lane_runs_strict_smoke_and_the_full_ordinary_suite() -> None: macos_job = text.split(" macos:\n", maxsplit=1)[1] for snippet in ( - "name: macOS 15 ARM64 · Python 3.12", + "name: Unit tests · macOS 15 ARM64 · Python 3.12", "runs-on: macos-15", "PRIK_GFORTRAN_BINARY: gfortran-13", "PRIK_GCC_BINARY: gcc-13", From 91bd9c245d810c129d07b7280c63bee86e1840f0 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Sun, 2 Aug 2026 08:07:50 +0100 Subject: [PATCH 08/22] require job order --- .github/workflows/blas-lapack.yml | 2 - .github/workflows/coverage.yml | 7 -- .github/workflows/docs.yml | 33 ++--- .github/workflows/fortran-toolchain-smoke.yml | 3 +- .github/workflows/merge-validation.yml | 94 +++++++++++++++ .github/workflows/parser-reference-guard.yml | 3 +- .github/workflows/static-analysis.yml | 2 - .github/workflows/tests.yml | 2 - docs/developer/quality-assurance.md | 86 ++++++------- docs/maintainer/ci-cd.md | 60 +++++---- .../architecture/test_test_suite_layout.py | 114 ++++++++++++++---- 11 files changed, 279 insertions(+), 127 deletions(-) create mode 100644 .github/workflows/merge-validation.yml diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index 7aa0cce9c..675d00e86 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -1,8 +1,6 @@ name: Native Libraries on: - pull_request: - types: [opened, synchronize, reopened, labeled, unlabeled] push: branches: - main diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 92e1e86a8..ef9d11be2 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -4,8 +4,6 @@ on: push: branches: - main - pull_request: - types: [opened, synchronize, reopened, labeled, unlabeled] workflow_dispatch: workflow_call: @@ -16,11 +14,6 @@ env: jobs: coverage: name: Project coverage · Ubuntu 24.04 · Python 3.12 - if: >- - ${{ - github.event_name != 'pull_request' || - contains(github.event.pull_request.labels.*.name, 'run-coverage') - }} runs-on: ubuntu-24.04 permissions: contents: read diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 26b16c2f6..8d8fc7167 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,21 +3,14 @@ name: Documentation on: push: branches: [main] - pull_request: - paths: - - ".github/workflows/docs.yml" - - "README.md" - - "benchmarks/**" - - "docs/**" - - "docs_theme/**" - - "mkdocs.yml" - - "pyproject.toml" - - "tests/shared/architecture/test_test_suite_layout.py" - - "tests/shared/docs/**" - - "tests/shared/tools/test_generate_performance_docs.py" - - "tools/generate_performance_docs.py" - - "tools/mkdocs_publication.py" workflow_dispatch: + workflow_call: + inputs: + run_performance_benchmark: + description: Run the pinned ARM64 performance benchmark before building the site. + required: false + type: boolean + default: false permissions: contents: read @@ -33,7 +26,11 @@ env: jobs: benchmark: name: Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12 - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + if: >- + ${{ + inputs.run_performance_benchmark || + (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') + }} runs-on: ubuntu-24.04-arm timeout-minutes: 90 permissions: @@ -139,7 +136,11 @@ jobs: run: python -m pip install -e ".[docs,qa]" - name: Download generated Performance snapshot - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + if: >- + ${{ + inputs.run_performance_benchmark || + (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') + }} uses: actions/download-artifact@v4 with: name: performance-snapshot diff --git a/.github/workflows/fortran-toolchain-smoke.yml b/.github/workflows/fortran-toolchain-smoke.yml index 9ed56b7d9..18bc26388 100644 --- a/.github/workflows/fortran-toolchain-smoke.yml +++ b/.github/workflows/fortran-toolchain-smoke.yml @@ -1,8 +1,6 @@ name: Compiler Compatibility on: - pull_request: - types: [opened, synchronize, reopened] push: branches: - main @@ -10,6 +8,7 @@ on: schedule: - cron: "17 4 * * 1" workflow_dispatch: + workflow_call: concurrency: group: fortran-toolchain-smoke-${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/merge-validation.yml b/.github/workflows/merge-validation.yml new file mode 100644 index 000000000..19dcfd014 --- /dev/null +++ b/.github/workflows/merge-validation.yml @@ -0,0 +1,94 @@ +name: Merge Validation + +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + +permissions: + contents: read + +concurrency: + group: merge-validation-${{ github.ref }} + cancel-in-progress: true + +jobs: + unit-tests: + name: Unit-test matrix stage + uses: ./.github/workflows/tests.yml + + code-quality: + name: Code-quality stage + uses: ./.github/workflows/static-analysis.yml + + parser-contract: + name: Parser-contract stage + uses: ./.github/workflows/parser-reference-guard.yml + + native-libraries: + name: Native-library stage + needs: [unit-tests, code-quality, parser-contract] + uses: ./.github/workflows/blas-lapack.yml + + compiler-compatibility: + name: Compiler-compatibility stage + needs: [unit-tests, code-quality, parser-contract] + uses: ./.github/workflows/fortran-toolchain-smoke.yml + + project-coverage: + name: Project-coverage stage + needs: [native-libraries, compiler-compatibility] + permissions: + contents: read + id-token: write + uses: ./.github/workflows/coverage.yml + + documentation: + name: Documentation benchmark and site-build stage + needs: project-coverage + uses: ./.github/workflows/docs.yml + with: + run_performance_benchmark: true + + merge-gate: + name: Pull request validation · all required checks + if: ${{ always() }} + needs: + - unit-tests + - code-quality + - parser-contract + - native-libraries + - compiler-compatibility + - project-coverage + - documentation + runs-on: ubuntu-24.04 + permissions: {} + env: + UNIT_TESTS_RESULT: ${{ needs.unit-tests.result }} + CODE_QUALITY_RESULT: ${{ needs.code-quality.result }} + PARSER_CONTRACT_RESULT: ${{ needs.parser-contract.result }} + NATIVE_LIBRARIES_RESULT: ${{ needs.native-libraries.result }} + COMPILER_COMPATIBILITY_RESULT: ${{ needs.compiler-compatibility.result }} + PROJECT_COVERAGE_RESULT: ${{ needs.project-coverage.result }} + DOCUMENTATION_RESULT: ${{ needs.documentation.result }} + steps: + - name: Require every staged validation result + shell: bash + run: | + failed=0 + for staged_result in \ + "unit-tests=$UNIT_TESTS_RESULT" \ + "code-quality=$CODE_QUALITY_RESULT" \ + "parser-contract=$PARSER_CONTRACT_RESULT" \ + "native-libraries=$NATIVE_LIBRARIES_RESULT" \ + "compiler-compatibility=$COMPILER_COMPATIBILITY_RESULT" \ + "project-coverage=$PROJECT_COVERAGE_RESULT" \ + "documentation=$DOCUMENTATION_RESULT" + do + stage=${staged_result%%=*} + result=${staged_result#*=} + if [[ "$result" != "success" ]]; then + echo "::error::$stage finished with result: $result" + failed=1 + fi + done + exit "$failed" diff --git a/.github/workflows/parser-reference-guard.yml b/.github/workflows/parser-reference-guard.yml index 2a05f77a1..c76d7a084 100644 --- a/.github/workflows/parser-reference-guard.yml +++ b/.github/workflows/parser-reference-guard.yml @@ -1,8 +1,7 @@ name: Contract Enforcement on: - pull_request: - types: [opened, synchronize, reopened, labeled, unlabeled] + workflow_call: jobs: parser-reference-guard: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 75154010e..684135451 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,8 +1,6 @@ name: Code Quality on: - pull_request: - types: [opened, synchronize, reopened] push: branches: - main diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 316a99959..db3a43f3f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,8 +1,6 @@ name: Test Matrix on: - pull_request: - types: [opened, synchronize, reopened] push: branches: - main diff --git a/docs/developer/quality-assurance.md b/docs/developer/quality-assurance.md index 6123ccbda..df17e9931 100644 --- a/docs/developer/quality-assurance.md +++ b/docs/developer/quality-assurance.md @@ -23,47 +23,36 @@ testing and pre-commit are not part of the active stack. | Cadence | Tools | | --- | --- | -| Pull request and protected-branch push | pytest, bounded property/fuzz cases, stable-seed pytest-randomly, Ruff, Bandit, Vulture, staged Radon policy | +| Pull request and protected-branch push | pytest, bounded property/fuzz cases, stable-seed pytest-randomly, Ruff, Bandit, Vulture, staged Radon policy, and project coverage | | Pull request, protected-branch push, weekly, and manual | Pinned Intel IFX/ICX and LLVM Flang/Clang profile checks plus strict Fortran toolchain smoke | -| Main-branch push and requested coverage run | coverage.py report from the Python 3.12 test job | +| Validated pull request and main-branch push | Pinned ARM64 prik/f2py correctness and rigorous performance benchmark | | Manual discovery | Fuzz-marked parser tests with the deeper Hypothesis fuzz profile | | Manual triage | Full Radon reports and low-severity Bandit review | | Annual dependency review | Dependency vulnerability audit outside the routine per-change gate | -Active GitHub Actions checks use stable `workflow / job` names. The workflow -name identifies the pipeline scope, while every job name independently -identifies the concrete check selected in repository rules. This avoids generic -job names such as `Python 3.12`. Matrix jobs include the platform, toolchain, -and Python-version axes that distinguish their checks. - -The pull-request quality checks are: - -- `Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.10`; -- `Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.11`; -- `Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.12`; -- `Test Matrix / Unit tests · macOS 15 ARM64 · Python 3.12`; -- `Code Quality / Static analysis · Ubuntu 24.04 · Python 3.12`; -- `Native Libraries / BLAS + LAPACK · Ubuntu 24.04 · Python 3.12`; -- `Compiler Compatibility / Compiler smoke · Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12`; -- `Compiler Compatibility / Compiler smoke · Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12`; -- `Compiler Compatibility / Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12`; -- `Contract Enforcement / Parser reference guard · Ubuntu 24.04`; and -- `Documentation / Documentation site build · Ubuntu 24.04 · Python 3.12` when - the documentation path filter matches. - -Other event-specific checks follow the same convention: - -- `Documentation / Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12`; -- `Documentation / Documentation deployment · GitHub Pages`; -- `Quality Metrics / Project coverage · Ubuntu 24.04 · Python 3.12`; -- `Release Automation / PyPI distribution build · Ubuntu 24.04 · Python 3.12`; -- `Release Automation / PyPI trusted publishing · pypi`; and -- `Repository Automation / Claude Code response to mention` when the optional `@claude` - integration is invoked. - -Treat these strings as ruleset API. If a workflow or job display name changes, -replace the corresponding required-status-check entry in the repository -ruleset; do not retain an alias job for the previous name. +Active GitHub Actions checks use stable, self-contained job names. Pull requests +are coordinated by `Merge Validation` in four stages: + +1. The unit-test matrix, static analysis, and parser-reference contract run in + parallel. +2. BLAS/LAPACK validation and alternate-compiler compatibility run in parallel + after every first-stage check succeeds. +3. The Python 3.12 project-coverage gate runs after all preceding checks pass. +4. The same pinned ARM64 documentation performance benchmark used on `main` + runs after coverage, and its generated snapshot is consumed by the strict + documentation build. + +An aggregate job runs with `always()` after every stage and fails unless all +required stage results succeeded. Configure the repository ruleset with this +single required status check: + +- `Merge Validation / Pull request validation · all required checks`. + +Treat that string as ruleset API. If its workflow or job display name changes, +replace the corresponding required-status-check entry; do not retain an alias +job for the previous name. The component workflows retain complete display +names for diagnostics and for their independent main, release, scheduled, and +manual runs. ## Install @@ -104,19 +93,18 @@ python -m coverage report For subprocess coverage investigations, mirror that command shape before deciding a fix. A plain local coverage run can miss subprocess data. -GitHub Actions runs ordinary PR tests without coverage overhead. Every Python -version excludes the full BLAS/LAPACK real-library wrapper test while retaining -general native-bundle coverage. The separate `BLAS + LAPACK` workflow runs the -two full real-library nodes together on Python 3.12. A pull request may use the -`ignore-real-library-wrappers` label to skip that expensive workflow without -disabling the ordinary Python-version matrix. - -Pushes to `main` run the same canonical Python 3.12 smoke and ordinary-suite -selections in the separate `Coverage` workflow, then combine and publish their -coverage data. Add the `run-coverage` PR label, manually dispatch that workflow, -or call it as a reusable workflow to request the same coverage gate elsewhere. -The combined coverage.py report is the blocking project gate and must remain at -or above 90%. Codecov repeats that project target for hosted reporting. Its +Every Python version excludes the full BLAS/LAPACK real-library wrapper test +while retaining general native-bundle coverage. The `Native Libraries` +component runs the complete BLAS and LAPACK examples and full-library nodes on +Python 3.12. A pull request may use the `ignore-real-library-wrappers` label to +skip that expensive component without disabling the ordinary Python-version +matrix. + +Every pull request and push to `main` runs the canonical Python 3.12 smoke and +ordinary-suite selections through `Quality Metrics`, then combines and +publishes their coverage data. The combined coverage.py report is the blocking +project gate and must remain at or above 90%. Codecov repeats that project +target for hosted reporting. Its patch status is informational: changed-line coverage remains visible for review, but a tiny defensive branch cannot independently fail an otherwise passing project report. New reachable behavior should still receive focused diff --git a/docs/maintainer/ci-cd.md b/docs/maintainer/ci-cd.md index 0a196b1d0..f5bdc7b1a 100644 --- a/docs/maintainer/ci-cd.md +++ b/docs/maintainer/ci-cd.md @@ -15,8 +15,9 @@ that maintainers can preview locally, uploads the generated `site/` directory, and deploys it through GitHub Pages. Workflow names identify a unique pipeline scope, and every job display name is -self-contained so it can be selected confidently as a required check. Required -status checks must use the exact `workflow / job` contexts documented in the +self-contained. Pull requests expose one aggregate required check after the +staged component workflows complete. Required status checks must use the exact +`workflow / job` context documented in the [quality-assurance guide](../developer/quality-assurance.md). Because GitHub treats a renamed check as a different context, update the repository ruleset whenever either half of that name changes. @@ -35,29 +36,38 @@ identity and approval sequence. ## Test Platforms -The `Tests` workflow runs the ordinary suite on Ubuntu with every supported +The `Test Matrix` workflow runs the ordinary suite on Ubuntu with every supported Python version. It also runs the complete ordinary suite on macOS 15 with Python 3.12 and GNU Fortran 13, preceded by the portable compiler smoke tests. Both selections exclude `real_library`; BLAS and LAPACK run only in their dedicated Ubuntu workflow. -The `Smoke Tests` workflow also runs LLVM Flang on macOS 15. Intel IFX remains -Linux-only because Intel does not provide IFX for macOS. +The `Compiler Compatibility` workflow also runs LLVM Flang on macOS 15. Intel +IFX remains Linux-only because Intel does not provide IFX for macOS. -## Documentation Publication +For pull requests, `Merge Validation` runs the test matrix, code quality, and +parser contract first. Native-library and compiler-compatibility work starts +only after that stage succeeds. Project +coverage follows those expensive checks, then the documentation performance +benchmark and strict site build run last. An `always()` aggregate job converts +any failed or dependency-skipped required stage into one stable ruleset result. -The `Documentation` workflow runs for relevant pull requests, pushes to -`main`, and manual dispatches. Pull requests run the documentation tests and a -strict production build without deploying. A push to `main` runs those checks -and deploys the reviewed site when GitHub Pages is configured to use GitHub -Actions. +## Documentation Publication -Every push to `main` first runs the prik/f2py correctness and rigorous -performance suite. The job extracts its platform and toolchain metadata, -generates the result-dependent Performance page sections and SVG, and uploads -the generated documentation together with the raw `pyperf` files. The website -build overlays that artifact before testing and building MkDocs. Generated -results are deployment inputs, not automated commits to `main`. +The `Documentation` workflow is called by `Merge Validation` for every pull +request and also runs on pushes to `main` and manual dispatches. Pull requests +run the pinned performance benchmark, consume its generated snapshot, execute +the documentation tests, and perform a strict production build without +deploying. A push to `main` repeats those checks and deploys the reviewed site +when GitHub Pages is configured to use GitHub Actions. + +Every validated pull request and push to `main` runs the same prik/f2py +correctness and rigorous performance suite. The job extracts its platform and +toolchain metadata, generates the result-dependent Performance page sections +and SVG, and uploads the generated documentation together with the raw +`pyperf` files. The website build overlays that artifact before testing and +building MkDocs. Generated results are deployment inputs, not automated +commits to `main`. The benchmark job always targets GitHub's `ubuntu-24.04-arm` standard runner, whose hosted pool is based on Microsoft Cobalt 100 processors. It verifies the @@ -67,13 +77,15 @@ generations that may back successive x86-64 Ubuntu jobs. The documentation build and deployment remain on x86-64 Ubuntu because they consume only the generated Markdown and SVG artifact. -Pull requests verify the generator and benchmark-host metadata helpers against -fixtures but do not replace the public snapshot. The workflow pins the -benchmark toolchain and alternates whether prik or f2py is measured first to -avoid a systematic ordering advantage. Runtime cases use separate latency, -medium, and bulk sampling budgets and are merged into one pyperf result per -tool; this gives nanosecond-scale calls more independent samples without -multiplying the cost of the largest array workloads. +The pre-merge benchmark catches code-induced failures before `main`. The +`main` run is still required because it generates the deployment artifact for +the merged commit; external runner or service failures can still occur and +must be retried or diagnosed honestly. The workflow pins the benchmark +toolchain and alternates whether prik or f2py is measured first to avoid a +systematic ordering advantage. Runtime cases use separate latency, medium, and +bulk sampling budgets and are merged into one pyperf result per tool; this +gives nanosecond-scale calls more independent samples without multiplying the +cost of the largest array workloads. Documentation workflow concurrency is isolated by Git ref. Pull-request runs may cancel an older run for the same ref, but a `main` run is never canceled by diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index 5acb45bf1..1307aff0b 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -16,6 +16,7 @@ CODECOV_CONFIG = REPO_ROOT / "codecov.yml" DOCS_WORKFLOW = REPO_ROOT / ".github/workflows/docs.yml" FORTRAN_SMOKE_WORKFLOW = REPO_ROOT / ".github/workflows/fortran-toolchain-smoke.yml" +MERGE_VALIDATION_WORKFLOW = REPO_ROOT / ".github/workflows/merge-validation.yml" PARSER_REFERENCE_WORKFLOW = REPO_ROOT / ".github/workflows/parser-reference-guard.yml" PUBLISH_WORKFLOW = REPO_ROOT / ".github/workflows/publish-to-pypi.yml" STATIC_ANALYSIS_WORKFLOW = REPO_ROOT / ".github/workflows/static-analysis.yml" @@ -152,6 +153,12 @@ def _github_matrix_display_names(workflow: Path) -> tuple[str, ...]: ) +def _github_action_job_block(workflow: Path, job_id: str) -> str: + remainder = workflow.read_text(encoding="utf-8").split(f" {job_id}:\n", maxsplit=1)[1] + next_job = re.search(r"\n [a-z0-9-]+:\n", remainder) + return remainder if next_job is None else remainder[: next_job.start()] + + def test_pytest_modules_have_one_allowed_primary_owner() -> None: root_modules = sorted(path.name for path in TEST_ROOT.glob("test_*.py")) assert root_modules == [] @@ -290,6 +297,7 @@ def test_active_github_action_checks_use_distinct_workflow_scopes_and_job_names( COVERAGE_WORKFLOW: "Quality Metrics", DOCS_WORKFLOW: "Documentation", FORTRAN_SMOKE_WORKFLOW: "Compiler Compatibility", + MERGE_VALIDATION_WORKFLOW: "Merge Validation", PARSER_REFERENCE_WORKFLOW: "Contract Enforcement", PUBLISH_WORKFLOW: "Release Automation", STATIC_ANALYSIS_WORKFLOW: "Code Quality", @@ -308,6 +316,16 @@ def test_active_github_action_checks_use_distinct_workflow_scopes_and_job_names( "toolchain-smoke": "Compiler smoke · ${{ matrix.display_name }}", "macos-flang-smoke": "Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12", }, + MERGE_VALIDATION_WORKFLOW: { + "unit-tests": "Unit-test matrix stage", + "code-quality": "Code-quality stage", + "parser-contract": "Parser-contract stage", + "native-libraries": "Native-library stage", + "compiler-compatibility": "Compiler-compatibility stage", + "project-coverage": "Project-coverage stage", + "documentation": "Documentation benchmark and site-build stage", + "merge-gate": "Pull request validation · all required checks", + }, PARSER_REFERENCE_WORKFLOW: {"parser-reference-guard": "Parser reference guard · Ubuntu 24.04"}, PUBLISH_WORKFLOW: { "build": "PyPI distribution build · Ubuntu 24.04 · Python 3.12", @@ -341,31 +359,83 @@ def test_active_github_action_checks_use_distinct_workflow_scopes_and_job_names( expanded_display_names.extend(f"Unit tests · Ubuntu 24.04 · Python {version}" for version in test_python_versions) assert len(expanded_display_names) == len(set(expanded_display_names)) - documented_contexts = ( - "Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.10", - "Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.11", - "Test Matrix / Unit tests · Ubuntu 24.04 · Python 3.12", - "Test Matrix / Unit tests · macOS 15 ARM64 · Python 3.12", - "Code Quality / Static analysis · Ubuntu 24.04 · Python 3.12", - "Native Libraries / BLAS + LAPACK · Ubuntu 24.04 · Python 3.12", - "Compiler Compatibility / Compiler smoke · Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12", - "Compiler Compatibility / Compiler smoke · Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12", - "Compiler Compatibility / Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12", - "Contract Enforcement / Parser reference guard · Ubuntu 24.04", - "Documentation / Documentation site build · Ubuntu 24.04 · Python 3.12", - "Documentation / Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12", - "Documentation / Documentation deployment · GitHub Pages", - "Quality Metrics / Project coverage · Ubuntu 24.04 · Python 3.12", - "Release Automation / PyPI distribution build · Ubuntu 24.04 · Python 3.12", - "Release Automation / PyPI trusted publishing · pypi", - "Repository Automation / Claude Code response to mention", - ) + documented_contexts = ("Merge Validation / Pull request validation · all required checks",) quality_assurance = QUALITY_ASSURANCE_DOC.read_text(encoding="utf-8") assert len(documented_contexts) == len(set(documented_contexts)) for context in documented_contexts: assert f"`{context}`" in quality_assurance +def test_pull_request_merge_validation_stages_expensive_work_and_always_reports_the_gate() -> None: + workflow = MERGE_VALIDATION_WORKFLOW.read_text(encoding="utf-8") + + assert workflow.startswith("name: Merge Validation\n") + assert " pull_request:\n types: [opened, synchronize, reopened, labeled, unlabeled]" in workflow + assert "group: merge-validation-${{ github.ref }}" in workflow + assert "cancel-in-progress: true" in workflow + + stage_one = { + "unit-tests": "uses: ./.github/workflows/tests.yml", + "code-quality": "uses: ./.github/workflows/static-analysis.yml", + "parser-contract": "uses: ./.github/workflows/parser-reference-guard.yml", + } + for job_id, reusable_workflow in stage_one.items(): + block = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, job_id) + assert reusable_workflow in block + assert "needs:" not in block + + for job_id, reusable_workflow in ( + ("native-libraries", "uses: ./.github/workflows/blas-lapack.yml"), + ("compiler-compatibility", "uses: ./.github/workflows/fortran-toolchain-smoke.yml"), + ): + block = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, job_id) + assert "needs: [unit-tests, code-quality, parser-contract]" in block + assert reusable_workflow in block + + coverage = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "project-coverage") + assert "needs: [native-libraries, compiler-compatibility]" in coverage + assert "uses: ./.github/workflows/coverage.yml" in coverage + assert "id-token: write" in coverage + + documentation = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "documentation") + assert "needs: project-coverage" in documentation + assert "uses: ./.github/workflows/docs.yml" in documentation + assert "run_performance_benchmark: true" in documentation + + gate = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "merge-gate") + assert "if: ${{ always() }}" in gate + for dependency in ( + "unit-tests", + "code-quality", + "parser-contract", + "native-libraries", + "compiler-compatibility", + "project-coverage", + "documentation", + ): + assert f" - {dependency}" in gate + assert f"needs.{dependency}.result" in gate + assert 'if [[ "$result" != "success" ]]' in gate + assert 'exit "$failed"' in gate + + +def test_pull_request_components_run_only_through_merge_validation() -> None: + for workflow in ( + TESTS_WORKFLOW, + STATIC_ANALYSIS_WORKFLOW, + PARSER_REFERENCE_WORKFLOW, + BLAS_LAPACK_WORKFLOW, + FORTRAN_SMOKE_WORKFLOW, + COVERAGE_WORKFLOW, + DOCS_WORKFLOW, + ): + text = workflow.read_text(encoding="utf-8") + assert " workflow_call:" in text + assert " pull_request:" not in text + + assert "run-coverage" not in COVERAGE_WORKFLOW.read_text(encoding="utf-8") + + def test_pypi_package_identity_is_complete_and_consistent() -> None: pyproject = PYPROJECT.read_text(encoding="utf-8") changelog = CHANGELOG.read_text(encoding="utf-8") @@ -424,13 +494,15 @@ def test_static_analysis_targets_the_renamed_package_tree() -> None: assert removed_root not in workflow -def test_documentation_workflow_generates_main_only_performance_snapshot() -> None: +def test_documentation_workflow_generates_the_same_pr_and_main_performance_snapshot() -> None: workflow = DOCS_WORKFLOW.read_text(encoding="utf-8") assert "group: documentation-${{ github.ref }}" in workflow assert "cancel-in-progress: ${{ github.event_name == 'pull_request' }}" in workflow assert "runs-on: ubuntu-24.04-arm" in workflow - assert "if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'" in workflow + assert "run_performance_benchmark:" in workflow + assert workflow.count("inputs.run_performance_benchmark ||") == 2 + assert workflow.count("github.ref == 'refs/heads/main' && github.event_name != 'pull_request'") == 5 assert "python tools/benchmark_host.py" in workflow assert "--require-machine aarch64" in workflow assert "--require-arm-part 0xd49" in workflow From 8be9e451612f4466eb94cda8beb5667c348679f0 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Sun, 2 Aug 2026 08:20:08 +0100 Subject: [PATCH 09/22] change job order --- .github/workflows/merge-validation.yml | 29 +++++++++++-------- docs/developer/quality-assurance.md | 22 +++++++------- docs/maintainer/ci-cd.md | 13 +++++---- .../architecture/test_test_suite_layout.py | 25 +++++++++------- 4 files changed, 51 insertions(+), 38 deletions(-) diff --git a/.github/workflows/merge-validation.yml b/.github/workflows/merge-validation.yml index 19dcfd014..516ef5241 100644 --- a/.github/workflows/merge-validation.yml +++ b/.github/workflows/merge-validation.yml @@ -12,10 +12,6 @@ concurrency: cancel-in-progress: true jobs: - unit-tests: - name: Unit-test matrix stage - uses: ./.github/workflows/tests.yml - code-quality: name: Code-quality stage uses: ./.github/workflows/static-analysis.yml @@ -24,27 +20,36 @@ jobs: name: Parser-contract stage uses: ./.github/workflows/parser-reference-guard.yml - native-libraries: - name: Native-library stage - needs: [unit-tests, code-quality, parser-contract] - uses: ./.github/workflows/blas-lapack.yml - compiler-compatibility: name: Compiler-compatibility stage - needs: [unit-tests, code-quality, parser-contract] + needs: [code-quality, parser-contract] uses: ./.github/workflows/fortran-toolchain-smoke.yml + unit-tests: + name: Unit-test matrix stage + needs: compiler-compatibility + uses: ./.github/workflows/tests.yml + project-coverage: name: Project-coverage stage - needs: [native-libraries, compiler-compatibility] + needs: compiler-compatibility permissions: contents: read id-token: write uses: ./.github/workflows/coverage.yml + native-libraries: + name: Native-library stage + needs: [unit-tests, project-coverage] + uses: ./.github/workflows/blas-lapack.yml + documentation: name: Documentation benchmark and site-build stage - needs: project-coverage + needs: native-libraries + permissions: + contents: read + pages: write + id-token: write uses: ./.github/workflows/docs.yml with: run_performance_benchmark: true diff --git a/docs/developer/quality-assurance.md b/docs/developer/quality-assurance.md index df17e9931..a2b8b6c2e 100644 --- a/docs/developer/quality-assurance.md +++ b/docs/developer/quality-assurance.md @@ -31,16 +31,18 @@ testing and pre-commit are not part of the active stack. | Annual dependency review | Dependency vulnerability audit outside the routine per-change gate | Active GitHub Actions checks use stable, self-contained job names. Pull requests -are coordinated by `Merge Validation` in four stages: - -1. The unit-test matrix, static analysis, and parser-reference contract run in - parallel. -2. BLAS/LAPACK validation and alternate-compiler compatibility run in parallel - after every first-stage check succeeds. -3. The Python 3.12 project-coverage gate runs after all preceding checks pass. -4. The same pinned ARM64 documentation performance benchmark used on `main` - runs after coverage, and its generated snapshot is consumed by the strict - documentation build. +are coordinated by `Merge Validation` in five stages: + +1. Static analysis and the parser-reference contract run in parallel. +2. Alternate-compiler smoke testing starts only after both fast policy checks + succeed. +3. The unit-test matrix and Python 3.12 project-coverage gate run in parallel + after compiler smoke testing succeeds. +4. BLAS/LAPACK validation starts only after both ordinary testing and coverage + succeed. +5. The same pinned ARM64 documentation performance benchmark used on `main` + runs after native-library validation, and its generated snapshot is consumed + by the strict documentation build. An aggregate job runs with `always()` after every stage and fails unless all required stage results succeeded. Configure the repository ruleset with this diff --git a/docs/maintainer/ci-cd.md b/docs/maintainer/ci-cd.md index f5bdc7b1a..ced8e9cd6 100644 --- a/docs/maintainer/ci-cd.md +++ b/docs/maintainer/ci-cd.md @@ -45,12 +45,13 @@ dedicated Ubuntu workflow. The `Compiler Compatibility` workflow also runs LLVM Flang on macOS 15. Intel IFX remains Linux-only because Intel does not provide IFX for macOS. -For pull requests, `Merge Validation` runs the test matrix, code quality, and -parser contract first. Native-library and compiler-compatibility work starts -only after that stage succeeds. Project -coverage follows those expensive checks, then the documentation performance -benchmark and strict site build run last. An `always()` aggregate job converts -any failed or dependency-skipped required stage into one stable ruleset result. +For pull requests, `Merge Validation` runs code quality and the parser contract +first. Compiler-compatibility smoke testing starts only after both policy checks +succeed. The ordinary test matrix and project coverage then run in parallel; +native-library validation waits for both of them, and the documentation +performance benchmark and strict site build run last. An `always()` aggregate +job converts any failed or dependency-skipped required stage into one stable +ruleset result. ## Documentation Publication diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index 1307aff0b..1ec87f11d 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -375,7 +375,6 @@ def test_pull_request_merge_validation_stages_expensive_work_and_always_reports_ assert "cancel-in-progress: true" in workflow stage_one = { - "unit-tests": "uses: ./.github/workflows/tests.yml", "code-quality": "uses: ./.github/workflows/static-analysis.yml", "parser-contract": "uses: ./.github/workflows/parser-reference-guard.yml", } @@ -384,23 +383,29 @@ def test_pull_request_merge_validation_stages_expensive_work_and_always_reports_ assert reusable_workflow in block assert "needs:" not in block - for job_id, reusable_workflow in ( - ("native-libraries", "uses: ./.github/workflows/blas-lapack.yml"), - ("compiler-compatibility", "uses: ./.github/workflows/fortran-toolchain-smoke.yml"), - ): - block = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, job_id) - assert "needs: [unit-tests, code-quality, parser-contract]" in block - assert reusable_workflow in block + compiler_compatibility = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "compiler-compatibility") + assert "needs: [code-quality, parser-contract]" in compiler_compatibility + assert "uses: ./.github/workflows/fortran-toolchain-smoke.yml" in compiler_compatibility + + unit_tests = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "unit-tests") + assert "needs: compiler-compatibility" in unit_tests + assert "uses: ./.github/workflows/tests.yml" in unit_tests coverage = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "project-coverage") - assert "needs: [native-libraries, compiler-compatibility]" in coverage + assert "needs: compiler-compatibility" in coverage assert "uses: ./.github/workflows/coverage.yml" in coverage assert "id-token: write" in coverage + native_libraries = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "native-libraries") + assert "needs: [unit-tests, project-coverage]" in native_libraries + assert "uses: ./.github/workflows/blas-lapack.yml" in native_libraries + documentation = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "documentation") - assert "needs: project-coverage" in documentation + assert "needs: native-libraries" in documentation assert "uses: ./.github/workflows/docs.yml" in documentation assert "run_performance_benchmark: true" in documentation + assert "pages: write" in documentation + assert "id-token: write" in documentation gate = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "merge-gate") assert "if: ${{ always() }}" in gate From 02d4836aff3a948c951e4de7eeeaaf8a2ce85169 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Sun, 2 Aug 2026 08:38:51 +0100 Subject: [PATCH 10/22] change job order --- .github/workflows/blas-lapack.yml | 1 - .github/workflows/coverage.yml | 1 - .github/workflows/docs.yml | 19 +- .github/workflows/fortran-toolchain-smoke.yml | 1 - .github/workflows/merge-validation.yml | 817 +++++++++++++++++- .github/workflows/parser-reference-guard.yml | 142 --- .github/workflows/static-analysis.yml | 1 - .github/workflows/tests.yml | 1 - docs/developer/quality-assurance.md | 21 +- docs/maintainer/ci-cd.md | 31 +- .../architecture/test_test_suite_layout.py | 187 ++-- 11 files changed, 913 insertions(+), 309 deletions(-) delete mode 100644 .github/workflows/parser-reference-guard.yml diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index 675d00e86..a25fd35fb 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -5,7 +5,6 @@ on: branches: - main - release/* - workflow_call: env: PRIK_GFORTRAN_BINARY: gfortran-13 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ef9d11be2..3e5522f6e 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -5,7 +5,6 @@ on: branches: - main workflow_dispatch: - workflow_call: env: PRIK_GFORTRAN_BINARY: gfortran-13 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8d8fc7167..cf0275220 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -4,20 +4,13 @@ on: push: branches: [main] workflow_dispatch: - workflow_call: - inputs: - run_performance_benchmark: - description: Run the pinned ARM64 performance benchmark before building the site. - required: false - type: boolean - default: false permissions: contents: read concurrency: group: documentation-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} + cancel-in-progress: true env: PRIK_GFORTRAN_BINARY: gfortran-13 @@ -26,11 +19,6 @@ env: jobs: benchmark: name: Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12 - if: >- - ${{ - inputs.run_performance_benchmark || - (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') - }} runs-on: ubuntu-24.04-arm timeout-minutes: 90 permissions: @@ -136,11 +124,6 @@ jobs: run: python -m pip install -e ".[docs,qa]" - name: Download generated Performance snapshot - if: >- - ${{ - inputs.run_performance_benchmark || - (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') - }} uses: actions/download-artifact@v4 with: name: performance-snapshot diff --git a/.github/workflows/fortran-toolchain-smoke.yml b/.github/workflows/fortran-toolchain-smoke.yml index 18bc26388..f09cf72df 100644 --- a/.github/workflows/fortran-toolchain-smoke.yml +++ b/.github/workflows/fortran-toolchain-smoke.yml @@ -8,7 +8,6 @@ on: schedule: - cron: "17 4 * * 1" workflow_dispatch: - workflow_call: concurrency: group: fortran-toolchain-smoke-${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/merge-validation.yml b/.github/workflows/merge-validation.yml index 516ef5241..141416de5 100644 --- a/.github/workflows/merge-validation.yml +++ b/.github/workflows/merge-validation.yml @@ -1,4 +1,4 @@ -name: Merge Validation +name: Pull Request on: pull_request: @@ -8,89 +8,814 @@ permissions: contents: read concurrency: - group: merge-validation-${{ github.ref }} + group: pull-request-${{ github.ref }} cancel-in-progress: true +env: + PRIK_GFORTRAN_BINARY: gfortran-13 + PRIK_GFORTRAN_PACKAGE: gfortran-13 + PRIK_IFX_VERSION: "2026.1.1" + PRIK_FLANG_VERSION: "22.1.8" + PRIK_FLANG_RUNTIME_VERSION: "22.1.7" + jobs: - code-quality: - name: Code-quality stage - uses: ./.github/workflows/static-analysis.yml + static-analysis: + name: Static analysis · Ubuntu 24.04 · Python 3.12 + runs-on: ubuntu-24.04 + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install QA dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e ".[qa]" + - name: Verify static-analysis versions + run: python tools/check_static_analysis_versions.py + - name: Ruff lint + run: python -m ruff check . + - name: Ruff format + run: python -m ruff format --check . + - name: Wrapper-plan generator contracts + run: python tools/check_wrapper_codegen_complexity.py + - name: Bandit security scan + run: python -m bandit -c pyproject.toml -r prik --severity-level medium --confidence-level medium + - name: Vulture dead-code scan + run: python -m vulture + - name: Radon complexity policy + env: + PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} + PUSH_BEFORE_SHA: ${{ github.event.before }} + run: python tools/check_radon_policy.py --base-ref auto + - name: Radon complexity report + continue-on-error: true + run: python -m radon cc prik -n C -s --total-average + - name: Radon maintainability report + continue-on-error: true + run: python -m radon mi prik -s - parser-contract: - name: Parser-contract stage - uses: ./.github/workflows/parser-reference-guard.yml + parser-reference-guard: + name: Parser reference guard · Ubuntu 24.04 + runs-on: ubuntu-24.04 + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Verify parser references were updated when needed + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} + run: | + set -euo pipefail + CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA") - compiler-compatibility: - name: Compiler-compatibility stage - needs: [code-quality, parser-contract] - uses: ./.github/workflows/fortran-toolchain-smoke.yml + echo "Changed files:" + echo "$CHANGED_FILES" + echo "PR labels: ${PR_LABELS:-}" - unit-tests: - name: Unit-test matrix stage - needs: compiler-compatibility - uses: ./.github/workflows/tests.yml + FORCE_LABEL="require-parser-reference-update" + IGNORE_LABEL="ignore-parser-reference-guard" + + if [[ ",${PR_LABELS}," == *",${FORCE_LABEL},"* && \ + ",${PR_LABELS}," == *",${IGNORE_LABEL},"* ]]; then + echo "Conflicting labels: ${FORCE_LABEL} and ${IGNORE_LABEL}. Remove one." + exit 1 + fi + + if [[ ",${PR_LABELS}," == *",${IGNORE_LABEL},"* ]]; then + echo "${IGNORE_LABEL} label present; skipping guard." + exit 0 + fi + + C_DOC="docs/developer/c-parser-reference.md" + FORTRAN_DOC="docs/developer/fortran-parser-reference.md" + PYI_DOC="docs/user/reference/semantic-pyi-format.md" + + C_DOC_CHANGED=false + FORTRAN_DOC_CHANGED=false + PYI_DOC_CHANGED=false + C_PARSER_CHANGED=false + FORTRAN_PARSER_CHANGED=false + PYI_PARSER_CHANGED=false + SHARED_PARSER_CHANGED=false + + if grep -Fxq "$C_DOC" <<< "$CHANGED_FILES"; then + C_DOC_CHANGED=true + fi + if grep -Fxq "$FORTRAN_DOC" <<< "$CHANGED_FILES"; then + FORTRAN_DOC_CHANGED=true + fi + if grep -Fxq "$PYI_DOC" <<< "$CHANGED_FILES"; then + PYI_DOC_CHANGED=true + fi + + while IFS= read -r changed_file; do + case "$changed_file" in + prik/parsers/c/*|tests/c/parsing/*|tests/c/fixtures/*|tests/c/probes/test_c_types.py) + C_PARSER_CHANGED=true + ;; + prik/parsers/fortran/*|tests/fortran/source_parsing/parsing/*|tests/fortran/data_types/probes/test_fortran_type_probes.py) + FORTRAN_PARSER_CHANGED=true + ;; + prik/parsers/pyi/*|tests/fortran/semantic_pyi_format/*) + PYI_PARSER_CHANGED=true + ;; + tests/fortran/command_line_interface/pipeline/*|\ + tests/fortran/source_preprocessing/preprocessing/*|\ + prik/parsers/__init__.py|\ + prik/preprocessing.py) + SHARED_PARSER_CHANGED=true + ;; + esac + done <<< "$CHANGED_FILES" + + if [[ ",${PR_LABELS}," == *",${FORCE_LABEL},"* ]]; then + if [ "$C_DOC_CHANGED" = true ] || [ "$FORTRAN_DOC_CHANGED" = true ] || [ "$PYI_DOC_CHANGED" = true ]; then + echo "${FORCE_LABEL} label present and at least one parser reference changed." + else + echo "${FORCE_LABEL} label present, but no parser reference changed." + echo "Update ${C_DOC}, ${FORTRAN_DOC}, or ${PYI_DOC}, or remove ${FORCE_LABEL}." + exit 1 + fi + fi + + FAILED=false + + if [ "$C_PARSER_CHANGED" = true ] && [ "$C_DOC_CHANGED" != true ]; then + echo "C parser-related files changed without updating ${C_DOC}." + FAILED=true + fi + + if [ "$FORTRAN_PARSER_CHANGED" = true ] && [ "$FORTRAN_DOC_CHANGED" != true ]; then + echo "Fortran parser-related files changed without updating ${FORTRAN_DOC}." + FAILED=true + fi + + if [ "$PYI_PARSER_CHANGED" = true ] && [ "$PYI_DOC_CHANGED" != true ]; then + echo "Semantic .pyi parser-related files changed without updating ${PYI_DOC}." + FAILED=true + fi + + if [ "$SHARED_PARSER_CHANGED" = true ] && \ + [ "$C_DOC_CHANGED" != true ] && \ + [ "$FORTRAN_DOC_CHANGED" != true ] && \ + [ "$PYI_DOC_CHANGED" != true ]; then + echo "Shared parser workflow files changed without updating a parser reference." + echo "Update ${C_DOC}, ${FORTRAN_DOC}, or ${PYI_DOC}, whichever behavior changed." + FAILED=true + fi + + if [ "$FAILED" = true ]; then + echo "Use ${IGNORE_LABEL} only when the parser reference is already accurate." + exit 1 + fi + + if [ "$C_DOC_CHANGED" = true ]; then + echo "${C_DOC} changed." + fi + if [ "$FORTRAN_DOC_CHANGED" = true ]; then + echo "${FORTRAN_DOC} changed." + fi + if [ "$PYI_DOC_CHANGED" = true ]; then + echo "${PYI_DOC} changed." + fi + + echo "Parser reference guard passed." + + compiler-smoke: + name: Compiler smoke · ${{ matrix.display_name }} + needs: [static-analysis, parser-reference-guard] + runs-on: ubuntu-24.04 + timeout-minutes: 60 + permissions: + contents: read + strategy: + fail-fast: false + matrix: + include: + - toolchain: ifx + display_name: Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12 + environment: prik-ifx-2026.1.1 + fortran_compiler: ifx + c_compiler: icx + cache_version: "2026.1.1-v2" + - toolchain: flang + display_name: Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12 + environment: prik-flang-22.1.8 + fortran_compiler: flang + c_compiler: clang + cache_version: "22.1.8-runtime-22.1.7-v1" + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install test dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e ".[qa]" + - name: Cache compiler environment + id: compiler-cache + uses: actions/cache@v4 + with: + path: ${{ runner.temp }}/${{ matrix.environment }} + key: fortran-toolchain-${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.cache_version }} + - name: Install Intel IFX and ICX + if: matrix.toolchain == 'ifx' && steps.compiler-cache.outputs.cache-hit != 'true' + shell: bash + run: | + conda create --yes --solver=libmamba \ + --prefix "$RUNNER_TEMP/${{ matrix.environment }}" \ + --override-channels \ + --channel https://software.repos.intel.com/python/conda/ \ + --channel conda-forge \ + "ifx_linux-64=$PRIK_IFX_VERSION" \ + "dpcpp_linux-64=$PRIK_IFX_VERSION" + - name: Install LLVM Flang and Clang + if: matrix.toolchain == 'flang' && steps.compiler-cache.outputs.cache-hit != 'true' + shell: bash + run: | + conda create --yes --solver=libmamba \ + --prefix "$RUNNER_TEMP/${{ matrix.environment }}" \ + --override-channels \ + --channel conda-forge \ + "flang=$PRIK_FLANG_VERSION" \ + "clang=$PRIK_FLANG_VERSION" \ + "libflang-rt=$PRIK_FLANG_RUNTIME_VERSION" + - name: Export coherent compiler profile + shell: bash + run: | + toolchain_prefix="$RUNNER_TEMP/${{ matrix.environment }}" + echo "$toolchain_prefix/bin" >> "$GITHUB_PATH" + echo "LD_LIBRARY_PATH=$toolchain_prefix/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV" + - name: Verify compiler pair + shell: bash + run: | + "${RUNNER_TEMP}/${{ matrix.environment }}/bin/${{ matrix.fortran_compiler }}" --version + "${RUNNER_TEMP}/${{ matrix.environment }}/bin/${{ matrix.c_compiler }}" --version + - name: Show repository-owned lane plan + run: | + python tools/run_fortran_toolchain_lane.py \ + --compiler "$RUNNER_TEMP/${{ matrix.environment }}/bin/${{ matrix.fortran_compiler }}" \ + --junit-dir "$RUNNER_TEMP" \ + --plan + - name: Run profile checks and strict smoke + env: + PYTHONPATH: . + HYPOTHESIS_PROFILE: ci + run: | + python tools/run_fortran_toolchain_lane.py \ + --compiler "$RUNNER_TEMP/${{ matrix.environment }}/bin/${{ matrix.fortran_compiler }}" \ + --junit-dir "$RUNNER_TEMP" + - name: Summarize failed pytest nodes + if: failure() + shell: bash + run: | + shopt -s nullglob + reports=("$RUNNER_TEMP"/pytest-toolchain-*-results.xml) + for report in "${reports[@]}"; do + python tools/print_pytest_failures.py "$report" + done + + compiler-smoke-macos: + name: Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12 + needs: [static-analysis, parser-reference-guard] + runs-on: macos-15 + timeout-minutes: 60 + permissions: + contents: read + env: + HOMEBREW_NO_AUTO_UPDATE: "1" + PRIK_MACOS_FLANG_ENVIRONMENT: prik-flang-macos + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install test dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e ".[qa]" + - name: Install LLVM Flang and Clang + shell: bash + run: | + brew install flang + toolchain_prefix="$RUNNER_TEMP/$PRIK_MACOS_FLANG_ENVIRONMENT" + flang_prefix="$(brew --prefix flang)" + llvm_prefix="$(brew --prefix llvm)" + flang_c_include="$flang_prefix/include/flang" + test -f "$flang_c_include/ISO_Fortran_binding.h" + mkdir -p "$toolchain_prefix/bin" + ln -sf "$flang_prefix/bin/flang" "$toolchain_prefix/bin/flang" + ln -sf "$llvm_prefix/bin/clang" "$toolchain_prefix/bin/clang" + echo "$toolchain_prefix/bin" >> "$GITHUB_PATH" + echo "C_INCLUDE_PATH=$flang_c_include${C_INCLUDE_PATH:+:$C_INCLUDE_PATH}" >> "$GITHUB_ENV" + echo "DYLD_LIBRARY_PATH=$flang_prefix/lib:$llvm_prefix/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}" \ + >> "$GITHUB_ENV" + - name: Verify macOS compiler pair + shell: bash + run: | + echo "runner image: ${ImageOS:-unknown} ${ImageVersion:-unknown}" + sw_vers + uname -m + python --version + command -v flang + flang --version + command -v clang + clang --version + printf '#include \n' | + clang -std=c99 -fsyntax-only -x c - + - name: Show repository-owned lane plan + run: | + python tools/run_fortran_toolchain_lane.py \ + --compiler flang \ + --junit-dir "$RUNNER_TEMP" \ + --plan + - name: Run profile checks and strict smoke + env: + PYTHONPATH: . + HYPOTHESIS_PROFILE: ci + run: | + python tools/run_fortran_toolchain_lane.py \ + --compiler flang \ + --junit-dir "$RUNNER_TEMP" + - name: Summarize failed pytest nodes + if: failure() + shell: bash + run: | + shopt -s nullglob + reports=("$RUNNER_TEMP"/pytest-toolchain-*-results.xml) + for report in "${reports[@]}"; do + python tools/print_pytest_failures.py "$report" + done - project-coverage: - name: Project-coverage stage - needs: compiler-compatibility + unit-tests: + name: ${{ matrix.display_name }} + needs: [compiler-smoke, compiler-smoke-macos] + runs-on: ubuntu-24.04 permissions: contents: read id-token: write - uses: ./.github/workflows/coverage.yml + strategy: + fail-fast: false + matrix: + include: + - python-version: "3.10" + display_name: Unit tests · Ubuntu 24.04 · Python 3.10 + coverage: false + - python-version: "3.11" + display_name: Unit tests · Ubuntu 24.04 · Python 3.11 + coverage: false + - python-version: "3.12" + display_name: Unit tests + project coverage · Ubuntu 24.04 · Python 3.12 + coverage: true + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install test dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e ".[qa]" + - name: Install pinned GFortran + shell: bash + run: | + if ! command -v "$PRIK_GFORTRAN_BINARY" >/dev/null 2>&1; then + sudo apt-get update + sudo apt-get install --yes "$PRIK_GFORTRAN_PACKAGE" + fi + compiler_dir="$RUNNER_TEMP/prik-gfortran" + mkdir -p "$compiler_dir" + ln -sf "$(command -v "$PRIK_GFORTRAN_BINARY")" "$compiler_dir/gfortran" + echo "$compiler_dir" >> "$GITHUB_PATH" + "$compiler_dir/gfortran" --version + - name: Run tests + if: ${{ !matrix.coverage }} + shell: bash + env: + PYTHONPATH: . + HYPOTHESIS_PROFILE: ci + run: | + python -m pytest -q --randomly-seed=1 \ + -o junit_family=legacy \ + --junitxml="$RUNNER_TEMP/pytest-smoke-results.xml" \ + tests/fortran \ + -m toolchain_smoke \ + --require-toolchain-smoke \ + --prik-fortran-compiler=gfortran + python -m pytest -q --randomly-seed=1 \ + -o junit_family=legacy \ + --junitxml="$RUNNER_TEMP/pytest-suite-results.xml" \ + -m "not real_library and not toolchain_smoke" \ + tests/architecture \ + tests/c \ + tests/fortran \ + tests/shared + - name: Run tests with project coverage + if: ${{ matrix.coverage }} + shell: bash + env: + PYTHONPATH: . + HYPOTHESIS_PROFILE: ci + COVERAGE_PROCESS_START: ${{ github.workspace }}/pyproject.toml + run: | + python -m coverage run -m pytest -q --randomly-seed=1 \ + -o junit_family=legacy \ + --junitxml="$RUNNER_TEMP/pytest-smoke-results.xml" \ + tests/fortran \ + -m toolchain_smoke \ + --require-toolchain-smoke \ + --prik-fortran-compiler=gfortran + python -m coverage run -m pytest -q --randomly-seed=1 \ + -o junit_family=legacy \ + --junitxml="$RUNNER_TEMP/pytest-suite-results.xml" \ + -m "not real_library and not toolchain_smoke" \ + tests/architecture \ + tests/c \ + tests/fortran \ + tests/shared + - name: Summarize failed pytest nodes + if: failure() + shell: bash + run: | + shopt -s nullglob + reports=("$RUNNER_TEMP"/pytest-*-results.xml) + for report in "${reports[@]}"; do + python tools/print_pytest_failures.py "$report" + done + - name: Combine coverage data + if: ${{ matrix.coverage }} + run: python -m coverage combine + - name: Report coverage + if: ${{ matrix.coverage }} + run: python -m coverage report + - name: Emit coverage XML + if: ${{ matrix.coverage }} + run: python -m coverage xml -o coverage.xml + - name: Upload coverage to Codecov + if: ${{ matrix.coverage }} + uses: codecov/codecov-action@v6 + with: + files: ./coverage.xml + flags: py312 + use_oidc: true + fail_ci_if_error: true + + unit-tests-macos: + name: Unit tests · macOS 15 ARM64 · Python 3.12 + needs: [compiler-smoke, compiler-smoke-macos] + runs-on: macos-15 + timeout-minutes: 120 + permissions: + contents: read + env: + PRIK_GFORTRAN_BINARY: gfortran-13 + PRIK_GCC_BINARY: gcc-13 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install test dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e ".[qa]" + - name: Configure GNU Fortran and GCC 13 + shell: bash + run: | + if ! command -v "$PRIK_GFORTRAN_BINARY" >/dev/null 2>&1 || \ + ! command -v "$PRIK_GCC_BINARY" >/dev/null 2>&1; then + brew install gcc@13 + fi + compiler_dir="$RUNNER_TEMP/prik-gfortran" + mkdir -p "$compiler_dir" + ln -sf "$(command -v "$PRIK_GFORTRAN_BINARY")" "$compiler_dir/gfortran" + ln -sf "$(command -v "$PRIK_GCC_BINARY")" "$compiler_dir/gcc" + echo "$compiler_dir" >> "$GITHUB_PATH" + - name: Show macOS test environment + shell: bash + run: | + echo "runner image: ${ImageOS:-unknown} ${ImageVersion:-unknown}" + sw_vers + uname -m + python --version + command -v gfortran + gfortran --version + command -v gcc + gcc --version + - name: Show repository-owned lane plan + run: | + python tools/run_fortran_toolchain_lane.py \ + --compiler gfortran \ + --junit-dir "$RUNNER_TEMP" \ + --plan + - name: Run compiler checks and strict smoke + env: + PYTHONPATH: . + HYPOTHESIS_PROFILE: ci + run: | + python tools/run_fortran_toolchain_lane.py \ + --compiler gfortran \ + --junit-dir "$RUNNER_TEMP" + - name: Run full suite without BLAS or LAPACK + env: + PYTHONPATH: . + HYPOTHESIS_PROFILE: ci + run: | + python -m pytest -q --randomly-seed=1 \ + -o junit_family=legacy \ + --junitxml="$RUNNER_TEMP/pytest-macos-suite-results.xml" \ + -m "not real_library and not toolchain_smoke" \ + tests/architecture \ + tests/c \ + tests/fortran \ + tests/shared + - name: Summarize failed pytest nodes + if: failure() + shell: bash + run: | + shopt -s nullglob + reports=("$RUNNER_TEMP"/pytest-*-results.xml) + for report in "${reports[@]}"; do + python tools/print_pytest_failures.py "$report" + done native-libraries: - name: Native-library stage - needs: [unit-tests, project-coverage] - uses: ./.github/workflows/blas-lapack.yml + name: BLAS + LAPACK · Ubuntu 24.04 · Python 3.12 + needs: [unit-tests, unit-tests-macos] + if: >- + ${{ !contains(github.event.pull_request.labels.*.name, 'ignore-real-library-wrappers') }} + runs-on: ubuntu-24.04 + timeout-minutes: 120 + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install test dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e ".[qa]" + python -m pip install \ + "meson==1.11.2" \ + "ninja==1.13.0" \ + "scipy==1.18.0" + - name: Install pinned GFortran and LAPACK link dependencies + shell: bash + run: | + packages=(libblas-dev liblapack-dev) + if ! command -v "$PRIK_GFORTRAN_BINARY" >/dev/null 2>&1; then + packages+=("$PRIK_GFORTRAN_PACKAGE") + fi + sudo apt-get update + sudo apt-get install --yes "${packages[@]}" + compiler_dir="$RUNNER_TEMP/prik-gfortran" + mkdir -p "$compiler_dir" + ln -sf "$(command -v "$PRIK_GFORTRAN_BINARY")" "$compiler_dir/gfortran" + echo "$compiler_dir" >> "$GITHUB_PATH" + "$compiler_dir/gfortran" --version + - name: Restore compiled native library cache + uses: actions/cache@v4 + with: + path: ${{ runner.temp }}/prik-real-library-native + key: real-libraries-${{ runner.os }}-gfortran13-${{ hashFiles('examples/blas/native/**', 'examples/lapack/native/**') }} + - name: Run complete BLAS correctness example + env: + PYTHONPATH: . + HYPOTHESIS_PROFILE: ci + run: python -m pytest -q examples/blas + - name: Report reviewed LAPACK inventory + env: + PYTHONPATH: . + run: | + python - <<'PY' + from examples.lapack.routine_inventory import ( + EXPECTED_LAPACK_ROOT_PROCEDURES, + EXPECTED_LAPACK_SOURCE_FILES, + F2PY_NUMERICAL_LIMITATIONS, + ROUTINE_GROUPS, + ROUTINES, + SCIPY_VERSION, + ) - documentation: - name: Documentation benchmark and site-build stage + print(f"SciPy version: {SCIPY_VERSION}") + print(f"LAPACK implementation sources: {EXPECTED_LAPACK_SOURCE_FILES}") + print(f"Expected PRIK root procedures: {EXPECTED_LAPACK_ROOT_PROCEDURES}") + print(f"Selected float64 correctness routines: {len(ROUTINES)}") + print(f"Raw-f2py numerical limitations: {len(F2PY_NUMERICAL_LIMITATIONS)}") + for family, routines in ROUTINE_GROUPS.items(): + print(f" {family}: {len(routines)}") + PY + - name: Run SciPy-exposed LAPACK correctness example + env: + PYTHONPATH: . + HYPOTHESIS_PROFILE: ci + PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native + run: python -m pytest -q examples/lapack + - name: Run full BLAS and LAPACK wrapper tests + env: + PYTHONPATH: . + HYPOTHESIS_PROFILE: ci + PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native + run: | + python -m pytest -q --randomly-seed=1 \ + "tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[blas]" \ + "tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[lapack]" + + documentation-benchmark: + name: Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12 needs: native-libraries + if: >- + ${{ + always() && + (needs.native-libraries.result == 'success' || + (needs.native-libraries.result == 'skipped' && + contains(github.event.pull_request.labels.*.name, 'ignore-real-library-wrappers'))) + }} + runs-on: ubuntu-24.04-arm + timeout-minutes: 90 permissions: contents: read - pages: write - id-token: write - uses: ./.github/workflows/docs.yml - with: - run_performance_benchmark: true + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + cache-dependency-path: pyproject.toml + - name: Verify and record benchmark host + run: >- + python tools/benchmark_host.py + --require-machine aarch64 + --require-arm-part 0xd49 + --github-env "$GITHUB_ENV" + - name: Install benchmark dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e ".[docs]" \ + "numpy==2.5.1" \ + "meson==1.11.2" \ + "ninja==1.13.0" + - name: Install pinned GFortran + shell: bash + run: | + if ! command -v "$PRIK_GFORTRAN_BINARY" >/dev/null 2>&1; then + sudo apt-get update + sudo apt-get install --yes "$PRIK_GFORTRAN_PACKAGE" + fi + compiler_dir="$RUNNER_TEMP/prik-gfortran" + mkdir -p "$compiler_dir" + ln -sf "$(command -v "$PRIK_GFORTRAN_BINARY")" "$compiler_dir/gfortran" + echo "$compiler_dir" >> "$GITHUB_PATH" + "$compiler_dir/gfortran" --version + - name: Run correctness and rigorous performance suite + shell: bash + run: | + if (( GITHUB_RUN_NUMBER % 2 == 0 )); then + export PRIK_BENCHMARK_FIRST=f2py + else + export PRIK_BENCHMARK_FIRST=prik + fi + bash benchmarks/run.sh + - name: Generate public Performance snapshot + run: | + python tools/generate_performance_docs.py \ + --commit "$GITHUB_SHA" + - name: Report measurement stability + run: | + python -m pyperf check \ + benchmarks/results/f2py.json \ + benchmarks/results/prik.json \ + benchmarks/results/f2py-build.json \ + benchmarks/results/prik-build.json + - name: Upload Performance snapshot and raw results + uses: actions/upload-artifact@v4 + with: + name: performance-snapshot + path: | + benchmarks/results/f2py.json + benchmarks/results/prik.json + benchmarks/results/f2py-build.json + benchmarks/results/prik-build.json + docs/user/performance.md + docs/user/assets/performance-comparison.svg + docs/user/assets/build-time-comparison.svg + retention-days: 90 + + documentation-build: + name: Documentation site build · Ubuntu 24.04 · Python 3.12 + needs: documentation-benchmark + runs-on: ubuntu-24.04 + permissions: + contents: read + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + cache-dependency-path: pyproject.toml + - name: Install documentation dependencies + run: python -m pip install -e ".[docs,qa]" + - name: Download generated Performance snapshot + uses: actions/download-artifact@v4 + with: + name: performance-snapshot + path: . + - name: Run documentation tests + run: python -m pytest -q tests/shared/docs + - name: Build reviewed documentation + run: python -m mkdocs build --strict merge-gate: - name: Pull request validation · all required checks + name: Validation · all required checks if: ${{ always() }} needs: + - static-analysis + - parser-reference-guard + - compiler-smoke + - compiler-smoke-macos - unit-tests - - code-quality - - parser-contract + - unit-tests-macos - native-libraries - - compiler-compatibility - - project-coverage - - documentation + - documentation-benchmark + - documentation-build runs-on: ubuntu-24.04 permissions: {} env: + STATIC_ANALYSIS_RESULT: ${{ needs.static-analysis.result }} + PARSER_REFERENCE_RESULT: ${{ needs.parser-reference-guard.result }} + COMPILER_SMOKE_RESULT: ${{ needs.compiler-smoke.result }} + COMPILER_SMOKE_MACOS_RESULT: ${{ needs.compiler-smoke-macos.result }} UNIT_TESTS_RESULT: ${{ needs.unit-tests.result }} - CODE_QUALITY_RESULT: ${{ needs.code-quality.result }} - PARSER_CONTRACT_RESULT: ${{ needs.parser-contract.result }} + UNIT_TESTS_MACOS_RESULT: ${{ needs.unit-tests-macos.result }} NATIVE_LIBRARIES_RESULT: ${{ needs.native-libraries.result }} - COMPILER_COMPATIBILITY_RESULT: ${{ needs.compiler-compatibility.result }} - PROJECT_COVERAGE_RESULT: ${{ needs.project-coverage.result }} - DOCUMENTATION_RESULT: ${{ needs.documentation.result }} + DOCUMENTATION_BENCHMARK_RESULT: ${{ needs.documentation-benchmark.result }} + DOCUMENTATION_BUILD_RESULT: ${{ needs.documentation-build.result }} + IGNORE_NATIVE_LIBRARIES: ${{ contains(github.event.pull_request.labels.*.name, 'ignore-real-library-wrappers') }} steps: - name: Require every staged validation result shell: bash run: | failed=0 for staged_result in \ + "static-analysis=$STATIC_ANALYSIS_RESULT" \ + "parser-reference=$PARSER_REFERENCE_RESULT" \ + "compiler-smoke=$COMPILER_SMOKE_RESULT" \ + "compiler-smoke-macos=$COMPILER_SMOKE_MACOS_RESULT" \ "unit-tests=$UNIT_TESTS_RESULT" \ - "code-quality=$CODE_QUALITY_RESULT" \ - "parser-contract=$PARSER_CONTRACT_RESULT" \ + "unit-tests-macos=$UNIT_TESTS_MACOS_RESULT" \ "native-libraries=$NATIVE_LIBRARIES_RESULT" \ - "compiler-compatibility=$COMPILER_COMPATIBILITY_RESULT" \ - "project-coverage=$PROJECT_COVERAGE_RESULT" \ - "documentation=$DOCUMENTATION_RESULT" + "documentation-benchmark=$DOCUMENTATION_BENCHMARK_RESULT" \ + "documentation-build=$DOCUMENTATION_BUILD_RESULT" do stage=${staged_result%%=*} result=${staged_result#*=} + if [[ "$stage" == "native-libraries" && \ + "$result" == "skipped" && \ + "$IGNORE_NATIVE_LIBRARIES" == "true" ]]; then + continue + fi if [[ "$result" != "success" ]]; then echo "::error::$stage finished with result: $result" failed=1 diff --git a/.github/workflows/parser-reference-guard.yml b/.github/workflows/parser-reference-guard.yml deleted file mode 100644 index c76d7a084..000000000 --- a/.github/workflows/parser-reference-guard.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: Contract Enforcement - -on: - workflow_call: - -jobs: - parser-reference-guard: - name: Parser reference guard · Ubuntu 24.04 - if: > - !contains(github.event.pull_request.labels.*.name, 'ignore-parser-reference-guard') && - (github.event.action == 'opened' || - github.event.action == 'synchronize' || - github.event.action == 'reopened' || - github.event.label.name == 'ignore-parser-reference-guard' || - github.event.label.name == 'require-parser-reference-update') - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Verify parser references were updated when needed - env: - BASE_SHA: ${{ github.event.pull_request.base.sha }} - HEAD_SHA: ${{ github.event.pull_request.head.sha }} - PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} - run: | - set -euo pipefail - CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA") - - echo "Changed files:" - echo "$CHANGED_FILES" - echo "PR labels: ${PR_LABELS:-}" - - FORCE_LABEL="require-parser-reference-update" - IGNORE_LABEL="ignore-parser-reference-guard" - - if [[ ",${PR_LABELS}," == *",${FORCE_LABEL},"* && \ - ",${PR_LABELS}," == *",${IGNORE_LABEL},"* ]]; then - echo "Conflicting labels: ${FORCE_LABEL} and ${IGNORE_LABEL}. Remove one." - exit 1 - fi - - if [[ ",${PR_LABELS}," == *",${IGNORE_LABEL},"* ]]; then - echo "${IGNORE_LABEL} label present; skipping guard." - exit 0 - fi - - C_DOC="docs/developer/c-parser-reference.md" - FORTRAN_DOC="docs/developer/fortran-parser-reference.md" - PYI_DOC="docs/user/reference/semantic-pyi-format.md" - - C_DOC_CHANGED=false - FORTRAN_DOC_CHANGED=false - PYI_DOC_CHANGED=false - C_PARSER_CHANGED=false - FORTRAN_PARSER_CHANGED=false - PYI_PARSER_CHANGED=false - SHARED_PARSER_CHANGED=false - - if grep -Fxq "$C_DOC" <<< "$CHANGED_FILES"; then - C_DOC_CHANGED=true - fi - if grep -Fxq "$FORTRAN_DOC" <<< "$CHANGED_FILES"; then - FORTRAN_DOC_CHANGED=true - fi - if grep -Fxq "$PYI_DOC" <<< "$CHANGED_FILES"; then - PYI_DOC_CHANGED=true - fi - - while IFS= read -r changed_file; do - case "$changed_file" in - prik/parsers/c/*|tests/c/parsing/*|tests/c/fixtures/*|tests/c/probes/test_c_types.py) - C_PARSER_CHANGED=true - ;; - prik/parsers/fortran/*|tests/fortran/source_parsing/parsing/*|tests/fortran/data_types/probes/test_fortran_type_probes.py) - FORTRAN_PARSER_CHANGED=true - ;; - prik/parsers/pyi/*|tests/fortran/semantic_pyi_format/*) - PYI_PARSER_CHANGED=true - ;; - tests/fortran/command_line_interface/pipeline/*|\ - tests/fortran/source_preprocessing/preprocessing/*|\ - prik/parsers/__init__.py|\ - prik/preprocessing.py) - SHARED_PARSER_CHANGED=true - ;; - esac - done <<< "$CHANGED_FILES" - - if [[ ",${PR_LABELS}," == *",${FORCE_LABEL},"* ]]; then - if [ "$C_DOC_CHANGED" = true ] || [ "$FORTRAN_DOC_CHANGED" = true ] || [ "$PYI_DOC_CHANGED" = true ]; then - echo "${FORCE_LABEL} label present and at least one parser reference changed." - else - echo "${FORCE_LABEL} label present, but no parser reference changed." - echo "Update ${C_DOC}, ${FORTRAN_DOC}, or ${PYI_DOC}, or remove ${FORCE_LABEL}." - exit 1 - fi - fi - - FAILED=false - - if [ "$C_PARSER_CHANGED" = true ] && [ "$C_DOC_CHANGED" != true ]; then - echo "C parser-related files changed without updating ${C_DOC}." - FAILED=true - fi - - if [ "$FORTRAN_PARSER_CHANGED" = true ] && [ "$FORTRAN_DOC_CHANGED" != true ]; then - echo "Fortran parser-related files changed without updating ${FORTRAN_DOC}." - FAILED=true - fi - - if [ "$PYI_PARSER_CHANGED" = true ] && [ "$PYI_DOC_CHANGED" != true ]; then - echo "Semantic .pyi parser-related files changed without updating ${PYI_DOC}." - FAILED=true - fi - - if [ "$SHARED_PARSER_CHANGED" = true ] && \ - [ "$C_DOC_CHANGED" != true ] && \ - [ "$FORTRAN_DOC_CHANGED" != true ] && \ - [ "$PYI_DOC_CHANGED" != true ]; then - echo "Shared parser workflow files changed without updating a parser reference." - echo "Update ${C_DOC}, ${FORTRAN_DOC}, or ${PYI_DOC}, whichever behavior changed." - FAILED=true - fi - - if [ "$FAILED" = true ]; then - echo "Use ${IGNORE_LABEL} only when the parser reference is already accurate." - exit 1 - fi - - if [ "$C_DOC_CHANGED" = true ]; then - echo "${C_DOC} changed." - fi - if [ "$FORTRAN_DOC_CHANGED" = true ]; then - echo "${FORTRAN_DOC} changed." - fi - if [ "$PYI_DOC_CHANGED" = true ]; then - echo "${PYI_DOC} changed." - fi - - echo "Parser reference guard passed." diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 684135451..b3baf7d6d 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -5,7 +5,6 @@ on: branches: - main - release/* - workflow_call: jobs: static-analysis: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index db3a43f3f..4e1c30015 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,6 @@ on: branches: - main - release/* - workflow_call: env: PRIK_GFORTRAN_BINARY: gfortran-13 diff --git a/docs/developer/quality-assurance.md b/docs/developer/quality-assurance.md index a2b8b6c2e..bc68034b1 100644 --- a/docs/developer/quality-assurance.md +++ b/docs/developer/quality-assurance.md @@ -31,15 +31,16 @@ testing and pre-commit are not part of the active stack. | Annual dependency review | Dependency vulnerability audit outside the routine per-change gate | Active GitHub Actions checks use stable, self-contained job names. Pull requests -are coordinated by `Merge Validation` in five stages: +are coordinated by `Pull Request` in five stages: 1. Static analysis and the parser-reference contract run in parallel. 2. Alternate-compiler smoke testing starts only after both fast policy checks succeed. -3. The unit-test matrix and Python 3.12 project-coverage gate run in parallel - after compiler smoke testing succeeds. -4. BLAS/LAPACK validation starts only after both ordinary testing and coverage - succeed. +3. The unit-test matrix starts after compiler smoke testing succeeds; its + Ubuntu Python 3.12 entry owns the project-coverage gate instead of repeating + that suite in a separate job. +4. BLAS/LAPACK validation starts only after the complete unit-test matrix, + including its coverage entry, succeeds. 5. The same pinned ARM64 documentation performance benchmark used on `main` runs after native-library validation, and its generated snapshot is consumed by the strict documentation build. @@ -48,13 +49,15 @@ An aggregate job runs with `always()` after every stage and fails unless all required stage results succeeded. Configure the repository ruleset with this single required status check: -- `Merge Validation / Pull request validation · all required checks`. +- `Pull Request / Validation · all required checks`. Treat that string as ruleset API. If its workflow or job display name changes, replace the corresponding required-status-check entry; do not retain an alias -job for the previous name. The component workflows retain complete display -names for diagnostics and for their independent main, release, scheduled, and -manual runs. +job for the previous name. The pull-request workflow declares its jobs directly +so check names contain only the `Pull Request` workflow name and the actual job +name; it does not add reusable-workflow caller stages between them. The +purpose-specific workflows retain the same complete job names for their +independent main, release, scheduled, and manual runs. ## Install diff --git a/docs/maintainer/ci-cd.md b/docs/maintainer/ci-cd.md index ced8e9cd6..ff8e2775a 100644 --- a/docs/maintainer/ci-cd.md +++ b/docs/maintainer/ci-cd.md @@ -15,9 +15,11 @@ that maintainers can preview locally, uploads the generated `site/` directory, and deploys it through GitHub Pages. Workflow names identify a unique pipeline scope, and every job display name is -self-contained. Pull requests expose one aggregate required check after the -staged component workflows complete. Required status checks must use the exact -`workflow / job` context documented in the +self-contained. The `Pull Request` workflow declares the staged validation jobs +directly, avoiding the extra caller and called-workflow name layers produced by +nested reusable workflows. Pull requests expose one aggregate required check +after those jobs complete. Required status checks must use the exact `workflow +/ job` context documented in the [quality-assurance guide](../developer/quality-assurance.md). Because GitHub treats a renamed check as a different context, update the repository ruleset whenever either half of that name changes. @@ -45,22 +47,25 @@ dedicated Ubuntu workflow. The `Compiler Compatibility` workflow also runs LLVM Flang on macOS 15. Intel IFX remains Linux-only because Intel does not provide IFX for macOS. -For pull requests, `Merge Validation` runs code quality and the parser contract +For pull requests, `Pull Request` runs code quality and the parser contract first. Compiler-compatibility smoke testing starts only after both policy checks -succeed. The ordinary test matrix and project coverage then run in parallel; -native-library validation waits for both of them, and the documentation +succeed. The Ubuntu Python 3.12 matrix entry records and uploads project +coverage, avoiding a second job that would execute the same suite. +Native-library validation waits for the complete matrix, and the documentation performance benchmark and strict site build run last. An `always()` aggregate job converts any failed or dependency-skipped required stage into one stable -ruleset result. +ruleset result. The purpose-specific workflows remain independent entry points +for main, release, scheduled, and manual execution; the pull-request workflow +does not call them as nested reusable workflows. ## Documentation Publication -The `Documentation` workflow is called by `Merge Validation` for every pull -request and also runs on pushes to `main` and manual dispatches. Pull requests -run the pinned performance benchmark, consume its generated snapshot, execute -the documentation tests, and perform a strict production build without -deploying. A push to `main` repeats those checks and deploys the reviewed site -when GitHub Pages is configured to use GitHub Actions. +The `Pull Request` workflow runs the pinned performance benchmark, consumes its +generated snapshot, executes the documentation tests, and performs a strict +production build without deploying. The independent `Documentation` workflow +runs on pushes to `main` and manual dispatches, repeats those checks, and +deploys the reviewed site when GitHub Pages is configured to use GitHub +Actions. Every validated pull request and push to `main` runs the same prik/f2py correctness and rigorous performance suite. The job extracts its platform and diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index 1ec87f11d..9940c883e 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -17,7 +17,6 @@ DOCS_WORKFLOW = REPO_ROOT / ".github/workflows/docs.yml" FORTRAN_SMOKE_WORKFLOW = REPO_ROOT / ".github/workflows/fortran-toolchain-smoke.yml" MERGE_VALIDATION_WORKFLOW = REPO_ROOT / ".github/workflows/merge-validation.yml" -PARSER_REFERENCE_WORKFLOW = REPO_ROOT / ".github/workflows/parser-reference-guard.yml" PUBLISH_WORKFLOW = REPO_ROOT / ".github/workflows/publish-to-pypi.yml" STATIC_ANALYSIS_WORKFLOW = REPO_ROOT / ".github/workflows/static-analysis.yml" TESTS_WORKFLOW = REPO_ROOT / ".github/workflows/tests.yml" @@ -159,6 +158,12 @@ def _github_action_job_block(workflow: Path, job_id: str) -> str: return remainder if next_job is None else remainder[: next_job.start()] +def _github_action_job_steps(workflow: Path, job_id: str) -> tuple[str, ...]: + block = _github_action_job_block(workflow, job_id) + steps = block.split(" steps:\n", maxsplit=1)[1] + return tuple(line for line in steps.splitlines() if line.strip()) + + def test_pytest_modules_have_one_allowed_primary_owner() -> None: root_modules = sorted(path.name for path in TEST_ROOT.glob("test_*.py")) assert root_modules == [] @@ -297,8 +302,7 @@ def test_active_github_action_checks_use_distinct_workflow_scopes_and_job_names( COVERAGE_WORKFLOW: "Quality Metrics", DOCS_WORKFLOW: "Documentation", FORTRAN_SMOKE_WORKFLOW: "Compiler Compatibility", - MERGE_VALIDATION_WORKFLOW: "Merge Validation", - PARSER_REFERENCE_WORKFLOW: "Contract Enforcement", + MERGE_VALIDATION_WORKFLOW: "Pull Request", PUBLISH_WORKFLOW: "Release Automation", STATIC_ANALYSIS_WORKFLOW: "Code Quality", TESTS_WORKFLOW: "Test Matrix", @@ -317,16 +321,17 @@ def test_active_github_action_checks_use_distinct_workflow_scopes_and_job_names( "macos-flang-smoke": "Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12", }, MERGE_VALIDATION_WORKFLOW: { - "unit-tests": "Unit-test matrix stage", - "code-quality": "Code-quality stage", - "parser-contract": "Parser-contract stage", - "native-libraries": "Native-library stage", - "compiler-compatibility": "Compiler-compatibility stage", - "project-coverage": "Project-coverage stage", - "documentation": "Documentation benchmark and site-build stage", - "merge-gate": "Pull request validation · all required checks", + "static-analysis": "Static analysis · Ubuntu 24.04 · Python 3.12", + "parser-reference-guard": "Parser reference guard · Ubuntu 24.04", + "compiler-smoke": "Compiler smoke · ${{ matrix.display_name }}", + "compiler-smoke-macos": "Compiler smoke · macOS 15 ARM64 · LLVM Flang · Python 3.12", + "unit-tests": "${{ matrix.display_name }}", + "unit-tests-macos": "Unit tests · macOS 15 ARM64 · Python 3.12", + "native-libraries": "BLAS + LAPACK · Ubuntu 24.04 · Python 3.12", + "documentation-benchmark": "Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12", + "documentation-build": "Documentation site build · Ubuntu 24.04 · Python 3.12", + "merge-gate": "Validation · all required checks", }, - PARSER_REFERENCE_WORKFLOW: {"parser-reference-guard": "Parser reference guard · Ubuntu 24.04"}, PUBLISH_WORKFLOW: { "build": "PyPI distribution build · Ubuntu 24.04 · Python 3.12", "publish": "PyPI trusted publishing · pypi", @@ -344,7 +349,10 @@ def test_active_github_action_checks_use_distinct_workflow_scopes_and_job_names( assert {workflow: _github_action_job_display_names(workflow) for workflow in expected} == expected display_names = [name for jobs in expected.values() for name in jobs.values()] - assert len(display_names) == len(set(display_names)) + check_contexts = [ + f"{workflow_names[workflow]} / {job_name}" for workflow, jobs in expected.items() for job_name in jobs.values() + ] + assert len(check_contexts) == len(set(check_contexts)) assert all(not re.fullmatch(r"Python(?:\s+.*)?", name) for name in display_names) smoke_matrix_names = _github_matrix_display_names(FORTRAN_SMOKE_WORKFLOW) @@ -352,71 +360,73 @@ def test_active_github_action_checks_use_distinct_workflow_scopes_and_job_names( "Ubuntu 24.04 · Intel IFX 2026.1.1 · Python 3.12", "Ubuntu 24.04 · LLVM Flang 22.1.8 · Python 3.12", ) - test_python_versions = ("3.10", "3.11", "3.12") assert 'python-version: ["3.10", "3.11", "3.12"]' in TESTS_WORKFLOW.read_text(encoding="utf-8") - expanded_display_names = [name for name in display_names if "${{ matrix." not in name] - expanded_display_names.extend(f"Compiler smoke · {name}" for name in smoke_matrix_names) - expanded_display_names.extend(f"Unit tests · Ubuntu 24.04 · Python {version}" for version in test_python_versions) - assert len(expanded_display_names) == len(set(expanded_display_names)) - - documented_contexts = ("Merge Validation / Pull request validation · all required checks",) + documented_contexts = ("Pull Request / Validation · all required checks",) quality_assurance = QUALITY_ASSURANCE_DOC.read_text(encoding="utf-8") assert len(documented_contexts) == len(set(documented_contexts)) for context in documented_contexts: assert f"`{context}`" in quality_assurance -def test_pull_request_merge_validation_stages_expensive_work_and_always_reports_the_gate() -> None: +def test_pull_request_declares_direct_staged_jobs_and_always_reports_the_gate() -> None: workflow = MERGE_VALIDATION_WORKFLOW.read_text(encoding="utf-8") - assert workflow.startswith("name: Merge Validation\n") + assert workflow.startswith("name: Pull Request\n") assert " pull_request:\n types: [opened, synchronize, reopened, labeled, unlabeled]" in workflow - assert "group: merge-validation-${{ github.ref }}" in workflow + assert "group: pull-request-${{ github.ref }}" in workflow assert "cancel-in-progress: true" in workflow + assert "uses: ./.github/workflows/" not in workflow - stage_one = { - "code-quality": "uses: ./.github/workflows/static-analysis.yml", - "parser-contract": "uses: ./.github/workflows/parser-reference-guard.yml", - } - for job_id, reusable_workflow in stage_one.items(): + for job_id in ("static-analysis", "parser-reference-guard"): block = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, job_id) - assert reusable_workflow in block assert "needs:" not in block + assert "runs-on:" in block - compiler_compatibility = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "compiler-compatibility") - assert "needs: [code-quality, parser-contract]" in compiler_compatibility - assert "uses: ./.github/workflows/fortran-toolchain-smoke.yml" in compiler_compatibility + for job_id in ("compiler-smoke", "compiler-smoke-macos"): + block = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, job_id) + assert "needs: [static-analysis, parser-reference-guard]" in block + assert "runs-on:" in block - unit_tests = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "unit-tests") - assert "needs: compiler-compatibility" in unit_tests - assert "uses: ./.github/workflows/tests.yml" in unit_tests + for job_id in ("unit-tests", "unit-tests-macos"): + block = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, job_id) + assert "needs: [compiler-smoke, compiler-smoke-macos]" in block + assert "runs-on:" in block - coverage = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "project-coverage") - assert "needs: compiler-compatibility" in coverage - assert "uses: ./.github/workflows/coverage.yml" in coverage - assert "id-token: write" in coverage + unit_tests = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "unit-tests") + assert "Unit tests + project coverage · Ubuntu 24.04 · Python 3.12" in unit_tests + assert "python -m coverage combine" in unit_tests + assert "python -m coverage report" in unit_tests + assert "uses: codecov/codecov-action@v6" in unit_tests + assert "id-token: write" in unit_tests native_libraries = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "native-libraries") - assert "needs: [unit-tests, project-coverage]" in native_libraries - assert "uses: ./.github/workflows/blas-lapack.yml" in native_libraries + assert "needs: [unit-tests, unit-tests-macos]" in native_libraries + assert "ignore-real-library-wrappers" in native_libraries + assert "python -m pytest -q examples/blas" in native_libraries + assert "python -m pytest -q examples/lapack" in native_libraries + + benchmark = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "documentation-benchmark") + assert "needs: native-libraries" in benchmark + assert "always()" in benchmark + assert "bash benchmarks/run.sh" in benchmark - documentation = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "documentation") - assert "needs: native-libraries" in documentation - assert "uses: ./.github/workflows/docs.yml" in documentation - assert "run_performance_benchmark: true" in documentation - assert "pages: write" in documentation - assert "id-token: write" in documentation + documentation = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "documentation-build") + assert "needs: documentation-benchmark" in documentation + assert "python -m pytest -q tests/shared/docs" in documentation + assert "python -m mkdocs build --strict" in documentation gate = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "merge-gate") assert "if: ${{ always() }}" in gate for dependency in ( + "static-analysis", + "parser-reference-guard", + "compiler-smoke", + "compiler-smoke-macos", "unit-tests", - "code-quality", - "parser-contract", + "unit-tests-macos", "native-libraries", - "compiler-compatibility", - "project-coverage", - "documentation", + "documentation-benchmark", + "documentation-build", ): assert f" - {dependency}" in gate assert f"needs.{dependency}.result" in gate @@ -424,23 +434,41 @@ def test_pull_request_merge_validation_stages_expensive_work_and_always_reports_ assert 'exit "$failed"' in gate -def test_pull_request_components_run_only_through_merge_validation() -> None: +def test_purpose_specific_workflows_do_not_create_duplicate_pull_request_runs() -> None: for workflow in ( TESTS_WORKFLOW, STATIC_ANALYSIS_WORKFLOW, - PARSER_REFERENCE_WORKFLOW, BLAS_LAPACK_WORKFLOW, FORTRAN_SMOKE_WORKFLOW, COVERAGE_WORKFLOW, DOCS_WORKFLOW, ): text = workflow.read_text(encoding="utf-8") - assert " workflow_call:" in text + assert " workflow_call:" not in text assert " pull_request:" not in text assert "run-coverage" not in COVERAGE_WORKFLOW.read_text(encoding="utf-8") +def test_pull_request_jobs_share_the_reviewed_component_workflow_steps() -> None: + for pull_request_job, component_workflow, component_job in ( + ("static-analysis", STATIC_ANALYSIS_WORKFLOW, "static-analysis"), + ("compiler-smoke", FORTRAN_SMOKE_WORKFLOW, "toolchain-smoke"), + ("compiler-smoke-macos", FORTRAN_SMOKE_WORKFLOW, "macos-flang-smoke"), + ("unit-tests-macos", TESTS_WORKFLOW, "macos"), + ("native-libraries", BLAS_LAPACK_WORKFLOW, "real-library-wrappers"), + ("documentation-benchmark", DOCS_WORKFLOW, "benchmark"), + ): + assert _github_action_job_steps(MERGE_VALIDATION_WORKFLOW, pull_request_job) == _github_action_job_steps( + component_workflow, component_job + ) + + pull_request_build = _github_action_job_steps(MERGE_VALIDATION_WORKFLOW, "documentation-build") + main_build = _github_action_job_steps(DOCS_WORKFLOW, "build") + configure_pages = main_build.index(" - name: Configure GitHub Pages") + assert pull_request_build == main_build[:configure_pages] + + def test_pypi_package_identity_is_complete_and_consistent() -> None: pyproject = PYPROJECT.read_text(encoding="utf-8") changelog = CHANGELOG.read_text(encoding="utf-8") @@ -499,24 +527,31 @@ def test_static_analysis_targets_the_renamed_package_tree() -> None: assert removed_root not in workflow -def test_documentation_workflow_generates_the_same_pr_and_main_performance_snapshot() -> None: - workflow = DOCS_WORKFLOW.read_text(encoding="utf-8") - - assert "group: documentation-${{ github.ref }}" in workflow - assert "cancel-in-progress: ${{ github.event_name == 'pull_request' }}" in workflow - assert "runs-on: ubuntu-24.04-arm" in workflow - assert "run_performance_benchmark:" in workflow - assert workflow.count("inputs.run_performance_benchmark ||") == 2 - assert workflow.count("github.ref == 'refs/heads/main' && github.event_name != 'pull_request'") == 5 - assert "python tools/benchmark_host.py" in workflow - assert "--require-machine aarch64" in workflow - assert "--require-arm-part 0xd49" in workflow - assert '--github-env "$GITHUB_ENV"' in workflow - assert "bash benchmarks/run.sh" in workflow - assert "python tools/generate_performance_docs.py" in workflow - assert "name: performance-snapshot" in workflow - assert "benchmarks/results/f2py.json" in workflow - assert "benchmarks/results/prik.json" in workflow - assert "benchmarks/results/f2py-build.json" in workflow - assert "benchmarks/results/prik-build.json" in workflow - assert "uses: actions/download-artifact@v4" in workflow +def test_pull_request_and_main_generate_equivalent_documentation_performance_snapshots() -> None: + pull_request = MERGE_VALIDATION_WORKFLOW.read_text(encoding="utf-8") + main = DOCS_WORKFLOW.read_text(encoding="utf-8") + + assert "group: documentation-${{ github.ref }}" in main + assert "cancel-in-progress: true" in main + assert " workflow_call:" not in main + for declaration in ( + "runs-on: ubuntu-24.04-arm", + "python tools/benchmark_host.py", + "--require-machine aarch64", + "--require-arm-part 0xd49", + '--github-env "$GITHUB_ENV"', + "bash benchmarks/run.sh", + "python tools/generate_performance_docs.py", + "name: performance-snapshot", + "benchmarks/results/f2py.json", + "benchmarks/results/prik.json", + "benchmarks/results/f2py-build.json", + "benchmarks/results/prik-build.json", + "uses: actions/download-artifact@v4", + "python -m pytest -q tests/shared/docs", + "python -m mkdocs build --strict", + ): + assert declaration in pull_request + assert declaration in main + + assert main.count("github.ref == 'refs/heads/main' && github.event_name != 'pull_request'") == 3 From 4cda01d197a25cc8c6d38c6557f194ca2124159d Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Mon, 3 Aug 2026 00:25:13 +0100 Subject: [PATCH 11/22] clean blas and lapack examples --- .github/workflows/blas-lapack.yml | 1 + .github/workflows/merge-validation.yml | 1 + docs/user/examples/blas-wrapper.md | 345 +++++++++++++++- docs/user/examples/lapack-wrapper.md | 502 ++++++++++++++++++++++- examples/blas/README.md | 46 ++- examples/blas/conftest.py | 54 ++- examples/blas/test_routine_coverage.py | 15 +- examples/lapack/README.md | 70 +++- examples/lapack/conftest.py | 61 ++- examples/lapack/test_routine_coverage.py | 17 + 10 files changed, 1009 insertions(+), 103 deletions(-) diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index a25fd35fb..b084f472c 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -36,6 +36,7 @@ jobs: python -m pip install --upgrade pip python -m pip install -e ".[qa]" python -m pip install \ + "numpy==2.5.1" \ "meson==1.11.2" \ "ninja==1.13.0" \ "scipy==1.18.0" diff --git a/.github/workflows/merge-validation.yml b/.github/workflows/merge-validation.yml index 141416de5..add65caa8 100644 --- a/.github/workflows/merge-validation.yml +++ b/.github/workflows/merge-validation.yml @@ -591,6 +591,7 @@ jobs: python -m pip install --upgrade pip python -m pip install -e ".[qa]" python -m pip install \ + "numpy==2.5.1" \ "meson==1.11.2" \ "ninja==1.13.0" \ "scipy==1.18.0" diff --git a/docs/user/examples/blas-wrapper.md b/docs/user/examples/blas-wrapper.md index 428a3a029..537cf3af5 100644 --- a/docs/user/examples/blas-wrapper.md +++ b/docs/user/examples/blas-wrapper.md @@ -1,5 +1,5 @@ --- -title: BLAS Wrapper Example +title: Build and Validate the Reference BLAS with PRIK audience: users, advanced users prerequisites: arrays, packaging related: lapack-wrapper.md, ../guide/arrays.md @@ -7,29 +7,334 @@ status: maintained publication: reviewed --- -# BLAS Wrapper Example +# Build and Validate the Reference BLAS with PRIK -The repository-root [complete BLAS project](../../../examples/blas/README.md) -builds all 155 authoritative Reference BLAS sources with PRIK and f2py, imports -both generated modules, and validates all 155 discovered callable routines. +This example shows how to take the official Reference BLAS sources and produce two importable Python extension modules: -The project is executable documentation rather than a synthetic snippet. Its -explicitly named tests show the real wrapper signatures, mutated arguments, -independent numerical expectations or solve residuals, differential checks, -and preservation of input-only and unused storage. Its coverage audit fails if -a source, classification, export, test function, or outcome is omitted. +- one generated by **PRIK** +- one generated by **NumPy’s f2py** -Run the whole example or focus on a family or routine: +It then tests both wrappers against explicit mathematical expectations. +The full test suite in the repository applies the same method to all 155 callable routines in the Reference BLAS corpus. + +### Why this example exists + +- It demonstrates PRIK on a real Fortran library. +- It makes the differences between the two wrappers visible. +- It verifies numerical behaviour with an independent mathematical check (instead of only checking that the two wrappers agree). + +You should already be comfortable with NumPy arrays, basic packaging, and building Fortran extensions. + +--- + +## Versions used by the maintained example + +| Component | Version / source | +|--------------------|-------------------------------------------------------| +| PRIK | current repository checkout (`0.1.0`) | +| Reference BLAS | snapshot shipped in Netlib LAPACK 3.12.1 | +| Python | 3.12 (dedicated CI job) | +| NumPy / f2py | NumPy 2.5.1 | +| Meson | 1.11.2 | +| Ninja | 1.13.0 | +| Fortran compiler | GNU Fortran 13 in CI (any compatible `gfortran` works locally) | + +> **Note:** f2py is part of NumPy. +> On Python 3.12 it uses the Meson backend, which is why Meson and Ninja are required. + +For everyday use of this example, prefer the checked-in sources in +`examples/blas/native/`. +(See the [Source provenance](#source-provenance) section at the end if you want to verify the upstream archive yourself.) + +--- + +## 1. Prepare the repository and toolchain + +Clone PRIK, create a virtual environment, and install the same Python build +tools used by the dedicated CI job: + +```bash +git clone https://github.com/PyNumLab/prik.git +cd prik +python3 -m venv .venv +. .venv/bin/activate +python -m pip install --upgrade pip +python -m pip install -e ".[qa]" \ + "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" +``` + +Install GNU Fortran separately. On Ubuntu: + +```bash +sudo apt-get update +sudo apt-get install --yes gfortran +gfortran --version +``` + +All remaining commands run from the repository root with the virtual +environment active. + +--- + +## 2. Build the full source set with PRIK + +The authoritative implementation lives in the pytest fixture +[`examples/blas/conftest.py`](../../../examples/blas/conftest.py). +The commands below reproduce the PRIK build. +Run them from the repository root: + +```bash +export REPOSITORY_ROOT="$PWD" +export BLAS_BUILD_ROOT="$(mktemp -d)" + +# Collect all Fortran sources in sorted order +mapfile -t BLAS_SOURCES < <( + find "$REPOSITORY_ROOT/examples/blas/native" -maxdepth 1 -type f \ + \( -name '*.f' -o -name '*.f90' \) -print | sort +) + +mkdir -p "$BLAS_BUILD_ROOT/prik/generated" +cd "$BLAS_BUILD_ROOT/prik" + +python -m prik "${BLAS_SOURCES[@]}" \ + --out prik_reference_blas \ + --out-dir "$BLAS_BUILD_ROOT/prik/generated" \ + --compiler "$(command -v gfortran)" \ + --jobs 8 \ + --native-compile-flags=-O0 \ + --wrapper-fortran-flags=-O0 \ + --wrapper-c-flags=-O0 +``` + +This is a single planning + generation + compilation step for the whole library +(not 155 individual builds). + +`-O0` keeps the PRIK and f2py correctness builds equivalent and avoids making +optimization-dependent claims. This example focuses on correctness, not +performance. + +--- + +## 3. Build the same sources with f2py + +Use the identical source list and optimisation level: + +```bash +mkdir -p "$BLAS_BUILD_ROOT/f2py/generated" +cd "$BLAS_BUILD_ROOT/f2py" + +python -m numpy.f2py -c -m f2py_reference_blas \ + "${BLAS_SOURCES[@]}" \ + --build-dir "$BLAS_BUILD_ROOT/f2py/generated" \ + --f77flags=-O0 \ + --f90flags=-O0 \ + --opt=-O0 +``` + +Import both modules: + +```python +import os +import sys + +build_root = os.environ["BLAS_BUILD_ROOT"] +sys.path.insert(0, f"{build_root}/prik") +sys.path.insert(0, f"{build_root}/f2py") + +import f2py_reference_blas +import prik_reference_blas +``` + +### Important wrapper difference + +PRIK deliberately follows the native scalar contract: + +- For a subroutine such as `DAXPY`, arrays are mutated in place and PRIK returns the visible input scalars because they are treated as inout. +- Raw f2py also mutates the output array but returns `None`. +- Function routines such as `DDOT` return their numerical result through both wrappers. + +--- + +## 4. Understand the test fixtures and helpers + +The names `prik_blas` and `f2py_blas` in the tests are session-scoped pytest +fixtures from [`conftest.py`](../../../examples/blas/conftest.py). They build +and import each complete module once, then reuse it for every test. + +The tests import small, explicit helpers from +[`helpers.py`](../../../examples/blas/helpers.py). The two helpers used below +are intentionally narrow: + +- `assert_allclose_for_dtype` chooses a tolerance from the result dtype and the + number of accumulated operations. It delegates the final comparison to + `numpy.testing.assert_allclose`. +- `assert_storage_unchanged` uses exact array equality, including NaNs, to prove + that an input-only array or padding was not modified. + +Their complete implementations are short enough to show here. +Both helper definitions and the test functions below assume: + +```python +import numpy as np +``` + + +```python +def assert_allclose_for_dtype(actual, expected, *, operation_size: int = 1) -> None: + """Compare floating values with dtype- and accumulation-aware tolerances.""" + actual_array = np.asarray(actual) + expected_array = np.asarray(expected) + dtype = np.result_type(actual_array.dtype, expected_array.dtype) + real_dtype = np.empty((), dtype=dtype).real.dtype + epsilon = np.finfo(real_dtype).eps + scale = max(1, operation_size) + magnitude = max(1.0, float(np.max(np.abs(expected_array), initial=0.0))) + np.testing.assert_allclose( + actual_array, + expected_array, + rtol=epsilon * 8 * scale, + atol=epsilon * 8 * scale * magnitude, + ) +``` + + +```python +def assert_storage_unchanged(actual: np.ndarray, original: np.ndarray) -> None: + """Require exact preservation, including NaNs and sentinel padding.""" + np.testing.assert_array_equal(actual, original, strict=True) +``` + +--- + +## 5. Validate behaviour, not just compilation + +A solid numerical test checks three relationships: + +```text +PRIK result == independent mathematical result +f2py result == independent mathematical result +PRIK result == f2py result +``` + +It should also verify mutation, input preservation, dtype, shape, increments, leading dimensions, and unused storage when those properties are part of the routine contract. + +f2py provides useful differential evidence, but the **independent formula or residual** is the primary oracle. + +The two examples below are taken verbatim from the runnable suite. +A documentation test compares these blocks with the Python AST, so the page and the real tests stay in sync. + +### DAXPY – in-place vector update + + +```python +def test_daxpy(prik_blas, f2py_blas): + alpha = np.float64(-1.5) + x = np.array([2.0, -4.0, 1.0], dtype=np.float64) + original_y = np.array([3.0, 5.0, -2.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = original_y.copy(), original_y.copy() + + prik_scalars = prik_blas.daxpy(np.int32(3), alpha, prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_result = f2py_blas.daxpy(np.int32(3), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected_y = alpha * x + original_y + assert_allclose_for_dtype(prik_y, expected_y) + assert_allclose_for_dtype(f2py_y, expected_y) + assert_allclose_for_dtype(prik_y, f2py_y) + assert prik_scalars == (np.int32(3), alpha, np.int32(1), np.int32(1)) + assert f2py_result is None + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) +``` + +Both wrappers must mutate `y` to the expected value. +The input-only array `x` must remain unchanged. + +### DDOT – scalar function result + + +```python +def test_ddot(prik_blas, f2py_blas): + x = np.array([1.0, -2.0, 4.0], dtype=np.float64) + y = np.array([3.0, 5.0, -1.0], dtype=np.float64) + prik_x, f2py_x = x.copy(), x.copy() + prik_y, f2py_y = y.copy(), y.copy() + + prik_value, n, incx, incy = prik_blas.ddot(np.int32(3), prik_x, np.int32(1), prik_y, np.int32(1)) + f2py_value = f2py_blas.ddot(np.int32(3), f2py_x, np.int32(1), f2py_y, np.int32(1)) + + expected = np.float64(1.0 * 3.0 + (-2.0) * 5.0 + 4.0 * (-1.0)) + assert_allclose_for_dtype(prik_value, expected, operation_size=3) + assert_allclose_for_dtype(f2py_value, expected, operation_size=3) + assert_allclose_for_dtype(prik_value, f2py_value, operation_size=3) + assert (n, incx, incy) == (np.int32(3), np.int32(1), np.int32(1)) + assert_storage_unchanged(prik_x, x) + assert_storage_unchanged(f2py_x, x) + assert_storage_unchanged(prik_y, y) + assert_storage_unchanged(f2py_y, y) +``` + +--- + +## 6. Run the maintained example + +Normally let pytest build each implementation once and reuse the modules: + +```bash +cd "$REPOSITORY_ROOT" +python -m pytest -q examples/blas +``` + +Focused commands for quick debugging: ```bash -python3 -m pytest -q examples/blas -python3 -m pytest -q examples/blas/test_level1_real.py -python3 -m pytest -q examples/blas/test_level1_real.py::test_daxpy -python3 -m pytest -q examples/blas -k dgemm +python -m pytest -q examples/blas/test_level1_real.py +python -m pytest -q examples/blas/test_level1_real.py::test_daxpy +python -m pytest -q examples/blas -k dgemm +``` + +- Complete Level-1 examples → [`test_level1_real.py`](../../../examples/blas/test_level1_real.py) +- Matrix / packed / banded / symmetric / Hermitian / triangular examples → files under [`examples/blas/`](../../../examples/blas/) +- Authoritative classification → [`routine_inventory.py`](../../../examples/blas/routine_inventory.py) +- Coverage guard → [`test_routine_coverage.py`](../../../examples/blas/test_routine_coverage.py) + +For the full explanation of increments, leading dimensions, packed/banded storage, Hermitian conjugation, tolerances, coverage totals and known wrapper differences, see the +[`examples/blas` project README](../../../examples/blas/README.md). + +--- + +## Troubleshooting + +- Confirm that `gfortran`, `meson` and `ninja` are on your `PATH`. +- On Python 3.12+, do **not** force the old distutils backend of f2py. Use the pinned Meson + Ninja setup shown above. +- Run a single failing test with more detail and keep the build directory: + + ```bash + python -m pytest -vv -s --basetemp=/tmp/prik-blas-debug examples/blas/test_level1_real.py::test_daxpy + ``` + +- Read the full compiler identity, command, stdout and stderr that the fixture prints. +- Keep correctness tests and benchmarking completely separate. + This suite uses small deterministic inputs and makes no performance claims. + +--- + +## Source provenance + +The files under [`examples/blas/native/`](../../../examples/blas/native/) are byte-for-byte copies of the 155 files in `BLAS/SRC/` from the official [LAPACK 3.12.1 archive](https://www.netlib.org/lapack/lapack-3.12.1.tar.gz). + +If you want to reconstruct the upstream sources yourself: + +```bash +curl --location --output lapack-3.12.1.tar.gz \ + https://www.netlib.org/lapack/lapack-3.12.1.tar.gz + +printf '%s %s\n' \ + 37b00c90947488521f475b5a187fff4da4a5cfe61b525efcacf7a97f39a45ec6 \ + lapack-3.12.1.tar.gz | sha256sum --check - + +tar -xzf lapack-3.12.1.tar.gz ``` -See the project README for source provenance and license, exact build commands, -the PRIK/f2py API differences, increments, leading dimensions, packed and -banded layouts, symmetric/Hermitian/triangular storage, tolerance policy, -source-verified representative tests, audited coverage counts, and failure -diagnostics. The example is deterministic and correctness-only. +Official license and provenance: +[Netlib LAPACK site](https://www.netlib.org/lapack/) · [LAPACK license](https://www.netlib.org/lapack/LICENSE.txt) diff --git a/docs/user/examples/lapack-wrapper.md b/docs/user/examples/lapack-wrapper.md index 2cfbcef10..885d7cb03 100644 --- a/docs/user/examples/lapack-wrapper.md +++ b/docs/user/examples/lapack-wrapper.md @@ -1,30 +1,496 @@ --- -title: LAPACK Wrapper Example +title: Build and Validate LAPACK with PRIK audience: users, advanced users prerequisites: arrays, BLAS wrapper example related: blas-wrapper.md, ../guide/error-handling.md status: maintained -publication: draft +publication: reviewed --- -# LAPACK Wrapper Example +# Build and Validate LAPACK with PRIK -The runnable example in [`examples/lapack/`](../../../examples/lapack/) builds -the complete Reference LAPACK source corpus once through PRIK, then validates -the 127 callable double-precision routines exposed by SciPy 1.18.0. The full -wrapper is available, but the correctness inventory is intentionally limited -to SciPy's `d*` API and excludes the `_lwork` convenience helpers. +This example wraps the complete Reference LAPACK implementation corpus once with PRIK, then validates a reviewed, reproducible correctness surface. +The surface contains the 127 double-precision real routines exposed by `scipy.linalg.lapack` in SciPy 1.18.0 for `dtype=np.float64`. -Run it with: +### Why this example exists -```console -python3 -m pytest -q examples/lapack -python3 -m pytest -q examples/lapack/test_linear_general.py::test_dgesv_solves_general_system +- PRIK wraps the **complete** LAPACK library (including its BLAS dependencies). + All source-level wrapper and compilation coverage stays intact. +- Raw f2py builds only the 125 selected routines it can expose safely. + Building all 2,062 LAPACK sources through f2py is unnecessary for the differential comparison. +- SciPy supplies the 127 reviewed low-level comparison functions. +- Independent residuals, reconstructions and invariants remain the primary correctness oracle. + +This separation keeps a large real library manageable without weakening the claim: +every LAPACK source compiles through the full PRIK path, while every selected float64 routine has one visible, named correctness test. + +You should already be comfortable with the BLAS wrapper example, NumPy arrays, and basic packaging. + +--- + +## Versions and source boundary + +| Component | Version / source | +|--------------------|-------------------------------------------------------| +| PRIK | current repository checkout (`0.1.0`) | +| Reference LAPACK | Netlib LAPACK 3.12.1 | +| Reference BLAS | BLAS snapshot shipped in LAPACK 3.12.1 | +| Python | 3.12 (dedicated CI job) | +| NumPy / f2py | NumPy 2.5.1 | +| SciPy | exactly 1.18.0 (reviewed inventory) | +| Meson | 1.11.2 | +| Ninja | 1.13.0 | +| Fortran compiler | GNU Fortran 13 in CI (any compatible `gfortran` works locally) | + +--- + +## 1. Prepare the repository and toolchain + +Clone PRIK, create a virtual environment, and install the pinned comparison and +build tools: + +```bash +git clone https://github.com/PyNumLab/prik.git +cd prik +python3 -m venv .venv +. .venv/bin/activate +python -m pip install --upgrade pip +python -m pip install -e ".[qa]" \ + "numpy==2.5.1" "scipy==1.18.0" \ + "meson==1.11.2" "ninja==1.13.0" +``` + +Install GNU Fortran plus the LAPACK and BLAS development libraries used by the +selected f2py comparison build. On Ubuntu: + +```bash +sudo apt-get update +sudo apt-get install --yes gfortran liblapack-dev libblas-dev +gfortran --version +``` + +All remaining commands run from the repository root with the virtual +environment active. + +```bash +export REPOSITORY_ROOT="$PWD" +``` + +--- + +## 2. Build the complete source set with PRIK + +LAPACK is large enough that a single enormous shell command would be fragile and hard to read. +The maintained fixture in [`examples/lapack/conftest.py`](../../../examples/lapack/conftest.py) therefore reuses PRIK’s tested complete-library integration path. +It performs these steps **once per pytest session**: + +1. Parse all 2,062 LAPACK sources and generate one complete `.pyi` contract. +2. Compile those sources together with the required authoritative BLAS sources into one cached native shared library. +3. Build one PRIK extension from that complete contract and shared library. +4. Import and reuse the module across every correctness test file. + +Contract generation uses the public PRIK CLI: + +```bash +export LAPACK_BUILD_ROOT="$(mktemp -d)" +export PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR="$LAPACK_BUILD_ROOT/native-cache" +python -m prik generate \ + --pyi examples/lapack/native \ + --language fortran \ + --out "$LAPACK_BUILD_ROOT/contracts/lapack" +``` + +Why is there an intermediate generated contract when the BLAS example can use a +single source command? Two LAPACK implementation details make the separation +necessary: + +- `LA_XISNAN` contains a module procedure named `SISNAN`, while the corpus also + contains the external `SISNAN` routine. They are distinct native symbols but + cannot both become the same root Python export. +- `LA_CONSTANTS` contains internal module constants needed to compile LAPACK, + but those constants are not part of the root callable-library surface. + +A direct one-step source wrapper tries to merge those internal modules into the +root Python API. The generated contract lets the example expose the 2,064 root +procedures while still compiling and linking every implementation source. It is +generated from the sources on every clean build; it is not a hand-maintained or +hand-edited substitute for them. + +The following preparation step reuses the repository's complete native-library +compiler and creates the projected root contract. It writes the two resulting +paths to a temporary file: + +```bash +python - <<'PY' +import os +from pathlib import Path + +from tests.fortran.building_shared_library.end_to_end.real_libraries import ( + test_full_libraries as full, +) + +workdir = Path(os.environ["LAPACK_BUILD_ROOT"]) +entry = workdir / "contracts" / "lapack" / "__init__.pyi" +native_library = full._cached_native_shared_library("lapack") +runtime_entry = full._runtime_entry("lapack", entry, workdir) +(workdir / "prik-inputs.txt").write_text( + f"{runtime_entry}\n{native_library}\n", + encoding="utf-8", +) +PY +``` + +The final wrapper build now uses the same public `python -m prik` CLI as BLAS: + +```bash +mapfile -t PRIK_INPUTS < "$LAPACK_BUILD_ROOT/prik-inputs.txt" +LAPACK_RUNTIME_CONTRACT="${PRIK_INPUTS[0]}" +LAPACK_SHARED_LIBRARY="${PRIK_INPUTS[1]}" +mkdir -p "$LAPACK_BUILD_ROOT/prik/generated" +cd "$LAPACK_BUILD_ROOT/prik" +python -m prik "$LAPACK_RUNTIME_CONTRACT" \ + --out prik_reference_lapack_example \ + --out-dir "$LAPACK_BUILD_ROOT/prik/generated" \ + --compiler "$(command -v gfortran)" \ + --native-objects "$LAPACK_SHARED_LIBRARY" \ + --jobs 8 \ + --wrapper-fortran-flags="-O0 -g0" \ + --wrapper-c-flags="-O0 -g0" +``` + +The native helper compiles the repository-owned LAPACK and BLAS sources instead +of trusting an unrelated system LAPACK binary. It caches the artifact by +compiler, platform, and source digest. The pytest fixture runs this complete +sequence automatically and reports the real CLI command on failure. + +The small `_runtime_entry` projection is specific to this corpus: it removes root imports of LAPACK’s internal constants modules while retaining all 2,064 root procedures. +For your own already-built library, pass its shared-library path through +`--native-objects` with the generated contract in the same way. + +This is still **one complete PRIK wrapper**. +The correctness inventory does not cause per-routine, per-file or per-family PRIK builds. + +--- + +## 3. Build the reviewed f2py comparison surface + +The f2py side intentionally does less compilation. +It wraps the 125 selected routines that are not affected by f2py’s callback-generation limitation, includes the minimal `la_constants.f90` dependency required by `dlartg`, and links unresolved helper symbols to the system `lapack` and `blas` libraries. + +The exact command is assembled from the reviewed inventory by `_f2py_build_command`. +This short reproducer runs that same command: + +```bash +cd "$REPOSITORY_ROOT" +export LAPACK_F2PY_ROOT="$(mktemp -d)" +python - <<'PY' +import os +from pathlib import Path +import subprocess + +from examples.lapack.conftest import _build_environment, _f2py_build_command +from tests.fortran.building_shared_library.end_to_end.real_libraries import ( + test_full_libraries as full, +) + +workdir = Path(os.environ["LAPACK_F2PY_ROOT"]) +compiler = full._compiler() +command = _f2py_build_command(workdir) +subprocess.run( + command, + cwd=workdir, + env=_build_environment(compiler), + check=True, +) +print(workdir) +PY +``` + +The assembled command has this shape: + +```text +python -m numpy.f2py -c -m f2py_reference_lapack_example \ + la_constants.f90 <125 reviewed implementation sources> \ + only: <125 reviewed routine names> : \ + --dep lapack --dep blas --f2cmap \ + --build-dir \ + --f77flags=-O0 --f90flags=-O0 --opt=-O0 +``` + +`dgees` and `dgges` remain in the 127-routine correctness inventory, but raw f2py 2.5.1 cannot generate valid callback declarations from their unannotated selection-callback interfaces. +They are validated through PRIK, SciPy and independent Schur reconstruction. + +Nine additional routines have scalar writebacks that raw f2py does not project; those limitations are recorded explicitly in +[`routine_inventory.py`](../../../examples/lapack/routine_inventory.py). + +Import the two built modules and SciPy's comparison surface from the repository +root: + +```python +import os +import sys + +sys.path.insert(0, f"{os.environ['LAPACK_BUILD_ROOT']}/prik") +sys.path.insert(0, os.environ["LAPACK_F2PY_ROOT"]) + +import f2py_reference_lapack_example +import prik_reference_lapack_example +from scipy.linalg import lapack as scipy_lapack +``` + +--- + +## 4. Resolve the SciPy float64 comparison API + +SciPy determines eligibility, not the organisation of the test files. +The reviewed inventory was discovered with representative `np.float64` arrays and then frozen for SciPy 1.18.0. + +A typical low-level lookup looks like this: + +```python +import numpy as np +import scipy +from scipy.linalg import lapack + +assert scipy.__version__ == "1.18.0" +matrix = np.array([[3.0, 1.0], [1.0, 2.0]], dtype=np.float64, order="F") +dgesv = lapack.get_lapack_funcs("gesv", (matrix,)) +assert dgesv.typecode == "d" +``` + +The runtime suite does **not** silently select “whatever SciPy exports today”. +It fails clearly if the SciPy version or the expected routine inventory drifts. + +--- + +## 5. Understand the test fixtures and helpers + +The arguments `prik_lapack`, `f2py_lapack`, and `scipy_lapack` are +session-scoped pytest fixtures from +[`conftest.py`](../../../examples/lapack/conftest.py). They provide the complete +PRIK module, the selected raw-f2py module, and SciPy's pinned low-level LAPACK +module respectively. + +The displayed tests use small helpers from +[`helpers.py`](../../../examples/lapack/helpers.py): + +| Helper | Exact responsibility | +| --- | --- | +| `column_major(a)` | Copies a matrix as `np.float64` in Fortran-contiguous column-major order. | +| `active(a, rows, columns)` | Selects the logical matrix and excludes leading-dimension padding. | +| `native_pivots(p)` | Converts SciPy's zero-based general-LU pivots to LAPACK's native one-based values. | +| `assert_allclose_float64(a, b)` | Uses a float64-epsilon tolerance scaled by operation length and expected magnitude. | +| `assert_small_residual(r, ...)` | Checks an infinity-norm backward residual scaled by matrix and solution norms. | +| `assert_storage_unchanged(a, b)` | Requires exact preservation, including NaN sentinels. | + +The numerical and preservation checks are intentionally small and visible: + +```python +import numpy as np +``` + + +```python +def assert_allclose_float64(actual, expected, *, operation_size: int = 1) -> None: + """Compare float64 LAPACK results with an accumulation-aware tolerance.""" + scale = max(1, operation_size) + expected_array = np.asarray(expected) + magnitude = max(1.0, float(np.max(np.abs(expected_array), initial=0.0))) + np.testing.assert_allclose( + actual, + expected, + rtol=np.finfo(np.float64).eps * 32 * scale, + atol=np.finfo(np.float64).eps * 32 * scale * magnitude, + ) +``` + + +```python +def assert_small_residual( + residual, + *, + matrix_norm: float, + solution_norm: float, + operation_size: int, +) -> None: + """Check a backward residual scaled by the represented operation.""" + denominator = max(1.0, matrix_norm * solution_norm) + scaled = np.linalg.norm(np.asarray(residual, dtype=np.float64), ord=np.inf) / denominator + tolerance = np.finfo(np.float64).eps * 128 * max(1, operation_size) + assert scaled <= tolerance, f"scaled residual {scaled} exceeded {tolerance}" +``` + + +```python +def assert_storage_unchanged(actual: np.ndarray, expected: np.ndarray) -> None: + """Compare storage exactly, including NaN sentinels.""" + np.testing.assert_array_equal(actual, expected) +``` + +These helpers do not call LAPACK and do not hide any wrapper invocation. The +routine call and the essential residual or reconstruction remain in each test. + +--- + +## 6. Validate mathematical behaviour + +LAPACK outputs are not always unique. +Eigenvectors and singular vectors may change sign, repeated eigenspaces may use a different orthonormal basis, and pivot ties may choose another valid permutation. +Therefore byte-for-byte agreement is not the only oracle. + +Tests use explicit solutions, residuals, factor reconstructions, orthogonality, eigen equations and storage invariants. + +The two real tests below keep all three wrapper calls and the independent oracle visible. +Documentation CI verifies these blocks directly against their source functions. + +### DGESV – solve a general linear system + + +```python +def test_dgesv_solves_general_system(prik_lapack, scipy_lapack, f2py_lapack): + original_a = np.array([[3.0, 1.0], [1.0, 2.0]], dtype=np.float64) + original_b = np.array([[5.0], [5.0]], dtype=np.float64) + expected_x = np.array([[1.0], [2.0]], dtype=np.float64) + prik_a, f2py_a = column_major(original_a), column_major(original_a) + prik_b, f2py_b = column_major(original_b), column_major(original_b) + prik_piv = np.empty(2, dtype=np.int32) + f2py_piv = np.empty(2, dtype=np.int32) + + prik_scalars = prik_lapack.dgesv( + np.int32(2), np.int32(1), prik_a, np.int32(2), prik_piv, prik_b, np.int32(2), np.int32(0) + ) + f2py_result = f2py_lapack.dgesv(2, 1, f2py_a, f2py_piv, f2py_b, 0) + scipy_lu, scipy_piv, scipy_x, scipy_info = scipy_lapack.dgesv( + original_a.copy(order="F"), original_b.copy(order="F") + ) + + assert prik_scalars == (2, 1, 2, 2, 0) + assert f2py_result is None + assert scipy_info == 0 + assert_allclose_float64(active(prik_b, 2, 1), expected_x, operation_size=2) + assert_allclose_float64(active(f2py_b, 2, 1), expected_x, operation_size=2) + assert_allclose_float64(scipy_x, expected_x, operation_size=2) + assert_allclose_float64(prik_a, scipy_lu, operation_size=2) + assert_allclose_float64(f2py_a, scipy_lu, operation_size=2) + np.testing.assert_array_equal(prik_piv, native_pivots(scipy_piv)) + np.testing.assert_array_equal(f2py_piv, native_pivots(scipy_piv)) + assert_small_residual( + original_a @ prik_b - original_b, + matrix_norm=np.linalg.norm(original_a, ord=np.inf), + solution_norm=np.linalg.norm(prik_b, ord=np.inf), + operation_size=2, + ) +``` + +This test checks the known solution, the independently scaled residual `A @ X - B`, the LU output, native one-based pivots versus SciPy’s convention, and `INFO == 0`. +PRIK preserves the native argument order and returns visible scalar arguments; both PRIK and raw f2py mutate the native output arrays. + +### DPOTRF – reconstruct a Cholesky factorization + + +```python +def test_dpotrf_reconstructs_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): + logical = np.array([[4.0, 1.0], [1.0, 3.0]], dtype=np.float64) + stored = np.array([[4.0, np.nan], [1.0, 3.0]], dtype=np.float64, order="F") + prik_a, f2py_a = column_major(stored), column_major(stored) + + prik_scalars = prik_lapack.dpotrf("L", np.int32(2), prik_a, np.int32(2), np.int32(0)) + f2py_result = f2py_lapack.dpotrf(b"L", 2, f2py_a, 0) + scipy_factor, scipy_info = scipy_lapack.dpotrf(stored.copy(order="F"), lower=1, clean=0) + + assert prik_scalars == (2, 2, 0) + assert f2py_result is None + assert scipy_info == 0 + prik_lower = np.tril(prik_a) + f2py_lower = np.tril(f2py_a) + scipy_lower = np.tril(scipy_factor) + assert_allclose_float64(prik_lower @ prik_lower.T, logical, operation_size=2) + assert_allclose_float64(f2py_lower @ f2py_lower.T, logical, operation_size=2) + assert_allclose_float64(scipy_lower @ scipy_lower.T, logical, operation_size=2) + assert_allclose_float64(prik_lower, scipy_lower, operation_size=2) + assert_allclose_float64(f2py_lower, scipy_lower, operation_size=2) + assert_storage_unchanged(np.triu(prik_a, 1), np.triu(stored, 1)) + assert_storage_unchanged(np.triu(f2py_a, 1), np.triu(stored, 1)) +``` + +The NaN in the unused upper triangle detects accidental access. +Correctness is established by reconstructing `A = L @ L.T`, not merely by comparing the factor’s bytes. + +--- + +## 7. Run the maintained example + +The complete command builds the full PRIK library once, builds the selected f2py surface once, imports SciPy, and runs all 127 named tests: + +```bash +cd "$REPOSITORY_ROOT" +python -m pytest -q examples/lapack +``` + +Use a family or a single routine while diagnosing a failure: + +```bash +python -m pytest -q examples/lapack/test_linear_general.py +python -m pytest -q \ + examples/lapack/test_linear_general.py::test_dgesv_solves_general_system +python -m pytest -q examples/lapack -k dgesvd +``` + +- Full DGESV and related general-system tests → [`test_linear_general.py`](../../../examples/lapack/test_linear_general.py) +- Cholesky and other positive-definite examples → [`test_linear_positive_definite.py`](../../../examples/lapack/test_linear_positive_definite.py) +- Other families live under [`examples/lapack/`](../../../examples/lapack/) +- Authoritative mapping of all 127 routines → [`routine_inventory.py`](../../../examples/lapack/routine_inventory.py) +- Coverage audit → [`test_routine_coverage.py`](../../../examples/lapack/test_routine_coverage.py) + +Repository maintainers normally leave this expensive LAPACK wrapper/runtime command to the dedicated BLAS + LAPACK GitHub Actions job unless local execution is explicitly requested. +The command is nevertheless complete and reproducible for users who have the listed native toolchain. + +For storage formats, workspaces, pivot conventions, f2py limitations, all representative families and audited coverage totals, continue to the +[`examples/lapack` project README](../../../examples/lapack/README.md). + +--- + +## Troubleshooting + +- Confirm that `gfortran`, `ar`, `meson` and `ninja` are on `PATH` and that the system LAPACK and BLAS development libraries are installed. +- Keep SciPy at **exactly 1.18.0** for this reviewed inventory. A different version is treated as inventory drift, not silently accepted. +- On Python 3.12 or newer, let f2py use Meson; do not force the removed distutils backend. +- Rerun one named test with more detail and keep the build directory: + + ```bash + python -m pytest -vv -s --basetemp=/tmp/prik-lapack-debug \ + examples/lapack/test_linear_general.py::test_dgesv_solves_general_system + ``` + +- Compare residuals and reconstructions **before** comparing raw factor bytes; several valid LAPACK decompositions are not unique. +- This is a deterministic correctness suite. It collects no timings and makes no performance claims. + +--- + +## Source provenance + +The official versioned archive is +[`lapack-3.12.1.tar.gz`](https://www.netlib.org/lapack/lapack-3.12.1.tar.gz) + +The repository boundary is precise: + +- [`examples/lapack/native/`](../../../examples/lapack/native/) owns 2,062 implementation sources. + Of those, 2,061 are byte-for-byte the upstream `SRC/` directory; the repository adds its project-local `dlamch.f` machine-parameter implementation. +- Upstream test programs, timing programs, examples and matrix generators are **not** part of the library source set. +- [`examples/blas/native/`](../../../examples/blas/native/) separately owns the 155 Reference BLAS sources. + They are consumed as dependencies and are not copied into the LAPACK directory. + +To independently audit the official archive: + +```bash +curl --location --output lapack-3.12.1.tar.gz \ + https://www.netlib.org/lapack/lapack-3.12.1.tar.gz +printf '%s %s\n' \ + 37b00c90947488521f475b5a187fff4da4a5cfe61b525efcacf7a97f39a45ec6 \ + lapack-3.12.1.tar.gz | sha256sum --check - +tar -xzf lapack-3.12.1.tar.gz ``` -Each test compares PRIK with an independent numerical calculation and with -SciPy. The complete native source set is owned by `examples/lapack/native/`; -BLAS dependencies remain owned by `examples/blas/native/`. Native compiler -output is kept in pytest temporary/cache directories. Repository policy leaves -these LAPACK runtime commands to the dedicated GitHub Actions lane unless a -maintainer explicitly requests a local run. +See the [Netlib LAPACK release](https://www.netlib.org/lapack/lapack-3.12.1.html) +and the [three-clause BSD-style license](https://www.netlib.org/lapack/LICENSE.txt) +for upstream provenance and redistribution terms. diff --git a/examples/blas/README.md b/examples/blas/README.md index 689152ed7..e62905e0e 100644 --- a/examples/blas/README.md +++ b/examples/blas/README.md @@ -13,11 +13,16 @@ integration test, the LAPACK CI build, and the build comparison tooling. ## Provenance and license The sources are the Reference BLAS distributed by the University of Tennessee -through [Netlib BLAS](https://www.netlib.org/blas/). The repository imported -this corpus in commit `9113acde1f7d30af4c3eb3d90bb9f9da422639f2` on 2026-05-02; -this change relocates those bytes without modifying or duplicating them. Their -upstream provenance notices are retained in the files. No separate license file -was present beside the imported corpus. The +through [Netlib BLAS](https://www.netlib.org/blas/). More precisely, all 155 +files are byte-for-byte the `BLAS/SRC/` snapshot shipped in +[Netlib LAPACK 3.12.1](https://www.netlib.org/lapack/lapack-3.12.1.html); the +audited archive has SHA-256 +`37b00c90947488521f475b5a187fff4da4a5cfe61b525efcacf7a97f39a45ec6`. +The repository imported this corpus in commit +`9113acde1f7d30af4c3eb3d90bb9f9da422639f2` on 2026-05-02; this change +relocates those bytes without modifying or duplicating them. Their upstream +provenance notices are retained in the files. No separate license file was +present beside the imported corpus. The [Netlib BLAS FAQ](https://www.netlib.org/blas/faq.html#1_5) describes BLAS as freely available, permits commercial use, and asks users to acknowledge Netlib and the authors. Consult that upstream statement when redistributing the native @@ -31,7 +36,7 @@ same Meson and Ninja versions used by the dedicated BLAS/LAPACK CI lane before running the example: ```console -python3 -m pip install "meson==1.11.2" "ninja==1.13.0" +python3 -m pip install "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" ``` The session fixtures use the following effective commands. Both commands @@ -39,8 +44,8 @@ receive the same sorted absolute source list and `-O0`; all artifacts stay in a temporary directory. ```bash -REPOSITORY_ROOT="$(pwd)" -BUILD_ROOT="$(mktemp -d)" +export REPOSITORY_ROOT="$(pwd)" +export BUILD_ROOT="$(mktemp -d)" mapfile -t BLAS_SOURCES < <(find "$REPOSITORY_ROOT/examples/blas/native" -maxdepth 1 -type f \( -name '*.f' -o -name '*.f90' \) -print | sort) mkdir -p "$BUILD_ROOT/prik" "$BUILD_ROOT/f2py" cd "$BUILD_ROOT/prik" @@ -55,10 +60,12 @@ python3 -m numpy.f2py -c -m f2py_reference_blas "${BLAS_SOURCES[@]}" --build-dir Import the modules from their build directories: ```python +import os import sys -sys.path.insert(0, f"{BUILD_ROOT}/prik") -sys.path.insert(0, f"{BUILD_ROOT}/f2py") +build_root = os.environ["BUILD_ROOT"] +sys.path.insert(0, f"{build_root}/prik") +sys.path.insert(0, f"{build_root}/f2py") import prik_reference_blas import f2py_reference_blas ``` @@ -130,6 +137,25 @@ symmetric, Hermitian, and triangular band storage. The tests reconstruct the logical matrix before calculating the independent expectation and preserve unused band rows exactly. +### Test fixtures and helper vocabulary + +`prik_blas` and `f2py_blas` are session-scoped pytest fixtures from +[`conftest.py`](conftest.py). They build and import each complete wrapper once. +The named tests use narrow helpers from [`helpers.py`](helpers.py): + +| Helper | Responsibility | +| --- | --- | +| `assert_allclose_for_dtype` | Compares floating results with a tolerance derived from the real component dtype, expected magnitude, and operation length. | +| `assert_storage_unchanged` | Uses exact equality, including NaNs, for input-only arrays, padding, and sentinel storage. | +| `logical_vector` / `logical_positions` | Maps native positive or negative BLAS increments to logical vector elements. | +| `packed_*` and `*_band_*` helpers | Reconstructs the logical matrix represented by packed or banded native storage. | +| `symmetric_from_triangle`, `hermitian_from_triangle`, `triangular_from_triangle` | Reconstructs only the triangle the BLAS contract permits the routine to read. | + +Every wrapper call and independent formula remains visible in its test; these +helpers only handle comparison or storage mechanics. The examples below assume +`import numpy as np` and the corresponding imports from `helpers.py`, exactly as +shown in the linked test files. + ## Representative tests (source verified) These examples are copied verbatim from the real tests. Documentation tests diff --git a/examples/blas/conftest.py b/examples/blas/conftest.py index ec0110f3b..f94240c85 100644 --- a/examples/blas/conftest.py +++ b/examples/blas/conftest.py @@ -100,20 +100,16 @@ def _import_built_module(module_name: str, workdir: Path): sys.path.remove(str(workdir)) -@pytest.fixture(scope="session") -def prik_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltBLAS: - """Build and import the complete source set through PRIK once.""" - compiler = _compiler() - workdir = tmp_path_factory.mktemp("prik-reference-blas") - module_name = "prik_reference_blas" +def _prik_build_command(workdir: Path, compiler: str) -> tuple[str, ...]: + """Build the complete source set through PRIK's public CLI.""" jobs = max(1, min(os.cpu_count() or 1, 8)) - command = ( + return ( sys.executable, "-m", "prik", *(str(source) for source in BLAS_SOURCES), "--out", - module_name, + "prik_reference_blas", "--out-dir", str(workdir / "generated"), "--compiler", @@ -124,6 +120,33 @@ def prik_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltBLAS: f"--wrapper-fortran-flags={BUILD_FLAGS}", f"--wrapper-c-flags={BUILD_FLAGS}", ) + + +def _f2py_build_command(workdir: Path) -> tuple[str, ...]: + """Build the identical complete source set through NumPy f2py.""" + return ( + sys.executable, + "-m", + "numpy.f2py", + "-c", + "-m", + "f2py_reference_blas", + *(str(source) for source in BLAS_SOURCES), + "--build-dir", + str(workdir / "generated"), + f"--f77flags={BUILD_FLAGS}", + f"--f90flags={BUILD_FLAGS}", + f"--opt={BUILD_FLAGS}", + ) + + +@pytest.fixture(scope="session") +def prik_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltBLAS: + """Build and import the complete source set through PRIK once.""" + compiler = _compiler() + workdir = tmp_path_factory.mktemp("prik-reference-blas") + module_name = "prik_reference_blas" + command = _prik_build_command(workdir, compiler) result = _run_build(command, workdir, compiler) return BuiltBLAS( module=_import_built_module(module_name, workdir), @@ -142,20 +165,7 @@ def f2py_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltBLAS: compiler = _compiler() workdir = tmp_path_factory.mktemp("f2py-reference-blas") module_name = "f2py_reference_blas" - command = ( - sys.executable, - "-m", - "numpy.f2py", - "-c", - "-m", - module_name, - *(str(source) for source in BLAS_SOURCES), - "--build-dir", - str(workdir / "generated"), - f"--f77flags={BUILD_FLAGS}", - f"--f90flags={BUILD_FLAGS}", - f"--opt={BUILD_FLAGS}", - ) + command = _f2py_build_command(workdir) result = _run_build(command, workdir, compiler) return BuiltBLAS( module=_import_built_module(module_name, workdir), diff --git a/examples/blas/test_routine_coverage.py b/examples/blas/test_routine_coverage.py index 95712fb9c..949119e95 100644 --- a/examples/blas/test_routine_coverage.py +++ b/examples/blas/test_routine_coverage.py @@ -3,11 +3,12 @@ from __future__ import annotations import ast +import sys from pathlib import Path import pytest -from conftest import BLAS_SOURCES, EXAMPLE_ROOT +from conftest import BLAS_SOURCES, EXAMPLE_ROOT, _f2py_build_command, _prik_build_command from prik.parsers.fortran.parser import parse_fortran_file from routine_inventory import ( ALL_ROUTINES, @@ -40,6 +41,18 @@ ) +def test_build_commands_use_the_documented_public_clis(tmp_path: Path): + prik_command = _prik_build_command(tmp_path / "prik", "/usr/bin/gfortran") + f2py_command = _f2py_build_command(tmp_path / "f2py") + + assert prik_command[:3] == (sys.executable, "-m", "prik") + assert prik_command[prik_command.index("--out") + 1] == "prik_reference_blas" + assert f2py_command[:6] == (sys.executable, "-m", "numpy.f2py", "-c", "-m", "f2py_reference_blas") + for source in BLAS_SOURCES: + assert str(source) in prik_command + assert str(source) in f2py_command + + def _source_routines() -> tuple[str, ...]: routines: list[str] = [] for source in BLAS_SOURCES: diff --git a/examples/lapack/README.md b/examples/lapack/README.md index 6e9710611..d3407e274 100644 --- a/examples/lapack/README.md +++ b/examples/lapack/README.md @@ -16,12 +16,17 @@ the coverage audit instead of shrinking the inventory. ## Source ownership, provenance, and license `examples/lapack/native/` is the repository's only owner of the Reference -LAPACK implementation sources. It contains library implementation routines and -the `la_constants`/`la_xisnan` modules required by the build; it excludes the -upstream testing programs, timing programs, examples, and matrix generators. -The corpus was originally imported from the Netlib Reference LAPACK distribution -and is covered by the LAPACK three-clause BSD-style license. See the -[Reference LAPACK site](https://www.netlib.org/lapack/) and +LAPACK implementation sources. Of its 2,062 files, 2,061 are byte-for-byte the +`SRC/` directory from +[Netlib LAPACK 3.12.1](https://www.netlib.org/lapack/lapack-3.12.1.html); the +repository adds its project-local `dlamch.f` machine-parameter implementation +to the wrapper corpus. The audited upstream archive has SHA-256 +`37b00c90947488521f475b5a187fff4da4a5cfe61b525efcacf7a97f39a45ec6`. +The boundary contains library implementation routines and the +`la_constants`/`la_xisnan` modules required by the build; it excludes upstream +testing programs, timing programs, examples, and matrix generators. The +upstream source is covered by the LAPACK three-clause BSD-style license. See +the [Reference LAPACK site](https://www.netlib.org/lapack/) and [license](https://www.netlib.org/lapack/LICENSE.txt). BLAS remains separately owned by `examples/blas/native/`. The complete LAPACK @@ -36,7 +41,7 @@ before running this example: ```console sudo apt-get install libblas-dev liblapack-dev -python3 -m pip install "meson==1.11.2" "ninja==1.13.0" "scipy==1.18.0" +python3 -m pip install "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" "scipy==1.18.0" ``` The session fixture reuses the established complete-library integration path in @@ -59,9 +64,30 @@ The contract-generation command is: python3 -m prik generate --pyi examples/lapack/native --language fortran --out /tmp/prik-lapack/contracts/lapack ``` -The extension build is performed by `build_pyi_extension` with the complete -contract, the cached `libprik_full_lapack.so`, and `-O0` wrapper flags. The raw -f2py command assembled by `conftest.py` is equivalent to: +The intermediate contract separates LAPACK's root callable surface from its +internal `LA_CONSTANTS` and `LA_XISNAN` modules. A direct merged source build +would otherwise collide the module procedure `SISNAN` with the distinct +external `SISNAN` routine and try to expose internal module constants. The +contract is generated from all sources; no callable procedure is manually +removed. All sources are still compiled into the native artifact. + +The final extension build uses the public CLI with the projected root contract +and cached native shared library: + +```console +python3 -m prik /tmp/prik-lapack/runtime-contract/lapack/__init__.pyi \ + --out prik_reference_lapack_example \ + --out-dir /tmp/prik-lapack/prik/generated \ + --compiler "$(command -v gfortran)" \ + --native-objects /tmp/prik-lapack/libprik_full_lapack.so \ + --jobs 8 \ + --wrapper-fortran-flags="-O0 -g0" \ + --wrapper-c-flags="-O0 -g0" +``` + +The paths are illustrative; `conftest.py` creates their actual temporary/cache +locations and records the exact executable command. The raw f2py command it +assembles is equivalent to: ```console python3 -m numpy.f2py -c -m f2py_reference_lapack_example \ @@ -225,6 +251,30 @@ Runtime success, f2py projection limitations, and any PRIK failures are CI outcomes and must be reported honestly; structural completion does not predict them. +## Test fixtures and helper vocabulary + +`prik_lapack`, `f2py_lapack`, and `scipy_lapack` are session-scoped pytest +fixtures from [`conftest.py`](conftest.py). They provide the complete PRIK +wrapper, the selected raw-f2py comparison module, and SciPy's pinned low-level +LAPACK module. + +The tests use explicit mechanics from [`helpers.py`](helpers.py): + +| Helper | Responsibility | +| --- | --- | +| `column_major` | Creates a Fortran-contiguous `np.float64` matrix for the native column-major contract. | +| `active` | Selects the logical matrix while excluding leading-dimension padding. | +| `native_pivots` | Converts SciPy's zero-based general-LU pivots to LAPACK's native one-based convention. | +| `assert_allclose_float64` | Scales a float64-epsilon tolerance by operation length and expected magnitude. | +| `assert_small_residual` | Checks an infinity-norm backward residual relative to the matrix and solution norms. | +| `assert_storage_unchanged` | Uses exact equality, including NaNs, for unused triangles, padding, and input-only storage. | +| `gfortran_logical_mask` | Represents the documented four-byte default-`LOGICAL` ABI used by the two selection-array tests. | +| reconstruction helpers | Converts banded, tridiagonal, packed, RFP, LU, QR, and related native storage into matrices used by visible residuals and identities. | + +The helpers never invoke LAPACK and never hide a PRIK, SciPy, or f2py routine +call. The source-verified examples below assume `import numpy as np` and the +corresponding imports from `helpers.py`, as shown in their linked test modules. + ## Representative source-verified tests The documentation checker extracts each named function from the real test AST diff --git a/examples/lapack/conftest.py b/examples/lapack/conftest.py index bee593fa3..84aa0c1dd 100644 --- a/examples/lapack/conftest.py +++ b/examples/lapack/conftest.py @@ -20,6 +20,7 @@ EXAMPLE_ROOT = Path(__file__).resolve().parent NATIVE_ROOT = EXAMPLE_ROOT / "native" BUILD_FLAGS = "-O0" +PRIK_WRAPPER_FLAGS = ("-O0", "-g0") FORTRAN_SUFFIXES = (".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn") F2PY_BUILD_DEPENDENCIES = ("la_constants.f90",) F2PY_KIND_MAP = "{'real': {'wp': 'double'}}\n" @@ -65,7 +66,7 @@ def _run_build(command: tuple[str, ...], workdir: Path, compiler: str) -> subpro ) if result.returncode: pytest.fail( - "Reference LAPACK comparison build failed\n" + "Reference LAPACK build failed\n" f"compiler: {full._compiler_identity(compiler)}\n" f"command: {shlex.join(command)}\n" f"stdout:\n{result.stdout or ''}\n" @@ -133,38 +134,54 @@ def _f2py_build_command(workdir: Path) -> tuple[str, ...]: ) +def _prik_build_command( + runtime_entry: Path, + native_library: Path, + workdir: Path, + compiler: str, +) -> tuple[str, ...]: + """Build the projected complete-library contract through PRIK's public CLI.""" + jobs = max(1, min(os.cpu_count() or 1, 8)) + joined_wrapper_flags = " ".join(PRIK_WRAPPER_FLAGS) + return ( + sys.executable, + "-m", + "prik", + str(runtime_entry), + "--out", + "prik_reference_lapack_example", + "--out-dir", + str(workdir / "generated"), + "--compiler", + compiler, + "--native-objects", + str(native_library), + "--jobs", + str(jobs), + f"--wrapper-fortran-flags={joined_wrapper_flags}", + f"--wrapper-c-flags={joined_wrapper_flags}", + ) + + @pytest.fixture(scope="session") def prik_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltLapack: - """Build the one complete PRIK LAPACK wrapper through the established path.""" + """Build the complete LAPACK wrapper through PRIK's public CLI once.""" compiler = full._compiler() workdir = tmp_path_factory.mktemp("prik-reference-lapack-example") entry = full._generate_contract(NATIVE_ROOT, workdir / "contracts" / "lapack") shared = full._cached_native_shared_library("lapack") runtime_entry = full._runtime_entry("lapack", entry, workdir) - result = full.build_pyi_extension( - runtime_entry, - output_name="prik_reference_lapack_example", - output_dir=workdir / "build", - native_objects=[shared], - wrapper_fortran_flags=full.FULL_LIBRARY_WRAPPER_FLAGS, - wrapper_c_flags=full.FULL_LIBRARY_WRAPPER_FLAGS, - ) - command = ( - sys.executable, - "-m", - "prik", - "", - "--native-shared-library", - str(shared), - ) + module_name = "prik_reference_lapack_example" + command = _prik_build_command(runtime_entry, shared, workdir, compiler) + result = _run_build(command, workdir, compiler) return BuiltLapack( - module=_import_built_module(result.module_name, result.output_dir), - module_name=result.module_name, + module=_import_built_module(module_name, workdir), + module_name=module_name, workdir=workdir, command=command, compiler_identity=full._compiler_identity(compiler), - stdout="", - stderr="", + stdout=result.stdout, + stderr=result.stderr, ) diff --git a/examples/lapack/test_routine_coverage.py b/examples/lapack/test_routine_coverage.py index c08809359..259020cf9 100644 --- a/examples/lapack/test_routine_coverage.py +++ b/examples/lapack/test_routine_coverage.py @@ -3,6 +3,7 @@ from __future__ import annotations import ast +import sys from pathlib import Path import pytest @@ -11,8 +12,10 @@ F2PY_BUILD_DEPENDENCIES, F2PY_KIND_MAP, F2PY_LINK_DEPENDENCIES, + PRIK_WRAPPER_FLAGS, _f2py_build_command, _f2py_source_plan, + _prik_build_command, ) from .routine_inventory import ( EXPLICIT_TEST_NAMES, @@ -141,6 +144,20 @@ def test_f2py_source_plan_includes_required_kind_module(tmp_path: Path): assert (tmp_path / ".f2py_f2cmap").read_text(encoding="utf-8") == F2PY_KIND_MAP +def test_prik_build_command_uses_the_public_cli(tmp_path: Path): + """The documented LAPACK wrapper build is a real PRIK CLI invocation.""" + runtime_entry = tmp_path / "runtime" / "__init__.pyi" + native_library = tmp_path / "libprik_full_lapack.so" + command = _prik_build_command(runtime_entry, native_library, tmp_path, "/usr/bin/gfortran") + + assert command[:4] == (sys.executable, "-m", "prik", str(runtime_entry)) + assert command[command.index("--native-objects") + 1] == str(native_library) + assert "--native-shared-library" not in command + joined_flags = " ".join(PRIK_WRAPPER_FLAGS) + assert f"--wrapper-fortran-flags={joined_flags}" in command + assert f"--wrapper-c-flags={joined_flags}" in command + + def test_authoritative_native_source_boundary_is_complete_and_unique(): """The maintained source owner contains the complete library corpus once.""" sources = tuple( From 3e1b8c4a50b6cd38fd9c36083f21f4e37b3bd9c7 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Mon, 3 Aug 2026 01:19:52 +0100 Subject: [PATCH 12/22] unify the testing of blas+lapack --- .github/workflows/blas-lapack.yml | 25 ++++---- .github/workflows/merge-validation.yml | 25 ++++---- docs/developer/quality-assurance.md | 11 ++-- docs/developer/testing-strategy.md | 12 +++- docs/user/examples/blas-wrapper.md | 41 +++++++++---- docs/user/examples/lapack-wrapper.md | 18 ++++-- examples/blas/README.md | 47 +++++++++++---- examples/blas/ci_full_surface.py | 17 ++++++ examples/blas/conftest.py | 8 ++- examples/blas/f2py_contract.py | 13 ++++ examples/blas/routine_inventory.py | 16 +---- examples/blas/test_level1_complex.py | 18 ++++-- examples/blas/test_level1_real.py | 24 ++++++-- examples/blas/test_routine_coverage.py | 40 ++++++++++--- examples/f2py_intents.py | 58 ++++++++++++++++++ examples/lapack/README.md | 59 +++++++++---------- examples/lapack/ci_full_surface.py | 22 +++++++ examples/lapack/conftest.py | 14 +++-- examples/lapack/f2py_contract.py | 16 +++++ examples/lapack/routine_inventory.py | 31 +++------- examples/lapack/test_auxiliary.py | 26 ++++++-- .../lapack/test_linear_banded_tridiagonal.py | 26 ++++++-- examples/lapack/test_linear_general.py | 7 ++- .../lapack/test_linear_positive_definite.py | 16 +++-- .../test_linear_symmetric_indefinite.py | 15 ++++- examples/lapack/test_linear_triangular.py | 15 ++++- examples/lapack/test_routine_coverage.py | 23 +++++--- .../architecture/test_test_suite_layout.py | 30 ++++++---- 28 files changed, 472 insertions(+), 201 deletions(-) create mode 100644 examples/blas/ci_full_surface.py create mode 100644 examples/blas/f2py_contract.py create mode 100644 examples/f2py_intents.py create mode 100644 examples/lapack/ci_full_surface.py create mode 100644 examples/lapack/f2py_contract.py diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index b084f472c..e86ad9820 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -59,20 +59,22 @@ jobs: with: path: ${{ runner.temp }}/prik-real-library-native key: real-libraries-${{ runner.os }}-gfortran13-${{ hashFiles('examples/blas/native/**', 'examples/lapack/native/**') }} - - name: Run complete BLAS correctness example + - name: Run BLAS example and CI full-surface audit env: PYTHONPATH: . HYPOTHESIS_PROFILE: ci - run: python -m pytest -q examples/blas + run: >- + python -m pytest -q -o "python_files=test_*.py ci_full_surface.py" + examples/blas examples/blas/ci_full_surface.py - name: Report reviewed LAPACK inventory env: PYTHONPATH: . run: | python - <<'PY' + from examples.lapack.f2py_contract import F2PY_INOUT_ARGUMENTS from examples.lapack.routine_inventory import ( EXPECTED_LAPACK_ROOT_PROCEDURES, EXPECTED_LAPACK_SOURCE_FILES, - F2PY_NUMERICAL_LIMITATIONS, ROUTINE_GROUPS, ROUTINES, SCIPY_VERSION, @@ -82,22 +84,15 @@ jobs: print(f"LAPACK implementation sources: {EXPECTED_LAPACK_SOURCE_FILES}") print(f"Expected PRIK root procedures: {EXPECTED_LAPACK_ROOT_PROCEDURES}") print(f"Selected float64 correctness routines: {len(ROUTINES)}") - print(f"Raw-f2py numerical limitations: {len(F2PY_NUMERICAL_LIMITATIONS)}") + print(f"f2py scalar-writeback intent overlays: {len(F2PY_INOUT_ARGUMENTS)}") for family, routines in ROUTINE_GROUPS.items(): print(f" {family}: {len(routines)}") PY - - name: Run SciPy-exposed LAPACK correctness example + - name: Run LAPACK example and CI full-surface audit env: PYTHONPATH: . HYPOTHESIS_PROFILE: ci PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native - run: python -m pytest -q examples/lapack - - name: Run full BLAS and LAPACK wrapper tests - env: - PYTHONPATH: . - HYPOTHESIS_PROFILE: ci - PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native - run: | - python -m pytest -q --randomly-seed=1 \ - "tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[blas]" \ - "tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[lapack]" + run: >- + python -m pytest -q -o "python_files=test_*.py ci_full_surface.py" + examples/lapack examples/lapack/ci_full_surface.py diff --git a/.github/workflows/merge-validation.yml b/.github/workflows/merge-validation.yml index add65caa8..b764e26d4 100644 --- a/.github/workflows/merge-validation.yml +++ b/.github/workflows/merge-validation.yml @@ -614,20 +614,22 @@ jobs: with: path: ${{ runner.temp }}/prik-real-library-native key: real-libraries-${{ runner.os }}-gfortran13-${{ hashFiles('examples/blas/native/**', 'examples/lapack/native/**') }} - - name: Run complete BLAS correctness example + - name: Run BLAS example and CI full-surface audit env: PYTHONPATH: . HYPOTHESIS_PROFILE: ci - run: python -m pytest -q examples/blas + run: >- + python -m pytest -q -o "python_files=test_*.py ci_full_surface.py" + examples/blas examples/blas/ci_full_surface.py - name: Report reviewed LAPACK inventory env: PYTHONPATH: . run: | python - <<'PY' + from examples.lapack.f2py_contract import F2PY_INOUT_ARGUMENTS from examples.lapack.routine_inventory import ( EXPECTED_LAPACK_ROOT_PROCEDURES, EXPECTED_LAPACK_SOURCE_FILES, - F2PY_NUMERICAL_LIMITATIONS, ROUTINE_GROUPS, ROUTINES, SCIPY_VERSION, @@ -637,25 +639,18 @@ jobs: print(f"LAPACK implementation sources: {EXPECTED_LAPACK_SOURCE_FILES}") print(f"Expected PRIK root procedures: {EXPECTED_LAPACK_ROOT_PROCEDURES}") print(f"Selected float64 correctness routines: {len(ROUTINES)}") - print(f"Raw-f2py numerical limitations: {len(F2PY_NUMERICAL_LIMITATIONS)}") + print(f"f2py scalar-writeback intent overlays: {len(F2PY_INOUT_ARGUMENTS)}") for family, routines in ROUTINE_GROUPS.items(): print(f" {family}: {len(routines)}") PY - - name: Run SciPy-exposed LAPACK correctness example - env: - PYTHONPATH: . - HYPOTHESIS_PROFILE: ci - PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native - run: python -m pytest -q examples/lapack - - name: Run full BLAS and LAPACK wrapper tests + - name: Run LAPACK example and CI full-surface audit env: PYTHONPATH: . HYPOTHESIS_PROFILE: ci PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native - run: | - python -m pytest -q --randomly-seed=1 \ - "tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[blas]" \ - "tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[lapack]" + run: >- + python -m pytest -q -o "python_files=test_*.py ci_full_surface.py" + examples/lapack examples/lapack/ci_full_surface.py documentation-benchmark: name: Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12 diff --git a/docs/developer/quality-assurance.md b/docs/developer/quality-assurance.md index bc68034b1..bcec3f9c8 100644 --- a/docs/developer/quality-assurance.md +++ b/docs/developer/quality-assurance.md @@ -100,10 +100,13 @@ For subprocess coverage investigations, mirror that command shape before deciding a fix. A plain local coverage run can miss subprocess data. Every Python version excludes the full BLAS/LAPACK real-library wrapper test while retaining general native-bundle coverage. The `Native Libraries` -component runs the complete BLAS and LAPACK examples and full-library nodes on -Python 3.12. A pull request may use the `ignore-real-library-wrappers` label to -skip that expensive component without disabling the ordinary Python-version -matrix. +component runs the complete BLAS and LAPACK examples on Python 3.12. Those +pytest invocations explicitly add each example's non-discovered +`ci_full_surface.py`, reusing the session-scoped extension for complete +root-export audits and runtime smoke calls instead of rebuilding the wrapper +layer in a second process. A pull request may use the +`ignore-real-library-wrappers` label to skip that expensive component without +disabling the ordinary Python-version matrix. Every pull request and push to `main` runs the canonical Python 3.12 smoke and ordinary-suite selections through `Quality Metrics`, then combines and diff --git a/docs/developer/testing-strategy.md b/docs/developer/testing-strategy.md index 675ddacb2..81ea9f2d5 100644 --- a/docs/developer/testing-strategy.md +++ b/docs/developer/testing-strategy.md @@ -128,8 +128,11 @@ For BLAS behavior, run `python3 -m pytest -q examples/blas` or one of its named test functions. The session fixtures build the identical sorted 155-source set once through PRIK and once through f2py. `test_routine_coverage.py` audits the parsed source inventory, both export sets, visible named tests, and terminal -outcomes. The older full-library BLAS node remains broader wrapper-build and -native-link integration evidence, while LAPACK runtime remains CI-only. +outcomes. The separate full-library node remains available as opt-in +`build_pyi_extension` and native-link integration evidence, but the dedicated +CI lane explicitly adds `examples/blas/ci_full_surface.py` to the same pytest +invocation and does not rebuild its wrappers afterward. Ordinary example runs +do not discover that CI-only file. For LAPACK behavior, the dedicated lane runs `python3 -m pytest -q examples/lapack`. Its session fixtures wrap and compile @@ -137,7 +140,10 @@ the complete LAPACK corpus and required authoritative BLAS dependencies once, then reuse that module while explicitly testing the reviewed 127-routine SciPy 1.18.0 `float64` inventory. The inventory audit fails on SciPy drift, missing sources or exports, missing explicitly named tests, and divergent -documentation totals. +documentation totals. CI explicitly adds `examples/lapack/ci_full_surface.py` +to the same pytest invocation, reusing the complete PRIK extension to require +all 2,064 root exports and run a non-inventory runtime smoke call. Ordinary +example runs do not discover that file. ## Ownership discipline diff --git a/docs/user/examples/blas-wrapper.md b/docs/user/examples/blas-wrapper.md index 537cf3af5..977ca2e6e 100644 --- a/docs/user/examples/blas-wrapper.md +++ b/docs/user/examples/blas-wrapper.md @@ -115,22 +115,36 @@ performance. --- -## 3. Build the same sources with f2py +## 3. Build the same implementations with f2py -Use the identical source list and optimisation level: +Use the maintained command builder so the comparison matches the test suite: ```bash -mkdir -p "$BLAS_BUILD_ROOT/f2py/generated" -cd "$BLAS_BUILD_ROOT/f2py" - -python -m numpy.f2py -c -m f2py_reference_blas \ - "${BLAS_SOURCES[@]}" \ - --build-dir "$BLAS_BUILD_ROOT/f2py/generated" \ - --f77flags=-O0 \ - --f90flags=-O0 \ - --opt=-O0 +cd "$REPOSITORY_ROOT" +python - <<'PY' +import os +from pathlib import Path +import subprocess + +from examples.blas.conftest import _build_environment, _compiler, _f2py_build_command + +workdir = Path(os.environ["BLAS_BUILD_ROOT"]) / "f2py" +workdir.mkdir(parents=True, exist_ok=True) +compiler = _compiler() +subprocess.run( + _f2py_build_command(workdir), + cwd=workdir, + env=_build_environment(compiler), + check=True, +) +PY ``` +Six rotation routines document scalar writebacks without declaring Fortran +`intent`. The f2py build adds temporary intent directives and the tests pass +typed 0-D arrays. PRIK needs neither: it returns unannotated scalar writebacks +directly, with ordinary scalar arguments. + Import both modules: ```python @@ -150,7 +164,7 @@ import prik_reference_blas PRIK deliberately follows the native scalar contract: - For a subroutine such as `DAXPY`, arrays are mutated in place and PRIK returns the visible input scalars because they are treated as inout. -- Raw f2py also mutates the output array but returns `None`. +- The f2py comparison module also mutates the output array but returns `None`. - Function routines such as `DDOT` return their numerical result through both wrappers. --- @@ -160,6 +174,9 @@ PRIK deliberately follows the native scalar contract: The names `prik_blas` and `f2py_blas` in the tests are session-scoped pytest fixtures from [`conftest.py`](../../../examples/blas/conftest.py). They build and import each complete module once, then reuse it for every test. +GitHub Actions explicitly adds the non-discovered `ci_full_surface.py` to the +same pytest invocation for maintainer-only full-surface checks; ordinary users +running `pytest examples/blas` do not collect it. The tests import small, explicit helpers from [`helpers.py`](../../../examples/blas/helpers.py). The two helpers used below diff --git a/docs/user/examples/lapack-wrapper.md b/docs/user/examples/lapack-wrapper.md index 885d7cb03..ad45fd906 100644 --- a/docs/user/examples/lapack-wrapper.md +++ b/docs/user/examples/lapack-wrapper.md @@ -169,6 +169,10 @@ For your own already-built library, pass its shared-library path through This is still **one complete PRIK wrapper**. The correctness inventory does not cause per-routine, per-file or per-family PRIK builds. +GitHub Actions explicitly adds the non-discovered `ci_full_surface.py` to reuse +the same imported extension for the all-2,064-root export audit and runtime +smoke call. Ordinary `pytest examples/lapack` runs do not collect that +maintainer-only file, and CI does not rebuild a second wrapper for it. --- @@ -177,6 +181,11 @@ The correctness inventory does not cause per-routine, per-file or per-family PRI The f2py side intentionally does less compilation. It wraps the 125 selected routines that are not affected by f2py’s callback-generation limitation, includes the minimal `la_constants.f90` dependency required by `dlartg`, and links unresolved helper symbols to the system `lapack` and `blas` libraries. +Nine routines document scalar writebacks without declaring Fortran `intent`. +The f2py build adds temporary intent directives and the tests pass typed 0-D +arrays. PRIK needs neither: it returns unannotated scalar writebacks directly, +with ordinary scalar arguments. + The exact command is assembled from the reviewed inventory by `_f2py_build_command`. This short reproducer runs that same command: @@ -220,9 +229,6 @@ python -m numpy.f2py -c -m f2py_reference_lapack_example \ `dgees` and `dgges` remain in the 127-routine correctness inventory, but raw f2py 2.5.1 cannot generate valid callback declarations from their unannotated selection-callback interfaces. They are validated through PRIK, SciPy and independent Schur reconstruction. -Nine additional routines have scalar writebacks that raw f2py does not project; those limitations are recorded explicitly in -[`routine_inventory.py`](../../../examples/lapack/routine_inventory.py). - Import the two built modules and SciPy's comparison surface from the repository root: @@ -268,7 +274,7 @@ It fails clearly if the SciPy version or the expected routine inventory drifts. The arguments `prik_lapack`, `f2py_lapack`, and `scipy_lapack` are session-scoped pytest fixtures from [`conftest.py`](../../../examples/lapack/conftest.py). They provide the complete -PRIK module, the selected raw-f2py module, and SciPy's pinned low-level LAPACK +PRIK module, the selected f2py comparison module, and SciPy's pinned low-level LAPACK module respectively. The displayed tests use small helpers from @@ -383,7 +389,7 @@ def test_dgesv_solves_general_system(prik_lapack, scipy_lapack, f2py_lapack): ``` This test checks the known solution, the independently scaled residual `A @ X - B`, the LU output, native one-based pivots versus SciPy’s convention, and `INFO == 0`. -PRIK preserves the native argument order and returns visible scalar arguments; both PRIK and raw f2py mutate the native output arrays. +PRIK preserves the native argument order and returns visible scalar arguments; both PRIK and the f2py comparison module mutate the native output arrays. ### DPOTRF – reconstruct a Cholesky factorization @@ -445,7 +451,7 @@ python -m pytest -q examples/lapack -k dgesvd Repository maintainers normally leave this expensive LAPACK wrapper/runtime command to the dedicated BLAS + LAPACK GitHub Actions job unless local execution is explicitly requested. The command is nevertheless complete and reproducible for users who have the listed native toolchain. -For storage formats, workspaces, pivot conventions, f2py limitations, all representative families and audited coverage totals, continue to the +For storage formats, workspaces, pivot conventions, the f2py callback limitation and scalar-intent overlays, all representative families and audited coverage totals, continue to the [`examples/lapack` project README](../../../examples/lapack/README.md). --- diff --git a/examples/blas/README.md b/examples/blas/README.md index e62905e0e..c9a2ca708 100644 --- a/examples/blas/README.md +++ b/examples/blas/README.md @@ -39,9 +39,9 @@ running the example: python3 -m pip install "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" ``` -The session fixtures use the following effective commands. Both commands -receive the same sorted absolute source list and `-O0`; all artifacts stay in a -temporary directory. +The session fixtures build the same implementations at `-O0`; all artifacts +stay in a temporary directory. PRIK consumes the authoritative sources +directly: ```bash export REPOSITORY_ROOT="$(pwd)" @@ -53,10 +53,31 @@ python3 -m prik "${BLAS_SOURCES[@]}" --out prik_reference_blas --out-dir "$BUILD ``` ```bash -cd "$BUILD_ROOT/f2py" -python3 -m numpy.f2py -c -m f2py_reference_blas "${BLAS_SOURCES[@]}" --build-dir "$BUILD_ROOT/f2py/generated" --f77flags=-O0 --f90flags=-O0 --opt=-O0 +cd "$REPOSITORY_ROOT" +python3 - <<'PY' +import os +from pathlib import Path +import subprocess + +from examples.blas.conftest import _build_environment, _compiler, _f2py_build_command + +workdir = Path(os.environ["BUILD_ROOT"]) / "f2py" +workdir.mkdir(parents=True, exist_ok=True) +compiler = _compiler() +subprocess.run( + _f2py_build_command(workdir), + cwd=workdir, + env=_build_environment(compiler), + check=True, +) +PY ``` +Six rotation routines document scalar writebacks without declaring Fortran +`intent`. The f2py fixture adds build-local intent directives and passes typed +0-D arrays so those writes are testable. PRIK needs neither the overlay nor +carrier arrays: it returns unannotated scalar writebacks directly. + Import the modules from their build directories: ```python @@ -79,6 +100,10 @@ python3 -m pytest -q examples/blas/test_level1_real.py::test_daxpy python3 -m pytest -q examples/blas -k dgemm ``` +The dedicated CI lane explicitly adds `ci_full_surface.py` to that same pytest +invocation. Its nonstandard filename keeps the maintainer-only audit out of +ordinary example runs while still reusing the already-built extensions. + ## What each test proves Numerical tests normally establish all three relationships: @@ -430,16 +455,14 @@ Current audited counts: | Discovered callable routines | 155 | | PRIK exports and independently validated routines | 155 | | f2py exports | 155 | -| Full independent plus differential success | 149 | -| Proven f2py scalar-writeback limitations | 6 | +| Full independent plus differential success | 155 | +| f2py scalar-writeback intent overlays | 6 | | Unsupported routines | 0 | | Environmentally skipped routines | 0 | -The six f2py limitations are `srotg`, `drotg`, `crotg`, `zrotg`, `srotmg`, and -`drotmg`. From these unannotated Reference BLAS sources, f2py treats the scalar -writeback arguments as input-only. PRIK's scalar results are independently -validated; f2py's observable return or `PARAM` mutation is still recorded. -These are f2py projection limitations, not skipped PRIK checks. +The overlays cover `srotg`, `drotg`, `crotg`, `zrotg`, `srotmg`, and `drotmg`. +Their tests validate f2py's 0-D scalar storage against PRIK and independent +mathematics; no routine is excluded from differential coverage. PRIK uses Python `str` for native character arguments while f2py uses `bytes`. PRIK returns detached scalar arguments alongside function/subroutine results; diff --git a/examples/blas/ci_full_surface.py b/examples/blas/ci_full_surface.py new file mode 100644 index 000000000..a2317004d --- /dev/null +++ b/examples/blas/ci_full_surface.py @@ -0,0 +1,17 @@ +"""Maintainer-only complete-surface checks that reuse the BLAS example build.""" + +from __future__ import annotations + +import pytest + +from examples.blas.routine_inventory import ALL_ROUTINES +from tests.fortran.building_shared_library.end_to_end.real_libraries import test_full_libraries as full + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_ci_complete_prik_surface_reuses_example_extension(prik_blas): + missing = sorted(routine for routine in ALL_ROUTINES if not callable(getattr(prik_blas, routine, None))) + assert missing == [] + full._assert_blas_runtime_smoke(prik_blas) diff --git a/examples/blas/conftest.py b/examples/blas/conftest.py index f94240c85..cc2592508 100644 --- a/examples/blas/conftest.py +++ b/examples/blas/conftest.py @@ -13,6 +13,9 @@ import pytest +from examples.f2py_intents import prepare_f2py_intent_sources +from examples.blas.f2py_contract import F2PY_INOUT_ARGUMENTS + EXAMPLE_ROOT = Path(__file__).resolve().parent REPOSITORY_ROOT = EXAMPLE_ROOT.parents[1] @@ -123,7 +126,8 @@ def _prik_build_command(workdir: Path, compiler: str) -> tuple[str, ...]: def _f2py_build_command(workdir: Path) -> tuple[str, ...]: - """Build the identical complete source set through NumPy f2py.""" + """Build the complete source set with reviewed f2py intent overlays.""" + sources = prepare_f2py_intent_sources(BLAS_SOURCES, workdir, F2PY_INOUT_ARGUMENTS) return ( sys.executable, "-m", @@ -131,7 +135,7 @@ def _f2py_build_command(workdir: Path) -> tuple[str, ...]: "-c", "-m", "f2py_reference_blas", - *(str(source) for source in BLAS_SOURCES), + *(str(source) for source in sources), "--build-dir", str(workdir / "generated"), f"--f77flags={BUILD_FLAGS}", diff --git a/examples/blas/f2py_contract.py b/examples/blas/f2py_contract.py new file mode 100644 index 000000000..f720baac0 --- /dev/null +++ b/examples/blas/f2py_contract.py @@ -0,0 +1,13 @@ +"""Reviewed f2py intent additions for Reference BLAS comparison calls.""" + +from __future__ import annotations + + +F2PY_INOUT_ARGUMENTS: dict[str, tuple[str, ...]] = { + "srotg": ("a", "b", "c", "s"), + "drotg": ("a", "b", "c", "s"), + "crotg": ("a", "c", "s"), + "zrotg": ("a", "c", "s"), + "srotmg": ("sd1", "sd2", "sx1", "sparam"), + "drotmg": ("dd1", "dd2", "dx1", "dparam"), +} diff --git a/examples/blas/routine_inventory.py b/examples/blas/routine_inventory.py index 48291db8e..a949cfd8e 100644 --- a/examples/blas/routine_inventory.py +++ b/examples/blas/routine_inventory.py @@ -2,7 +2,6 @@ from __future__ import annotations - ROUTINE_GROUPS: dict[str, tuple[str, ...]] = { "BLAS Level 1 real": ( "sasum", @@ -190,20 +189,7 @@ ALL_ROUTINES = tuple(routine for routines in ROUTINE_GROUPS.values() for routine in routines) PRIK_TESTED_ROUTINES = frozenset(ALL_ROUTINES) -# f2py infers these scalar arguments as input-only from the unannotated reference -# sources. The native calls run, but updated scalar values are not projected back -# to Python. Their tests validate PRIK completely and compare any observable f2py -# array mutation. -F2PY_LIMITATIONS: dict[str, str] = { - "srotg": "f2py returns None and exposes none of the four updated scalar arguments", - "drotg": "f2py returns None and exposes none of the four updated scalar arguments", - "crotg": "f2py returns None and exposes none of the four updated scalar arguments", - "zrotg": "f2py returns None and exposes none of the four updated scalar arguments", - "srotmg": "f2py exposes PARAM mutation but not the updated D1, D2, and X1 scalars", - "drotmg": "f2py exposes PARAM mutation but not the updated D1, D2, and X1 scalars", -} - -DIFFERENTIALLY_TESTED_ROUTINES = frozenset(ALL_ROUTINES) - F2PY_LIMITATIONS.keys() +DIFFERENTIALLY_TESTED_ROUTINES = frozenset(ALL_ROUTINES) UNSUPPORTED_ROUTINES: dict[str, str] = {} PERMANENTLY_SKIPPED_ROUTINES: dict[str, str] = {} diff --git a/examples/blas/test_level1_complex.py b/examples/blas/test_level1_complex.py index 105e2b8f7..2cff36d55 100644 --- a/examples/blas/test_level1_complex.py +++ b/examples/blas/test_level1_complex.py @@ -228,25 +228,35 @@ def test_dznrm2(prik_blas, f2py_blas): def test_crotg(prik_blas, f2py_blas): a, b = np.complex64(3.0 + 1.0j), np.complex64(4.0 - 2.0j) + f2py_a = np.array(a, dtype=np.complex64) + f2py_b = np.array(b, dtype=np.complex64) + f2py_c = np.array(0.0, dtype=np.float32) + f2py_s = np.array(0.0j, dtype=np.complex64) - result, _, c, s = prik_blas.crotg(a, b, np.float32(0.0), np.complex64(0.0j)) - f2py_result = f2py_blas.crotg(a, b, np.float32(0.0), np.complex64(0.0j)) + result, prik_b, c, s = prik_blas.crotg(a, b, np.float32(0.0), np.complex64(0.0j)) + f2py_result = f2py_blas.crotg(f2py_a, f2py_b, f2py_c, f2py_s) assert_allclose_for_dtype(c * a + s * b, result, operation_size=2) assert_allclose_for_dtype(-np.conj(s) * a + c * b, np.complex64(0.0j), operation_size=2) assert_allclose_for_dtype(c * c + abs(s) ** 2, np.float32(1.0), operation_size=2) + assert_allclose_for_dtype([f2py_a, f2py_b, f2py_c, f2py_s], [result, prik_b, c, s]) assert f2py_result is None def test_zrotg(prik_blas, f2py_blas): a, b = np.complex128(3.0 + 1.0j), np.complex128(4.0 - 2.0j) + f2py_a = np.array(a, dtype=np.complex128) + f2py_b = np.array(b, dtype=np.complex128) + f2py_c = np.array(0.0, dtype=np.float64) + f2py_s = np.array(0.0j, dtype=np.complex128) - result, _, c, s = prik_blas.zrotg(a, b, np.float64(0.0), np.complex128(0.0j)) - f2py_result = f2py_blas.zrotg(a, b, np.float64(0.0), np.complex128(0.0j)) + result, prik_b, c, s = prik_blas.zrotg(a, b, np.float64(0.0), np.complex128(0.0j)) + f2py_result = f2py_blas.zrotg(f2py_a, f2py_b, f2py_c, f2py_s) assert_allclose_for_dtype(c * a + s * b, result, operation_size=2) assert_allclose_for_dtype(-np.conj(s) * a + c * b, np.complex128(0.0j), operation_size=2) assert_allclose_for_dtype(c * c + abs(s) ** 2, np.float64(1.0), operation_size=2) + assert_allclose_for_dtype([f2py_a, f2py_b, f2py_c, f2py_s], [result, prik_b, c, s]) assert f2py_result is None diff --git a/examples/blas/test_level1_real.py b/examples/blas/test_level1_real.py index fa4087d57..10a87fe9c 100644 --- a/examples/blas/test_level1_real.py +++ b/examples/blas/test_level1_real.py @@ -270,27 +270,37 @@ def test_drot(prik_blas, f2py_blas): def test_srotg(prik_blas, f2py_blas): a, b = np.float32(3.0), np.float32(4.0) + f2py_a = np.array(a, dtype=np.float32) + f2py_b = np.array(b, dtype=np.float32) + f2py_c = np.array(0.0, dtype=np.float32) + f2py_s = np.array(0.0, dtype=np.float32) prik_a, prik_b, c, s = prik_blas.srotg(a, b, np.float32(0.0), np.float32(0.0)) - f2py_result = f2py_blas.srotg(a, b, np.float32(0.0), np.float32(0.0)) + f2py_result = f2py_blas.srotg(f2py_a, f2py_b, f2py_c, f2py_s) assert_allclose_for_dtype(prik_a, np.float32(5.0)) assert_allclose_for_dtype(prik_b, np.float32(5.0 / 3.0)) assert_allclose_for_dtype(c * a + s * b, prik_a, operation_size=2) assert_allclose_for_dtype(-s * a + c * b, np.float32(0.0), operation_size=2) + assert_allclose_for_dtype([f2py_a, f2py_b, f2py_c, f2py_s], [prik_a, prik_b, c, s]) assert f2py_result is None def test_drotg(prik_blas, f2py_blas): a, b = np.float64(3.0), np.float64(4.0) + f2py_a = np.array(a, dtype=np.float64) + f2py_b = np.array(b, dtype=np.float64) + f2py_c = np.array(0.0, dtype=np.float64) + f2py_s = np.array(0.0, dtype=np.float64) prik_a, prik_b, c, s = prik_blas.drotg(a, b, np.float64(0.0), np.float64(0.0)) - f2py_result = f2py_blas.drotg(a, b, np.float64(0.0), np.float64(0.0)) + f2py_result = f2py_blas.drotg(f2py_a, f2py_b, f2py_c, f2py_s) assert_allclose_for_dtype(prik_a, np.float64(5.0)) assert_allclose_for_dtype(prik_b, np.float64(5.0 / 3.0)) assert_allclose_for_dtype(c * a + s * b, prik_a, operation_size=2) assert_allclose_for_dtype(-s * a + c * b, np.float64(0.0), operation_size=2) + assert_allclose_for_dtype([f2py_a, f2py_b, f2py_c, f2py_s], [prik_a, prik_b, c, s]) assert f2py_result is None @@ -339,13 +349,16 @@ def test_drotm(prik_blas, f2py_blas): def test_srotmg(prik_blas, f2py_blas): prik_param = np.zeros(5, dtype=np.float32) f2py_param = np.zeros(5, dtype=np.float32) + f2py_scalars = [np.array(value, dtype=np.float32) for value in (1.0, 2.0, 3.0, 4.0)] prik_values = prik_blas.srotmg(np.float32(1.0), np.float32(2.0), np.float32(3.0), np.float32(4.0), prik_param) - f2py_result = f2py_blas.srotmg(np.float32(1.0), np.float32(2.0), np.float32(3.0), np.float32(4.0), f2py_param) + f2py_result = f2py_blas.srotmg(*f2py_scalars, f2py_param) expected_values = np.array([1.5609756, 0.7804878, 5.125, 4.0], dtype=np.float32) expected_param = np.array([1.0, 0.375, 0.0, 0.0, 0.75], dtype=np.float32) assert_allclose_for_dtype(prik_values, expected_values, operation_size=2) + assert_allclose_for_dtype(f2py_scalars, expected_values, operation_size=2) + assert_allclose_for_dtype(f2py_scalars, prik_values, operation_size=2) assert_allclose_for_dtype(prik_param, expected_param) assert_allclose_for_dtype(f2py_param, expected_param) assert_allclose_for_dtype(prik_param, f2py_param) @@ -355,13 +368,16 @@ def test_srotmg(prik_blas, f2py_blas): def test_drotmg(prik_blas, f2py_blas): prik_param = np.zeros(5, dtype=np.float64) f2py_param = np.zeros(5, dtype=np.float64) + f2py_scalars = [np.array(value, dtype=np.float64) for value in (1.0, 2.0, 3.0, 4.0)] prik_values = prik_blas.drotmg(np.float64(1.0), np.float64(2.0), np.float64(3.0), np.float64(4.0), prik_param) - f2py_result = f2py_blas.drotmg(np.float64(1.0), np.float64(2.0), np.float64(3.0), np.float64(4.0), f2py_param) + f2py_result = f2py_blas.drotmg(*f2py_scalars, f2py_param) expected_values = np.array([1.5609756097560976, 0.7804878048780488, 5.125, 4.0]) expected_param = np.array([1.0, 0.375, 0.0, 0.0, 0.75]) assert_allclose_for_dtype(prik_values, expected_values, operation_size=2) + assert_allclose_for_dtype(f2py_scalars, expected_values, operation_size=2) + assert_allclose_for_dtype(f2py_scalars, prik_values, operation_size=2) assert_allclose_for_dtype(prik_param, expected_param) assert_allclose_for_dtype(f2py_param, expected_param) assert_allclose_for_dtype(prik_param, f2py_param) diff --git a/examples/blas/test_routine_coverage.py b/examples/blas/test_routine_coverage.py index 949119e95..75af520a4 100644 --- a/examples/blas/test_routine_coverage.py +++ b/examples/blas/test_routine_coverage.py @@ -8,13 +8,13 @@ import pytest +from examples.blas.f2py_contract import F2PY_INOUT_ARGUMENTS from conftest import BLAS_SOURCES, EXAMPLE_ROOT, _f2py_build_command, _prik_build_command from prik.parsers.fortran.parser import parse_fortran_file from routine_inventory import ( ALL_ROUTINES, DIFFERENTIALLY_TESTED_ROUTINES, EXPLICIT_TEST_NAMES, - F2PY_LIMITATIONS, PERMANENTLY_SKIPPED_ROUTINES, PRIK_TESTED_ROUTINES, ROUTINE_GROUPS, @@ -50,7 +50,21 @@ def test_build_commands_use_the_documented_public_clis(tmp_path: Path): assert f2py_command[:6] == (sys.executable, "-m", "numpy.f2py", "-c", "-m", "f2py_reference_blas") for source in BLAS_SOURCES: assert str(source) in prik_command - assert str(source) in f2py_command + expected_f2py_source = ( + tmp_path / "f2py" / "f2py-intent-sources" / source.name if source.stem in F2PY_INOUT_ARGUMENTS else source + ) + assert str(expected_f2py_source) in f2py_command + + +def test_f2py_scalar_writeback_overlays_are_explicit(tmp_path: Path): + command = _f2py_build_command(tmp_path) + + for routine, arguments in F2PY_INOUT_ARGUMENTS.items(): + source = next(source for source in BLAS_SOURCES if source.stem == routine) + overlay = tmp_path / "f2py-intent-sources" / source.name + prefix = "Cf2py" if source.suffix == ".f" else "!f2py" + assert str(overlay) in command + assert f"{prefix} intent(inout) {', '.join(arguments)}" in overlay.read_text(encoding="utf-8") def _source_routines() -> tuple[str, ...]: @@ -83,11 +97,6 @@ def test_source_routines_match_the_classified_inventory(): assert sum(len(routines) for routines in ROUTINE_GROUPS.values()) == 155 -def test_prik_exports_every_source_routine(prik_blas): - missing = sorted(routine for routine in ALL_ROUTINES if not callable(getattr(prik_blas, routine, None))) - assert missing == [] - - def test_f2py_exports_every_expected_routine(f2py_blas): missing = sorted(routine for routine in ALL_ROUTINES if not callable(getattr(f2py_blas, routine, None))) assert missing == [] @@ -114,7 +123,6 @@ def test_every_routine_has_one_visible_explicit_test(): def test_every_routine_has_exactly_one_audited_outcome(): outcomes = { "differential success": set(DIFFERENTIALLY_TESTED_ROUTINES), - "proven f2py limitation": set(F2PY_LIMITATIONS), "unsupported": set(UNSUPPORTED_ROUTINES), "environmental skip": set(PERMANENTLY_SKIPPED_ROUTINES), } @@ -127,3 +135,19 @@ def test_every_routine_has_exactly_one_audited_outcome(): assert set(ALL_ROUTINES) == PRIK_TESTED_ROUTINES assert UNSUPPORTED_ROUTINES == {} assert PERMANENTLY_SKIPPED_ROUTINES == {} + + +def test_documented_coverage_totals_match_inventory(): + readme = (EXAMPLE_ROOT / "README.md").read_text(encoding="utf-8") + expected_rows = { + "Native source files": len(BLAS_SOURCES), + "Discovered callable routines": len(ALL_ROUTINES), + "PRIK exports and independently validated routines": len(PRIK_TESTED_ROUTINES), + "f2py exports": len(ALL_ROUTINES), + "Full independent plus differential success": len(DIFFERENTIALLY_TESTED_ROUTINES), + "f2py scalar-writeback intent overlays": len(F2PY_INOUT_ARGUMENTS), + "Unsupported routines": len(UNSUPPORTED_ROUTINES), + "Environmentally skipped routines": len(PERMANENTLY_SKIPPED_ROUTINES), + } + for label, count in expected_rows.items(): + assert f"| {label} | {count:,} |" in readme diff --git a/examples/f2py_intents.py b/examples/f2py_intents.py new file mode 100644 index 000000000..d882de43f --- /dev/null +++ b/examples/f2py_intents.py @@ -0,0 +1,58 @@ +"""Build-local f2py intent overlays for caller-owned scalar storage.""" + +from __future__ import annotations + +from collections.abc import Mapping, Sequence +from pathlib import Path +import re + + +_FIXED_FORM_SUFFIXES = frozenset({".f", ".for", ".f77", ".ftn"}) + + +def prepare_f2py_intent_sources( + sources: Sequence[Path], + workdir: Path, + inout_arguments: Mapping[str, tuple[str, ...]], +) -> tuple[Path, ...]: + """Copy selected sources and add f2py-only ``intent(inout)`` directives.""" + overlay_root = workdir / "f2py-intent-sources" + prepared: list[Path] = [] + for source in sources: + arguments = inout_arguments.get(source.stem.lower()) + if arguments is None: + prepared.append(source) + continue + + overlay_root.mkdir(parents=True, exist_ok=True) + target = overlay_root / source.name + target.write_text(_with_inout_directive(source, arguments), encoding="utf-8") + prepared.append(target) + return tuple(prepared) + + +def _with_inout_directive(source: Path, arguments: tuple[str, ...]) -> str: + text = source.read_text(encoding="utf-8") + lines = text.splitlines(keepends=True) + declaration = re.compile(rf"^\s*subroutine\s+{re.escape(source.stem)}\s*\(", re.IGNORECASE) + matches = [index for index, line in enumerate(lines) if declaration.match(line)] + if len(matches) != 1: + raise ValueError(f"expected one SUBROUTINE declaration for {source.stem}, found {len(matches)}") + + insertion_index = _statement_end(lines, matches[0], fixed_form=source.suffix.lower() in _FIXED_FORM_SUFFIXES) + prefix = "Cf2py" if source.suffix.lower() in _FIXED_FORM_SUFFIXES else "!f2py" + directive = f"{prefix} intent(inout) {', '.join(arguments)}\n" + lines.insert(insertion_index, directive) + return "".join(lines) + + +def _statement_end(lines: list[str], start: int, *, fixed_form: bool) -> int: + index = start + 1 + if fixed_form: + while index < len(lines) and len(lines[index]) > 5 and lines[index][5] not in {" ", "0", "\n", "\r"}: + index += 1 + return index + + while index < len(lines) and lines[index - 1].rstrip().endswith("&"): + index += 1 + return index diff --git a/examples/lapack/README.md b/examples/lapack/README.md index d3407e274..ddf399b68 100644 --- a/examples/lapack/README.md +++ b/examples/lapack/README.md @@ -53,10 +53,12 @@ It performs these operations once: cached shared library; 3. build one PRIK extension from the complete generated contract and shared library; -4. independently build one raw f2py comparison surface from the 125 reviewed +4. independently build one f2py comparison surface from the 125 reviewed f2py-compatible routine sources and their minimal module dependency, linking unselected LAPACK and BLAS helper symbols from the system development libraries; and -5. reuse the three imported comparison surfaces for every correctness file. +5. reuse the three imported comparison surfaces for every correctness file; + CI explicitly adds the non-discovered `ci_full_surface.py` for the complete + PRIK root-export audit and runtime smoke call. The contract-generation command is: @@ -86,7 +88,7 @@ python3 -m prik /tmp/prik-lapack/runtime-contract/lapack/__init__.pyi \ ``` The paths are illustrative; `conftest.py` creates their actual temporary/cache -locations and records the exact executable command. The raw f2py command it +locations and records the exact executable command. The f2py command it assembles is equivalent to: ```console @@ -113,21 +115,18 @@ Build products stay in pytest temporary/cache directories. Failures report the compiler identity, command, stdout, and stderr. Neither build dirties the repository. -The fixtures import the complete PRIK module, the raw f2py module, and +The fixtures import the complete PRIK module, the f2py comparison module, and `scipy.linalg.lapack`. Character flags are Python `str` through PRIK and `bytes` through SciPy/f2py. PRIK retains the complete native argument order. -Raw f2py retains the order of the arguments it exposes, but infers and hides +f2py retains the order of the arguments it exposes, but infers and hides leading dimensions and a few other shape-only scalar arguments; each visible f2py call follows the generated wrapper signature. SciPy projects arrays and optional arguments into its documented Python API. -The Reference LAPACK subroutines do not declare Fortran `intent`, so raw f2py -does not project their scalar writebacks. It still exposes in-place array -mutation, which provides enough output for the independent oracle in 112 of -the 121 exported subroutines; the four exported LAPACK functions return their -values normally. Nine subroutines have an essential scalar-only result, or need -an unprojected scalar to validate their mutated vector, and are explicitly -recorded in `F2PY_NUMERICAL_LIMITATIONS`. +Nine routines document essential scalar writebacks without declaring Fortran +`intent`. The f2py fixture adds build-local intent directives and passes typed +0-D arrays so every writeback is validated. PRIK needs neither the overlay nor +carrier arrays: it returns unannotated scalar writebacks directly. `dgees` and `dgges` remain in the 127-routine correctness inventory but are recorded in `F2PY_EXPORT_LIMITATIONS`. Their Reference LAPACK interfaces accept @@ -135,17 +134,9 @@ external selection callbacks. From the unannotated implementation sources, NumPy f2py 2.5.1 generates incomplete callback declarations (`select_t` and `selctg_t`) and invalid C wrapper code. Those two routines are therefore validated through PRIK, SciPy, and independent Schur reconstruction without a -raw-f2py call; the remaining 125 selected names must be exported by the one +f2py call; the remaining 125 selected names must be exported by the one f2py comparison module. -The nine reviewed limitations are: - -- `dlarfg`: the vector writeback is compared, but `ALPHA` and `TAU` are not - projected; -- `dlartg`: `C`, `S`, and `R` are all unprojected scalar writebacks; and -- `dgbcon`, `dgecon`, `dgtcon`, `dpocon`, `dppcon`, `dsycon`, and `dtrcon`: - `RCOND` and `INFO` are unprojected scalar writebacks. - ## Correctness evidence The official LAPACK contract defines behavior. An independent mathematical @@ -193,7 +184,7 @@ Workspace-bearing tests allocate the native `WORK`/`IWORK` arrays and keep covered where the exposed API supports it. `INFO == 0` is exact on normal paths. Invalid argument calls that could route through `XERBLA` are not made in-process. -Native LAPACK pivots and positions are one-based. PRIK and the raw f2py surface +Native LAPACK pivots and positions are one-based. PRIK and the f2py comparison surface preserve native values. SciPy converts several low-level pivot/index APIs to zero-based values, but preserves one-based `JPVT` for `DGELSY`/`DGEQP3`, one-based `IPIV` for the general-tridiagonal `DGTTRF`/`DGTTRS` family, and one-based Schur @@ -212,6 +203,10 @@ python3 -m pytest -q examples/lapack/test_linear_general.py::test_dgesv_solves_g python3 -m pytest -q examples/lapack -k dgesvd ``` +The dedicated CI lane explicitly adds `ci_full_surface.py` to that same pytest +invocation. Its nonstandard filename keeps the maintainer-only audit out of +ordinary example runs while still reusing the already-built extensions. + Repository policy leaves LAPACK wrapper/runtime execution to that lane unless a maintainer explicitly requests a local run. Local work may collect tests and run the structural inventory, documentation, architecture, and static-analysis @@ -238,16 +233,17 @@ documented totals. | Discovered root LAPACK procedures | 2,064 | | Selected SciPy-backed float64 routines | 127 | | Explicit correctness tests | 127 | -| PRIK exports required in CI | 127 | +| PRIK root exports required in CI | 2,064 | +| Selected PRIK routines independently validated | 127 | | SciPy exports used | 127 | | f2py exports required in CI | 125 | -| Routines satisfying the independent oracle through f2py | 116 | -| Documented raw-f2py export limitations | 2 | -| Documented raw-f2py numerical projection limitations | 9 | +| Routines satisfying the independent oracle through f2py | 125 | +| Documented f2py source-parser export limitations | 2 | +| f2py scalar-writeback intent overlays | 9 | | Documented PRIK default-LOGICAL ABI adapters | 2 | | Documented unsupported/skipped routines | 0 | -Runtime success, f2py projection limitations, and any PRIK failures are CI +Runtime success, f2py export limitations, and any PRIK failures are CI outcomes and must be reported honestly; structural completion does not predict them. @@ -255,7 +251,7 @@ them. `prik_lapack`, `f2py_lapack`, and `scipy_lapack` are session-scoped pytest fixtures from [`conftest.py`](conftest.py). They provide the complete PRIK -wrapper, the selected raw-f2py comparison module, and SciPy's pinned low-level +wrapper, the selected f2py comparison module, and SciPy's pinned low-level LAPACK module. The tests use explicit mechanics from [`helpers.py`](helpers.py): @@ -514,6 +510,8 @@ def test_dtbtrs_solves_triangular_band_system(prik_lapack, scipy_lapack, f2py_la def test_dgecon_estimates_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): factor = np.array([[4.0]], dtype=np.float64, order="F") expected = 1.0 + f2py_rcond = np.array(0.0, dtype=np.float64) + f2py_info = np.array(0, dtype=np.int32) prik_scalars = prik_lapack.dgecon( "1", @@ -527,12 +525,13 @@ def test_dgecon_estimates_reciprocal_condition(prik_lapack, scipy_lapack, f2py_l np.int32(0), ) f2py_result = f2py_lapack.dgecon( - b"1", 1, factor.copy(order="F"), 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 + b"1", 1, factor.copy(order="F"), 4.0, f2py_rcond, np.empty(4), np.empty(1, dtype=np.int32), f2py_info ) scipy_rcond, scipy_info = scipy_lapack.dgecon(factor.copy(order="F"), 4.0, norm=b"1") assert f2py_result is None - assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[-1] == f2py_info == scipy_info == 0 assert_allclose_float64(prik_scalars[-2], expected) + assert_allclose_float64(f2py_rcond, expected) assert_allclose_float64(scipy_rcond, expected) ``` diff --git a/examples/lapack/ci_full_surface.py b/examples/lapack/ci_full_surface.py new file mode 100644 index 000000000..7c24f66d8 --- /dev/null +++ b/examples/lapack/ci_full_surface.py @@ -0,0 +1,22 @@ +"""Maintainer-only complete-surface checks that reuse the LAPACK example build.""" + +from __future__ import annotations + +import pytest + +from tests.fortran.building_shared_library.end_to_end.real_libraries import test_full_libraries as full + +from .routine_inventory import EXPECTED_LAPACK_ROOT_PROCEDURES + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_ci_complete_prik_surface_reuses_example_extension(prik_build): + runtime_package = prik_build.workdir / "runtime_contract" / "lapack" + expected = {function.name for function in full._root_module(runtime_package).functions} + assert len(expected) == EXPECTED_LAPACK_ROOT_PROCEDURES + + missing = sorted(name for name in expected if not callable(getattr(prik_build.module, name, None))) + assert missing == [] + full._assert_lapack_runtime_smoke(prik_build.module) diff --git a/examples/lapack/conftest.py b/examples/lapack/conftest.py index 84aa0c1dd..92aa6bc7b 100644 --- a/examples/lapack/conftest.py +++ b/examples/lapack/conftest.py @@ -12,8 +12,10 @@ import pytest +from examples.f2py_intents import prepare_f2py_intent_sources from tests.fortran.building_shared_library.end_to_end.real_libraries import test_full_libraries as full +from .f2py_contract import F2PY_INOUT_ARGUMENTS from .routine_inventory import F2PY_EXPORT_LIMITATIONS, ROUTINES, SCIPY_VERSION @@ -95,14 +97,14 @@ def _selected_source(routine: str) -> Path: return matches[0] -def _f2py_source_plan() -> tuple[Path, ...]: - """Return reviewed implementations plus their minimal compile dependency.""" +def _f2py_source_plan(workdir: Path) -> tuple[Path, ...]: + """Return reviewed implementations with intent overlays and their dependency.""" dependencies = tuple(NATIVE_ROOT / name for name in F2PY_BUILD_DEPENDENCIES) missing_dependencies = [str(path) for path in dependencies if not path.is_file()] if missing_dependencies: pytest.fail(f"missing f2py build dependencies: {missing_dependencies}") selected = tuple(_selected_source(name) for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) - return dependencies + selected + return prepare_f2py_intent_sources(dependencies + selected, workdir, F2PY_INOUT_ARGUMENTS) def _f2py_build_command(workdir: Path) -> tuple[str, ...]: @@ -119,7 +121,7 @@ def _f2py_build_command(workdir: Path) -> tuple[str, ...]: "-c", "-m", module_name, - *(str(source) for source in _f2py_source_plan()), + *(str(source) for source in _f2py_source_plan(workdir)), "only:", *selected_routines, ":", @@ -193,7 +195,7 @@ def prik_lapack(prik_build: BuiltLapack): @pytest.fixture(scope="session") def f2py_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltLapack: - """Build one raw f2py surface from only the reviewed implementations.""" + """Build one f2py comparison surface from the reviewed implementations.""" compiler = full._compiler() workdir = tmp_path_factory.mktemp("f2py-reference-lapack-example") module_name = "f2py_reference_lapack_example" @@ -212,7 +214,7 @@ def f2py_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltLapack: @pytest.fixture(scope="session") def f2py_lapack(f2py_build: BuiltLapack): - """Return the session-scoped raw f2py comparison module.""" + """Return the session-scoped f2py comparison module.""" return f2py_build.module diff --git a/examples/lapack/f2py_contract.py b/examples/lapack/f2py_contract.py new file mode 100644 index 000000000..a389f5233 --- /dev/null +++ b/examples/lapack/f2py_contract.py @@ -0,0 +1,16 @@ +"""Reviewed f2py intent additions for Reference LAPACK comparison calls.""" + +from __future__ import annotations + + +F2PY_INOUT_ARGUMENTS: dict[str, tuple[str, ...]] = { + "dlarfg": ("alpha", "tau"), + "dlartg": ("c", "s", "r"), + "dgbcon": ("rcond", "info"), + "dgecon": ("rcond", "info"), + "dgtcon": ("rcond", "info"), + "dpocon": ("rcond", "info"), + "dppcon": ("rcond", "info"), + "dsycon": ("rcond", "info"), + "dtrcon": ("rcond", "info"), +} diff --git a/examples/lapack/routine_inventory.py b/examples/lapack/routine_inventory.py index 2cad7e845..f6b6d5028 100644 --- a/examples/lapack/routine_inventory.py +++ b/examples/lapack/routine_inventory.py @@ -4,24 +4,14 @@ from dataclasses import dataclass +from .f2py_contract import F2PY_INOUT_ARGUMENTS + SCIPY_VERSION = "1.18.0" EXPECTED_LAPACK_SOURCE_FILES = 2062 EXPECTED_LAPACK_ROOT_PROCEDURES = 2064 F2PY_FUNCTION_RESULTS = frozenset({"dlamch", "dlangb", "dlange", "dlantr"}) -F2PY_NUMERICAL_LIMITATIONS = { - "dlarfg": "raw f2py exposes the vector mutation but not the scalar ALPHA and TAU writebacks", - "dlartg": "all three numerical outputs are scalar writebacks that raw f2py does not project", - "dgbcon": "RCOND and INFO are scalar writebacks that raw f2py does not project", - "dgecon": "RCOND and INFO are scalar writebacks that raw f2py does not project", - "dgtcon": "RCOND and INFO are scalar writebacks that raw f2py does not project", - "dpocon": "RCOND and INFO are scalar writebacks that raw f2py does not project", - "dppcon": "RCOND and INFO are scalar writebacks that raw f2py does not project", - "dsycon": "RCOND and INFO are scalar writebacks that raw f2py does not project", - "dtrcon": "RCOND and INFO are scalar writebacks that raw f2py does not project", -} - ROUTINE_GROUPS = { "auxiliary": ( "dlamch", @@ -468,7 +458,7 @@ class RoutineSpec: prik_export: str prik_adapter: str f2py_export: str - f2py_limitation: str + f2py_behavior: str family: str mutation: str returns: str @@ -486,20 +476,17 @@ class RoutineSpec: prik_export=name, prik_adapter=PRIK_ABI_ADAPTERS.get(name, "none"), f2py_export=name, - f2py_limitation=F2PY_EXPORT_LIMITATIONS.get( + f2py_behavior=F2PY_EXPORT_LIMITATIONS.get( name, - F2PY_NUMERICAL_LIMITATIONS.get( - name, - ( - "raw f2py exposes array mutation but not scalar subroutine writebacks from the intent-free source" - if name not in F2PY_FUNCTION_RESULTS - else "none" - ), + ( + "build-local intent directives expose caller-owned scalar writeback storage" + if name in F2PY_INOUT_ARGUMENTS + else "none" ), ), family=ROUTINE_FAMILIES[name], mutation="explicit in/out arrays and preserved inputs are asserted in the named test", - returns="PRIK native scalar tuple, SciPy projected tuple, and raw f2py observable writeback", + returns="PRIK native scalar tuple, SciPy projected tuple, and f2py observable writeback", workspace=( "explicit workspace arrays and sizes are visible in the named test" if name in WORKSPACE_ROUTINES diff --git a/examples/lapack/test_auxiliary.py b/examples/lapack/test_auxiliary.py index 4f3756e21..466571389 100644 --- a/examples/lapack/test_auxiliary.py +++ b/examples/lapack/test_auxiliary.py @@ -99,36 +99,50 @@ def test_dlarfg_constructs_a_valid_householder_reflector(prik_lapack, scipy_lapa alpha = 4.0 original_x = np.array([3.0, 0.0], dtype=np.float64) prik_x, f2py_x = original_x.copy(), original_x.copy() + f2py_alpha = np.array(alpha, dtype=np.float64) + f2py_tau = np.array(0.0, dtype=np.float64) prik_scalars = prik_lapack.dlarfg(np.int32(3), np.float64(alpha), prik_x, np.int32(1), np.float64(0.0)) - f2py_result = f2py_lapack.dlarfg(3, alpha, f2py_x, 1, 0.0) + f2py_result = f2py_lapack.dlarfg(3, f2py_alpha, f2py_x, 1, f2py_tau) scipy_beta, scipy_x, scipy_tau = scipy_lapack.dlarfg(3, alpha, original_x.copy()) _, prik_beta, _, prik_tau = prik_scalars prik_vector = np.concatenate(([1.0], prik_x)) + f2py_vector = np.concatenate(([1.0], f2py_x)) original = np.concatenate(([alpha], original_x)) - expected = np.array([prik_beta, 0.0, 0.0], dtype=np.float64) - assert f2py_result is None # raw f2py cannot project the scalar ALPHA and TAU writebacks - assert_allclose_float64((np.eye(3) - prik_tau * np.outer(prik_vector, prik_vector)) @ original, expected) + prik_expected = np.array([prik_beta, 0.0, 0.0], dtype=np.float64) + f2py_expected = np.array([f2py_alpha, 0.0, 0.0], dtype=np.float64) + assert f2py_result is None + assert_allclose_float64((np.eye(3) - prik_tau * np.outer(prik_vector, prik_vector)) @ original, prik_expected) + assert_allclose_float64((np.eye(3) - f2py_tau * np.outer(f2py_vector, f2py_vector)) @ original, f2py_expected) assert_allclose_float64(prik_beta, scipy_beta) + assert_allclose_float64(f2py_alpha, scipy_beta) assert_allclose_float64(prik_x, scipy_x) assert_allclose_float64(f2py_x, scipy_x) assert_allclose_float64(prik_tau, scipy_tau) + assert_allclose_float64(f2py_tau, scipy_tau) def test_dlartg_constructs_a_givens_rotation(prik_lapack, scipy_lapack, f2py_lapack): f, g = 3.0, 4.0 + f2py_c = np.array(0.0, dtype=np.float64) + f2py_s = np.array(0.0, dtype=np.float64) + f2py_r = np.array(0.0, dtype=np.float64) prik_scalars = prik_lapack.dlartg(np.float64(f), np.float64(g), np.float64(0.0), np.float64(0.0), np.float64(0.0)) - f2py_result = f2py_lapack.dlartg(f, g, 0.0, 0.0, 0.0) + f2py_result = f2py_lapack.dlartg(f, g, f2py_c, f2py_s, f2py_r) scipy_c, scipy_s, scipy_r = scipy_lapack.dlartg(f, g) _, _, prik_c, prik_s, prik_r = prik_scalars - assert f2py_result is None # raw f2py cannot project scalar-only subroutine outputs + assert f2py_result is None assert_allclose_float64(prik_c * f + prik_s * g, prik_r) assert_allclose_float64(-prik_s * f + prik_c * g, 0.0) assert_allclose_float64(prik_c * prik_c + prik_s * prik_s, 1.0) assert_allclose_float64([prik_c, prik_s, prik_r], [scipy_c, scipy_s, scipy_r]) + assert_allclose_float64(f2py_c * f + f2py_s * g, f2py_r) + assert_allclose_float64(-f2py_s * f + f2py_c * g, 0.0) + assert_allclose_float64(f2py_c * f2py_c + f2py_s * f2py_s, 1.0) + assert_allclose_float64([f2py_c, f2py_s, f2py_r], [scipy_c, scipy_s, scipy_r]) def test_dlaswp_applies_native_one_based_row_pivots(prik_lapack, scipy_lapack, f2py_lapack): diff --git a/examples/lapack/test_linear_banded_tridiagonal.py b/examples/lapack/test_linear_banded_tridiagonal.py index 5b1597c02..ef2b8d6a9 100644 --- a/examples/lapack/test_linear_banded_tridiagonal.py +++ b/examples/lapack/test_linear_banded_tridiagonal.py @@ -37,6 +37,8 @@ def _general_tridiagonal_factorization(): def test_dgbcon_estimates_general_band_condition(prik_lapack, scipy_lapack, f2py_lapack): factor = np.array([[4.0]], dtype=np.float64, order="F") native_ipiv = np.array([1], dtype=np.int32) + f2py_rcond = np.array(0.0, dtype=np.float64) + f2py_info = np.array(0, dtype=np.int32) prik_scalars = prik_lapack.dgbcon( "1", @@ -53,13 +55,24 @@ def test_dgbcon_estimates_general_band_condition(prik_lapack, scipy_lapack, f2py np.int32(0), ) f2py_result = f2py_lapack.dgbcon( - b"1", 1, 0, 0, factor.copy(order="F"), native_ipiv, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 + b"1", + 1, + 0, + 0, + factor.copy(order="F"), + native_ipiv, + 4.0, + f2py_rcond, + np.empty(3), + np.empty(1, dtype=np.int32), + f2py_info, ) scipy_rcond, scipy_info = scipy_lapack.dgbcon(0, 0, factor.copy(order="F"), np.array([0], dtype=np.int32), 4.0) assert f2py_result is None - assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[-1] == f2py_info == scipy_info == 0 assert_allclose_float64(prik_scalars[-2], 1.0) + assert_allclose_float64(f2py_rcond, 1.0) assert_allclose_float64(scipy_rcond, 1.0) @@ -153,6 +166,8 @@ def test_dgtcon_estimates_tridiagonal_condition(prik_lapack, scipy_lapack, f2py_ assert factor_info == 0 native_ipiv = native_pivots(scipy_piv) anorm = 5.0 + f2py_rcond = np.array(0.0, dtype=np.float64) + f2py_info = np.array(0, dtype=np.int32) prik_scalars = prik_lapack.dgtcon( "1", @@ -177,16 +192,17 @@ def test_dgtcon_estimates_tridiagonal_condition(prik_lapack, scipy_lapack, f2py_ scipy_du2, native_ipiv, anorm, - 0.0, + f2py_rcond, np.empty(6), np.empty(3, dtype=np.int32), - 0, + f2py_info, ) scipy_rcond, scipy_info = scipy_lapack.dgtcon(scipy_dl, scipy_d, scipy_du, scipy_du2, scipy_piv, anorm) assert f2py_result is None - assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[-1] == f2py_info == scipy_info == 0 assert_allclose_float64(prik_scalars[-2], scipy_rcond, operation_size=3) + assert_allclose_float64(f2py_rcond, scipy_rcond, operation_size=3) assert 0.0 < scipy_rcond <= 1.0 diff --git a/examples/lapack/test_linear_general.py b/examples/lapack/test_linear_general.py index b00058efb..097cd7d60 100644 --- a/examples/lapack/test_linear_general.py +++ b/examples/lapack/test_linear_general.py @@ -23,6 +23,8 @@ def test_dgecon_estimates_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): factor = np.array([[4.0]], dtype=np.float64, order="F") expected = 1.0 + f2py_rcond = np.array(0.0, dtype=np.float64) + f2py_info = np.array(0, dtype=np.int32) prik_scalars = prik_lapack.dgecon( "1", @@ -36,13 +38,14 @@ def test_dgecon_estimates_reciprocal_condition(prik_lapack, scipy_lapack, f2py_l np.int32(0), ) f2py_result = f2py_lapack.dgecon( - b"1", 1, factor.copy(order="F"), 4.0, 0.0, np.empty(4), np.empty(1, dtype=np.int32), 0 + b"1", 1, factor.copy(order="F"), 4.0, f2py_rcond, np.empty(4), np.empty(1, dtype=np.int32), f2py_info ) scipy_rcond, scipy_info = scipy_lapack.dgecon(factor.copy(order="F"), 4.0, norm=b"1") assert f2py_result is None - assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[-1] == f2py_info == scipy_info == 0 assert_allclose_float64(prik_scalars[-2], expected) + assert_allclose_float64(f2py_rcond, expected) assert_allclose_float64(scipy_rcond, expected) diff --git a/examples/lapack/test_linear_positive_definite.py b/examples/lapack/test_linear_positive_definite.py index 1653e5699..9fadc9cea 100644 --- a/examples/lapack/test_linear_positive_definite.py +++ b/examples/lapack/test_linear_positive_definite.py @@ -72,6 +72,8 @@ def test_dpftrs_solves_from_rfp_cholesky_factor(prik_lapack, scipy_lapack, f2py_ def test_dpocon_estimates_spd_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): factor = np.array([[2.0]], dtype=np.float64, order="F") + f2py_rcond = np.array(0.0, dtype=np.float64) + f2py_info = np.array(0, dtype=np.int32) prik_scalars = prik_lapack.dpocon( "U", @@ -85,13 +87,14 @@ def test_dpocon_estimates_spd_reciprocal_condition(prik_lapack, scipy_lapack, f2 np.int32(0), ) f2py_result = f2py_lapack.dpocon( - b"U", 1, factor.copy(order="F"), 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0 + b"U", 1, factor.copy(order="F"), 4.0, f2py_rcond, np.empty(3), np.empty(1, dtype=np.int32), f2py_info ) scipy_rcond, scipy_info = scipy_lapack.dpocon(factor.copy(order="F"), 4.0, uplo=b"U") assert f2py_result is None - assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[-1] == f2py_info == scipy_info == 0 assert_allclose_float64(prik_scalars[-2], 1.0) + assert_allclose_float64(f2py_rcond, 1.0) assert_allclose_float64(scipy_rcond, 1.0) @@ -239,6 +242,8 @@ def test_dpotrs_solves_from_cholesky_factor(prik_lapack, scipy_lapack, f2py_lapa def test_dppcon_estimates_packed_spd_condition(prik_lapack, scipy_lapack, f2py_lapack): factor = np.array([2.0]) + f2py_rcond = np.array(0.0, dtype=np.float64) + f2py_info = np.array(0, dtype=np.int32) prik_scalars = prik_lapack.dppcon( "U", @@ -250,12 +255,15 @@ def test_dppcon_estimates_packed_spd_condition(prik_lapack, scipy_lapack, f2py_l np.empty(1, dtype=np.int32), np.int32(0), ) - f2py_result = f2py_lapack.dppcon(b"U", 1, factor, 4.0, 0.0, np.empty(3), np.empty(1, dtype=np.int32), 0) + f2py_result = f2py_lapack.dppcon( + b"U", 1, factor, 4.0, f2py_rcond, np.empty(3), np.empty(1, dtype=np.int32), f2py_info + ) scipy_rcond, scipy_info = scipy_lapack.dppcon(1, factor, 4.0) assert f2py_result is None - assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[-1] == f2py_info == scipy_info == 0 assert_allclose_float64(prik_scalars[-2], 1.0) + assert_allclose_float64(f2py_rcond, 1.0) assert_allclose_float64(scipy_rcond, 1.0) diff --git a/examples/lapack/test_linear_symmetric_indefinite.py b/examples/lapack/test_linear_symmetric_indefinite.py index c3bba0c96..e8c730e2b 100644 --- a/examples/lapack/test_linear_symmetric_indefinite.py +++ b/examples/lapack/test_linear_symmetric_indefinite.py @@ -18,6 +18,8 @@ def _negative_scalar_factor(): def test_dsycon_estimates_symmetric_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): factor, native_ipiv = _negative_scalar_factor() + f2py_rcond = np.array(0.0, dtype=np.float64) + f2py_info = np.array(0, dtype=np.int32) prik_scalars = prik_lapack.dsycon( "U", @@ -32,13 +34,22 @@ def test_dsycon_estimates_symmetric_reciprocal_condition(prik_lapack, scipy_lapa np.int32(0), ) f2py_result = f2py_lapack.dsycon( - b"U", 1, factor.copy(order="F"), native_ipiv, 4.0, 0.0, np.empty(2), np.empty(1, dtype=np.int32), 0 + b"U", + 1, + factor.copy(order="F"), + native_ipiv, + 4.0, + f2py_rcond, + np.empty(2), + np.empty(1, dtype=np.int32), + f2py_info, ) scipy_rcond, scipy_info = scipy_lapack.dsycon(factor.copy(order="F"), native_ipiv, 4.0) assert f2py_result is None - assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[-1] == f2py_info == scipy_info == 0 assert_allclose_float64(prik_scalars[-2], 1.0) + assert_allclose_float64(f2py_rcond, 1.0) assert_allclose_float64(scipy_rcond, 1.0) diff --git a/examples/lapack/test_linear_triangular.py b/examples/lapack/test_linear_triangular.py index f79a60f47..4d19dfe8a 100644 --- a/examples/lapack/test_linear_triangular.py +++ b/examples/lapack/test_linear_triangular.py @@ -113,6 +113,8 @@ def test_dtpttr_converts_packed_to_full_triangular(prik_lapack, scipy_lapack, f2 def test_dtrcon_estimates_triangular_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): _logical, stored, _packed = _upper_triangular() + f2py_rcond = np.array(0.0, dtype=np.float64) + f2py_info = np.array(0, dtype=np.int32) prik_scalars = prik_lapack.dtrcon( "1", @@ -127,13 +129,22 @@ def test_dtrcon_estimates_triangular_reciprocal_condition(prik_lapack, scipy_lap np.int32(0), ) f2py_result = f2py_lapack.dtrcon( - b"1", b"U", b"N", 2, stored.copy(order="F"), 0.0, np.empty(6), np.empty(2, dtype=np.int32), 0 + b"1", + b"U", + b"N", + 2, + stored.copy(order="F"), + f2py_rcond, + np.empty(6), + np.empty(2, dtype=np.int32), + f2py_info, ) scipy_rcond, scipy_info = scipy_lapack.dtrcon(stored.copy(order="F"), norm=b"1", uplo=b"U", diag=b"N") assert f2py_result is None - assert prik_scalars[-1] == scipy_info == 0 + assert prik_scalars[-1] == f2py_info == scipy_info == 0 assert_allclose_float64(prik_scalars[-2], scipy_rcond, operation_size=2) + assert_allclose_float64(f2py_rcond, scipy_rcond, operation_size=2) assert 0.0 < scipy_rcond <= 1.0 diff --git a/examples/lapack/test_routine_coverage.py b/examples/lapack/test_routine_coverage.py index 259020cf9..1d4045c78 100644 --- a/examples/lapack/test_routine_coverage.py +++ b/examples/lapack/test_routine_coverage.py @@ -17,13 +17,13 @@ _f2py_source_plan, _prik_build_command, ) +from .f2py_contract import F2PY_INOUT_ARGUMENTS from .routine_inventory import ( EXPLICIT_TEST_NAMES, EXPECTED_LAPACK_ROOT_PROCEDURES, EXPECTED_LAPACK_SOURCE_FILES, F2PY_EXPORT_LIMITATIONS, F2PY_FUNCTION_RESULTS, - F2PY_NUMERICAL_LIMITATIONS, PRIK_ABI_ADAPTERS, ROUTINE_FAMILIES, ROUTINE_GROUPS, @@ -112,7 +112,7 @@ def test_inventory_groups_form_one_complete_partition(): spec.prik_export, spec.prik_adapter, spec.f2py_export, - spec.f2py_limitation, + spec.f2py_behavior, spec.mutation, spec.returns, spec.workspace, @@ -121,20 +121,25 @@ def test_inventory_groups_form_one_complete_partition(): ) ) assert set(ROUTINES) >= F2PY_FUNCTION_RESULTS - assert set(F2PY_NUMERICAL_LIMITATIONS) <= set(ROUTINES) assert set(F2PY_EXPORT_LIMITATIONS) <= set(ROUTINES) assert set(PRIK_ABI_ADAPTERS) <= set(ROUTINES) def test_f2py_source_plan_includes_required_kind_module(tmp_path: Path): """The selected build closes dependencies without consuming PRIK's library.""" - plan = _f2py_source_plan() + plan = _f2py_source_plan(tmp_path) dependency_count = len(F2PY_BUILD_DEPENDENCIES) assert tuple(path.name for path in plan[:dependency_count]) == F2PY_BUILD_DEPENDENCIES assert {path.stem for path in plan[dependency_count:]} == set(ROUTINES) - set(F2PY_EXPORT_LIMITATIONS) assert len(plan) == dependency_count + len(ROUTINES) - len(F2PY_EXPORT_LIMITATIONS) assert F2PY_KIND_MAP == "{'real': {'wp': 'double'}}\n" + for routine, arguments in F2PY_INOUT_ARGUMENTS.items(): + source = next(path for path in plan if path.stem == routine) + prefix = "Cf2py" if source.suffix == ".f" else "!f2py" + assert source.parent == tmp_path / "f2py-intent-sources" + assert f"{prefix} intent(inout) {', '.join(arguments)}" in source.read_text(encoding="utf-8") + command = _f2py_build_command(tmp_path) dependency_values = tuple(command[index + 1] for index, value in enumerate(command) if value == "--dep") assert dependency_values == F2PY_LINK_DEPENDENCIES @@ -203,13 +208,13 @@ def test_documented_coverage_totals_match_inventory(): "Discovered root LAPACK procedures": EXPECTED_LAPACK_ROOT_PROCEDURES, "Selected SciPy-backed float64 routines": len(ROUTINES), "Explicit correctness tests": len(EXPLICIT_TEST_NAMES), - "PRIK exports required in CI": len(ROUTINES), + "PRIK root exports required in CI": EXPECTED_LAPACK_ROOT_PROCEDURES, + "Selected PRIK routines independently validated": len(ROUTINES), "SciPy exports used": len(ROUTINES), "f2py exports required in CI": len(ROUTINES) - len(F2PY_EXPORT_LIMITATIONS), - "Routines satisfying the independent oracle through f2py": len(ROUTINES) - - len(set(F2PY_EXPORT_LIMITATIONS) | set(F2PY_NUMERICAL_LIMITATIONS)), - "Documented raw-f2py export limitations": len(F2PY_EXPORT_LIMITATIONS), - "Documented raw-f2py numerical projection limitations": len(F2PY_NUMERICAL_LIMITATIONS), + "Routines satisfying the independent oracle through f2py": len(ROUTINES) - len(F2PY_EXPORT_LIMITATIONS), + "Documented f2py source-parser export limitations": len(F2PY_EXPORT_LIMITATIONS), + "f2py scalar-writeback intent overlays": len(F2PY_INOUT_ARGUMENTS), "Documented PRIK default-LOGICAL ABI adapters": len(PRIK_ABI_ADAPTERS), "Documented unsupported/skipped routines": 0, } diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index 9940c883e..207650d4c 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -25,6 +25,8 @@ CHANGELOG = REPO_ROOT / "CHANGELOG.md" MANIFEST = REPO_ROOT / "MANIFEST.in" FULL_REAL_LIBRARY_TEST = "tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py" +BLAS_CI_FULL_SURFACE = "examples/blas/ci_full_surface.py" +LAPACK_CI_FULL_SURFACE = "examples/lapack/ci_full_surface.py" LEGACY_TEST_ROOTS = { "benchmarks", @@ -232,7 +234,7 @@ def test_maintained_docs_do_not_name_deprecated_pytest_locations() -> None: assert stale == [] -def test_full_real_library_nodes_have_one_dedicated_workflow() -> None: +def test_real_library_examples_have_one_dedicated_workflow() -> None: ordinary_jobs = TESTS_WORKFLOW.read_text(encoding="utf-8") dedicated_job = BLAS_LAPACK_WORKFLOW.read_text(encoding="utf-8") @@ -241,21 +243,18 @@ def test_full_real_library_nodes_have_one_dedicated_workflow() -> None: assert FULL_REAL_LIBRARY_TEST not in ordinary_jobs assert "examples/blas" not in ordinary_jobs assert "examples/lapack" not in ordinary_jobs - assert "python -m pytest -q examples/blas" in dedicated_job - assert "python -m pytest -q examples/lapack" in dedicated_job + assert 'python -m pytest -q -o "python_files=test_*.py ci_full_surface.py"' in dedicated_job + assert dedicated_job.count("python_files=test_*.py ci_full_surface.py") == 2 + assert f"examples/blas {BLAS_CI_FULL_SURFACE}" in dedicated_job + assert f"examples/lapack {LAPACK_CI_FULL_SURFACE}" in dedicated_job + assert BLAS_CI_FULL_SURFACE in dedicated_job + assert LAPACK_CI_FULL_SURFACE in dedicated_job + assert FULL_REAL_LIBRARY_TEST not in dedicated_job assert '"meson==1.11.2"' in dedicated_job assert '"ninja==1.13.0"' in dedicated_job assert '"scipy==1.18.0"' in dedicated_job assert "libblas-dev" in dedicated_job assert "liblapack-dev" in dedicated_job - assert ( - f'"{FULL_REAL_LIBRARY_TEST}::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[blas]"' - in dedicated_job - ) - assert ( - f'"{FULL_REAL_LIBRARY_TEST}::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[lapack]"' - in dedicated_job - ) assert "ignore-real-library-wrappers" in dedicated_job assert "matrix.library" not in dedicated_job @@ -402,8 +401,13 @@ def test_pull_request_declares_direct_staged_jobs_and_always_reports_the_gate() native_libraries = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "native-libraries") assert "needs: [unit-tests, unit-tests-macos]" in native_libraries assert "ignore-real-library-wrappers" in native_libraries - assert "python -m pytest -q examples/blas" in native_libraries - assert "python -m pytest -q examples/lapack" in native_libraries + assert 'python -m pytest -q -o "python_files=test_*.py ci_full_surface.py"' in native_libraries + assert native_libraries.count("python_files=test_*.py ci_full_surface.py") == 2 + assert f"examples/blas {BLAS_CI_FULL_SURFACE}" in native_libraries + assert f"examples/lapack {LAPACK_CI_FULL_SURFACE}" in native_libraries + assert BLAS_CI_FULL_SURFACE in native_libraries + assert LAPACK_CI_FULL_SURFACE in native_libraries + assert FULL_REAL_LIBRARY_TEST not in native_libraries benchmark = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "documentation-benchmark") assert "needs: native-libraries" in benchmark From a4353f7cdcff642c87cb61d29bc2e34334473858 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Mon, 3 Aug 2026 02:39:52 +0100 Subject: [PATCH 13/22] simplify blas and lapack examples --- docs/developer/quality-assurance.md | 9 +- docs/developer/testing-strategy.md | 21 +- docs/user/examples/blas-wrapper.md | 73 ++-- docs/user/examples/lapack-wrapper.md | 153 +++------ examples/.gitignore | 1 + examples/__init__.py | 1 + examples/blas/README.md | 31 +- examples/blas/__init__.py | 1 + examples/blas/ci_full_surface.py | 4 +- examples/blas/conftest.py | 150 +++++--- examples/blas/helpers.py | 23 ++ examples/blas/test_auxiliary.py | 2 +- examples/blas/test_level1_complex.py | 2 +- examples/blas/test_level1_real.py | 2 +- examples/blas/test_level2_banded.py | 2 +- examples/blas/test_level2_general.py | 2 +- examples/blas/test_level2_hermitian.py | 2 +- examples/blas/test_level2_packed.py | 2 +- examples/blas/test_level2_symmetric.py | 2 +- examples/blas/test_level2_triangular.py | 2 +- examples/blas/test_level3_general.py | 2 +- examples/blas/test_level3_hermitian.py | 2 +- examples/blas/test_level3_symmetric.py | 2 +- examples/blas/test_level3_triangular.py | 2 +- examples/blas/test_routine_coverage.py | 40 ++- examples/conftest.py | 11 + examples/lapack/README.md | 67 ++-- examples/lapack/ci_full_surface.py | 10 +- examples/lapack/conftest.py | 135 ++++++-- examples/lapack/contracts.py | 27 ++ examples/lapack/helpers.py | 9 + examples/lapack/test_routine_coverage.py | 53 ++- examples/native_library.py | 319 ++++++++++++++++++ .../real_libraries/test_full_libraries.py | 312 ++--------------- .../architecture/test_test_suite_layout.py | 23 ++ .../test_warm_real_library_native_cache.py | 26 +- tools/warm_real_library_native_cache.py | 14 +- 37 files changed, 928 insertions(+), 611 deletions(-) create mode 100644 examples/.gitignore create mode 100644 examples/__init__.py create mode 100644 examples/blas/__init__.py create mode 100644 examples/conftest.py create mode 100644 examples/lapack/contracts.py create mode 100644 examples/native_library.py diff --git a/docs/developer/quality-assurance.md b/docs/developer/quality-assurance.md index bcec3f9c8..516b35bea 100644 --- a/docs/developer/quality-assurance.md +++ b/docs/developer/quality-assurance.md @@ -287,10 +287,11 @@ reports advisory/manual. issues, Ruff formatting drift, Vulture unused test parameters, and the too-strict Radon policy. -**Native artifact cache:** dedicated Python 3.12 BLAS and LAPACK jobs restore a -separate runner-local native cache for each library before executing the full -wrapper test. The ordinary pytest matrix excludes that full corpus while -retaining the lighter native-bundle tests. Requested coverage runs still +**Native artifact cache:** dedicated Python 3.12 BLAS and LAPACK jobs restore +the cache used by `examples.native_library`. On a miss, the example-owned +builder compiles each implementation corpus once; PRIK and f2py reuse the same +artifact. The ordinary pytest matrix excludes that full corpus while retaining +the lighter native-bundle tests. Requested coverage runs still collect Python 3.12 coverage data; a final coverage job combines that artifact and uploads the XML report. diff --git a/docs/developer/testing-strategy.md b/docs/developer/testing-strategy.md index 81ea9f2d5..7799febca 100644 --- a/docs/developer/testing-strategy.md +++ b/docs/developer/testing-strategy.md @@ -125,26 +125,31 @@ directories. Check in generated `.pyi` only where exact generation text, imports, placement, or package shape is the invariant. For BLAS behavior, run `python3 -m pytest -q examples/blas` or one of its named -test functions. The session fixtures build the identical sorted 155-source set -once through PRIK and once through f2py. `test_routine_coverage.py` audits the -parsed source inventory, both export sets, visible named tests, and terminal -outcomes. The separate full-library node remains available as opt-in +test functions. The example-owned native builder compiles the sorted +155-source implementation once; PRIK and f2py generate their own wrappers and +link both to that artifact. `test_routine_coverage.py` audits the parsed source +inventory, both export sets, visible named tests, and terminal outcomes. The +separate full-library node remains available as opt-in `build_pyi_extension` and native-link integration evidence, but the dedicated CI lane explicitly adds `examples/blas/ci_full_surface.py` to the same pytest invocation and does not rebuild its wrappers afterward. Ordinary example runs do not discover that CI-only file. For LAPACK behavior, the dedicated lane runs -`python3 -m pytest -q examples/lapack`. Its session fixtures wrap and compile -the complete LAPACK corpus and required authoritative BLAS dependencies once, -then reuse that module while explicitly testing the reviewed 127-routine -SciPy 1.18.0 `float64` inventory. The inventory audit fails on SciPy drift, +`python3 -m pytest -q examples/lapack`. Its example-owned builder compiles the +complete LAPACK corpus and required authoritative BLAS dependencies once; +PRIK and f2py link their distinct wrappers to that same artifact while testing +the reviewed 127-routine SciPy 1.18.0 `float64` inventory. The inventory audit fails on SciPy drift, missing sources or exports, missing explicitly named tests, and divergent documentation totals. CI explicitly adds `examples/lapack/ci_full_surface.py` to the same pytest invocation, reusing the complete PRIK extension to require all 2,064 root exports and run a non-inventory runtime smoke call. Ordinary example runs do not discover that file. +The complete `examples/` tree is a copyable execution boundary. Example code +may depend on an installed `prik` and its documented external toolchain, but it +must not import repository-only helpers from `tests/`. + ## Ownership discipline Every maintained test and checked fixture has one final language-first owner. diff --git a/docs/user/examples/blas-wrapper.md b/docs/user/examples/blas-wrapper.md index 977ca2e6e..fe2b2d7e4 100644 --- a/docs/user/examples/blas-wrapper.md +++ b/docs/user/examples/blas-wrapper.md @@ -74,40 +74,53 @@ gfortran --version All remaining commands run from the repository root with the virtual environment active. +The runnable material is self-contained in the repository's +[`examples/` directory](../../../examples/). After PRIK and the listed tools +are installed, you can copy that directory alone. + --- -## 2. Build the full source set with PRIK +## 2. Compile BLAS once and build the PRIK wrapper The authoritative implementation lives in the pytest fixture [`examples/blas/conftest.py`](../../../examples/blas/conftest.py). -The commands below reproduce the PRIK build. +The commands below reproduce the cold build. Run them from the repository root: ```bash -export REPOSITORY_ROOT="$PWD" +export EXAMPLE_WORKSPACE="$PWD" export BLAS_BUILD_ROOT="$(mktemp -d)" +export PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR="$BLAS_BUILD_ROOT/native-cache" -# Collect all Fortran sources in sorted order -mapfile -t BLAS_SOURCES < <( - find "$REPOSITORY_ROOT/examples/blas/native" -maxdepth 1 -type f \ - \( -name '*.f' -o -name '*.f90' \) -print | sort -) +export BLAS_SHARED_LIBRARY="$( + python -m examples.native_library blas \ + --cache-dir "$PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR" \ + --compiler "$(command -v gfortran)" \ + --jobs 8 +)" + +python -m prik generate \ + --pyi examples/blas/native \ + --language fortran \ + --out "$BLAS_BUILD_ROOT/contract/blas" mkdir -p "$BLAS_BUILD_ROOT/prik/generated" cd "$BLAS_BUILD_ROOT/prik" -python -m prik "${BLAS_SOURCES[@]}" \ +python -m prik "$BLAS_BUILD_ROOT/contract/blas/__init__.pyi" \ --out prik_reference_blas \ --out-dir "$BLAS_BUILD_ROOT/prik/generated" \ --compiler "$(command -v gfortran)" \ + --native-objects "$BLAS_SHARED_LIBRARY" \ --jobs 8 \ - --native-compile-flags=-O0 \ - --wrapper-fortran-flags=-O0 \ - --wrapper-c-flags=-O0 + --wrapper-fortran-flags="-O0 -g0" \ + --wrapper-c-flags="-O0 -g0" ``` -This is a single planning + generation + compilation step for the whole library -(not 155 individual builds). +`examples.native_library` compiles all 155 implementations on the first call +and returns the resulting shared-library path. The cache is optional: an +identical later call reuses it. PRIK generates the complete contract and links +its wrapper to that artifact instead of compiling the implementations again. `-O0` keeps the PRIK and f2py correctness builds equivalent and avoids making optimization-dependent claims. This example focuses on correctness, not @@ -115,31 +128,45 @@ performance. --- -## 3. Build the same implementations with f2py +## 3. Build f2py against the same native library Use the maintained command builder so the comparison matches the test suite: ```bash -cd "$REPOSITORY_ROOT" +cd "$EXAMPLE_WORKSPACE" python - <<'PY' import os from pathlib import Path import subprocess -from examples.blas.conftest import _build_environment, _compiler, _f2py_build_command +from examples.blas.conftest import ( + _build_environment, + _compiler, + _f2py_build_command, + _f2py_signature_command, +) workdir = Path(os.environ["BLAS_BUILD_ROOT"]) / "f2py" workdir.mkdir(parents=True, exist_ok=True) compiler = _compiler() -subprocess.run( - _f2py_build_command(workdir), - cwd=workdir, - env=_build_environment(compiler), - check=True, -) +native_library = Path(os.environ["BLAS_SHARED_LIBRARY"]) +for command in ( + _f2py_signature_command(workdir), + _f2py_build_command(workdir, native_library), +): + subprocess.run( + command, + cwd=workdir, + env=_build_environment(compiler, native_library), + check=True, + ) PY ``` +f2py reads the source declarations to generate its `.pyf` signature, compiles +only its wrapper, and links that wrapper to `BLAS_SHARED_LIBRARY`. PRIK and +f2py therefore exercise the same compiled BLAS implementations. + Six rotation routines document scalar writebacks without declaring Fortran `intent`. The f2py build adds temporary intent directives and the tests pass typed 0-D arrays. PRIK needs neither: it returns unannotated scalar writebacks diff --git a/docs/user/examples/lapack-wrapper.md b/docs/user/examples/lapack-wrapper.md index ad45fd906..4bdc4656d 100644 --- a/docs/user/examples/lapack-wrapper.md +++ b/docs/user/examples/lapack-wrapper.md @@ -16,13 +16,13 @@ The surface contains the 127 double-precision real routines exposed by `scipy.li - PRIK wraps the **complete** LAPACK library (including its BLAS dependencies). All source-level wrapper and compilation coverage stays intact. -- Raw f2py builds only the 125 selected routines it can expose safely. - Building all 2,062 LAPACK sources through f2py is unnecessary for the differential comparison. +- Raw f2py generates wrappers for the 125 selected routines it can expose + safely and links them to the same complete native artifact as PRIK. - SciPy supplies the 127 reviewed low-level comparison functions. - Independent residuals, reconstructions and invariants remain the primary correctness oracle. This separation keeps a large real library manageable without weakening the claim: -every LAPACK source compiles through the full PRIK path, while every selected float64 routine has one visible, named correctness test. +every LAPACK source compiles once for the complete PRIK wrapper, while every selected float64 routine has one visible, named correctness test. You should already be comfortable with the BLAS wrapper example, NumPy arrays, and basic packaging. @@ -60,8 +60,8 @@ python -m pip install -e ".[qa]" \ "meson==1.11.2" "ninja==1.13.0" ``` -Install GNU Fortran plus the LAPACK and BLAS development libraries used by the -selected f2py comparison build. On Ubuntu: +Install GNU Fortran. The current repository setup also installs the LAPACK and +BLAS development packages used by the existing CI environment. On Ubuntu: ```bash sudo apt-get update @@ -72,83 +72,40 @@ gfortran --version All remaining commands run from the repository root with the virtual environment active. -```bash -export REPOSITORY_ROOT="$PWD" -``` +The runnable material is self-contained in the repository's +[`examples/` directory](../../../examples/). After PRIK and the listed tools +are installed, you can copy that directory alone. --- -## 2. Build the complete source set with PRIK - -LAPACK is large enough that a single enormous shell command would be fragile and hard to read. -The maintained fixture in [`examples/lapack/conftest.py`](../../../examples/lapack/conftest.py) therefore reuses PRIK’s tested complete-library integration path. -It performs these steps **once per pytest session**: - -1. Parse all 2,062 LAPACK sources and generate one complete `.pyi` contract. -2. Compile those sources together with the required authoritative BLAS sources into one cached native shared library. -3. Build one PRIK extension from that complete contract and shared library. -4. Import and reuse the module across every correctness test file. +## 2. Compile LAPACK once and build the PRIK wrapper -Contract generation uses the public PRIK CLI: +Compile the native files once into a shared `.so` file so both wrappers can +reuse it: ```bash +export EXAMPLE_WORKSPACE="$PWD" export LAPACK_BUILD_ROOT="$(mktemp -d)" -export PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR="$LAPACK_BUILD_ROOT/native-cache" +export LAPACK_SHARED_LIBRARY="$( + python -m examples.native_library lapack \ + --cache-dir "$LAPACK_BUILD_ROOT/native" \ + --compiler "$(command -v gfortran)" \ + --jobs 8 +)" + python -m prik generate \ --pyi examples/lapack/native \ --language fortran \ --out "$LAPACK_BUILD_ROOT/contracts/lapack" -``` - -Why is there an intermediate generated contract when the BLAS example can use a -single source command? Two LAPACK implementation details make the separation -necessary: -- `LA_XISNAN` contains a module procedure named `SISNAN`, while the corpus also - contains the external `SISNAN` routine. They are distinct native symbols but - cannot both become the same root Python export. -- `LA_CONSTANTS` contains internal module constants needed to compile LAPACK, - but those constants are not part of the root callable-library surface. - -A direct one-step source wrapper tries to merge those internal modules into the -root Python API. The generated contract lets the example expose the 2,064 root -procedures while still compiling and linking every implementation source. It is -generated from the sources on every clean build; it is not a hand-maintained or -hand-edited substitute for them. - -The following preparation step reuses the repository's complete native-library -compiler and creates the projected root contract. It writes the two resulting -paths to a temporary file: - -```bash -python - <<'PY' -import os -from pathlib import Path +# Remove the LA_CONSTANTS and LA_XISNAN imports from the generated root contract. +python -c 'import sys; from pathlib import Path; p=Path(sys.argv[1]); s=p.read_text(encoding="utf-8") +p.write_text(s.replace("from . import LA_CONSTANTS\n", "").replace("from . import LA_XISNAN\n", ""), encoding="utf-8")' \ + "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" -from tests.fortran.building_shared_library.end_to_end.real_libraries import ( - test_full_libraries as full, -) - -workdir = Path(os.environ["LAPACK_BUILD_ROOT"]) -entry = workdir / "contracts" / "lapack" / "__init__.pyi" -native_library = full._cached_native_shared_library("lapack") -runtime_entry = full._runtime_entry("lapack", entry, workdir) -(workdir / "prik-inputs.txt").write_text( - f"{runtime_entry}\n{native_library}\n", - encoding="utf-8", -) -PY -``` - -The final wrapper build now uses the same public `python -m prik` CLI as BLAS: - -```bash -mapfile -t PRIK_INPUTS < "$LAPACK_BUILD_ROOT/prik-inputs.txt" -LAPACK_RUNTIME_CONTRACT="${PRIK_INPUTS[0]}" -LAPACK_SHARED_LIBRARY="${PRIK_INPUTS[1]}" mkdir -p "$LAPACK_BUILD_ROOT/prik/generated" cd "$LAPACK_BUILD_ROOT/prik" -python -m prik "$LAPACK_RUNTIME_CONTRACT" \ +python -m prik "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" \ --out prik_reference_lapack_example \ --out-dir "$LAPACK_BUILD_ROOT/prik/generated" \ --compiler "$(command -v gfortran)" \ @@ -158,28 +115,16 @@ python -m prik "$LAPACK_RUNTIME_CONTRACT" \ --wrapper-c-flags="-O0 -g0" ``` -The native helper compiles the repository-owned LAPACK and BLAS sources instead -of trusting an unrelated system LAPACK binary. It caches the artifact by -compiler, platform, and source digest. The pytest fixture runs this complete -sequence automatically and reports the real CLI command on failure. - -The small `_runtime_entry` projection is specific to this corpus: it removes root imports of LAPACK’s internal constants modules while retaining all 2,064 root procedures. -For your own already-built library, pass its shared-library path through -`--native-objects` with the generated contract in the same way. - -This is still **one complete PRIK wrapper**. -The correctness inventory does not cause per-routine, per-file or per-family PRIK builds. -GitHub Actions explicitly adds the non-discovered `ci_full_surface.py` to reuse -the same imported extension for the all-2,064-root export audit and runtime -smoke call. Ordinary `pytest examples/lapack` runs do not collect that -maintainer-only file, and CI does not rebuild a second wrapper for it. +The short contract command removes only the internal `LA_CONSTANTS` and +`LA_XISNAN` root imports in place. --- ## 3. Build the reviewed f2py comparison surface -The f2py side intentionally does less compilation. -It wraps the 125 selected routines that are not affected by f2py’s callback-generation limitation, includes the minimal `la_constants.f90` dependency required by `dlartg`, and links unresolved helper symbols to the system `lapack` and `blas` libraries. +The f2py side does not compile the implementations again. It reads the 125 +selected routines and `la_constants.f90` to generate reviewed signatures, then +compiles only its wrapper and links it to `LAPACK_SHARED_LIBRARY`. Nine routines document scalar writebacks without declaring Fortran `intent`. The f2py build adds temporary intent directives and the tests pass typed 0-D @@ -190,27 +135,33 @@ The exact command is assembled from the reviewed inventory by `_f2py_build_comma This short reproducer runs that same command: ```bash -cd "$REPOSITORY_ROOT" +cd "$EXAMPLE_WORKSPACE" export LAPACK_F2PY_ROOT="$(mktemp -d)" python - <<'PY' import os from pathlib import Path import subprocess -from examples.lapack.conftest import _build_environment, _f2py_build_command -from tests.fortran.building_shared_library.end_to_end.real_libraries import ( - test_full_libraries as full, +from examples.lapack.conftest import ( + _build_environment, + _compiler, + _f2py_build_command, + _f2py_signature_command, ) workdir = Path(os.environ["LAPACK_F2PY_ROOT"]) -compiler = full._compiler() -command = _f2py_build_command(workdir) -subprocess.run( - command, - cwd=workdir, - env=_build_environment(compiler), - check=True, -) +compiler = _compiler() +native_library = Path(os.environ["LAPACK_SHARED_LIBRARY"]) +for command in ( + _f2py_signature_command(workdir), + _f2py_build_command(workdir, native_library), +): + subprocess.run( + command, + cwd=workdir, + env=_build_environment(compiler, native_library), + check=True, + ) print(workdir) PY ``` @@ -218,10 +169,14 @@ PY The assembled command has this shape: ```text -python -m numpy.f2py -c -m f2py_reference_lapack_example \ +python -m numpy.f2py -m f2py_reference_lapack_example \ + -h f2py_reference_lapack_example.pyf \ la_constants.f90 <125 reviewed implementation sources> \ only: <125 reviewed routine names> : \ - --dep lapack --dep blas --f2cmap \ + --f2cmap --overwrite-signature +python -m numpy.f2py -c f2py_reference_lapack_example.pyf \ + -L -lprik_full_lapack \ + --f2cmap \ --build-dir \ --f77flags=-O0 --f90flags=-O0 --opt=-O0 ``` @@ -458,7 +413,7 @@ For storage formats, workspaces, pivot conventions, the f2py callback limitation ## Troubleshooting -- Confirm that `gfortran`, `ar`, `meson` and `ninja` are on `PATH` and that the system LAPACK and BLAS development libraries are installed. +- Confirm that `gfortran`, `ar`, `meson` and `ninja` are on `PATH`. - Keep SciPy at **exactly 1.18.0** for this reviewed inventory. A different version is treated as inventory drift, not silently accepted. - On Python 3.12 or newer, let f2py use Meson; do not force the removed distutils backend. - Rerun one named test with more detail and keep the build directory: diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 000000000..30bcfa4ed --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1 @@ +.build/ diff --git a/examples/__init__.py b/examples/__init__.py new file mode 100644 index 000000000..65d577b30 --- /dev/null +++ b/examples/__init__.py @@ -0,0 +1 @@ +"""Copyable, runnable examples for an installed PRIK package.""" diff --git a/examples/blas/README.md b/examples/blas/README.md index c9a2ca708..7ab3f003a 100644 --- a/examples/blas/README.md +++ b/examples/blas/README.md @@ -39,40 +39,43 @@ running the example: python3 -m pip install "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" ``` -The session fixtures build the same implementations at `-O0`; all artifacts -stay in a temporary directory. PRIK consumes the authoritative sources -directly: +The session fixtures compile the implementations once at `-O0`, then link both +wrappers to that same native library. All artifacts stay in a temporary +directory: ```bash -export REPOSITORY_ROOT="$(pwd)" +export EXAMPLE_WORKSPACE="$(pwd)" export BUILD_ROOT="$(mktemp -d)" -mapfile -t BLAS_SOURCES < <(find "$REPOSITORY_ROOT/examples/blas/native" -maxdepth 1 -type f \( -name '*.f' -o -name '*.f90' \) -print | sort) +export PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR="$BUILD_ROOT/native-cache" +export BLAS_SHARED_LIBRARY="$(python3 -m examples.native_library blas --cache-dir "$PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR" --compiler "$(command -v gfortran)" --jobs 8)" +python3 -m prik generate --pyi examples/blas/native --language fortran --out "$BUILD_ROOT/contract/blas" mkdir -p "$BUILD_ROOT/prik" "$BUILD_ROOT/f2py" cd "$BUILD_ROOT/prik" -python3 -m prik "${BLAS_SOURCES[@]}" --out prik_reference_blas --out-dir "$BUILD_ROOT/prik/generated" --compiler "$(command -v gfortran)" --jobs 8 --native-compile-flags=-O0 --wrapper-fortran-flags=-O0 --wrapper-c-flags=-O0 +python3 -m prik "$BUILD_ROOT/contract/blas/__init__.pyi" --out prik_reference_blas --out-dir "$BUILD_ROOT/prik/generated" --compiler "$(command -v gfortran)" --native-objects "$BLAS_SHARED_LIBRARY" --jobs 8 --wrapper-fortran-flags="-O0 -g0" --wrapper-c-flags="-O0 -g0" ``` ```bash -cd "$REPOSITORY_ROOT" +cd "$EXAMPLE_WORKSPACE" python3 - <<'PY' import os from pathlib import Path import subprocess -from examples.blas.conftest import _build_environment, _compiler, _f2py_build_command +from examples.blas.conftest import _build_environment, _compiler, _f2py_build_command, _f2py_signature_command workdir = Path(os.environ["BUILD_ROOT"]) / "f2py" workdir.mkdir(parents=True, exist_ok=True) compiler = _compiler() -subprocess.run( - _f2py_build_command(workdir), - cwd=workdir, - env=_build_environment(compiler), - check=True, -) +native_library = Path(os.environ["BLAS_SHARED_LIBRARY"]) +for command in (_f2py_signature_command(workdir), _f2py_build_command(workdir, native_library)): + subprocess.run(command, cwd=workdir, env=_build_environment(compiler, native_library), check=True) PY ``` +The first native-builder call compiles all sources; later identical calls may +reuse its cache. f2py reads the sources only to generate signatures and +compiles its wrapper against `BLAS_SHARED_LIBRARY`. + Six rotation routines document scalar writebacks without declaring Fortran `intent`. The f2py fixture adds build-local intent directives and passes typed 0-D arrays so those writes are testable. PRIK needs neither the overlay nor diff --git a/examples/blas/__init__.py b/examples/blas/__init__.py new file mode 100644 index 000000000..12e94c555 --- /dev/null +++ b/examples/blas/__init__.py @@ -0,0 +1 @@ +"""Complete Reference BLAS correctness example.""" diff --git a/examples/blas/ci_full_surface.py b/examples/blas/ci_full_surface.py index a2317004d..91f53fe13 100644 --- a/examples/blas/ci_full_surface.py +++ b/examples/blas/ci_full_surface.py @@ -4,8 +4,8 @@ import pytest +from examples.blas.helpers import assert_runtime_smoke from examples.blas.routine_inventory import ALL_ROUTINES -from tests.fortran.building_shared_library.end_to_end.real_libraries import test_full_libraries as full pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] @@ -14,4 +14,4 @@ def test_ci_complete_prik_surface_reuses_example_extension(prik_blas): missing = sorted(routine for routine in ALL_ROUTINES if not callable(getattr(prik_blas, routine, None))) assert missing == [] - full._assert_blas_runtime_smoke(prik_blas) + assert_runtime_smoke(prik_blas) diff --git a/examples/blas/conftest.py b/examples/blas/conftest.py index cc2592508..d1afb2770 100644 --- a/examples/blas/conftest.py +++ b/examples/blas/conftest.py @@ -1,4 +1,4 @@ -"""Build the complete reference BLAS once per pytest session with both tools.""" +"""Build one native BLAS library and reuse it through PRIK and f2py.""" from __future__ import annotations @@ -7,24 +7,31 @@ import os from pathlib import Path import shlex -import shutil import subprocess import sys import pytest -from examples.f2py_intents import prepare_f2py_intent_sources from examples.blas.f2py_contract import F2PY_INOUT_ARGUMENTS +from examples.f2py_intents import prepare_f2py_intent_sources +from examples.native_library import ( + NativeLibrary, + build_reference_library, + compiler_identity, + linker_name, + native_cache_root, + require_tool, +) EXAMPLE_ROOT = Path(__file__).resolve().parent -REPOSITORY_ROOT = EXAMPLE_ROOT.parents[1] NATIVE_ROOT = EXAMPLE_ROOT / "native" FORTRAN_SUFFIXES = frozenset({".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"}) BLAS_SOURCES = tuple( sorted(path for path in NATIVE_ROOT.iterdir() if path.is_file() and path.suffix.lower() in FORTRAN_SUFFIXES) ) BUILD_FLAGS = "-O0" +PRIK_WRAPPER_FLAGS = ("-O0", "-g0") @dataclass(frozen=True) @@ -38,27 +45,17 @@ class BuiltBLAS: compiler_identity: str stdout: str stderr: str + native_library: Path def _compiler() -> str: - compiler = shutil.which("gfortran") - if compiler is None: - pytest.skip("GNU Fortran is required to build the reference BLAS example") - return compiler - - -def _compiler_identity(compiler: str) -> str: - result = subprocess.run( # nosec B603 - fixed local compiler identity probe - (compiler, "--version"), - capture_output=True, - text=True, - check=False, - ) - first_line = result.stdout.splitlines()[0] if result.stdout else compiler - return f"{Path(compiler).resolve()}: {first_line}" + try: + return require_tool("gfortran") + except RuntimeError as error: + pytest.skip(str(error)) -def _build_environment(compiler: str) -> dict[str, str]: +def _build_environment(compiler: str, native_library: Path | None = None) -> dict[str, str]: environment = dict(os.environ) environment.update( { @@ -68,17 +65,24 @@ def _build_environment(compiler: str) -> dict[str, str]: "F90": compiler, "FFLAGS": BUILD_FLAGS, "F90FLAGS": BUILD_FLAGS, - "PYTHONPATH": os.pathsep.join(filter(None, (str(REPOSITORY_ROOT), environment.get("PYTHONPATH")))), } ) + if native_library is not None: + rpath_flag = f"-Wl,-rpath,{native_library.parent}" + environment["LDFLAGS"] = " ".join(filter(None, (environment.get("LDFLAGS"), rpath_flag))) return environment -def _run_build(command: tuple[str, ...], workdir: Path, compiler: str) -> subprocess.CompletedProcess[str]: - result = subprocess.run( # nosec B603 - command is assembled from repository sources and fixed tools +def _run_build( + command: tuple[str, ...], + workdir: Path, + compiler: str, + native_library: Path | None = None, +) -> subprocess.CompletedProcess[str]: + result = subprocess.run( # nosec B603 - fixed tools and copied example inputs command, cwd=workdir, - env=_build_environment(compiler), + env=_build_environment(compiler, native_library), capture_output=True, text=True, check=False, @@ -86,7 +90,7 @@ def _run_build(command: tuple[str, ...], workdir: Path, compiler: str) -> subpro if result.returncode: pytest.fail( "Reference BLAS build failed\n" - f"compiler: {_compiler_identity(compiler)}\n" + f"compiler: {compiler_identity(compiler)}\n" f"command: {shlex.join(command)}\n" f"stdout:\n{result.stdout or ''}\n" f"stderr:\n{result.stderr or ''}" @@ -103,39 +107,77 @@ def _import_built_module(module_name: str, workdir: Path): sys.path.remove(str(workdir)) -def _prik_build_command(workdir: Path, compiler: str) -> tuple[str, ...]: - """Build the complete source set through PRIK's public CLI.""" +def _contract_command(workdir: Path) -> tuple[str, ...]: + """Generate the complete BLAS semantic contract through the public CLI.""" + return ( + sys.executable, + "-m", + "prik", + "generate", + "--pyi", + str(NATIVE_ROOT), + "--language", + "fortran", + "--out", + str(workdir / "contract" / "blas"), + ) + + +def _prik_build_command( + contract_entry: Path, + native_library: Path, + workdir: Path, + compiler: str, +) -> tuple[str, ...]: + """Build the complete contract while reusing the precompiled native library.""" jobs = max(1, min(os.cpu_count() or 1, 8)) + joined_wrapper_flags = " ".join(PRIK_WRAPPER_FLAGS) return ( sys.executable, "-m", "prik", - *(str(source) for source in BLAS_SOURCES), + str(contract_entry), "--out", "prik_reference_blas", "--out-dir", str(workdir / "generated"), "--compiler", compiler, + "--native-objects", + str(native_library), "--jobs", str(jobs), - f"--native-compile-flags={BUILD_FLAGS}", - f"--wrapper-fortran-flags={BUILD_FLAGS}", - f"--wrapper-c-flags={BUILD_FLAGS}", + f"--wrapper-fortran-flags={joined_wrapper_flags}", + f"--wrapper-c-flags={joined_wrapper_flags}", ) -def _f2py_build_command(workdir: Path) -> tuple[str, ...]: - """Build the complete source set with reviewed f2py intent overlays.""" +def _f2py_signature_command(workdir: Path) -> tuple[str, ...]: + """Generate f2py signatures from reviewed build-local intent overlays.""" sources = prepare_f2py_intent_sources(BLAS_SOURCES, workdir, F2PY_INOUT_ARGUMENTS) return ( sys.executable, "-m", "numpy.f2py", - "-c", "-m", "f2py_reference_blas", + "-h", + str(workdir / "f2py_reference_blas.pyf"), *(str(source) for source in sources), + "--overwrite-signature", + ) + + +def _f2py_build_command(workdir: Path, native_library: Path) -> tuple[str, ...]: + """Build only f2py's wrapper and link the precompiled BLAS implementation.""" + return ( + sys.executable, + "-m", + "numpy.f2py", + "-c", + str(workdir / "f2py_reference_blas.pyf"), + f"-L{native_library.parent}", + f"-l{linker_name(native_library)}", "--build-dir", str(workdir / "generated"), f"--f77flags={BUILD_FLAGS}", @@ -145,40 +187,60 @@ def _f2py_build_command(workdir: Path) -> tuple[str, ...]: @pytest.fixture(scope="session") -def prik_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltBLAS: - """Build and import the complete source set through PRIK once.""" +def native_build(tmp_path_factory: pytest.TempPathFactory) -> NativeLibrary: + """Compile the complete BLAS implementation once for both wrappers.""" compiler = _compiler() + cache_root = ( + native_cache_root() + if os.environ.get("PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR") + else tmp_path_factory.mktemp("reference-blas-native") + ) + try: + return build_reference_library("blas", cache_root=cache_root, compiler=compiler) + except (RuntimeError, subprocess.CalledProcessError) as error: + pytest.fail(f"Reference BLAS native build failed with {compiler_identity(compiler)}\n{error}") + + +@pytest.fixture(scope="session") +def prik_build(tmp_path_factory: pytest.TempPathFactory, native_build: NativeLibrary) -> BuiltBLAS: + """Build and import PRIK against the session's native BLAS library.""" + compiler = native_build.compiler workdir = tmp_path_factory.mktemp("prik-reference-blas") + _run_build(_contract_command(workdir), workdir, compiler) + contract_entry = workdir / "contract" / "blas" / "__init__.pyi" module_name = "prik_reference_blas" - command = _prik_build_command(workdir, compiler) + command = _prik_build_command(contract_entry, native_build.shared_library, workdir, compiler) result = _run_build(command, workdir, compiler) return BuiltBLAS( module=_import_built_module(module_name, workdir), module_name=module_name, workdir=workdir, command=command, - compiler_identity=_compiler_identity(compiler), + compiler_identity=compiler_identity(compiler), stdout=result.stdout, stderr=result.stderr, + native_library=native_build.shared_library, ) @pytest.fixture(scope="session") -def f2py_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltBLAS: - """Build and import the identical complete source set through f2py once.""" - compiler = _compiler() +def f2py_build(tmp_path_factory: pytest.TempPathFactory, native_build: NativeLibrary) -> BuiltBLAS: + """Build and import f2py against the same native BLAS library.""" + compiler = native_build.compiler workdir = tmp_path_factory.mktemp("f2py-reference-blas") + _run_build(_f2py_signature_command(workdir), workdir, compiler) module_name = "f2py_reference_blas" - command = _f2py_build_command(workdir) - result = _run_build(command, workdir, compiler) + command = _f2py_build_command(workdir, native_build.shared_library) + result = _run_build(command, workdir, compiler, native_build.shared_library) return BuiltBLAS( module=_import_built_module(module_name, workdir), module_name=module_name, workdir=workdir, command=command, - compiler_identity=_compiler_identity(compiler), + compiler_identity=compiler_identity(compiler), stdout=result.stdout, stderr=result.stderr, + native_library=native_build.shared_library, ) diff --git a/examples/blas/helpers.py b/examples/blas/helpers.py index eb6f149a8..6552c5fea 100644 --- a/examples/blas/helpers.py +++ b/examples/blas/helpers.py @@ -218,3 +218,26 @@ def triangular_from_band( if unit_diagonal: triangle += np.eye(n, dtype=storage.dtype) return triangle + + +def assert_runtime_smoke(module) -> None: + """Exercise representative complete-library BLAS exports.""" + x = np.array([1.0, 2.0, 3.0], dtype=np.float64) + y = np.array([10.0, 20.0, 30.0], dtype=np.float64) + daxpy_scalars = module.daxpy(np.int32(3), np.float64(2.0), x, np.int32(1), y, np.int32(1)) + assert daxpy_scalars == (np.int32(3), np.float64(2.0), np.int32(1), np.int32(1)) + np.testing.assert_allclose(y, [12.0, 24.0, 36.0]) + assert module.ddot(np.int32(3), x, np.int32(1), y, np.int32(1)) == ( + np.float64(168.0), + np.int32(3), + np.int32(1), + np.int32(1), + ) + assert module.dasum(np.int32(3), y, np.int32(1)) == ( + np.float64(72.0), + np.int32(3), + np.int32(1), + ) + dscal_scalars = module.dscal(np.int32(3), np.float64(0.5), y, np.int32(1)) + assert dscal_scalars == (np.int32(3), np.float64(0.5), np.int32(1)) + np.testing.assert_allclose(y, [6.0, 12.0, 18.0]) diff --git a/examples/blas/test_auxiliary.py b/examples/blas/test_auxiliary.py index f2488e500..feb83b5c6 100644 --- a/examples/blas/test_auxiliary.py +++ b/examples/blas/test_auxiliary.py @@ -9,7 +9,7 @@ import numpy as np import pytest -from helpers import assert_allclose_for_dtype +from .helpers import assert_allclose_for_dtype pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] diff --git a/examples/blas/test_level1_complex.py b/examples/blas/test_level1_complex.py index 2cff36d55..7a4ba146e 100644 --- a/examples/blas/test_level1_complex.py +++ b/examples/blas/test_level1_complex.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import ( +from .helpers import ( assert_allclose_for_dtype, assert_storage_unchanged, logical_vector, diff --git a/examples/blas/test_level1_real.py b/examples/blas/test_level1_real.py index 10a87fe9c..cb6429503 100644 --- a/examples/blas/test_level1_real.py +++ b/examples/blas/test_level1_real.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import ( +from .helpers import ( assert_allclose_for_dtype, assert_storage_unchanged, logical_vector, diff --git a/examples/blas/test_level2_banded.py b/examples/blas/test_level2_banded.py index 1d836f195..c17305a91 100644 --- a/examples/blas/test_level2_banded.py +++ b/examples/blas/test_level2_banded.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import ( +from .helpers import ( assert_allclose_for_dtype, assert_storage_unchanged, general_from_band, diff --git a/examples/blas/test_level2_general.py b/examples/blas/test_level2_general.py index 93600aaee..e0a2dbfbe 100644 --- a/examples/blas/test_level2_general.py +++ b/examples/blas/test_level2_general.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import assert_allclose_for_dtype, assert_storage_unchanged +from .helpers import assert_allclose_for_dtype, assert_storage_unchanged pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] diff --git a/examples/blas/test_level2_hermitian.py b/examples/blas/test_level2_hermitian.py index 8d4b2d16b..b60f4c695 100644 --- a/examples/blas/test_level2_hermitian.py +++ b/examples/blas/test_level2_hermitian.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import assert_allclose_for_dtype, assert_storage_unchanged, hermitian_from_triangle +from .helpers import assert_allclose_for_dtype, assert_storage_unchanged, hermitian_from_triangle pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] diff --git a/examples/blas/test_level2_packed.py b/examples/blas/test_level2_packed.py index 5d99707f4..ad4667d9a 100644 --- a/examples/blas/test_level2_packed.py +++ b/examples/blas/test_level2_packed.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import ( +from .helpers import ( assert_allclose_for_dtype, assert_storage_unchanged, hermitian_from_packed, diff --git a/examples/blas/test_level2_symmetric.py b/examples/blas/test_level2_symmetric.py index d540e146a..6938914d2 100644 --- a/examples/blas/test_level2_symmetric.py +++ b/examples/blas/test_level2_symmetric.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import assert_allclose_for_dtype, assert_storage_unchanged, symmetric_from_triangle +from .helpers import assert_allclose_for_dtype, assert_storage_unchanged, symmetric_from_triangle pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] diff --git a/examples/blas/test_level2_triangular.py b/examples/blas/test_level2_triangular.py index 3f8986493..e9bcc2860 100644 --- a/examples/blas/test_level2_triangular.py +++ b/examples/blas/test_level2_triangular.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import assert_allclose_for_dtype, assert_storage_unchanged, triangular_from_triangle +from .helpers import assert_allclose_for_dtype, assert_storage_unchanged, triangular_from_triangle pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] diff --git a/examples/blas/test_level3_general.py b/examples/blas/test_level3_general.py index 203bf4b61..7a85ffce1 100644 --- a/examples/blas/test_level3_general.py +++ b/examples/blas/test_level3_general.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import assert_allclose_for_dtype, assert_storage_unchanged +from .helpers import assert_allclose_for_dtype, assert_storage_unchanged pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] diff --git a/examples/blas/test_level3_hermitian.py b/examples/blas/test_level3_hermitian.py index c70fb4c4e..895fbf87f 100644 --- a/examples/blas/test_level3_hermitian.py +++ b/examples/blas/test_level3_hermitian.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import assert_allclose_for_dtype, assert_storage_unchanged, hermitian_from_triangle +from .helpers import assert_allclose_for_dtype, assert_storage_unchanged, hermitian_from_triangle pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] diff --git a/examples/blas/test_level3_symmetric.py b/examples/blas/test_level3_symmetric.py index 00510c915..d80942dae 100644 --- a/examples/blas/test_level3_symmetric.py +++ b/examples/blas/test_level3_symmetric.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import assert_allclose_for_dtype, assert_storage_unchanged, symmetric_from_triangle +from .helpers import assert_allclose_for_dtype, assert_storage_unchanged, symmetric_from_triangle pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] diff --git a/examples/blas/test_level3_triangular.py b/examples/blas/test_level3_triangular.py index 4934f05ba..0437a3eec 100644 --- a/examples/blas/test_level3_triangular.py +++ b/examples/blas/test_level3_triangular.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from helpers import assert_allclose_for_dtype, assert_storage_unchanged, triangular_from_triangle +from .helpers import assert_allclose_for_dtype, assert_storage_unchanged, triangular_from_triangle pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] diff --git a/examples/blas/test_routine_coverage.py b/examples/blas/test_routine_coverage.py index 75af520a4..0a45f7e3b 100644 --- a/examples/blas/test_routine_coverage.py +++ b/examples/blas/test_routine_coverage.py @@ -9,9 +9,16 @@ import pytest from examples.blas.f2py_contract import F2PY_INOUT_ARGUMENTS -from conftest import BLAS_SOURCES, EXAMPLE_ROOT, _f2py_build_command, _prik_build_command +from .conftest import ( + BLAS_SOURCES, + EXAMPLE_ROOT, + _contract_command, + _f2py_build_command, + _f2py_signature_command, + _prik_build_command, +) from prik.parsers.fortran.parser import parse_fortran_file -from routine_inventory import ( +from .routine_inventory import ( ALL_ROUTINES, DIFFERENTIALLY_TESTED_ROUTINES, EXPLICIT_TEST_NAMES, @@ -42,22 +49,32 @@ def test_build_commands_use_the_documented_public_clis(tmp_path: Path): - prik_command = _prik_build_command(tmp_path / "prik", "/usr/bin/gfortran") - f2py_command = _f2py_build_command(tmp_path / "f2py") - + native_library = tmp_path / "native" / "libprik_full_blas.so" + contract_entry = tmp_path / "prik" / "contract" / "blas" / "__init__.pyi" + contract_command = _contract_command(tmp_path / "prik") + prik_command = _prik_build_command(contract_entry, native_library, tmp_path / "prik", "/usr/bin/gfortran") + signature_command = _f2py_signature_command(tmp_path / "f2py") + f2py_command = _f2py_build_command(tmp_path / "f2py", native_library) + + assert contract_command[:5] == (sys.executable, "-m", "prik", "generate", "--pyi") assert prik_command[:3] == (sys.executable, "-m", "prik") assert prik_command[prik_command.index("--out") + 1] == "prik_reference_blas" - assert f2py_command[:6] == (sys.executable, "-m", "numpy.f2py", "-c", "-m", "f2py_reference_blas") + assert prik_command[prik_command.index("--native-objects") + 1] == str(native_library) + assert signature_command[:5] == (sys.executable, "-m", "numpy.f2py", "-m", "f2py_reference_blas") + assert f2py_command[:4] == (sys.executable, "-m", "numpy.f2py", "-c") + assert f"-L{native_library.parent}" in f2py_command + assert "-lprik_full_blas" in f2py_command for source in BLAS_SOURCES: - assert str(source) in prik_command expected_f2py_source = ( tmp_path / "f2py" / "f2py-intent-sources" / source.name if source.stem in F2PY_INOUT_ARGUMENTS else source ) - assert str(expected_f2py_source) in f2py_command + assert str(expected_f2py_source) in signature_command + assert str(source) not in prik_command + assert str(source) not in f2py_command def test_f2py_scalar_writeback_overlays_are_explicit(tmp_path: Path): - command = _f2py_build_command(tmp_path) + command = _f2py_signature_command(tmp_path) for routine, arguments in F2PY_INOUT_ARGUMENTS.items(): source = next(source for source in BLAS_SOURCES if source.stem == routine) @@ -102,6 +119,11 @@ def test_f2py_exports_every_expected_routine(f2py_blas): assert missing == [] +def test_both_wrappers_reuse_the_same_precompiled_native_library(prik_build, f2py_build): + assert prik_build.native_library == f2py_build.native_library + assert prik_build.native_library.name == "libprik_full_blas.so" + + def test_every_routine_has_one_visible_explicit_test(): functions = _explicit_test_functions() expected_names = set(EXPLICIT_TEST_NAMES.values()) diff --git a/examples/conftest.py b/examples/conftest.py new file mode 100644 index 000000000..04a0b20d2 --- /dev/null +++ b/examples/conftest.py @@ -0,0 +1,11 @@ +"""Pytest configuration shipped with the copyable native-library examples.""" + +from __future__ import annotations + +import pytest + + +def pytest_configure(config: pytest.Config) -> None: + """Register the repository's two example markers in a copied directory.""" + config.addinivalue_line("markers", "fortran_end_to_end: compiled and called Fortran example") + config.addinivalue_line("markers", "real_library: complete BLAS or LAPACK native-library example") diff --git a/examples/lapack/README.md b/examples/lapack/README.md index ddf399b68..94ac8c9fa 100644 --- a/examples/lapack/README.md +++ b/examples/lapack/README.md @@ -35,17 +35,16 @@ stem already supplied by LAPACK. No BLAS source is copied below this directory. ## Build topology -On Python 3.12 and newer, NumPy's f2py uses its Meson backend. Install the -same Meson, Ninja, and SciPy versions used by the dedicated BLAS/LAPACK CI lane -before running this example: +On Python 3.12 and newer, NumPy's f2py uses its Meson backend. The maintained +environment currently installs the same system development packages and +pinned Meson, Ninja, and SciPy versions as the dedicated CI lane: ```console sudo apt-get install libblas-dev liblapack-dev python3 -m pip install "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" "scipy==1.18.0" ``` -The session fixture reuses the established complete-library integration path in -`tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py`. +The session fixture uses the copyable builder in `examples/native_library.py`. It performs these operations once: 1. generate one semantic package for all LAPACK sources; @@ -53,50 +52,50 @@ It performs these operations once: cached shared library; 3. build one PRIK extension from the complete generated contract and shared library; -4. independently build one f2py comparison surface from the 125 reviewed - f2py-compatible routine sources and their minimal module dependency, linking unselected - LAPACK and BLAS helper symbols from the system development libraries; and +4. generate f2py signatures for the 125 reviewed compatible routines and link + its wrapper to the same shared library; and 5. reuse the three imported comparison surfaces for every correctness file; CI explicitly adds the non-discovered `ci_full_surface.py` for the complete PRIK root-export audit and runtime smoke call. -The contract-generation command is: +The complete build is one command sequence: ```console +export LAPACK_SHARED_LIBRARY="$(python3 -m examples.native_library lapack --cache-dir /tmp/prik-lapack/native-cache)" python3 -m prik generate --pyi examples/lapack/native --language fortran --out /tmp/prik-lapack/contracts/lapack -``` - -The intermediate contract separates LAPACK's root callable surface from its -internal `LA_CONSTANTS` and `LA_XISNAN` modules. A direct merged source build -would otherwise collide the module procedure `SISNAN` with the distinct -external `SISNAN` routine and try to expose internal module constants. The -contract is generated from all sources; no callable procedure is manually -removed. All sources are still compiled into the native artifact. - -The final extension build uses the public CLI with the projected root contract -and cached native shared library: - -```console -python3 -m prik /tmp/prik-lapack/runtime-contract/lapack/__init__.pyi \ +# Remove the LA_CONSTANTS and LA_XISNAN imports from the generated root contract. +python3 -c 'import sys; from pathlib import Path; p=Path(sys.argv[1]); s=p.read_text(encoding="utf-8") +p.write_text(s.replace("from . import LA_CONSTANTS\n", "").replace("from . import LA_XISNAN\n", ""), encoding="utf-8")' \ + /tmp/prik-lapack/contracts/lapack/__init__.pyi +mkdir -p /tmp/prik-lapack/prik/generated +python3 -m prik /tmp/prik-lapack/contracts/lapack/__init__.pyi \ --out prik_reference_lapack_example \ --out-dir /tmp/prik-lapack/prik/generated \ --compiler "$(command -v gfortran)" \ - --native-objects /tmp/prik-lapack/libprik_full_lapack.so \ + --native-objects "$LAPACK_SHARED_LIBRARY" \ --jobs 8 \ --wrapper-fortran-flags="-O0 -g0" \ --wrapper-c-flags="-O0 -g0" ``` -The paths are illustrative; `conftest.py` creates their actual temporary/cache -locations and records the exact executable command. The f2py command it -assembles is equivalent to: +The short contract command removes only the internal `LA_CONSTANTS` and +`LA_XISNAN` root imports in place. All native sources remain in the shared +library. The paths are illustrative; `conftest.py` creates the actual temporary +locations and records the exact executable command. + +The first call builds the library; an identical later call may reuse it. The +f2py commands are equivalent to: ```console -python3 -m numpy.f2py -c -m f2py_reference_lapack_example \ +python3 -m numpy.f2py -m f2py_reference_lapack_example \ + -h /tmp/prik-lapack/f2py_reference_lapack_example.pyf \ examples/lapack/native/la_constants.f90 \ \ only: : \ - --dep lapack --dep blas \ + --f2cmap /tmp/prik-lapack/.f2py_f2cmap \ + --overwrite-signature +python3 -m numpy.f2py -c /tmp/prik-lapack/f2py_reference_lapack_example.pyf \ + -L/tmp/prik-lapack/native-cache/ -lprik_full_lapack \ --f2cmap /tmp/prik-lapack/.f2py_f2cmap \ --build-dir /tmp/prik-lapack/f2py --f77flags=-O0 --f90flags=-O0 --opt=-O0 ``` @@ -104,12 +103,10 @@ python3 -m numpy.f2py -c -m f2py_reference_lapack_example \ `dlartg.f90` imports the `LA_CONSTANTS` module and declares its arguments as `REAL(wp)`. The f2py build therefore includes `la_constants.f90` as a build-only dependency and supplies a kind map that resolves `wp` to C `double`. The -`only:` list makes the 125 f2py-compatible routine wrappers explicit; module support metadata -is not counted as a selected routine. The dependency is compiled only to -satisfy f2py's standalone selected-source build. f2py does not compile or link -PRIK's complete 2,062-source native artifact. The reviewed implementations come -from `examples/lapack/native/`; only their unselected transitive LAPACK and BLAS -dependencies come from the system libraries. +`only:` list makes the 125 f2py-compatible routine wrappers explicit; module +support metadata is not counted as a selected routine. Those files provide +signature information only. f2py compiles its generated wrapper and reuses the +complete native artifact already linked by PRIK. Build products stay in pytest temporary/cache directories. Failures report the compiler identity, command, stdout, and stderr. Neither build dirties the diff --git a/examples/lapack/ci_full_surface.py b/examples/lapack/ci_full_surface.py index 7c24f66d8..b23ae9962 100644 --- a/examples/lapack/ci_full_surface.py +++ b/examples/lapack/ci_full_surface.py @@ -4,8 +4,8 @@ import pytest -from tests.fortran.building_shared_library.end_to_end.real_libraries import test_full_libraries as full - +from .contracts import root_function_names +from .helpers import assert_runtime_smoke from .routine_inventory import EXPECTED_LAPACK_ROOT_PROCEDURES @@ -13,10 +13,10 @@ def test_ci_complete_prik_surface_reuses_example_extension(prik_build): - runtime_package = prik_build.workdir / "runtime_contract" / "lapack" - expected = {function.name for function in full._root_module(runtime_package).functions} + runtime_package = prik_build.workdir / "contracts" / "lapack" + expected = root_function_names(runtime_package) assert len(expected) == EXPECTED_LAPACK_ROOT_PROCEDURES missing = sorted(name for name in expected if not callable(getattr(prik_build.module, name, None))) assert missing == [] - full._assert_lapack_runtime_smoke(prik_build.module) + assert_runtime_smoke(prik_build.module) diff --git a/examples/lapack/conftest.py b/examples/lapack/conftest.py index 92aa6bc7b..2da6efa4e 100644 --- a/examples/lapack/conftest.py +++ b/examples/lapack/conftest.py @@ -1,4 +1,4 @@ -"""Session fixtures for the complete PRIK, f2py, and SciPy LAPACK surfaces.""" +"""Build one native LAPACK library and reuse it through PRIK and f2py.""" from __future__ import annotations @@ -13,8 +13,16 @@ import pytest from examples.f2py_intents import prepare_f2py_intent_sources -from tests.fortran.building_shared_library.end_to_end.real_libraries import test_full_libraries as full - +from examples.native_library import ( + NativeLibrary, + build_reference_library, + compiler_identity, + linker_name, + native_cache_root, + require_tool, +) + +from .contracts import remove_internal_root_imports from .f2py_contract import F2PY_INOUT_ARGUMENTS from .routine_inventory import F2PY_EXPORT_LIMITATIONS, ROUTINES, SCIPY_VERSION @@ -26,7 +34,6 @@ FORTRAN_SUFFIXES = (".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn") F2PY_BUILD_DEPENDENCIES = ("la_constants.f90",) F2PY_KIND_MAP = "{'real': {'wp': 'double'}}\n" -F2PY_LINK_DEPENDENCIES = ("lapack", "blas") @dataclass(frozen=True) @@ -40,9 +47,17 @@ class BuiltLapack: compiler_identity: str stdout: str stderr: str + native_library: Path + + +def _compiler() -> str: + try: + return require_tool("gfortran") + except RuntimeError as error: + pytest.skip(str(error)) -def _build_environment(compiler: str) -> dict[str, str]: +def _build_environment(compiler: str, native_library: Path | None = None) -> dict[str, str]: environment = dict(os.environ) environment.update( { @@ -54,14 +69,22 @@ def _build_environment(compiler: str) -> dict[str, str]: "F90FLAGS": BUILD_FLAGS, } ) + if native_library is not None: + rpath_flag = f"-Wl,-rpath,{native_library.parent}" + environment["LDFLAGS"] = " ".join(filter(None, (environment.get("LDFLAGS"), rpath_flag))) return environment -def _run_build(command: tuple[str, ...], workdir: Path, compiler: str) -> subprocess.CompletedProcess[str]: - result = subprocess.run( # nosec B603 - fixed tools and repository-owned sources +def _run_build( + command: tuple[str, ...], + workdir: Path, + compiler: str, + native_library: Path | None = None, +) -> subprocess.CompletedProcess[str]: + result = subprocess.run( # nosec B603 - fixed tools and copied example inputs command, cwd=workdir, - env=_build_environment(compiler), + env=_build_environment(compiler, native_library), capture_output=True, text=True, check=False, @@ -69,7 +92,7 @@ def _run_build(command: tuple[str, ...], workdir: Path, compiler: str) -> subpro if result.returncode: pytest.fail( "Reference LAPACK build failed\n" - f"compiler: {full._compiler_identity(compiler)}\n" + f"compiler: {compiler_identity(compiler)}\n" f"command: {shlex.join(command)}\n" f"stdout:\n{result.stdout or ''}\n" f"stderr:\n{result.stderr or ''}" @@ -93,41 +116,59 @@ def _selected_source(routine: str) -> Path: """Resolve one reviewed routine to its authoritative native source file.""" matches = tuple(path for suffix in FORTRAN_SUFFIXES if (path := NATIVE_ROOT / f"{routine}{suffix}").is_file()) if len(matches) != 1: - pytest.fail(f"expected exactly one authoritative source for {routine}, found {[str(path) for path in matches]}") + raise FileNotFoundError( + f"expected exactly one authoritative source for {routine}, found {[str(path) for path in matches]}" + ) return matches[0] def _f2py_source_plan(workdir: Path) -> tuple[Path, ...]: - """Return reviewed implementations with intent overlays and their dependency.""" + """Return reviewed signatures with intent overlays and their kind dependency.""" dependencies = tuple(NATIVE_ROOT / name for name in F2PY_BUILD_DEPENDENCIES) missing_dependencies = [str(path) for path in dependencies if not path.is_file()] if missing_dependencies: - pytest.fail(f"missing f2py build dependencies: {missing_dependencies}") + raise FileNotFoundError(f"missing f2py signature dependencies: {missing_dependencies}") selected = tuple(_selected_source(name) for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) return prepare_f2py_intent_sources(dependencies + selected, workdir, F2PY_INOUT_ARGUMENTS) -def _f2py_build_command(workdir: Path) -> tuple[str, ...]: - """Build only reviewed implementations and link external helper symbols.""" +def _f2py_signature_command(workdir: Path) -> tuple[str, ...]: + """Generate reviewed f2py signatures without compiling implementations.""" module_name = "f2py_reference_lapack_example" f2cmap = workdir / ".f2py_f2cmap" f2cmap.write_text(F2PY_KIND_MAP, encoding="utf-8") selected_routines = tuple(name for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) - link_dependencies = tuple(item for dependency in F2PY_LINK_DEPENDENCIES for item in ("--dep", dependency)) return ( sys.executable, "-m", "numpy.f2py", - "-c", "-m", module_name, + "-h", + str(workdir / f"{module_name}.pyf"), *(str(source) for source in _f2py_source_plan(workdir)), "only:", *selected_routines, ":", - *link_dependencies, "--f2cmap", str(f2cmap), + "--overwrite-signature", + ) + + +def _f2py_build_command(workdir: Path, native_library: Path) -> tuple[str, ...]: + """Build only f2py's wrapper and link the precompiled LAPACK implementation.""" + module_name = "f2py_reference_lapack_example" + return ( + sys.executable, + "-m", + "numpy.f2py", + "-c", + str(workdir / f"{module_name}.pyf"), + f"-L{native_library.parent}", + f"-l{linker_name(native_library)}", + "--f2cmap", + str(workdir / ".f2py_f2cmap"), "--build-dir", str(workdir / "generated"), f"--f77flags={BUILD_FLAGS}", @@ -136,6 +177,22 @@ def _f2py_build_command(workdir: Path) -> tuple[str, ...]: ) +def _contract_command(workdir: Path) -> tuple[str, ...]: + """Generate the complete LAPACK semantic contract through the public CLI.""" + return ( + sys.executable, + "-m", + "prik", + "generate", + "--pyi", + str(NATIVE_ROOT), + "--language", + "fortran", + "--out", + str(workdir / "contracts" / "lapack"), + ) + + def _prik_build_command( runtime_entry: Path, native_library: Path, @@ -166,24 +223,40 @@ def _prik_build_command( @pytest.fixture(scope="session") -def prik_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltLapack: +def native_build(tmp_path_factory: pytest.TempPathFactory) -> NativeLibrary: + """Compile complete LAPACK plus its BLAS dependencies once for both wrappers.""" + compiler = _compiler() + cache_root = ( + native_cache_root() + if os.environ.get("PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR") + else tmp_path_factory.mktemp("reference-lapack-native") + ) + try: + return build_reference_library("lapack", cache_root=cache_root, compiler=compiler) + except (RuntimeError, subprocess.CalledProcessError) as error: + pytest.fail(f"Reference LAPACK native build failed with {compiler_identity(compiler)}\n{error}") + + +@pytest.fixture(scope="session") +def prik_build(tmp_path_factory: pytest.TempPathFactory, native_build: NativeLibrary) -> BuiltLapack: """Build the complete LAPACK wrapper through PRIK's public CLI once.""" - compiler = full._compiler() + compiler = native_build.compiler workdir = tmp_path_factory.mktemp("prik-reference-lapack-example") - entry = full._generate_contract(NATIVE_ROOT, workdir / "contracts" / "lapack") - shared = full._cached_native_shared_library("lapack") - runtime_entry = full._runtime_entry("lapack", entry, workdir) + _run_build(_contract_command(workdir), workdir, compiler) + entry = workdir / "contracts" / "lapack" / "__init__.pyi" + runtime_entry = remove_internal_root_imports(entry) module_name = "prik_reference_lapack_example" - command = _prik_build_command(runtime_entry, shared, workdir, compiler) + command = _prik_build_command(runtime_entry, native_build.shared_library, workdir, compiler) result = _run_build(command, workdir, compiler) return BuiltLapack( module=_import_built_module(module_name, workdir), module_name=module_name, workdir=workdir, command=command, - compiler_identity=full._compiler_identity(compiler), + compiler_identity=compiler_identity(compiler), stdout=result.stdout, stderr=result.stderr, + native_library=native_build.shared_library, ) @@ -194,21 +267,23 @@ def prik_lapack(prik_build: BuiltLapack): @pytest.fixture(scope="session") -def f2py_build(tmp_path_factory: pytest.TempPathFactory) -> BuiltLapack: - """Build one f2py comparison surface from the reviewed implementations.""" - compiler = full._compiler() +def f2py_build(tmp_path_factory: pytest.TempPathFactory, native_build: NativeLibrary) -> BuiltLapack: + """Build f2py against the same complete native LAPACK library.""" + compiler = native_build.compiler workdir = tmp_path_factory.mktemp("f2py-reference-lapack-example") + _run_build(_f2py_signature_command(workdir), workdir, compiler) module_name = "f2py_reference_lapack_example" - command = _f2py_build_command(workdir) - result = _run_build(command, workdir, compiler) + command = _f2py_build_command(workdir, native_build.shared_library) + result = _run_build(command, workdir, compiler, native_build.shared_library) return BuiltLapack( module=_import_built_module(module_name, workdir), module_name=module_name, workdir=workdir, command=command, - compiler_identity=full._compiler_identity(compiler), + compiler_identity=compiler_identity(compiler), stdout=result.stdout, stderr=result.stderr, + native_library=native_build.shared_library, ) diff --git a/examples/lapack/contracts.py b/examples/lapack/contracts.py new file mode 100644 index 000000000..1ab4a7b9e --- /dev/null +++ b/examples/lapack/contracts.py @@ -0,0 +1,27 @@ +"""Helpers for LAPACK's generated root-only runtime contract.""" + +from __future__ import annotations + +from pathlib import Path + +from prik.pipeline.pyi import pyi_paths_to_semantic_modules + + +RUNTIME_EXCLUDED_IMPORTS = frozenset({"from . import LA_CONSTANTS\n", "from . import LA_XISNAN\n"}) + + +def remove_internal_root_imports(entry: Path) -> Path: + """Remove internal module imports from a generated LAPACK root contract.""" + lines = entry.read_text(encoding="utf-8").splitlines(keepends=True) + entry.write_text( + "".join(line for line in lines if line not in RUNTIME_EXCLUDED_IMPORTS), + encoding="utf-8", + ) + return entry + + +def root_function_names(package: Path) -> set[str]: + """Return the generated callable names owned by the root contract.""" + modules = pyi_paths_to_semantic_modules([package]) + root = next(module for module in modules if module.name == "__init__") + return {function.name for function in root.functions} diff --git a/examples/lapack/helpers.py b/examples/lapack/helpers.py index 5d5a5f458..9ff770b52 100644 --- a/examples/lapack/helpers.py +++ b/examples/lapack/helpers.py @@ -165,3 +165,12 @@ def column_major(matrix: np.ndarray, *, rows: int | None = None) -> np.ndarray: def active(matrix: np.ndarray, rows: int, columns: int) -> np.ndarray: """Extract the logical matrix while preserving its column-major convention.""" return np.asarray(matrix[:rows, :columns], dtype=np.float64) + + +def assert_runtime_smoke(module) -> None: + """Exercise a representative complete-library LAPACK export.""" + index = np.zeros(5, dtype=np.int32) + values = np.array([1.0, 4.0, 7.0, 2.0, 8.0], dtype=np.float64) + scalars = module.dlamrg(np.int32(3), np.int32(2), values, np.int32(1), np.int32(1), index) + assert scalars == (np.int32(3), np.int32(2), np.int32(1), np.int32(1)) + np.testing.assert_array_equal(index, [1, 4, 2, 3, 5]) diff --git a/examples/lapack/test_routine_coverage.py b/examples/lapack/test_routine_coverage.py index 1d4045c78..789ceda18 100644 --- a/examples/lapack/test_routine_coverage.py +++ b/examples/lapack/test_routine_coverage.py @@ -11,12 +11,13 @@ from .conftest import ( F2PY_BUILD_DEPENDENCIES, F2PY_KIND_MAP, - F2PY_LINK_DEPENDENCIES, PRIK_WRAPPER_FLAGS, _f2py_build_command, + _f2py_signature_command, _f2py_source_plan, _prik_build_command, ) +from .contracts import remove_internal_root_imports from .f2py_contract import F2PY_INOUT_ARGUMENTS from .routine_inventory import ( EXPLICIT_TEST_NAMES, @@ -35,16 +36,6 @@ EXAMPLE_ROOT = Path(__file__).resolve().parent NATIVE_ROOT = EXAMPLE_ROOT / "native" -OLD_NATIVE_ROOT = ( - EXAMPLE_ROOT.parents[1] - / "tests" - / "fortran" - / "building_shared_library" - / "end_to_end" - / "real_libraries" - / "lapack" - / "native" -) FORTRAN_SUFFIXES = {".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"} pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] @@ -126,7 +117,7 @@ def test_inventory_groups_form_one_complete_partition(): def test_f2py_source_plan_includes_required_kind_module(tmp_path: Path): - """The selected build closes dependencies without consuming PRIK's library.""" + """Signature discovery covers every selected implementation and reviewed overlay.""" plan = _f2py_source_plan(tmp_path) dependency_count = len(F2PY_BUILD_DEPENDENCIES) assert tuple(path.name for path in plan[:dependency_count]) == F2PY_BUILD_DEPENDENCIES @@ -140,15 +131,29 @@ def test_f2py_source_plan_includes_required_kind_module(tmp_path: Path): assert source.parent == tmp_path / "f2py-intent-sources" assert f"{prefix} intent(inout) {', '.join(arguments)}" in source.read_text(encoding="utf-8") - command = _f2py_build_command(tmp_path) - dependency_values = tuple(command[index + 1] for index, value in enumerate(command) if value == "--dep") - assert dependency_values == F2PY_LINK_DEPENDENCIES + command = _f2py_signature_command(tmp_path) assert "only:" in command assert ":" in command - assert not any("libprik_full_lapack" in value for value in command) assert (tmp_path / ".f2py_f2cmap").read_text(encoding="utf-8") == F2PY_KIND_MAP +def test_f2py_build_command_reuses_the_precompiled_native_library(tmp_path: Path): + native_library = tmp_path / "native" / "libprik_full_lapack.so" + command = _f2py_build_command(tmp_path, native_library) + + assert command[:4] == (sys.executable, "-m", "numpy.f2py", "-c") + assert str(tmp_path / "f2py_reference_lapack_example.pyf") in command + assert f"-L{native_library.parent}" in command + assert "-lprik_full_lapack" in command + assert "--dep" not in command + assert not any(str(NATIVE_ROOT) in value for value in command) + + +def test_both_wrappers_reuse_the_same_precompiled_native_library(prik_build, f2py_build): + assert prik_build.native_library == f2py_build.native_library + assert prik_build.native_library.name == "libprik_full_lapack.so" + + def test_prik_build_command_uses_the_public_cli(tmp_path: Path): """The documented LAPACK wrapper build is a real PRIK CLI invocation.""" runtime_entry = tmp_path / "runtime" / "__init__.pyi" @@ -163,6 +168,21 @@ def test_prik_build_command_uses_the_public_cli(tmp_path: Path): assert f"--wrapper-c-flags={joined_flags}" in command +def test_runtime_contract_edit_removes_internal_imports_in_place(tmp_path: Path): + generated_package = tmp_path / "contracts" / "lapack" + generated_package.mkdir(parents=True) + entry = generated_package / "__init__.pyi" + entry.write_text( + "from . import LA_CONSTANTS\nfrom . import LA_XISNAN\ndef dgesv() -> None: ...\n", + encoding="utf-8", + ) + + runtime_entry = remove_internal_root_imports(entry) + + assert runtime_entry == entry + assert entry.read_text(encoding="utf-8") == "def dgesv() -> None: ...\n" + + def test_authoritative_native_source_boundary_is_complete_and_unique(): """The maintained source owner contains the complete library corpus once.""" sources = tuple( @@ -175,7 +195,6 @@ def test_authoritative_native_source_boundary_is_complete_and_unique(): for routine, spec in ROUTINE_SPECS.items(): assert (NATIVE_ROOT / spec.source_file).is_file(), routine assert {"la_constants", "la_xisnan"} <= stems - assert not OLD_NATIVE_ROOT.exists() def test_selected_routines_have_one_explicit_named_test(): diff --git a/examples/native_library.py b/examples/native_library.py new file mode 100644 index 000000000..96831451c --- /dev/null +++ b/examples/native_library.py @@ -0,0 +1,319 @@ +"""Build one reusable native BLAS or LAPACK library from the copied examples.""" + +from __future__ import annotations + +import argparse +import concurrent.futures +from dataclasses import dataclass +import hashlib +import os +from pathlib import Path +import shutil +import subprocess +import sys +import sysconfig +from collections.abc import Sequence + + +EXAMPLES_ROOT = Path(__file__).resolve().parent +BLAS_SOURCE_ROOT = EXAMPLES_ROOT / "blas" / "native" +LAPACK_SOURCE_ROOT = EXAMPLES_ROOT / "lapack" / "native" +NATIVE_CACHE_ENV = "PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR" +NATIVE_JOBS_ENV = "PRIK_REAL_LIBRARY_NATIVE_JOBS" +NATIVE_CACHE_VERSION = "copyable-examples-v1" +NATIVE_MODULE_SOURCE_STEMS = frozenset({"la_constants", "la_xisnan"}) +DEFAULT_NATIVE_COMPILE_JOB_LIMIT = 8 +FORTRAN_SUFFIXES = frozenset({".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"}) +SUPPORTED_LIBRARIES = ("blas", "lapack") + + +@dataclass(frozen=True) +class NativeLibrary: + """A complete native library compiled once for both wrapper generators.""" + + name: str + shared_library: Path + archive: Path + cache_dir: Path + sources: tuple[Path, ...] + compiler: str + + +def require_tool(name: str) -> str: + """Return an executable path or explain the missing example prerequisite.""" + executable = shutil.which(name) + if executable is None: + raise RuntimeError(f"{name} is required to build the native-library examples") + return executable + + +def compiler_identity(compiler: str) -> str: + """Return the resolved compiler path and its first version line.""" + result = subprocess.run( # nosec B603 - explicit local compiler identity probe + (compiler, "--version"), + capture_output=True, + text=True, + check=False, + ) + first_line = result.stdout.splitlines()[0] if result.stdout else compiler + return f"{Path(compiler).resolve()}: {first_line}" + + +def library_sources(library: str) -> tuple[Path, ...]: + """Return the authoritative implementation sources for one named library.""" + if library not in SUPPORTED_LIBRARIES: + raise ValueError(f"unknown reference library {library!r}; choose from {', '.join(SUPPORTED_LIBRARIES)}") + root = BLAS_SOURCE_ROOT if library == "blas" else LAPACK_SOURCE_ROOT + return tuple(sorted(path for path in root.iterdir() if path.is_file() and path.suffix.lower() in FORTRAN_SUFFIXES)) + + +def native_sources(library: str) -> tuple[Path, ...]: + """Return sources in a safe compilation order, including LAPACK's BLAS dependencies.""" + if library not in SUPPORTED_LIBRARIES: + return library_sources(library) + if library == "blas": + return library_sources("blas") + lapack_sources = library_sources("lapack") + module_sources = tuple( + source + for source in ( + LAPACK_SOURCE_ROOT / "la_constants.f90", + LAPACK_SOURCE_ROOT / "la_xisnan.F90", + ) + if source.is_file() + ) + module_source_set = set(module_sources) + lapack_rest = tuple(source for source in lapack_sources if source not in module_source_set) + lapack_stems = {source.stem.lower() for source in lapack_sources} + blas_dependencies = tuple(source for source in library_sources("blas") if source.stem.lower() not in lapack_stems) + return (*module_sources, *lapack_rest, *blas_dependencies) + + +def native_cache_root() -> Path: + """Return the configured cache, or a build directory inside the copied examples.""" + configured = os.environ.get(NATIVE_CACHE_ENV) + if configured: + return Path(configured).expanduser().resolve() + return EXAMPLES_ROOT / ".build" / "native" + + +def native_compile_jobs() -> int: + """Return the validated native compilation parallelism.""" + configured = os.environ.get(NATIVE_JOBS_ENV) + if configured: + try: + jobs = int(configured) + except ValueError as error: + raise ValueError(f"{NATIVE_JOBS_ENV} must be a positive integer, got {configured!r}") from error + if jobs < 1: + raise ValueError(f"{NATIVE_JOBS_ENV} must be a positive integer, got {configured!r}") + return jobs + return max(1, min(os.cpu_count() or 1, DEFAULT_NATIVE_COMPILE_JOB_LIMIT)) + + +def _native_platform_identity() -> str: + return f"{sysconfig.get_platform()}:{os.name}:{sys.maxsize}" + + +def _source_digest(source: Path) -> str: + digest = hashlib.sha256() + with source.open("rb") as stream: + for chunk in iter(lambda: stream.read(1024 * 1024), b""): + digest.update(chunk) + return digest.hexdigest() + + +def _native_cache_key(library: str, compiler: str, sources: tuple[Path, ...]) -> str: + digest = hashlib.sha256() + for value in (NATIVE_CACHE_VERSION, library, compiler_identity(compiler), _native_platform_identity()): + digest.update(value.encode()) + digest.update(b"\0") + for source in sources: + digest.update(source.relative_to(EXAMPLES_ROOT).as_posix().encode()) + digest.update(b":") + digest.update(_source_digest(source).encode()) + digest.update(b"\0") + return digest.hexdigest()[:24] + + +def _cached_object_path(objects_dir: Path, source: Path) -> Path: + return objects_dir / source.relative_to(EXAMPLES_ROOT).with_suffix(".o") + + +def _compile_source(compiler: str, source: Path, native_object: Path, module_dir: Path) -> None: + native_object.parent.mkdir(parents=True, exist_ok=True) + subprocess.run( # nosec B603 - explicit compiler and copied example source + ( + compiler, + "-O0", + "-fPIC", + "-c", + str(source), + "-o", + str(native_object), + "-J", + str(module_dir), + "-I", + str(module_dir), + ), + check=True, + ) + + +def _compile_independent_sources( + compiler: str, + sources: tuple[Path, ...], + objects_dir: Path, + module_dir: Path, + jobs: int, +) -> None: + if not sources: + return + with concurrent.futures.ThreadPoolExecutor(max_workers=min(jobs, len(sources))) as executor: + futures = [ + executor.submit( + _compile_source, + compiler, + source, + _cached_object_path(objects_dir, source), + module_dir, + ) + for source in sources + ] + for future in concurrent.futures.as_completed(futures): + future.result() + + +def _cached_objects( + cache_dir: Path, + sources: tuple[Path, ...], + compiler: str, + jobs: int, +) -> tuple[Path, ...]: + objects_dir = cache_dir / "objects" + complete = cache_dir / "objects.complete" + objects = tuple(_cached_object_path(objects_dir, source) for source in sources) + if complete.is_file() and all(native_object.is_file() for native_object in objects): + return objects + + process_suffix = str(os.getpid()) + temporary_objects = cache_dir / f"objects.{process_suffix}.tmp" + temporary_modules = cache_dir / f"modules.{process_suffix}.tmp" + shutil.rmtree(temporary_objects, ignore_errors=True) + shutil.rmtree(temporary_modules, ignore_errors=True) + temporary_objects.mkdir(parents=True) + temporary_modules.mkdir(parents=True) + module_sources = tuple(source for source in sources if source.stem.lower() in NATIVE_MODULE_SOURCE_STEMS) + module_source_set = set(module_sources) + independent_sources = tuple(source for source in sources if source not in module_source_set) + for source in module_sources: + _compile_source(compiler, source, _cached_object_path(temporary_objects, source), temporary_modules) + _compile_independent_sources(compiler, independent_sources, temporary_objects, temporary_modules, jobs) + shutil.rmtree(objects_dir, ignore_errors=True) + temporary_objects.rename(objects_dir) + shutil.rmtree(temporary_modules, ignore_errors=True) + complete.write_text(f"{NATIVE_CACHE_VERSION}\n", encoding="utf-8") + (cache_dir / "archive.complete").unlink(missing_ok=True) + (cache_dir / "shared.complete").unlink(missing_ok=True) + return tuple(_cached_object_path(objects_dir, source) for source in sources) + + +def _cached_archive(cache_dir: Path, library: str, objects: tuple[Path, ...], archiver: str) -> Path: + archive = cache_dir / f"libprik_full_{library}.a" + complete = cache_dir / "archive.complete" + if complete.is_file() and archive.is_file(): + return archive + temporary_archive = cache_dir / f"{archive.name}.{os.getpid()}.tmp" + temporary_archive.unlink(missing_ok=True) + subprocess.run( # nosec B603 - explicit archiver and compiled example objects + (archiver, "rcs", str(temporary_archive), *(str(native_object) for native_object in objects)), + check=True, + ) + os.replace(temporary_archive, archive) + complete.write_text(f"{NATIVE_CACHE_VERSION}\n", encoding="utf-8") + return archive + + +def _cached_shared_library(cache_dir: Path, library: str, archive: Path, compiler: str) -> Path: + shared_library = cache_dir / f"libprik_full_{library}.so" + complete = cache_dir / "shared.complete" + if complete.is_file() and shared_library.is_file(): + return shared_library + temporary_shared = cache_dir / f"{shared_library.name}.{os.getpid()}.tmp" + temporary_shared.unlink(missing_ok=True) + subprocess.run( # nosec B603 - explicit compiler and compiled example archive + ( + compiler, + "-shared", + "-o", + str(temporary_shared), + "-Wl,--whole-archive", + str(archive), + "-Wl,--no-whole-archive", + ), + check=True, + ) + os.replace(temporary_shared, shared_library) + complete.write_text(f"{NATIVE_CACHE_VERSION}\n", encoding="utf-8") + return shared_library + + +def build_reference_library( + library: str, + *, + cache_root: Path | None = None, + compiler: str | None = None, + archiver: str | None = None, + jobs: int | None = None, +) -> NativeLibrary: + """Build on a cache miss and return one complete reusable native library.""" + selected_compiler = compiler or require_tool("gfortran") + selected_archiver = archiver or require_tool("ar") + selected_sources = native_sources(library) + selected_jobs = jobs if jobs is not None else native_compile_jobs() + if selected_jobs < 1: + raise ValueError(f"jobs must be a positive integer, got {selected_jobs!r}") + selected_cache_root = (cache_root or native_cache_root()).resolve() + cache_dir = selected_cache_root / f"{library}-{_native_cache_key(library, selected_compiler, selected_sources)}" + cache_dir.mkdir(parents=True, exist_ok=True) + objects = _cached_objects(cache_dir, selected_sources, selected_compiler, selected_jobs) + archive = _cached_archive(cache_dir, library, objects, selected_archiver) + shared_library = _cached_shared_library(cache_dir, library, archive, selected_compiler) + return NativeLibrary( + name=library, + shared_library=shared_library, + archive=archive, + cache_dir=cache_dir, + sources=selected_sources, + compiler=selected_compiler, + ) + + +def linker_name(shared_library: Path) -> str: + """Return the `-l` name for a shared library produced by this module.""" + name = shared_library.name + if not name.startswith("lib") or ".so" not in name: + raise ValueError(f"expected a lib*.so native library, got {shared_library}") + return name[3 : name.index(".so")] + + +def main(argv: Sequence[str] | None = None) -> int: + """Build a copied example's native library and print its reusable path.""" + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("library", choices=SUPPORTED_LIBRARIES) + parser.add_argument("--cache-dir", type=Path, default=None) + parser.add_argument("--compiler", default=None) + parser.add_argument("--jobs", type=int, default=None) + args = parser.parse_args(argv) + build = build_reference_library( + args.library, + cache_root=args.cache_dir, + compiler=args.compiler, + jobs=args.jobs, + ) + print(build.shared_library) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py b/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py index de3bc295a..9663365dd 100644 --- a/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py +++ b/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py @@ -2,34 +2,30 @@ from __future__ import annotations -import concurrent.futures -import hashlib import importlib import os -import shutil import subprocess import sys -import sysconfig from pathlib import Path -import numpy as np import pytest -from tests.fortran._support.wrapper_build import REPO_ROOT +from examples.blas.helpers import assert_runtime_smoke as assert_blas_runtime_smoke +from examples.lapack.contracts import remove_internal_root_imports +from examples.lapack.helpers import assert_runtime_smoke as assert_lapack_runtime_smoke +from examples.native_library import ( + BLAS_SOURCE_ROOT, + LAPACK_SOURCE_ROOT, + build_reference_library, + library_sources, + native_cache_root, + require_tool, +) from prik import build_pyi_extension from prik.pipeline.pyi import pyi_paths_to_semantic_modules -BLAS_SOURCE_ROOT = REPO_ROOT / "examples" / "blas" / "native" -LAPACK_SOURCE_ROOT = REPO_ROOT / "examples" / "lapack" / "native" -NATIVE_CACHE_ENV = "PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR" -NATIVE_JOBS_ENV = "PRIK_REAL_LIBRARY_NATIVE_JOBS" -DEFAULT_NATIVE_CACHE_ROOT = REPO_ROOT / ".pytest_cache" / "prik" / "real-library-native" -NATIVE_CACHE_VERSION = "full-library-v3" -NATIVE_MODULE_SOURCE_STEMS = {"la_constants", "la_xisnan"} -DEFAULT_NATIVE_COMPILE_JOB_LIMIT = 8 pytestmark = pytest.mark.fortran_end_to_end FULL_LIBRARY_WRAPPER_FLAGS = ("-O0", "-g0") -FORTRAN_SUFFIXES = {".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"} FULL_LIBRARY_CASES = { "blas": { "root_function_count": 155, @@ -44,106 +40,23 @@ "sentinel_functions": {"dgesv", "dgetrf", "dgetrs", "dlamch", "dlamrg", "zgesv"}, }, } -LAPACK_RUNTIME_EXCLUDED_IMPORTS = {"from . import LA_CONSTANTS\n", "from . import LA_XISNAN\n"} def _compiler() -> str: - compiler = shutil.which("gfortran") - if compiler is None: - pytest.skip("gfortran is required for real BLAS/LAPACK wrapper tests") - return compiler - - -def _archiver() -> str: - archiver = shutil.which("ar") - if archiver is None: - pytest.skip("ar is required for real BLAS/LAPACK native cache tests") - return archiver + try: + return require_tool("gfortran") + except RuntimeError as error: + pytest.skip(str(error)) def _library_sources(library: str) -> tuple[Path, ...]: - root = BLAS_SOURCE_ROOT if library == "blas" else LAPACK_SOURCE_ROOT - return tuple(sorted(path for path in root.iterdir() if path.is_file() and path.suffix.lower() in FORTRAN_SUFFIXES)) - - -def _native_sources(library: str) -> tuple[Path, ...]: - if library == "blas": - return _library_sources("blas") - lapack_sources = _library_sources("lapack") - module_sources = tuple( - source - for source in ( - LAPACK_SOURCE_ROOT / "la_constants.f90", - LAPACK_SOURCE_ROOT / "la_xisnan.F90", - ) - if source.is_file() - ) - module_source_set = set(module_sources) - lapack_rest = tuple(source for source in lapack_sources if source not in module_source_set) - lapack_stems = {source.stem.lower() for source in lapack_sources} - blas_dependencies = tuple(source for source in _library_sources("blas") if source.stem.lower() not in lapack_stems) - return (*module_sources, *lapack_rest, *blas_dependencies) + return library_sources(library) def _source_stems(library: str) -> set[str]: return {path.stem.lower() for path in _library_sources(library)} -def _compiler_identity(compiler: str) -> str: - result = subprocess.run([compiler, "--version"], capture_output=True, text=True, check=False) - first_line = result.stdout.splitlines()[0] if result.stdout else compiler - return f"{Path(compiler).resolve()}:{first_line}" - - -def _native_platform_identity() -> str: - return f"{sysconfig.get_platform()}:{os.name}:{sys.maxsize}" - - -def _source_digest(source: Path) -> str: - digest = hashlib.sha256() - with source.open("rb") as stream: - for chunk in iter(lambda: stream.read(1024 * 1024), b""): - digest.update(chunk) - return digest.hexdigest() - - -def _native_cache_key(library: str, compiler: str, sources: tuple[Path, ...]) -> str: - digest = hashlib.sha256() - digest.update(NATIVE_CACHE_VERSION.encode()) - digest.update(b"\0") - digest.update(library.encode()) - digest.update(b"\0") - digest.update(_compiler_identity(compiler).encode()) - digest.update(b"\0") - digest.update(_native_platform_identity().encode()) - for source in sources: - digest.update(b"\0") - digest.update(source.relative_to(REPO_ROOT).as_posix().encode()) - digest.update(b":") - digest.update(_source_digest(source).encode()) - return digest.hexdigest()[:24] - - -def _native_cache_root() -> Path: - configured = os.environ.get(NATIVE_CACHE_ENV) - if configured: - return Path(configured).expanduser() - return DEFAULT_NATIVE_CACHE_ROOT - - -def _native_compile_jobs() -> int: - configured = os.environ.get(NATIVE_JOBS_ENV) - if configured: - try: - jobs = int(configured) - except ValueError: - pytest.fail(f"{NATIVE_JOBS_ENV} must be a positive integer, got {configured!r}") - if jobs < 1: - pytest.fail(f"{NATIVE_JOBS_ENV} must be a positive integer, got {configured!r}") - return jobs - return max(1, min(os.cpu_count() or 1, DEFAULT_NATIVE_COMPILE_JOB_LIMIT)) - - def _generate_contract(source_root: Path, package: Path) -> Path: subprocess.run( [ @@ -177,158 +90,10 @@ def _function_names(package: Path) -> set[str]: return {function.name for module in _contract_modules(package) for function in module.functions} -def _cached_object_path(objects_dir: Path, source: Path) -> Path: - return objects_dir / source.relative_to(REPO_ROOT).with_suffix(".o") - - -def _compile_native_source(compiler: str, source: Path, native_object: Path, module_dir: Path) -> None: - native_object.parent.mkdir(parents=True, exist_ok=True) - subprocess.run( - [ - compiler, - "-fPIC", - "-c", - str(source), - "-o", - str(native_object), - "-J", - str(module_dir), - "-I", - str(module_dir), - ], - check=True, - ) - - -def _compile_independent_native_sources( - compiler: str, - sources: tuple[Path, ...], - objects_dir: Path, - module_dir: Path, -) -> None: - if not sources: - return - jobs = min(_native_compile_jobs(), len(sources)) - if jobs == 1: - for source in sources: - _compile_native_source(compiler, source, _cached_object_path(objects_dir, source), module_dir) - return - with concurrent.futures.ThreadPoolExecutor(max_workers=jobs) as executor: - futures = [ - executor.submit( - _compile_native_source, - compiler, - source, - _cached_object_path(objects_dir, source), - module_dir, - ) - for source in sources - ] - for future in concurrent.futures.as_completed(futures): - future.result() - - -def _split_ordered_module_sources(sources: tuple[Path, ...]) -> tuple[tuple[Path, ...], tuple[Path, ...]]: - module_sources = tuple(source for source in sources if source.stem.lower() in NATIVE_MODULE_SOURCE_STEMS) - module_source_set = set(module_sources) - independent_sources = tuple(source for source in sources if source not in module_source_set) - return module_sources, independent_sources - - -def _cached_objects(cache_dir: Path, sources: tuple[Path, ...], compiler: str) -> tuple[Path, ...]: - objects_dir = cache_dir / "objects" - complete = cache_dir / "objects.complete" - objects = tuple(_cached_object_path(objects_dir, source) for source in sources) - if complete.is_file() and all(obj.is_file() for obj in objects): - return objects - - temp_objects_dir = cache_dir / f"objects.{os.getpid()}.tmp" - temp_module_dir = cache_dir / f"modules.{os.getpid()}.tmp" - shutil.rmtree(temp_objects_dir, ignore_errors=True) - shutil.rmtree(temp_module_dir, ignore_errors=True) - temp_objects_dir.mkdir(parents=True) - temp_module_dir.mkdir(parents=True) - module_sources, independent_sources = _split_ordered_module_sources(sources) - for source in module_sources: - _compile_native_source(compiler, source, _cached_object_path(temp_objects_dir, source), temp_module_dir) - _compile_independent_native_sources(compiler, independent_sources, temp_objects_dir, temp_module_dir) - shutil.rmtree(objects_dir, ignore_errors=True) - temp_objects_dir.rename(objects_dir) - shutil.rmtree(temp_module_dir, ignore_errors=True) - complete.write_text(f"{NATIVE_CACHE_VERSION}\n", encoding="utf-8") - (cache_dir / "archive.complete").unlink(missing_ok=True) - (cache_dir / "shared.complete").unlink(missing_ok=True) - return tuple(_cached_object_path(objects_dir, source) for source in sources) - - -def _cached_archive(cache_dir: Path, library: str, objects: tuple[Path, ...]) -> Path: - archive = cache_dir / f"libprik_full_{library}.a" - complete = cache_dir / "archive.complete" - if complete.is_file() and archive.is_file(): - return archive - - temp_archive = cache_dir / f"{archive.name}.{os.getpid()}.tmp" - temp_archive.unlink(missing_ok=True) - subprocess.run([_archiver(), "rcs", str(temp_archive), *(str(obj) for obj in objects)], check=True) - os.replace(temp_archive, archive) - complete.write_text(f"{NATIVE_CACHE_VERSION}\n", encoding="utf-8") - return archive - - -def _cached_shared_library(cache_dir: Path, library: str, archive: Path, compiler: str) -> Path: - shared = cache_dir / f"libprik_full_{library}.so" - complete = cache_dir / "shared.complete" - if complete.is_file() and shared.is_file(): - return shared - - temp_shared = cache_dir / f"{shared.name}.{os.getpid()}.tmp" - temp_shared.unlink(missing_ok=True) - subprocess.run( - [ - compiler, - "-shared", - "-o", - str(temp_shared), - "-Wl,--whole-archive", - str(archive), - "-Wl,--no-whole-archive", - ], - capture_output=True, - text=True, - check=True, - ) - os.replace(temp_shared, shared) - complete.write_text(f"{NATIVE_CACHE_VERSION}\n", encoding="utf-8") - return shared - - -def _cached_native_shared_library(library: str) -> Path: - compiler = _compiler() - sources = _native_sources(library) - cache_dir = _native_cache_root() / f"{library}-{_native_cache_key(library, compiler, sources)}" - cache_dir.mkdir(parents=True, exist_ok=True) - shared = cache_dir / f"libprik_full_{library}.so" - if (cache_dir / "shared.complete").is_file() and shared.is_file(): - return shared - objects = _cached_objects(cache_dir, sources, compiler) - archive = _cached_archive(cache_dir, library, objects) - return _cached_shared_library(cache_dir, library, archive, compiler) - - -def _runtime_entry(library: str, entry: Path, workdir: Path) -> Path: +def _runtime_entry(library: str, entry: Path) -> Path: if library != "lapack": return entry - # The full LAPACK package also contains helper modules with constants and - # generic interfaces. Runtime evidence here covers the root procedure set. - runtime_package = workdir / "runtime_contract" / library - shutil.copytree(entry.parent, runtime_package) - runtime_entry = runtime_package / "__init__.pyi" - lines = runtime_entry.read_text(encoding="utf-8").splitlines(keepends=True) - runtime_entry.write_text( - "".join(line for line in lines if line not in LAPACK_RUNTIME_EXCLUDED_IMPORTS), - encoding="utf-8", - ) - return runtime_entry + return remove_internal_root_imports(entry) def _import_extension(module_name: str, build_dir: Path, *, lazy: bool = False): @@ -345,36 +110,6 @@ def _import_extension(module_name: str, build_dir: Path, *, lazy: bool = False): sys.path.remove(str(build_dir)) -def _assert_blas_runtime_smoke(module) -> None: - x = np.array([1.0, 2.0, 3.0], dtype=np.float64) - y = np.array([10.0, 20.0, 30.0], dtype=np.float64) - daxpy_scalars = module.daxpy(np.int32(3), np.float64(2.0), x, np.int32(1), y, np.int32(1)) - assert daxpy_scalars == (np.int32(3), np.float64(2.0), np.int32(1), np.int32(1)) - np.testing.assert_allclose(y, [12.0, 24.0, 36.0]) - assert module.ddot(np.int32(3), x, np.int32(1), y, np.int32(1)) == ( - np.float64(168.0), - np.int32(3), - np.int32(1), - np.int32(1), - ) - assert module.dasum(np.int32(3), y, np.int32(1)) == ( - np.float64(72.0), - np.int32(3), - np.int32(1), - ) - dscal_scalars = module.dscal(np.int32(3), np.float64(0.5), y, np.int32(1)) - assert dscal_scalars == (np.int32(3), np.float64(0.5), np.int32(1)) - np.testing.assert_allclose(y, [6.0, 12.0, 18.0]) - - -def _assert_lapack_runtime_smoke(module) -> None: - index = np.zeros(5, dtype=np.int32) - values = np.array([1.0, 4.0, 7.0, 2.0, 8.0], dtype=np.float64) - scalars = module.dlamrg(np.int32(3), np.int32(2), values, np.int32(1), np.int32(1), index) - assert scalars == (np.int32(3), np.int32(2), np.int32(1), np.int32(1)) - np.testing.assert_array_equal(index, [1, 4, 2, 3, 5]) - - @pytest.mark.real_library @pytest.mark.parametrize("library", ["blas", "lapack"]) def test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library(library: str, tmp_path: Path): @@ -390,8 +125,11 @@ def test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_li assert _source_stems(library) - all_function_names == case["source_stem_exceptions"] assert all_function_names - _source_stems(library) == case["extra_function_names"] - shared = _cached_native_shared_library(library) - runtime_entry = _runtime_entry(library, entry, tmp_path) + cache_root = ( + native_cache_root() if os.environ.get("PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR") else tmp_path / "native-cache" + ) + shared = build_reference_library(library, cache_root=cache_root, compiler=_compiler()).shared_library + runtime_entry = _runtime_entry(library, entry) expected_root_names = {function.name for function in _root_module(runtime_entry.parent).functions} result = build_pyi_extension( runtime_entry, @@ -420,6 +158,6 @@ def test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_li assert "subroutine daxpy(" not in bridge assert "private\n" not in bridge assert "public :: bind_c_daxpy" not in bridge - _assert_blas_runtime_smoke(module) + assert_blas_runtime_smoke(module) else: - _assert_lapack_runtime_smoke(module) + assert_lapack_runtime_smoke(module) diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index 207650d4c..1a4ece4da 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -2,12 +2,14 @@ from __future__ import annotations +import ast import re from pathlib import Path REPO_ROOT = Path(__file__).parents[3] TEST_ROOT = REPO_ROOT / "tests" +EXAMPLES_ROOT = REPO_ROOT / "examples" TEST_INDEX = TEST_ROOT / "README.md" WORKFLOW_ROOT = REPO_ROOT / ".github/workflows" BLAS_LAPACK_WORKFLOW = REPO_ROOT / ".github/workflows/blas-lapack.yml" @@ -216,6 +218,27 @@ def test_fortran_support_directory_contains_no_pytest_modules() -> None: assert sorted((TEST_ROOT / "fortran" / "_support").rglob("test_*.py")) == [] +def test_native_library_examples_are_copyable_without_the_repository_test_package() -> None: + assert (EXAMPLES_ROOT / "__init__.py").is_file() + assert (EXAMPLES_ROOT / "conftest.py").is_file() + assert (EXAMPLES_ROOT / "blas" / "__init__.py").is_file() + assert (EXAMPLES_ROOT / "lapack" / "__init__.py").is_file() + + repository_test_imports = [] + for path in sorted(EXAMPLES_ROOT.rglob("*.py")): + tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path)) + for node in ast.walk(tree): + if isinstance(node, ast.ImportFrom) and node.module is not None and node.module.startswith("tests"): + repository_test_imports.append(f"{path.relative_to(REPO_ROOT)}: {node.module}") + if isinstance(node, ast.Import): + repository_test_imports.extend( + f"{path.relative_to(REPO_ROOT)}: {alias.name}" + for alias in node.names + if alias.name.startswith("tests") + ) + assert repository_test_imports == [] + + def test_test_index_links_and_language_directories_exist() -> None: text = TEST_INDEX.read_text(encoding="utf-8") for target in re.findall(r"\[[^]]+\]\(([^)#]+)", text): diff --git a/tests/shared/tools/test_warm_real_library_native_cache.py b/tests/shared/tools/test_warm_real_library_native_cache.py index d71d38ae1..62ccf0041 100644 --- a/tests/shared/tools/test_warm_real_library_native_cache.py +++ b/tests/shared/tools/test_warm_real_library_native_cache.py @@ -7,16 +7,16 @@ def test_warm_real_library_native_cache_defaults_to_all_libraries(monkeypatch, capsys): calls = [] - def cached_native_shared_library(library: str) -> Path: + def build_reference_library(library: str): calls.append(library) - return Path("/cache") / f"libprik_full_{library}.so" + return SimpleNamespace(shared_library=Path("/cache") / f"libprik_full_{library}.so") monkeypatch.setattr( warm_real_library_native_cache, - "_real_library_cache_module", + "_native_library_module", lambda: SimpleNamespace( - _native_cache_root=lambda: Path("/cache"), - _cached_native_shared_library=cached_native_shared_library, + native_cache_root=lambda: Path("/cache"), + build_reference_library=build_reference_library, ), ) @@ -33,16 +33,16 @@ def cached_native_shared_library(library: str) -> Path: def test_warm_real_library_native_cache_accepts_selected_libraries(monkeypatch, capsys): calls = [] - def cached_native_shared_library(library: str) -> Path: + def build_reference_library(library: str): calls.append(library) - return Path("/cache") / f"libprik_full_{library}.so" + return SimpleNamespace(shared_library=Path("/cache") / f"libprik_full_{library}.so") monkeypatch.setattr( warm_real_library_native_cache, - "_real_library_cache_module", + "_native_library_module", lambda: SimpleNamespace( - _native_cache_root=lambda: Path("/cache"), - _cached_native_shared_library=cached_native_shared_library, + native_cache_root=lambda: Path("/cache"), + build_reference_library=build_reference_library, ), ) @@ -58,10 +58,10 @@ def cached_native_shared_library(library: str) -> Path: def test_warm_real_library_native_cache_rejects_unknown_library(monkeypatch): monkeypatch.setattr( warm_real_library_native_cache, - "_real_library_cache_module", + "_native_library_module", lambda: SimpleNamespace( - _native_cache_root=lambda: Path("/cache"), - _cached_native_shared_library=lambda library: Path("/cache") / library, + native_cache_root=lambda: Path("/cache"), + build_reference_library=lambda library: SimpleNamespace(shared_library=Path("/cache") / library), ), ) diff --git a/tools/warm_real_library_native_cache.py b/tools/warm_real_library_native_cache.py index 5deacf501..bfacd97aa 100644 --- a/tools/warm_real_library_native_cache.py +++ b/tools/warm_real_library_native_cache.py @@ -11,13 +11,11 @@ DEFAULT_LIBRARIES = ("blas", "lapack") -def _real_library_cache_module(): +def _native_library_module(): repo_root = Path(__file__).resolve().parents[1] if str(repo_root) not in sys.path: sys.path.insert(0, str(repo_root)) - return importlib.import_module( - "tests.fortran.building_shared_library.end_to_end.real_libraries.test_full_libraries" - ) + return importlib.import_module("examples.native_library") def main(argv: Sequence[str] | None = None) -> int: @@ -39,11 +37,11 @@ def main(argv: Sequence[str] | None = None) -> int: + " (choose from blas, lapack)" ) - cache_module = _real_library_cache_module() - print(f"native cache root: {cache_module._native_cache_root()}") + native_library = _native_library_module() + print(f"native cache root: {native_library.native_cache_root()}") for library in libraries: - shared = cache_module._cached_native_shared_library(library) - print(f"{library}: {shared}") + build = native_library.build_reference_library(library) + print(f"{library}: {build.shared_library}") return 0 From fa5b73202903a7b7bb0ca71fb5602899b540a63b Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Mon, 3 Aug 2026 03:25:03 +0100 Subject: [PATCH 14/22] clean blas and lapack examples --- .github/workflows/blas-lapack.yml | 15 +- .github/workflows/merge-validation.yml | 15 +- docs/developer/quality-assurance.md | 13 +- docs/developer/repository-structure.md | 6 +- docs/developer/source-map.md | 4 +- docs/developer/testing-strategy.md | 55 ++-- .../fortran-test-suite-cleanup-checklist.md | 10 +- .../roadmap/semantic-pyi-wrapper-checklist.md | 20 +- .../wrapper-plan-migration-checklist.md | 16 +- docs/user/examples/blas-wrapper.md | 85 ++---- docs/user/examples/lapack-wrapper.md | 82 ++--- examples/__init__.py | 1 - examples/blas/README.md | 105 ++++--- examples/blas/__init__.py | 1 - examples/blas/build_all.sh | 3 + examples/blas/build_f2py.sh | 6 + examples/blas/build_prik.sh | 24 ++ examples/blas/ci/__init__.py | 0 .../full_surface.py} | 2 +- examples/blas/conftest.py | 253 +-------------- examples/blas/f2py_build.py | 111 +++++++ examples/blas/f2py_contract.py | 13 - examples/blas/tests/__init__.py | 0 examples/blas/{ => tests}/helpers.py | 0 examples/blas/{ => tests}/test_auxiliary.py | 13 +- .../blas/{ => tests}/test_level1_complex.py | 0 examples/blas/{ => tests}/test_level1_real.py | 0 .../blas/{ => tests}/test_level2_banded.py | 0 .../blas/{ => tests}/test_level2_general.py | 0 .../blas/{ => tests}/test_level2_hermitian.py | 0 .../blas/{ => tests}/test_level2_packed.py | 0 .../blas/{ => tests}/test_level2_symmetric.py | 0 .../{ => tests}/test_level2_triangular.py | 0 .../blas/{ => tests}/test_level3_general.py | 0 .../blas/{ => tests}/test_level3_hermitian.py | 0 .../blas/{ => tests}/test_level3_symmetric.py | 0 .../{ => tests}/test_level3_triangular.py | 0 .../blas/{ => tests}/test_routine_coverage.py | 45 ++- examples/lapack/README.md | 101 +++--- examples/lapack/__init__.py | 1 - examples/lapack/build_all.sh | 3 + examples/lapack/build_f2py.sh | 6 + examples/lapack/build_prik.sh | 28 ++ examples/lapack/ci/__init__.py | 0 examples/lapack/ci/full_surface.py | 27 ++ examples/lapack/ci_full_surface.py | 22 -- examples/lapack/conftest.py | 288 +----------------- examples/lapack/contracts.py | 27 -- examples/lapack/f2py_build.py | 145 +++++++++ examples/lapack/f2py_contract.py | 16 - examples/lapack/routine_inventory.py | 8 +- examples/lapack/tests/__init__.py | 0 examples/lapack/{ => tests}/helpers.py | 0 examples/lapack/{ => tests}/test_auxiliary.py | 0 .../{ => tests}/test_eigen_generalized.py | 0 .../{ => tests}/test_eigen_nonsymmetric.py | 0 .../{ => tests}/test_eigen_symmetric.py | 0 .../lapack/{ => tests}/test_least_squares.py | 0 .../test_linear_banded_tridiagonal.py | 0 .../lapack/{ => tests}/test_linear_general.py | 0 .../test_linear_positive_definite.py | 0 .../test_linear_symmetric_indefinite.py | 0 .../{ => tests}/test_linear_triangular.py | 0 .../test_orthogonal_factorizations.py | 0 .../{ => tests}/test_routine_coverage.py | 64 ++-- examples/lapack/{ => tests}/test_svd.py | 0 pyproject.toml | 2 - .../fortran/test_language_ownership.py | 4 - .../fortran/test_smoke_selection.py | 1 - tests/fortran/CONTRACT_COVERAGE.md | 2 +- tests/fortran/README.md | 5 +- .../fortran/building_shared_library/README.md | 18 +- .../real_libraries/test_full_libraries.py | 163 ---------- tests/fortran/conftest.py | 8 - .../parsing/test_parser_benchmarks.py | 10 +- .../architecture/test_test_suite_layout.py | 48 ++- 76 files changed, 726 insertions(+), 1169 deletions(-) create mode 100644 examples/blas/build_all.sh create mode 100644 examples/blas/build_f2py.sh create mode 100644 examples/blas/build_prik.sh create mode 100644 examples/blas/ci/__init__.py rename examples/blas/{ci_full_surface.py => ci/full_surface.py} (89%) create mode 100644 examples/blas/f2py_build.py delete mode 100644 examples/blas/f2py_contract.py create mode 100644 examples/blas/tests/__init__.py rename examples/blas/{ => tests}/helpers.py (100%) rename examples/blas/{ => tests}/test_auxiliary.py (89%) rename examples/blas/{ => tests}/test_level1_complex.py (100%) rename examples/blas/{ => tests}/test_level1_real.py (100%) rename examples/blas/{ => tests}/test_level2_banded.py (100%) rename examples/blas/{ => tests}/test_level2_general.py (100%) rename examples/blas/{ => tests}/test_level2_hermitian.py (100%) rename examples/blas/{ => tests}/test_level2_packed.py (100%) rename examples/blas/{ => tests}/test_level2_symmetric.py (100%) rename examples/blas/{ => tests}/test_level2_triangular.py (100%) rename examples/blas/{ => tests}/test_level3_general.py (100%) rename examples/blas/{ => tests}/test_level3_hermitian.py (100%) rename examples/blas/{ => tests}/test_level3_symmetric.py (100%) rename examples/blas/{ => tests}/test_level3_triangular.py (100%) rename examples/blas/{ => tests}/test_routine_coverage.py (81%) create mode 100644 examples/lapack/build_all.sh create mode 100644 examples/lapack/build_f2py.sh create mode 100644 examples/lapack/build_prik.sh create mode 100644 examples/lapack/ci/__init__.py create mode 100644 examples/lapack/ci/full_surface.py delete mode 100644 examples/lapack/ci_full_surface.py delete mode 100644 examples/lapack/contracts.py create mode 100644 examples/lapack/f2py_build.py delete mode 100644 examples/lapack/f2py_contract.py create mode 100644 examples/lapack/tests/__init__.py rename examples/lapack/{ => tests}/helpers.py (100%) rename examples/lapack/{ => tests}/test_auxiliary.py (100%) rename examples/lapack/{ => tests}/test_eigen_generalized.py (100%) rename examples/lapack/{ => tests}/test_eigen_nonsymmetric.py (100%) rename examples/lapack/{ => tests}/test_eigen_symmetric.py (100%) rename examples/lapack/{ => tests}/test_least_squares.py (100%) rename examples/lapack/{ => tests}/test_linear_banded_tridiagonal.py (100%) rename examples/lapack/{ => tests}/test_linear_general.py (100%) rename examples/lapack/{ => tests}/test_linear_positive_definite.py (100%) rename examples/lapack/{ => tests}/test_linear_symmetric_indefinite.py (100%) rename examples/lapack/{ => tests}/test_linear_triangular.py (100%) rename examples/lapack/{ => tests}/test_orthogonal_factorizations.py (100%) rename examples/lapack/{ => tests}/test_routine_coverage.py (81%) rename examples/lapack/{ => tests}/test_svd.py (100%) delete mode 100644 tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index e86ad9820..73d139099 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -63,15 +63,16 @@ jobs: env: PYTHONPATH: . HYPOTHESIS_PROFILE: ci - run: >- - python -m pytest -q -o "python_files=test_*.py ci_full_surface.py" - examples/blas examples/blas/ci_full_surface.py + PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native + run: | + source examples/blas/build_all.sh + python -m pytest -q examples/blas/tests examples/blas/ci/full_surface.py - name: Report reviewed LAPACK inventory env: PYTHONPATH: . run: | python - <<'PY' - from examples.lapack.f2py_contract import F2PY_INOUT_ARGUMENTS + from examples.lapack.f2py_build import F2PY_INOUT_ARGUMENTS from examples.lapack.routine_inventory import ( EXPECTED_LAPACK_ROOT_PROCEDURES, EXPECTED_LAPACK_SOURCE_FILES, @@ -93,6 +94,6 @@ jobs: PYTHONPATH: . HYPOTHESIS_PROFILE: ci PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native - run: >- - python -m pytest -q -o "python_files=test_*.py ci_full_surface.py" - examples/lapack examples/lapack/ci_full_surface.py + run: | + source examples/lapack/build_all.sh + python -m pytest -q examples/lapack/tests examples/lapack/ci/full_surface.py diff --git a/.github/workflows/merge-validation.yml b/.github/workflows/merge-validation.yml index b764e26d4..11baa2051 100644 --- a/.github/workflows/merge-validation.yml +++ b/.github/workflows/merge-validation.yml @@ -618,15 +618,16 @@ jobs: env: PYTHONPATH: . HYPOTHESIS_PROFILE: ci - run: >- - python -m pytest -q -o "python_files=test_*.py ci_full_surface.py" - examples/blas examples/blas/ci_full_surface.py + PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native + run: | + source examples/blas/build_all.sh + python -m pytest -q examples/blas/tests examples/blas/ci/full_surface.py - name: Report reviewed LAPACK inventory env: PYTHONPATH: . run: | python - <<'PY' - from examples.lapack.f2py_contract import F2PY_INOUT_ARGUMENTS + from examples.lapack.f2py_build import F2PY_INOUT_ARGUMENTS from examples.lapack.routine_inventory import ( EXPECTED_LAPACK_ROOT_PROCEDURES, EXPECTED_LAPACK_SOURCE_FILES, @@ -648,9 +649,9 @@ jobs: PYTHONPATH: . HYPOTHESIS_PROFILE: ci PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native - run: >- - python -m pytest -q -o "python_files=test_*.py ci_full_surface.py" - examples/lapack examples/lapack/ci_full_surface.py + run: | + source examples/lapack/build_all.sh + python -m pytest -q examples/lapack/tests examples/lapack/ci/full_surface.py documentation-benchmark: name: Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12 diff --git a/docs/developer/quality-assurance.md b/docs/developer/quality-assurance.md index 516b35bea..0320300c1 100644 --- a/docs/developer/quality-assurance.md +++ b/docs/developer/quality-assurance.md @@ -100,11 +100,14 @@ For subprocess coverage investigations, mirror that command shape before deciding a fix. A plain local coverage run can miss subprocess data. Every Python version excludes the full BLAS/LAPACK real-library wrapper test while retaining general native-bundle coverage. The `Native Libraries` -component runs the complete BLAS and LAPACK examples on Python 3.12. Those -pytest invocations explicitly add each example's non-discovered -`ci_full_surface.py`, reusing the session-scoped extension for complete -root-export audits and runtime smoke calls instead of rebuilding the wrapper -layer in a second process. A pull request may use the +component runs the complete BLAS and LAPACK examples on Python 3.12. Each job +step sources `build_all.sh`, which sources the exact `build_prik.sh` and +`build_f2py.sh` sequences displayed in the user documentation, before starting +pytest. Each f2py script reuses the native library from its PRIK script, and +each explicitly selected `ci/full_surface.py` audit reuses the PRIK extension. +The job therefore verifies the copyable commands without repeating native +compilation or wrapper construction in a second process. A +pull request may use the `ignore-real-library-wrappers` label to skip that expensive component without disabling the ordinary Python-version matrix. diff --git a/docs/developer/repository-structure.md b/docs/developer/repository-structure.md index 9bd8f1cdc..e1537007a 100644 --- a/docs/developer/repository-structure.md +++ b/docs/developer/repository-structure.md @@ -56,8 +56,10 @@ through `prik/__init__.py`. | `tests/fortran/infrastructure/` | Internal cross-feature policy, wrapper-generation, compiler, and runtime frameworks with no honest public-capability owner. | | `tests/c/` | C input-language parsing, preprocessing, probe, semantic, CLI, and fixture evidence. | | `tests/shared/` | Language-neutral product architecture, documentation, naming, tools, type mapping, and utility checks. | -| `examples/blas/test_*.py` | Dedicated real-library correctness documentation: explicit independent and PRIK/f2py differential validation for every Reference BLAS routine. | -| `examples/lapack/test_*.py` | CI-only real-library correctness documentation: explicit independent and PRIK/SciPy/f2py validation for the reviewed double-precision routine inventory. | +| `examples/blas/tests/test_*.py` | User-facing real-library correctness documentation: explicit independent and PRIK/f2py differential validation for every Reference BLAS routine. | +| `examples/blas/ci/full_surface.py` | Maintainer-only complete BLAS export and smoke audit, selected explicitly by CI. | +| `examples/lapack/tests/test_*.py` | User-facing real-library correctness documentation: explicit independent and PRIK/SciPy/f2py validation for the reviewed double-precision routine inventory. | +| `examples/lapack/ci/full_surface.py` | Maintainer-only complete LAPACK export and smoke audit, selected explicitly by CI. | ```bash export EXAMPLE_WORKSPACE="$PWD" export BLAS_BUILD_ROOT="$(mktemp -d)" -export PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR="$BLAS_BUILD_ROOT/native-cache" - export BLAS_SHARED_LIBRARY="$( python -m examples.native_library blas \ - --cache-dir "$PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR" \ --compiler "$(command -v gfortran)" \ --jobs 8 )" @@ -130,37 +125,16 @@ performance. ## 3. Build f2py against the same native library -Use the maintained command builder so the comparison matches the test suite: +Run the same f2py build script exercised by the test suite: + ```bash cd "$EXAMPLE_WORKSPACE" -python - <<'PY' -import os -from pathlib import Path -import subprocess - -from examples.blas.conftest import ( - _build_environment, - _compiler, - _f2py_build_command, - _f2py_signature_command, -) - -workdir = Path(os.environ["BLAS_BUILD_ROOT"]) / "f2py" -workdir.mkdir(parents=True, exist_ok=True) -compiler = _compiler() -native_library = Path(os.environ["BLAS_SHARED_LIBRARY"]) -for command in ( - _f2py_signature_command(workdir), - _f2py_build_command(workdir, native_library), -): - subprocess.run( - command, - cwd=workdir, - env=_build_environment(compiler, native_library), - check=True, - ) -PY +export BLAS_F2PY_ROOT="$BLAS_BUILD_ROOT/f2py" +python -m examples.blas.f2py_build \ + "$BLAS_F2PY_ROOT" \ + "$BLAS_SHARED_LIBRARY" \ + --compiler "$(command -v gfortran)" ``` f2py reads the source declarations to generate its `.pyf` signature, compiles @@ -196,17 +170,15 @@ PRIK deliberately follows the native scalar contract: --- -## 4. Understand the test fixtures and helpers +## 4. Run the correctness tests The names `prik_blas` and `f2py_blas` in the tests are session-scoped pytest -fixtures from [`conftest.py`](../../../examples/blas/conftest.py). They build -and import each complete module once, then reuse it for every test. -GitHub Actions explicitly adds the non-discovered `ci_full_surface.py` to the -same pytest invocation for maintainer-only full-surface checks; ordinary users -running `pytest examples/blas` do not collect it. +fixtures from [`conftest.py`](../../../examples/blas/conftest.py). After the +build scripts finish, they import the modules and reuse them for every test +under [`examples/blas/tests/`](../../../examples/blas/tests/). The tests import small, explicit helpers from -[`helpers.py`](../../../examples/blas/helpers.py). The two helpers used below +[`tests/helpers.py`](../../../examples/blas/tests/helpers.py). The two helpers used below are intentionally narrow: - `assert_allclose_for_dtype` chooses a tolerance from the result dtype and the @@ -222,7 +194,7 @@ Both helper definitions and the test functions below assume: import numpy as np ``` - + ```python def assert_allclose_for_dtype(actual, expected, *, operation_size: int = 1) -> None: """Compare floating values with dtype- and accumulation-aware tolerances.""" @@ -241,7 +213,7 @@ def assert_allclose_for_dtype(actual, expected, *, operation_size: int = 1) -> N ) ``` - + ```python def assert_storage_unchanged(actual: np.ndarray, original: np.ndarray) -> None: """Require exact preservation, including NaNs and sentinel padding.""" @@ -269,7 +241,7 @@ A documentation test compares these blocks with the Python AST, so the page and ### DAXPY – in-place vector update - + ```python def test_daxpy(prik_blas, f2py_blas): alpha = np.float64(-1.5) @@ -296,7 +268,7 @@ The input-only array `x` must remain unchanged. ### DDOT – scalar function result - + ```python def test_ddot(prik_blas, f2py_blas): x = np.array([1.0, -2.0, 4.0], dtype=np.float64) @@ -322,25 +294,26 @@ def test_ddot(prik_blas, f2py_blas): ## 6. Run the maintained example -Normally let pytest build each implementation once and reuse the modules: +Build both wrappers once, then run any user-facing test selection: ```bash cd "$REPOSITORY_ROOT" -python -m pytest -q examples/blas +source examples/blas/build_all.sh +python -m pytest -q examples/blas/tests ``` Focused commands for quick debugging: ```bash -python -m pytest -q examples/blas/test_level1_real.py -python -m pytest -q examples/blas/test_level1_real.py::test_daxpy -python -m pytest -q examples/blas -k dgemm +python -m pytest -q examples/blas/tests/test_level1_real.py +python -m pytest -q examples/blas/tests/test_level1_real.py::test_daxpy +python -m pytest -q examples/blas/tests -k dgemm ``` -- Complete Level-1 examples → [`test_level1_real.py`](../../../examples/blas/test_level1_real.py) -- Matrix / packed / banded / symmetric / Hermitian / triangular examples → files under [`examples/blas/`](../../../examples/blas/) +- Complete Level-1 examples → [`test_level1_real.py`](../../../examples/blas/tests/test_level1_real.py) +- Matrix / packed / banded / symmetric / Hermitian / triangular examples → files under [`examples/blas/tests/`](../../../examples/blas/tests/) - Authoritative classification → [`routine_inventory.py`](../../../examples/blas/routine_inventory.py) -- Coverage guard → [`test_routine_coverage.py`](../../../examples/blas/test_routine_coverage.py) +- Coverage guard → [`test_routine_coverage.py`](../../../examples/blas/tests/test_routine_coverage.py) For the full explanation of increments, leading dimensions, packed/banded storage, Hermitian conjugation, tolerances, coverage totals and known wrapper differences, see the [`examples/blas` project README](../../../examples/blas/README.md). @@ -354,10 +327,10 @@ For the full explanation of increments, leading dimensions, packed/banded storag - Run a single failing test with more detail and keep the build directory: ```bash - python -m pytest -vv -s --basetemp=/tmp/prik-blas-debug examples/blas/test_level1_real.py::test_daxpy + python -m pytest -vv -s --basetemp=/tmp/prik-blas-debug examples/blas/tests/test_level1_real.py::test_daxpy ``` -- Read the full compiler identity, command, stdout and stderr that the fixture prints. +- Read the compiler output from `build_all.sh`. - Keep correctness tests and benchmarking completely separate. This suite uses small deterministic inputs and makes no performance claims. diff --git a/docs/user/examples/lapack-wrapper.md b/docs/user/examples/lapack-wrapper.md index 4bdc4656d..1e2519f5a 100644 --- a/docs/user/examples/lapack-wrapper.md +++ b/docs/user/examples/lapack-wrapper.md @@ -83,12 +83,12 @@ are installed, you can copy that directory alone. Compile the native files once into a shared `.so` file so both wrappers can reuse it: + ```bash export EXAMPLE_WORKSPACE="$PWD" export LAPACK_BUILD_ROOT="$(mktemp -d)" export LAPACK_SHARED_LIBRARY="$( python -m examples.native_library lapack \ - --cache-dir "$LAPACK_BUILD_ROOT/native" \ --compiler "$(command -v gfortran)" \ --jobs 8 )" @@ -131,39 +131,17 @@ The f2py build adds temporary intent directives and the tests pass typed 0-D arrays. PRIK needs neither: it returns unannotated scalar writebacks directly, with ordinary scalar arguments. -The exact command is assembled from the reviewed inventory by `_f2py_build_command`. -This short reproducer runs that same command: +The example-owned f2py builder assembles the reviewed inventory. Run the same +script exercised by the test suite: + ```bash cd "$EXAMPLE_WORKSPACE" -export LAPACK_F2PY_ROOT="$(mktemp -d)" -python - <<'PY' -import os -from pathlib import Path -import subprocess - -from examples.lapack.conftest import ( - _build_environment, - _compiler, - _f2py_build_command, - _f2py_signature_command, -) - -workdir = Path(os.environ["LAPACK_F2PY_ROOT"]) -compiler = _compiler() -native_library = Path(os.environ["LAPACK_SHARED_LIBRARY"]) -for command in ( - _f2py_signature_command(workdir), - _f2py_build_command(workdir, native_library), -): - subprocess.run( - command, - cwd=workdir, - env=_build_environment(compiler, native_library), - check=True, - ) -print(workdir) -PY +export LAPACK_F2PY_ROOT="$LAPACK_BUILD_ROOT/f2py" +python -m examples.lapack.f2py_build \ + "$LAPACK_F2PY_ROOT" \ + "$LAPACK_SHARED_LIBRARY" \ + --compiler "$(command -v gfortran)" ``` The assembled command has this shape: @@ -224,16 +202,17 @@ It fails clearly if the SciPy version or the expected routine inventory drifts. --- -## 5. Understand the test fixtures and helpers +## 5. Run the correctness tests The arguments `prik_lapack`, `f2py_lapack`, and `scipy_lapack` are session-scoped pytest fixtures from -[`conftest.py`](../../../examples/lapack/conftest.py). They provide the complete -PRIK module, the selected f2py comparison module, and SciPy's pinned low-level LAPACK -module respectively. +[`conftest.py`](../../../examples/lapack/conftest.py). After the build scripts +finish, they provide the complete PRIK module, selected f2py comparison module, +and SciPy's pinned low-level LAPACK module to the tests under +[`examples/lapack/tests/`](../../../examples/lapack/tests/). The displayed tests use small helpers from -[`helpers.py`](../../../examples/lapack/helpers.py): +[`tests/helpers.py`](../../../examples/lapack/tests/helpers.py): | Helper | Exact responsibility | | --- | --- | @@ -250,7 +229,7 @@ The numerical and preservation checks are intentionally small and visible: import numpy as np ``` - + ```python def assert_allclose_float64(actual, expected, *, operation_size: int = 1) -> None: """Compare float64 LAPACK results with an accumulation-aware tolerance.""" @@ -265,7 +244,7 @@ def assert_allclose_float64(actual, expected, *, operation_size: int = 1) -> Non ) ``` - + ```python def assert_small_residual( residual, @@ -281,7 +260,7 @@ def assert_small_residual( assert scaled <= tolerance, f"scaled residual {scaled} exceeded {tolerance}" ``` - + ```python def assert_storage_unchanged(actual: np.ndarray, expected: np.ndarray) -> None: """Compare storage exactly, including NaN sentinels.""" @@ -306,7 +285,7 @@ Documentation CI verifies these blocks directly against their source functions. ### DGESV – solve a general linear system - + ```python def test_dgesv_solves_general_system(prik_lapack, scipy_lapack, f2py_lapack): original_a = np.array([[3.0, 1.0], [1.0, 2.0]], dtype=np.float64) @@ -348,7 +327,7 @@ PRIK preserves the native argument order and returns visible scalar arguments; b ### DPOTRF – reconstruct a Cholesky factorization - + ```python def test_dpotrf_reconstructs_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): logical = np.array([[4.0, 1.0], [1.0, 3.0]], dtype=np.float64) @@ -381,27 +360,28 @@ Correctness is established by reconstructing `A = L @ L.T`, not merely by compar ## 7. Run the maintained example -The complete command builds the full PRIK library once, builds the selected f2py surface once, imports SciPy, and runs all 127 named tests: +Build both wrappers once, then run all 127 named tests: ```bash cd "$REPOSITORY_ROOT" -python -m pytest -q examples/lapack +source examples/lapack/build_all.sh +python -m pytest -q examples/lapack/tests ``` Use a family or a single routine while diagnosing a failure: ```bash -python -m pytest -q examples/lapack/test_linear_general.py +python -m pytest -q examples/lapack/tests/test_linear_general.py python -m pytest -q \ - examples/lapack/test_linear_general.py::test_dgesv_solves_general_system -python -m pytest -q examples/lapack -k dgesvd + examples/lapack/tests/test_linear_general.py::test_dgesv_solves_general_system +python -m pytest -q examples/lapack/tests -k dgesvd ``` -- Full DGESV and related general-system tests → [`test_linear_general.py`](../../../examples/lapack/test_linear_general.py) -- Cholesky and other positive-definite examples → [`test_linear_positive_definite.py`](../../../examples/lapack/test_linear_positive_definite.py) -- Other families live under [`examples/lapack/`](../../../examples/lapack/) +- Full DGESV and related general-system tests → [`test_linear_general.py`](../../../examples/lapack/tests/test_linear_general.py) +- Cholesky and other positive-definite examples → [`test_linear_positive_definite.py`](../../../examples/lapack/tests/test_linear_positive_definite.py) +- Other families live under [`examples/lapack/tests/`](../../../examples/lapack/tests/) - Authoritative mapping of all 127 routines → [`routine_inventory.py`](../../../examples/lapack/routine_inventory.py) -- Coverage audit → [`test_routine_coverage.py`](../../../examples/lapack/test_routine_coverage.py) +- Coverage audit → [`test_routine_coverage.py`](../../../examples/lapack/tests/test_routine_coverage.py) Repository maintainers normally leave this expensive LAPACK wrapper/runtime command to the dedicated BLAS + LAPACK GitHub Actions job unless local execution is explicitly requested. The command is nevertheless complete and reproducible for users who have the listed native toolchain. @@ -420,7 +400,7 @@ For storage formats, workspaces, pivot conventions, the f2py callback limitation ```bash python -m pytest -vv -s --basetemp=/tmp/prik-lapack-debug \ - examples/lapack/test_linear_general.py::test_dgesv_solves_general_system + examples/lapack/tests/test_linear_general.py::test_dgesv_solves_general_system ``` - Compare residuals and reconstructions **before** comparing raw factor bytes; several valid LAPACK decompositions are not unique. diff --git a/examples/__init__.py b/examples/__init__.py index 65d577b30..e69de29bb 100644 --- a/examples/__init__.py +++ b/examples/__init__.py @@ -1 +0,0 @@ -"""Copyable, runnable examples for an installed PRIK package.""" diff --git a/examples/blas/README.md b/examples/blas/README.md index 7ab3f003a..77c5fc7c8 100644 --- a/examples/blas/README.md +++ b/examples/blas/README.md @@ -39,45 +39,53 @@ running the example: python3 -m pip install "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" ``` -The session fixtures compile the implementations once at `-O0`, then link both +`build_all.sh` compiles the implementations once at `-O0`, then links both wrappers to that same native library. All artifacts stay in a temporary -directory: +directory. It sources these two scripts: + ```bash -export EXAMPLE_WORKSPACE="$(pwd)" -export BUILD_ROOT="$(mktemp -d)" -export PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR="$BUILD_ROOT/native-cache" -export BLAS_SHARED_LIBRARY="$(python3 -m examples.native_library blas --cache-dir "$PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR" --compiler "$(command -v gfortran)" --jobs 8)" -python3 -m prik generate --pyi examples/blas/native --language fortran --out "$BUILD_ROOT/contract/blas" -mkdir -p "$BUILD_ROOT/prik" "$BUILD_ROOT/f2py" -cd "$BUILD_ROOT/prik" -python3 -m prik "$BUILD_ROOT/contract/blas/__init__.pyi" --out prik_reference_blas --out-dir "$BUILD_ROOT/prik/generated" --compiler "$(command -v gfortran)" --native-objects "$BLAS_SHARED_LIBRARY" --jobs 8 --wrapper-fortran-flags="-O0 -g0" --wrapper-c-flags="-O0 -g0" +export EXAMPLE_WORKSPACE="$PWD" +export BLAS_BUILD_ROOT="$(mktemp -d)" +export BLAS_SHARED_LIBRARY="$( + python -m examples.native_library blas \ + --compiler "$(command -v gfortran)" \ + --jobs 8 +)" + +python -m prik generate \ + --pyi examples/blas/native \ + --language fortran \ + --out "$BLAS_BUILD_ROOT/contract/blas" + +mkdir -p "$BLAS_BUILD_ROOT/prik/generated" +cd "$BLAS_BUILD_ROOT/prik" + +python -m prik "$BLAS_BUILD_ROOT/contract/blas/__init__.pyi" \ + --out prik_reference_blas \ + --out-dir "$BLAS_BUILD_ROOT/prik/generated" \ + --compiler "$(command -v gfortran)" \ + --native-objects "$BLAS_SHARED_LIBRARY" \ + --jobs 8 \ + --wrapper-fortran-flags="-O0 -g0" \ + --wrapper-c-flags="-O0 -g0" ``` + ```bash cd "$EXAMPLE_WORKSPACE" -python3 - <<'PY' -import os -from pathlib import Path -import subprocess - -from examples.blas.conftest import _build_environment, _compiler, _f2py_build_command, _f2py_signature_command - -workdir = Path(os.environ["BUILD_ROOT"]) / "f2py" -workdir.mkdir(parents=True, exist_ok=True) -compiler = _compiler() -native_library = Path(os.environ["BLAS_SHARED_LIBRARY"]) -for command in (_f2py_signature_command(workdir), _f2py_build_command(workdir, native_library)): - subprocess.run(command, cwd=workdir, env=_build_environment(compiler, native_library), check=True) -PY +export BLAS_F2PY_ROOT="$BLAS_BUILD_ROOT/f2py" +python -m examples.blas.f2py_build \ + "$BLAS_F2PY_ROOT" \ + "$BLAS_SHARED_LIBRARY" \ + --compiler "$(command -v gfortran)" ``` -The first native-builder call compiles all sources; later identical calls may -reuse its cache. f2py reads the sources only to generate signatures and -compiles its wrapper against `BLAS_SHARED_LIBRARY`. +f2py reads the sources only to generate signatures and compiles its wrapper +against `BLAS_SHARED_LIBRARY`. Six rotation routines document scalar writebacks without declaring Fortran -`intent`. The f2py fixture adds build-local intent directives and passes typed +`intent`. The f2py build adds local intent directives, and the tests pass typed 0-D arrays so those writes are testable. PRIK needs neither the overlay nor carrier arrays: it returns unannotated scalar writebacks directly. @@ -87,25 +95,25 @@ Import the modules from their build directories: import os import sys -build_root = os.environ["BUILD_ROOT"] +build_root = os.environ["BLAS_BUILD_ROOT"] sys.path.insert(0, f"{build_root}/prik") sys.path.insert(0, f"{build_root}/f2py") import prik_reference_blas import f2py_reference_blas ``` -For normal use, let pytest create, report, and clean those directories: +Build once, then run any user-facing test selection: ```bash -python3 -m pytest -q examples/blas -python3 -m pytest -q examples/blas/test_level1_real.py -python3 -m pytest -q examples/blas/test_level1_real.py::test_daxpy -python3 -m pytest -q examples/blas -k dgemm +source examples/blas/build_all.sh +python3 -m pytest -q examples/blas/tests +python3 -m pytest -q examples/blas/tests/test_level1_real.py +python3 -m pytest -q examples/blas/tests/test_level1_real.py::test_daxpy +python3 -m pytest -q examples/blas/tests -k dgemm ``` -The dedicated CI lane explicitly adds `ci_full_surface.py` to that same pytest -invocation. Its nonstandard filename keeps the maintainer-only audit out of -ordinary example runs while still reusing the already-built extensions. +User-run correctness tests live in `tests/`. The separate `ci/` directory owns +the maintainer-only full-surface audit. ## What each test proves @@ -168,8 +176,9 @@ unused band rows exactly. ### Test fixtures and helper vocabulary `prik_blas` and `f2py_blas` are session-scoped pytest fixtures from -[`conftest.py`](conftest.py). They build and import each complete wrapper once. -The named tests use narrow helpers from [`helpers.py`](helpers.py): +[`conftest.py`](conftest.py). After `build_all.sh` completes, they import each +complete wrapper once and reuse the modules across `tests/`. +The named tests use narrow helpers from [`tests/helpers.py`](tests/helpers.py): | Helper | Responsibility | | --- | --- | @@ -181,7 +190,7 @@ The named tests use narrow helpers from [`helpers.py`](helpers.py): Every wrapper call and independent formula remains visible in its test; these helpers only handle comparison or storage mechanics. The examples below assume -`import numpy as np` and the corresponding imports from `helpers.py`, exactly as +`import numpy as np` and the corresponding imports from `tests/helpers.py`, exactly as shown in the linked test files. ## Representative tests (source verified) @@ -192,7 +201,7 @@ diverges. ### DAXPY - + ```python def test_daxpy(prik_blas, f2py_blas): alpha = np.float64(-1.5) @@ -216,7 +225,7 @@ def test_daxpy(prik_blas, f2py_blas): ### DDOT - + ```python def test_ddot(prik_blas, f2py_blas): x = np.array([1.0, -2.0, 4.0], dtype=np.float64) @@ -240,7 +249,7 @@ def test_ddot(prik_blas, f2py_blas): ### DGEMV - + ```python def test_dgemv_no_transpose(prik_blas, f2py_blas): alpha, beta = np.float64(2.0), np.float64(-1.0) @@ -274,7 +283,7 @@ def test_dgemv_no_transpose(prik_blas, f2py_blas): ### DGEMM - + ```python def test_dgemm(prik_blas, f2py_blas): alpha, beta = np.float64(2.0), np.float64(-0.5) @@ -337,7 +346,7 @@ def test_dgemm(prik_blas, f2py_blas): ### DTRSV - + ```python def test_dtrsv_upper_nonunit(prik_blas, f2py_blas): original_a = np.asfortranarray([[2.0, -1.0], [np.nan, 3.0], [91.0, 92.0]], dtype=np.float64) @@ -361,7 +370,7 @@ def test_dtrsv_upper_nonunit(prik_blas, f2py_blas): ### CHEMV (complex Hermitian) - + ```python def test_chemv(prik_blas, f2py_blas): alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(0.25j) @@ -390,7 +399,7 @@ def test_chemv(prik_blas, f2py_blas): ### SGBMV (general band) - + ```python def test_sgbmv(prik_blas, f2py_blas): alpha, beta = np.float32(1.5), np.float32(-0.5) @@ -478,7 +487,7 @@ through f2py. Tests keep both calls visible wherever these APIs differ. Keep a named temporary directory and display build output: ```bash -python3 -m pytest -vv -s examples/blas -k dgemm --basetemp=/tmp/prik-blas-debug +python3 -m pytest -vv -s examples/blas/tests -k dgemm --basetemp=/tmp/prik-blas-debug ``` Build failures include the compiler identity, complete command, stdout, and diff --git a/examples/blas/__init__.py b/examples/blas/__init__.py index 12e94c555..e69de29bb 100644 --- a/examples/blas/__init__.py +++ b/examples/blas/__init__.py @@ -1 +0,0 @@ -"""Complete Reference BLAS correctness example.""" diff --git a/examples/blas/build_all.sh b/examples/blas/build_all.sh new file mode 100644 index 000000000..1939382b7 --- /dev/null +++ b/examples/blas/build_all.sh @@ -0,0 +1,3 @@ +source examples/blas/build_prik.sh +source "$EXAMPLE_WORKSPACE/examples/blas/build_f2py.sh" +export PYTHONPATH="$BLAS_BUILD_ROOT/prik:$BLAS_F2PY_ROOT${PYTHONPATH:+:$PYTHONPATH}" diff --git a/examples/blas/build_f2py.sh b/examples/blas/build_f2py.sh new file mode 100644 index 000000000..6d6a80b40 --- /dev/null +++ b/examples/blas/build_f2py.sh @@ -0,0 +1,6 @@ +cd "$EXAMPLE_WORKSPACE" +export BLAS_F2PY_ROOT="$BLAS_BUILD_ROOT/f2py" +python -m examples.blas.f2py_build \ + "$BLAS_F2PY_ROOT" \ + "$BLAS_SHARED_LIBRARY" \ + --compiler "$(command -v gfortran)" diff --git a/examples/blas/build_prik.sh b/examples/blas/build_prik.sh new file mode 100644 index 000000000..b630611d3 --- /dev/null +++ b/examples/blas/build_prik.sh @@ -0,0 +1,24 @@ +export EXAMPLE_WORKSPACE="$PWD" +export BLAS_BUILD_ROOT="$(mktemp -d)" +export BLAS_SHARED_LIBRARY="$( + python -m examples.native_library blas \ + --compiler "$(command -v gfortran)" \ + --jobs 8 +)" + +python -m prik generate \ + --pyi examples/blas/native \ + --language fortran \ + --out "$BLAS_BUILD_ROOT/contract/blas" + +mkdir -p "$BLAS_BUILD_ROOT/prik/generated" +cd "$BLAS_BUILD_ROOT/prik" + +python -m prik "$BLAS_BUILD_ROOT/contract/blas/__init__.pyi" \ + --out prik_reference_blas \ + --out-dir "$BLAS_BUILD_ROOT/prik/generated" \ + --compiler "$(command -v gfortran)" \ + --native-objects "$BLAS_SHARED_LIBRARY" \ + --jobs 8 \ + --wrapper-fortran-flags="-O0 -g0" \ + --wrapper-c-flags="-O0 -g0" diff --git a/examples/blas/ci/__init__.py b/examples/blas/ci/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/examples/blas/ci_full_surface.py b/examples/blas/ci/full_surface.py similarity index 89% rename from examples/blas/ci_full_surface.py rename to examples/blas/ci/full_surface.py index 91f53fe13..b991306a2 100644 --- a/examples/blas/ci_full_surface.py +++ b/examples/blas/ci/full_surface.py @@ -4,8 +4,8 @@ import pytest -from examples.blas.helpers import assert_runtime_smoke from examples.blas.routine_inventory import ALL_ROUTINES +from examples.blas.tests.helpers import assert_runtime_smoke pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] diff --git a/examples/blas/conftest.py b/examples/blas/conftest.py index d1afb2770..f0127737b 100644 --- a/examples/blas/conftest.py +++ b/examples/blas/conftest.py @@ -1,256 +1,17 @@ -"""Build one native BLAS library and reuse it through PRIK and f2py.""" +"""Import fixtures for the wrappers produced by ``build_all.sh``.""" -from __future__ import annotations - -from dataclasses import dataclass import importlib -import os -from pathlib import Path -import shlex -import subprocess -import sys import pytest -from examples.blas.f2py_contract import F2PY_INOUT_ARGUMENTS -from examples.f2py_intents import prepare_f2py_intent_sources -from examples.native_library import ( - NativeLibrary, - build_reference_library, - compiler_identity, - linker_name, - native_cache_root, - require_tool, -) - - -EXAMPLE_ROOT = Path(__file__).resolve().parent -NATIVE_ROOT = EXAMPLE_ROOT / "native" -FORTRAN_SUFFIXES = frozenset({".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"}) -BLAS_SOURCES = tuple( - sorted(path for path in NATIVE_ROOT.iterdir() if path.is_file() and path.suffix.lower() in FORTRAN_SUFFIXES) -) -BUILD_FLAGS = "-O0" -PRIK_WRAPPER_FLAGS = ("-O0", "-g0") - - -@dataclass(frozen=True) -class BuiltBLAS: - """One imported wrapper plus the information needed to diagnose its build.""" - - module: object - module_name: str - workdir: Path - command: tuple[str, ...] - compiler_identity: str - stdout: str - stderr: str - native_library: Path - - -def _compiler() -> str: - try: - return require_tool("gfortran") - except RuntimeError as error: - pytest.skip(str(error)) - - -def _build_environment(compiler: str, native_library: Path | None = None) -> dict[str, str]: - environment = dict(os.environ) - environment.update( - { - "CFLAGS": BUILD_FLAGS, - "FC": compiler, - "F77": compiler, - "F90": compiler, - "FFLAGS": BUILD_FLAGS, - "F90FLAGS": BUILD_FLAGS, - } - ) - if native_library is not None: - rpath_flag = f"-Wl,-rpath,{native_library.parent}" - environment["LDFLAGS"] = " ".join(filter(None, (environment.get("LDFLAGS"), rpath_flag))) - return environment - - -def _run_build( - command: tuple[str, ...], - workdir: Path, - compiler: str, - native_library: Path | None = None, -) -> subprocess.CompletedProcess[str]: - result = subprocess.run( # nosec B603 - fixed tools and copied example inputs - command, - cwd=workdir, - env=_build_environment(compiler, native_library), - capture_output=True, - text=True, - check=False, - ) - if result.returncode: - pytest.fail( - "Reference BLAS build failed\n" - f"compiler: {compiler_identity(compiler)}\n" - f"command: {shlex.join(command)}\n" - f"stdout:\n{result.stdout or ''}\n" - f"stderr:\n{result.stderr or ''}" - ) - return result - - -def _import_built_module(module_name: str, workdir: Path): - sys.modules.pop(module_name, None) - sys.path.insert(0, str(workdir)) - try: - return importlib.import_module(module_name) - finally: - sys.path.remove(str(workdir)) - - -def _contract_command(workdir: Path) -> tuple[str, ...]: - """Generate the complete BLAS semantic contract through the public CLI.""" - return ( - sys.executable, - "-m", - "prik", - "generate", - "--pyi", - str(NATIVE_ROOT), - "--language", - "fortran", - "--out", - str(workdir / "contract" / "blas"), - ) - - -def _prik_build_command( - contract_entry: Path, - native_library: Path, - workdir: Path, - compiler: str, -) -> tuple[str, ...]: - """Build the complete contract while reusing the precompiled native library.""" - jobs = max(1, min(os.cpu_count() or 1, 8)) - joined_wrapper_flags = " ".join(PRIK_WRAPPER_FLAGS) - return ( - sys.executable, - "-m", - "prik", - str(contract_entry), - "--out", - "prik_reference_blas", - "--out-dir", - str(workdir / "generated"), - "--compiler", - compiler, - "--native-objects", - str(native_library), - "--jobs", - str(jobs), - f"--wrapper-fortran-flags={joined_wrapper_flags}", - f"--wrapper-c-flags={joined_wrapper_flags}", - ) - - -def _f2py_signature_command(workdir: Path) -> tuple[str, ...]: - """Generate f2py signatures from reviewed build-local intent overlays.""" - sources = prepare_f2py_intent_sources(BLAS_SOURCES, workdir, F2PY_INOUT_ARGUMENTS) - return ( - sys.executable, - "-m", - "numpy.f2py", - "-m", - "f2py_reference_blas", - "-h", - str(workdir / "f2py_reference_blas.pyf"), - *(str(source) for source in sources), - "--overwrite-signature", - ) - - -def _f2py_build_command(workdir: Path, native_library: Path) -> tuple[str, ...]: - """Build only f2py's wrapper and link the precompiled BLAS implementation.""" - return ( - sys.executable, - "-m", - "numpy.f2py", - "-c", - str(workdir / "f2py_reference_blas.pyf"), - f"-L{native_library.parent}", - f"-l{linker_name(native_library)}", - "--build-dir", - str(workdir / "generated"), - f"--f77flags={BUILD_FLAGS}", - f"--f90flags={BUILD_FLAGS}", - f"--opt={BUILD_FLAGS}", - ) - - -@pytest.fixture(scope="session") -def native_build(tmp_path_factory: pytest.TempPathFactory) -> NativeLibrary: - """Compile the complete BLAS implementation once for both wrappers.""" - compiler = _compiler() - cache_root = ( - native_cache_root() - if os.environ.get("PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR") - else tmp_path_factory.mktemp("reference-blas-native") - ) - try: - return build_reference_library("blas", cache_root=cache_root, compiler=compiler) - except (RuntimeError, subprocess.CalledProcessError) as error: - pytest.fail(f"Reference BLAS native build failed with {compiler_identity(compiler)}\n{error}") - - -@pytest.fixture(scope="session") -def prik_build(tmp_path_factory: pytest.TempPathFactory, native_build: NativeLibrary) -> BuiltBLAS: - """Build and import PRIK against the session's native BLAS library.""" - compiler = native_build.compiler - workdir = tmp_path_factory.mktemp("prik-reference-blas") - _run_build(_contract_command(workdir), workdir, compiler) - contract_entry = workdir / "contract" / "blas" / "__init__.pyi" - module_name = "prik_reference_blas" - command = _prik_build_command(contract_entry, native_build.shared_library, workdir, compiler) - result = _run_build(command, workdir, compiler) - return BuiltBLAS( - module=_import_built_module(module_name, workdir), - module_name=module_name, - workdir=workdir, - command=command, - compiler_identity=compiler_identity(compiler), - stdout=result.stdout, - stderr=result.stderr, - native_library=native_build.shared_library, - ) - - -@pytest.fixture(scope="session") -def f2py_build(tmp_path_factory: pytest.TempPathFactory, native_build: NativeLibrary) -> BuiltBLAS: - """Build and import f2py against the same native BLAS library.""" - compiler = native_build.compiler - workdir = tmp_path_factory.mktemp("f2py-reference-blas") - _run_build(_f2py_signature_command(workdir), workdir, compiler) - module_name = "f2py_reference_blas" - command = _f2py_build_command(workdir, native_build.shared_library) - result = _run_build(command, workdir, compiler, native_build.shared_library) - return BuiltBLAS( - module=_import_built_module(module_name, workdir), - module_name=module_name, - workdir=workdir, - command=command, - compiler_identity=compiler_identity(compiler), - stdout=result.stdout, - stderr=result.stderr, - native_library=native_build.shared_library, - ) - @pytest.fixture(scope="session") -def prik_blas(prik_build: BuiltBLAS): - """Return the session-scoped PRIK module.""" - return prik_build.module +def prik_blas(): + """Return the already-built PRIK BLAS module.""" + return importlib.import_module("prik_reference_blas") @pytest.fixture(scope="session") -def f2py_blas(f2py_build: BuiltBLAS): - """Return the session-scoped f2py module.""" - return f2py_build.module +def f2py_blas(): + """Return the already-built f2py BLAS module.""" + return importlib.import_module("f2py_reference_blas") diff --git a/examples/blas/f2py_build.py b/examples/blas/f2py_build.py new file mode 100644 index 000000000..1f38f9385 --- /dev/null +++ b/examples/blas/f2py_build.py @@ -0,0 +1,111 @@ +"""Build the reviewed f2py BLAS wrapper against one native shared library.""" + +from __future__ import annotations + +import argparse +import os +import subprocess +import sys +from collections.abc import Sequence +from pathlib import Path + +from examples.f2py_intents import prepare_f2py_intent_sources +from examples.native_library import linker_name, require_tool + + +EXAMPLE_ROOT = Path(__file__).resolve().parent +NATIVE_ROOT = EXAMPLE_ROOT / "native" +FORTRAN_SUFFIXES = frozenset({".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"}) +BLAS_SOURCES = tuple( + sorted(path for path in NATIVE_ROOT.iterdir() if path.is_file() and path.suffix.lower() in FORTRAN_SUFFIXES) +) +BUILD_FLAGS = "-O0" +F2PY_INOUT_ARGUMENTS: dict[str, tuple[str, ...]] = { + "srotg": ("a", "b", "c", "s"), + "drotg": ("a", "b", "c", "s"), + "crotg": ("a", "c", "s"), + "zrotg": ("a", "c", "s"), + "srotmg": ("sd1", "sd2", "sx1", "sparam"), + "drotmg": ("dd1", "dd2", "dx1", "dparam"), +} + + +def build_environment(compiler: str, native_library: Path) -> dict[str, str]: + """Return the compiler and runtime-link environment for f2py.""" + environment = dict(os.environ) + environment.update( + { + "CFLAGS": BUILD_FLAGS, + "FC": compiler, + "F77": compiler, + "F90": compiler, + "FFLAGS": BUILD_FLAGS, + "F90FLAGS": BUILD_FLAGS, + } + ) + rpath_flag = f"-Wl,-rpath,{native_library.parent}" + environment["LDFLAGS"] = " ".join(filter(None, (environment.get("LDFLAGS"), rpath_flag))) + return environment + + +def f2py_signature_command(workdir: Path) -> tuple[str, ...]: + """Generate f2py signatures from reviewed build-local intent overlays.""" + sources = prepare_f2py_intent_sources(BLAS_SOURCES, workdir, F2PY_INOUT_ARGUMENTS) + return ( + sys.executable, + "-m", + "numpy.f2py", + "-m", + "f2py_reference_blas", + "-h", + str(workdir / "f2py_reference_blas.pyf"), + *(str(source) for source in sources), + "--overwrite-signature", + ) + + +def f2py_build_command(workdir: Path, native_library: Path) -> tuple[str, ...]: + """Build only f2py's wrapper and link the precompiled BLAS implementation.""" + return ( + sys.executable, + "-m", + "numpy.f2py", + "-c", + str(workdir / "f2py_reference_blas.pyf"), + f"-L{native_library.parent}", + f"-l{linker_name(native_library)}", + "--build-dir", + str(workdir / "generated"), + f"--f77flags={BUILD_FLAGS}", + f"--f90flags={BUILD_FLAGS}", + f"--opt={BUILD_FLAGS}", + ) + + +def build_f2py_wrapper(workdir: Path, native_library: Path, compiler: str) -> None: + """Generate and compile the f2py wrapper in one user-facing build directory.""" + workdir.mkdir(parents=True, exist_ok=True) + environment = build_environment(compiler, native_library) + for command in (f2py_signature_command(workdir), f2py_build_command(workdir, native_library)): + subprocess.run( # nosec B603 - explicit Python/f2py commands and copied example inputs + command, + cwd=workdir, + env=environment, + check=True, + ) + + +def main(argv: Sequence[str] | None = None) -> int: + """Build the documented f2py comparison wrapper.""" + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("workdir", type=Path) + parser.add_argument("native_library", type=Path) + parser.add_argument("--compiler", default=None) + args = parser.parse_args(argv) + compiler = args.compiler or require_tool("gfortran") + build_f2py_wrapper(args.workdir.resolve(), args.native_library.resolve(), compiler) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/examples/blas/f2py_contract.py b/examples/blas/f2py_contract.py deleted file mode 100644 index f720baac0..000000000 --- a/examples/blas/f2py_contract.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Reviewed f2py intent additions for Reference BLAS comparison calls.""" - -from __future__ import annotations - - -F2PY_INOUT_ARGUMENTS: dict[str, tuple[str, ...]] = { - "srotg": ("a", "b", "c", "s"), - "drotg": ("a", "b", "c", "s"), - "crotg": ("a", "c", "s"), - "zrotg": ("a", "c", "s"), - "srotmg": ("sd1", "sd2", "sx1", "sparam"), - "drotmg": ("dd1", "dd2", "dx1", "dparam"), -} diff --git a/examples/blas/tests/__init__.py b/examples/blas/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/examples/blas/helpers.py b/examples/blas/tests/helpers.py similarity index 100% rename from examples/blas/helpers.py rename to examples/blas/tests/helpers.py diff --git a/examples/blas/test_auxiliary.py b/examples/blas/tests/test_auxiliary.py similarity index 89% rename from examples/blas/test_auxiliary.py rename to examples/blas/tests/test_auxiliary.py index feb83b5c6..97250048d 100644 --- a/examples/blas/test_auxiliary.py +++ b/examples/blas/tests/test_auxiliary.py @@ -3,6 +3,7 @@ from __future__ import annotations import os +from pathlib import Path import subprocess import sys @@ -57,14 +58,14 @@ def test_lsame(prik_blas, f2py_blas): assert bool(prik_different) == bool(f2py_different) -def test_xerbla(prik_build, f2py_build): +def test_xerbla(prik_blas, f2py_blas): prik_environment = dict(os.environ) prik_environment["PYTHONPATH"] = os.pathsep.join( - filter(None, (str(prik_build.workdir), prik_environment.get("PYTHONPATH"))) + filter(None, (str(Path(prik_blas.__file__).resolve().parent), prik_environment.get("PYTHONPATH"))) ) f2py_environment = dict(os.environ) f2py_environment["PYTHONPATH"] = os.pathsep.join( - filter(None, (str(f2py_build.workdir), f2py_environment.get("PYTHONPATH"))) + filter(None, (str(Path(f2py_blas.__file__).resolve().parent), f2py_environment.get("PYTHONPATH"))) ) prik_result = subprocess.run( # nosec B603 - fixed interpreter and test program @@ -100,14 +101,14 @@ def test_xerbla(prik_build, f2py_build): assert f2py_result.stderr == "" -def test_xerbla_array(prik_build, f2py_build): +def test_xerbla_array(prik_blas, f2py_blas): prik_environment = dict(os.environ) prik_environment["PYTHONPATH"] = os.pathsep.join( - filter(None, (str(prik_build.workdir), prik_environment.get("PYTHONPATH"))) + filter(None, (str(Path(prik_blas.__file__).resolve().parent), prik_environment.get("PYTHONPATH"))) ) f2py_environment = dict(os.environ) f2py_environment["PYTHONPATH"] = os.pathsep.join( - filter(None, (str(f2py_build.workdir), f2py_environment.get("PYTHONPATH"))) + filter(None, (str(Path(f2py_blas.__file__).resolve().parent), f2py_environment.get("PYTHONPATH"))) ) prik_result = subprocess.run( # nosec B603 - fixed interpreter and test program diff --git a/examples/blas/test_level1_complex.py b/examples/blas/tests/test_level1_complex.py similarity index 100% rename from examples/blas/test_level1_complex.py rename to examples/blas/tests/test_level1_complex.py diff --git a/examples/blas/test_level1_real.py b/examples/blas/tests/test_level1_real.py similarity index 100% rename from examples/blas/test_level1_real.py rename to examples/blas/tests/test_level1_real.py diff --git a/examples/blas/test_level2_banded.py b/examples/blas/tests/test_level2_banded.py similarity index 100% rename from examples/blas/test_level2_banded.py rename to examples/blas/tests/test_level2_banded.py diff --git a/examples/blas/test_level2_general.py b/examples/blas/tests/test_level2_general.py similarity index 100% rename from examples/blas/test_level2_general.py rename to examples/blas/tests/test_level2_general.py diff --git a/examples/blas/test_level2_hermitian.py b/examples/blas/tests/test_level2_hermitian.py similarity index 100% rename from examples/blas/test_level2_hermitian.py rename to examples/blas/tests/test_level2_hermitian.py diff --git a/examples/blas/test_level2_packed.py b/examples/blas/tests/test_level2_packed.py similarity index 100% rename from examples/blas/test_level2_packed.py rename to examples/blas/tests/test_level2_packed.py diff --git a/examples/blas/test_level2_symmetric.py b/examples/blas/tests/test_level2_symmetric.py similarity index 100% rename from examples/blas/test_level2_symmetric.py rename to examples/blas/tests/test_level2_symmetric.py diff --git a/examples/blas/test_level2_triangular.py b/examples/blas/tests/test_level2_triangular.py similarity index 100% rename from examples/blas/test_level2_triangular.py rename to examples/blas/tests/test_level2_triangular.py diff --git a/examples/blas/test_level3_general.py b/examples/blas/tests/test_level3_general.py similarity index 100% rename from examples/blas/test_level3_general.py rename to examples/blas/tests/test_level3_general.py diff --git a/examples/blas/test_level3_hermitian.py b/examples/blas/tests/test_level3_hermitian.py similarity index 100% rename from examples/blas/test_level3_hermitian.py rename to examples/blas/tests/test_level3_hermitian.py diff --git a/examples/blas/test_level3_symmetric.py b/examples/blas/tests/test_level3_symmetric.py similarity index 100% rename from examples/blas/test_level3_symmetric.py rename to examples/blas/tests/test_level3_symmetric.py diff --git a/examples/blas/test_level3_triangular.py b/examples/blas/tests/test_level3_triangular.py similarity index 100% rename from examples/blas/test_level3_triangular.py rename to examples/blas/tests/test_level3_triangular.py diff --git a/examples/blas/test_routine_coverage.py b/examples/blas/tests/test_routine_coverage.py similarity index 81% rename from examples/blas/test_routine_coverage.py rename to examples/blas/tests/test_routine_coverage.py index 0a45f7e3b..3abb82b32 100644 --- a/examples/blas/test_routine_coverage.py +++ b/examples/blas/tests/test_routine_coverage.py @@ -8,17 +8,15 @@ import pytest -from examples.blas.f2py_contract import F2PY_INOUT_ARGUMENTS -from .conftest import ( +from prik.parsers.fortran.parser import parse_fortran_file + +from ..f2py_build import ( BLAS_SOURCES, - EXAMPLE_ROOT, - _contract_command, - _f2py_build_command, - _f2py_signature_command, - _prik_build_command, + F2PY_INOUT_ARGUMENTS, + f2py_build_command, + f2py_signature_command, ) -from prik.parsers.fortran.parser import parse_fortran_file -from .routine_inventory import ( +from ..routine_inventory import ( ALL_ROUTINES, DIFFERENTIALLY_TESTED_ROUTINES, EXPLICIT_TEST_NAMES, @@ -30,6 +28,8 @@ pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] +TEST_ROOT = Path(__file__).resolve().parent +EXAMPLE_ROOT = TEST_ROOT.parent TEST_MODULES = ( "test_level1_real.py", @@ -48,18 +48,11 @@ ) -def test_build_commands_use_the_documented_public_clis(tmp_path: Path): +def test_f2py_commands_generate_signatures_and_reuse_the_native_library(tmp_path: Path): native_library = tmp_path / "native" / "libprik_full_blas.so" - contract_entry = tmp_path / "prik" / "contract" / "blas" / "__init__.pyi" - contract_command = _contract_command(tmp_path / "prik") - prik_command = _prik_build_command(contract_entry, native_library, tmp_path / "prik", "/usr/bin/gfortran") - signature_command = _f2py_signature_command(tmp_path / "f2py") - f2py_command = _f2py_build_command(tmp_path / "f2py", native_library) - - assert contract_command[:5] == (sys.executable, "-m", "prik", "generate", "--pyi") - assert prik_command[:3] == (sys.executable, "-m", "prik") - assert prik_command[prik_command.index("--out") + 1] == "prik_reference_blas" - assert prik_command[prik_command.index("--native-objects") + 1] == str(native_library) + signature_command = f2py_signature_command(tmp_path / "f2py") + f2py_command = f2py_build_command(tmp_path / "f2py", native_library) + assert signature_command[:5] == (sys.executable, "-m", "numpy.f2py", "-m", "f2py_reference_blas") assert f2py_command[:4] == (sys.executable, "-m", "numpy.f2py", "-c") assert f"-L{native_library.parent}" in f2py_command @@ -69,12 +62,11 @@ def test_build_commands_use_the_documented_public_clis(tmp_path: Path): tmp_path / "f2py" / "f2py-intent-sources" / source.name if source.stem in F2PY_INOUT_ARGUMENTS else source ) assert str(expected_f2py_source) in signature_command - assert str(source) not in prik_command assert str(source) not in f2py_command def test_f2py_scalar_writeback_overlays_are_explicit(tmp_path: Path): - command = _f2py_signature_command(tmp_path) + command = f2py_signature_command(tmp_path) for routine, arguments in F2PY_INOUT_ARGUMENTS.items(): source = next(source for source in BLAS_SOURCES if source.stem == routine) @@ -95,7 +87,7 @@ def _source_routines() -> tuple[str, ...]: def _explicit_test_functions() -> dict[str, tuple[Path, ast.FunctionDef]]: functions: dict[str, tuple[Path, ast.FunctionDef]] = {} for filename in TEST_MODULES: - path = EXAMPLE_ROOT / filename + path = TEST_ROOT / filename tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path)) for node in tree.body: if isinstance(node, ast.FunctionDef) and node.name.startswith("test_"): @@ -119,9 +111,10 @@ def test_f2py_exports_every_expected_routine(f2py_blas): assert missing == [] -def test_both_wrappers_reuse_the_same_precompiled_native_library(prik_build, f2py_build): - assert prik_build.native_library == f2py_build.native_library - assert prik_build.native_library.name == "libprik_full_blas.so" +def test_documented_scripts_place_both_wrappers_under_one_build_root(prik_blas, f2py_blas): + prik_root = Path(prik_blas.__file__).resolve().parent.parent + f2py_root = Path(f2py_blas.__file__).resolve().parent.parent + assert prik_root == f2py_root def test_every_routine_has_one_visible_explicit_test(): diff --git a/examples/lapack/README.md b/examples/lapack/README.md index 94ac8c9fa..b2a263dae 100644 --- a/examples/lapack/README.md +++ b/examples/lapack/README.md @@ -44,8 +44,8 @@ sudo apt-get install libblas-dev liblapack-dev python3 -m pip install "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" "scipy==1.18.0" ``` -The session fixture uses the copyable builder in `examples/native_library.py`. -It performs these operations once: +The copyable builder in `examples/native_library.py` performs these operations +once when `build_all.sh` runs: 1. generate one semantic package for all LAPACK sources; 2. compile all 2,062 LAPACK sources plus required BLAS dependencies into one @@ -54,23 +54,35 @@ It performs these operations once: library; 4. generate f2py signatures for the 125 reviewed compatible routines and link its wrapper to the same shared library; and -5. reuse the three imported comparison surfaces for every correctness file; - CI explicitly adds the non-discovered `ci_full_surface.py` for the complete - PRIK root-export audit and runtime smoke call. +5. reuse the three imported comparison surfaces for every correctness file. The complete build is one command sequence: -```console -export LAPACK_SHARED_LIBRARY="$(python3 -m examples.native_library lapack --cache-dir /tmp/prik-lapack/native-cache)" -python3 -m prik generate --pyi examples/lapack/native --language fortran --out /tmp/prik-lapack/contracts/lapack + +```bash +export EXAMPLE_WORKSPACE="$PWD" +export LAPACK_BUILD_ROOT="$(mktemp -d)" +export LAPACK_SHARED_LIBRARY="$( + python -m examples.native_library lapack \ + --compiler "$(command -v gfortran)" \ + --jobs 8 +)" + +python -m prik generate \ + --pyi examples/lapack/native \ + --language fortran \ + --out "$LAPACK_BUILD_ROOT/contracts/lapack" + # Remove the LA_CONSTANTS and LA_XISNAN imports from the generated root contract. -python3 -c 'import sys; from pathlib import Path; p=Path(sys.argv[1]); s=p.read_text(encoding="utf-8") +python -c 'import sys; from pathlib import Path; p=Path(sys.argv[1]); s=p.read_text(encoding="utf-8") p.write_text(s.replace("from . import LA_CONSTANTS\n", "").replace("from . import LA_XISNAN\n", ""), encoding="utf-8")' \ - /tmp/prik-lapack/contracts/lapack/__init__.pyi -mkdir -p /tmp/prik-lapack/prik/generated -python3 -m prik /tmp/prik-lapack/contracts/lapack/__init__.pyi \ + "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" + +mkdir -p "$LAPACK_BUILD_ROOT/prik/generated" +cd "$LAPACK_BUILD_ROOT/prik" +python -m prik "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" \ --out prik_reference_lapack_example \ - --out-dir /tmp/prik-lapack/prik/generated \ + --out-dir "$LAPACK_BUILD_ROOT/prik/generated" \ --compiler "$(command -v gfortran)" \ --native-objects "$LAPACK_SHARED_LIBRARY" \ --jobs 8 \ @@ -79,12 +91,19 @@ python3 -m prik /tmp/prik-lapack/contracts/lapack/__init__.pyi \ ``` The short contract command removes only the internal `LA_CONSTANTS` and -`LA_XISNAN` root imports in place. All native sources remain in the shared -library. The paths are illustrative; `conftest.py` creates the actual temporary -locations and records the exact executable command. +`LA_XISNAN` root imports in place. The f2py build uses the same tested script: + + +```bash +cd "$EXAMPLE_WORKSPACE" +export LAPACK_F2PY_ROOT="$LAPACK_BUILD_ROOT/f2py" +python -m examples.lapack.f2py_build \ + "$LAPACK_F2PY_ROOT" \ + "$LAPACK_SHARED_LIBRARY" \ + --compiler "$(command -v gfortran)" +``` -The first call builds the library; an identical later call may reuse it. The -f2py commands are equivalent to: +The assembled f2py commands are equivalent to: ```console python3 -m numpy.f2py -m f2py_reference_lapack_example \ @@ -95,7 +114,7 @@ python3 -m numpy.f2py -m f2py_reference_lapack_example \ --f2cmap /tmp/prik-lapack/.f2py_f2cmap \ --overwrite-signature python3 -m numpy.f2py -c /tmp/prik-lapack/f2py_reference_lapack_example.pyf \ - -L/tmp/prik-lapack/native-cache/ -lprik_full_lapack \ + -L -lprik_full_lapack \ --f2cmap /tmp/prik-lapack/.f2py_f2cmap \ --build-dir /tmp/prik-lapack/f2py --f77flags=-O0 --f90flags=-O0 --opt=-O0 ``` @@ -108,11 +127,11 @@ support metadata is not counted as a selected routine. Those files provide signature information only. f2py compiles its generated wrapper and reuses the complete native artifact already linked by PRIK. -Build products stay in pytest temporary/cache directories. Failures report the -compiler identity, command, stdout, and stderr. Neither build dirties the +Build products stay outside the source tree. Neither build dirties the repository. -The fixtures import the complete PRIK module, the f2py comparison module, and +After `build_all.sh` completes, the fixtures import the complete PRIK module, +the f2py comparison module, and `scipy.linalg.lapack`. Character flags are Python `str` through PRIK and `bytes` through SciPy/f2py. PRIK retains the complete native argument order. f2py retains the order of the arguments it exposes, but infers and hides @@ -121,7 +140,7 @@ f2py call follows the generated wrapper signature. SciPy projects arrays and optional arguments into its documented Python API. Nine routines document essential scalar writebacks without declaring Fortran -`intent`. The f2py fixture adds build-local intent directives and passes typed +`intent`. The f2py build adds local intent directives, and the tests pass typed 0-D arrays so every writeback is validated. PRIK needs neither the overlay nor carrier arrays: it returns unannotated scalar writebacks directly. @@ -194,15 +213,15 @@ routine so a new conversion cannot be hidden in a generic adapter. The dedicated BLAS + LAPACK GitHub Actions lane runs runtime verification: ```console -python3 -m pytest -q examples/lapack -python3 -m pytest -q examples/lapack/test_linear_general.py -python3 -m pytest -q examples/lapack/test_linear_general.py::test_dgesv_solves_general_system -python3 -m pytest -q examples/lapack -k dgesvd +source examples/lapack/build_all.sh +python3 -m pytest -q examples/lapack/tests +python3 -m pytest -q examples/lapack/tests/test_linear_general.py +python3 -m pytest -q examples/lapack/tests/test_linear_general.py::test_dgesv_solves_general_system +python3 -m pytest -q examples/lapack/tests -k dgesvd ``` -The dedicated CI lane explicitly adds `ci_full_surface.py` to that same pytest -invocation. Its nonstandard filename keeps the maintainer-only audit out of -ordinary example runs while still reusing the already-built extensions. +User-run correctness tests live in `tests/`. The separate `ci/` directory owns +the maintainer-only full-surface audit. Repository policy leaves LAPACK wrapper/runtime execution to that lane unless a maintainer explicitly requests a local run. Local work may collect tests and run @@ -249,9 +268,9 @@ them. `prik_lapack`, `f2py_lapack`, and `scipy_lapack` are session-scoped pytest fixtures from [`conftest.py`](conftest.py). They provide the complete PRIK wrapper, the selected f2py comparison module, and SciPy's pinned low-level -LAPACK module. +LAPACK module to `tests/` after `build_all.sh` completes. -The tests use explicit mechanics from [`helpers.py`](helpers.py): +The tests use explicit mechanics from [`tests/helpers.py`](tests/helpers.py): | Helper | Responsibility | | --- | --- | @@ -266,7 +285,7 @@ The tests use explicit mechanics from [`helpers.py`](helpers.py): The helpers never invoke LAPACK and never hide a PRIK, SciPy, or f2py routine call. The source-verified examples below assume `import numpy as np` and the -corresponding imports from `helpers.py`, as shown in their linked test modules. +corresponding imports from `tests/helpers.py`, as shown in their linked test modules. ## Representative source-verified tests @@ -275,7 +294,7 @@ and fails if the displayed source diverges. ### DGESV - + ```python def test_dgesv_solves_general_system(prik_lapack, scipy_lapack, f2py_lapack): original_a = np.array([[3.0, 1.0], [1.0, 2.0]], dtype=np.float64) @@ -314,7 +333,7 @@ def test_dgesv_solves_general_system(prik_lapack, scipy_lapack, f2py_lapack): ### DGETRF - + ```python def test_dgetrf_reconstructs_pivoted_lu(prik_lapack, scipy_lapack, f2py_lapack): original = np.array([[0.0, 2.0], [3.0, 4.0]], dtype=np.float64) @@ -341,7 +360,7 @@ def test_dgetrf_reconstructs_pivoted_lu(prik_lapack, scipy_lapack, f2py_lapack): ### DPOTRF - + ```python def test_dpotrf_reconstructs_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): logical = np.array([[4.0, 1.0], [1.0, 3.0]], dtype=np.float64) @@ -369,7 +388,7 @@ def test_dpotrf_reconstructs_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): ### DGEQRF - + ```python def test_dgeqrf_reconstructs_qr_factorization(prik_lapack, scipy_lapack, f2py_lapack): matrix = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 7.0]], dtype=np.float64) @@ -399,7 +418,7 @@ def test_dgeqrf_reconstructs_qr_factorization(prik_lapack, scipy_lapack, f2py_la ### DSYEV - + ```python def test_dsyev_returns_orthonormal_eigenvectors(prik_lapack, scipy_lapack, f2py_lapack): matrix = np.array([[2.0, 1.0], [1.0, 2.0]], dtype=np.float64) @@ -429,7 +448,7 @@ def test_dsyev_returns_orthonormal_eigenvectors(prik_lapack, scipy_lapack, f2py_ ### DGESVD - + ```python def test_dgesvd_reconstructs_matrix(prik_lapack, scipy_lapack, f2py_lapack): matrix = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 7.0]], dtype=np.float64) @@ -477,7 +496,7 @@ def test_dgesvd_reconstructs_matrix(prik_lapack, scipy_lapack, f2py_lapack): ### DTBTRS (banded storage) - + ```python def test_dtbtrs_solves_triangular_band_system(prik_lapack, scipy_lapack, f2py_lapack): matrix = np.array([[2.0, 1.0], [0.0, 3.0]], dtype=np.float64) @@ -502,7 +521,7 @@ def test_dtbtrs_solves_triangular_band_system(prik_lapack, scipy_lapack, f2py_la ### DGECON (condition estimation) - + ```python def test_dgecon_estimates_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): factor = np.array([[4.0]], dtype=np.float64, order="F") diff --git a/examples/lapack/__init__.py b/examples/lapack/__init__.py index a6dce0b8b..e69de29bb 100644 --- a/examples/lapack/__init__.py +++ b/examples/lapack/__init__.py @@ -1 +0,0 @@ -"""Correctness example for the SciPy-exposed double-precision LAPACK API.""" diff --git a/examples/lapack/build_all.sh b/examples/lapack/build_all.sh new file mode 100644 index 000000000..a99544d65 --- /dev/null +++ b/examples/lapack/build_all.sh @@ -0,0 +1,3 @@ +source examples/lapack/build_prik.sh +source "$EXAMPLE_WORKSPACE/examples/lapack/build_f2py.sh" +export PYTHONPATH="$LAPACK_BUILD_ROOT/prik:$LAPACK_F2PY_ROOT${PYTHONPATH:+:$PYTHONPATH}" diff --git a/examples/lapack/build_f2py.sh b/examples/lapack/build_f2py.sh new file mode 100644 index 000000000..38ae685e6 --- /dev/null +++ b/examples/lapack/build_f2py.sh @@ -0,0 +1,6 @@ +cd "$EXAMPLE_WORKSPACE" +export LAPACK_F2PY_ROOT="$LAPACK_BUILD_ROOT/f2py" +python -m examples.lapack.f2py_build \ + "$LAPACK_F2PY_ROOT" \ + "$LAPACK_SHARED_LIBRARY" \ + --compiler "$(command -v gfortran)" diff --git a/examples/lapack/build_prik.sh b/examples/lapack/build_prik.sh new file mode 100644 index 000000000..ad702b02c --- /dev/null +++ b/examples/lapack/build_prik.sh @@ -0,0 +1,28 @@ +export EXAMPLE_WORKSPACE="$PWD" +export LAPACK_BUILD_ROOT="$(mktemp -d)" +export LAPACK_SHARED_LIBRARY="$( + python -m examples.native_library lapack \ + --compiler "$(command -v gfortran)" \ + --jobs 8 +)" + +python -m prik generate \ + --pyi examples/lapack/native \ + --language fortran \ + --out "$LAPACK_BUILD_ROOT/contracts/lapack" + +# Remove the LA_CONSTANTS and LA_XISNAN imports from the generated root contract. +python -c 'import sys; from pathlib import Path; p=Path(sys.argv[1]); s=p.read_text(encoding="utf-8") +p.write_text(s.replace("from . import LA_CONSTANTS\n", "").replace("from . import LA_XISNAN\n", ""), encoding="utf-8")' \ + "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" + +mkdir -p "$LAPACK_BUILD_ROOT/prik/generated" +cd "$LAPACK_BUILD_ROOT/prik" +python -m prik "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" \ + --out prik_reference_lapack_example \ + --out-dir "$LAPACK_BUILD_ROOT/prik/generated" \ + --compiler "$(command -v gfortran)" \ + --native-objects "$LAPACK_SHARED_LIBRARY" \ + --jobs 8 \ + --wrapper-fortran-flags="-O0 -g0" \ + --wrapper-c-flags="-O0 -g0" diff --git a/examples/lapack/ci/__init__.py b/examples/lapack/ci/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/examples/lapack/ci/full_surface.py b/examples/lapack/ci/full_surface.py new file mode 100644 index 000000000..46ebb4d3e --- /dev/null +++ b/examples/lapack/ci/full_surface.py @@ -0,0 +1,27 @@ +"""Maintainer-only complete-surface checks that reuse the LAPACK example build.""" + +from __future__ import annotations + +from pathlib import Path + +import pytest + +from ..routine_inventory import EXPECTED_LAPACK_ROOT_PROCEDURES +from examples.lapack.tests.helpers import assert_runtime_smoke +from prik.pipeline.pyi import pyi_paths_to_semantic_modules + + +pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] + + +def test_ci_complete_prik_surface_reuses_example_extension(prik_lapack): + build_root = Path(prik_lapack.__file__).resolve().parent.parent + runtime_package = build_root / "contracts" / "lapack" + modules = pyi_paths_to_semantic_modules([runtime_package]) + root = next(module for module in modules if module.name == "__init__") + expected = {function.name for function in root.functions} + assert len(expected) == EXPECTED_LAPACK_ROOT_PROCEDURES + + missing = sorted(name for name in expected if not callable(getattr(prik_lapack, name, None))) + assert missing == [] + assert_runtime_smoke(prik_lapack) diff --git a/examples/lapack/ci_full_surface.py b/examples/lapack/ci_full_surface.py deleted file mode 100644 index b23ae9962..000000000 --- a/examples/lapack/ci_full_surface.py +++ /dev/null @@ -1,22 +0,0 @@ -"""Maintainer-only complete-surface checks that reuse the LAPACK example build.""" - -from __future__ import annotations - -import pytest - -from .contracts import root_function_names -from .helpers import assert_runtime_smoke -from .routine_inventory import EXPECTED_LAPACK_ROOT_PROCEDURES - - -pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] - - -def test_ci_complete_prik_surface_reuses_example_extension(prik_build): - runtime_package = prik_build.workdir / "contracts" / "lapack" - expected = root_function_names(runtime_package) - assert len(expected) == EXPECTED_LAPACK_ROOT_PROCEDURES - - missing = sorted(name for name in expected if not callable(getattr(prik_build.module, name, None))) - assert missing == [] - assert_runtime_smoke(prik_build.module) diff --git a/examples/lapack/conftest.py b/examples/lapack/conftest.py index 2da6efa4e..2b43a8f07 100644 --- a/examples/lapack/conftest.py +++ b/examples/lapack/conftest.py @@ -1,296 +1,34 @@ -"""Build one native LAPACK library and reuse it through PRIK and f2py.""" +"""Import fixtures for the wrappers produced by ``build_all.sh``.""" -from __future__ import annotations - -from dataclasses import dataclass import importlib import os -from pathlib import Path -import shlex -import subprocess import sys import pytest -from examples.f2py_intents import prepare_f2py_intent_sources -from examples.native_library import ( - NativeLibrary, - build_reference_library, - compiler_identity, - linker_name, - native_cache_root, - require_tool, -) - -from .contracts import remove_internal_root_imports -from .f2py_contract import F2PY_INOUT_ARGUMENTS -from .routine_inventory import F2PY_EXPORT_LIMITATIONS, ROUTINES, SCIPY_VERSION - - -EXAMPLE_ROOT = Path(__file__).resolve().parent -NATIVE_ROOT = EXAMPLE_ROOT / "native" -BUILD_FLAGS = "-O0" -PRIK_WRAPPER_FLAGS = ("-O0", "-g0") -FORTRAN_SUFFIXES = (".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn") -F2PY_BUILD_DEPENDENCIES = ("la_constants.f90",) -F2PY_KIND_MAP = "{'real': {'wp': 'double'}}\n" - - -@dataclass(frozen=True) -class BuiltLapack: - """One imported wrapper and the evidence needed to diagnose its build.""" - - module: object - module_name: str - workdir: Path - command: tuple[str, ...] - compiler_identity: str - stdout: str - stderr: str - native_library: Path - - -def _compiler() -> str: - try: - return require_tool("gfortran") - except RuntimeError as error: - pytest.skip(str(error)) - +from .routine_inventory import SCIPY_VERSION -def _build_environment(compiler: str, native_library: Path | None = None) -> dict[str, str]: - environment = dict(os.environ) - environment.update( - { - "CFLAGS": BUILD_FLAGS, - "FC": compiler, - "F77": compiler, - "F90": compiler, - "FFLAGS": BUILD_FLAGS, - "F90FLAGS": BUILD_FLAGS, - } - ) - if native_library is not None: - rpath_flag = f"-Wl,-rpath,{native_library.parent}" - environment["LDFLAGS"] = " ".join(filter(None, (environment.get("LDFLAGS"), rpath_flag))) - return environment - -def _run_build( - command: tuple[str, ...], - workdir: Path, - compiler: str, - native_library: Path | None = None, -) -> subprocess.CompletedProcess[str]: - result = subprocess.run( # nosec B603 - fixed tools and copied example inputs - command, - cwd=workdir, - env=_build_environment(compiler, native_library), - capture_output=True, - text=True, - check=False, - ) - if result.returncode: - pytest.fail( - "Reference LAPACK build failed\n" - f"compiler: {compiler_identity(compiler)}\n" - f"command: {shlex.join(command)}\n" - f"stdout:\n{result.stdout or ''}\n" - f"stderr:\n{result.stderr or ''}" - ) - return result - - -def _import_built_module(module_name: str, workdir: Path): - sys.modules.pop(module_name, None) - sys.path.insert(0, str(workdir)) +@pytest.fixture(scope="session") +def prik_lapack(): + """Return the already-built PRIK LAPACK module.""" old_flags = sys.getdlopenflags() sys.setdlopenflags(getattr(os, "RTLD_LAZY", old_flags) | getattr(os, "RTLD_GLOBAL", 0)) try: - return importlib.import_module(module_name) + return importlib.import_module("prik_reference_lapack_example") finally: sys.setdlopenflags(old_flags) - sys.path.remove(str(workdir)) - - -def _selected_source(routine: str) -> Path: - """Resolve one reviewed routine to its authoritative native source file.""" - matches = tuple(path for suffix in FORTRAN_SUFFIXES if (path := NATIVE_ROOT / f"{routine}{suffix}").is_file()) - if len(matches) != 1: - raise FileNotFoundError( - f"expected exactly one authoritative source for {routine}, found {[str(path) for path in matches]}" - ) - return matches[0] - - -def _f2py_source_plan(workdir: Path) -> tuple[Path, ...]: - """Return reviewed signatures with intent overlays and their kind dependency.""" - dependencies = tuple(NATIVE_ROOT / name for name in F2PY_BUILD_DEPENDENCIES) - missing_dependencies = [str(path) for path in dependencies if not path.is_file()] - if missing_dependencies: - raise FileNotFoundError(f"missing f2py signature dependencies: {missing_dependencies}") - selected = tuple(_selected_source(name) for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) - return prepare_f2py_intent_sources(dependencies + selected, workdir, F2PY_INOUT_ARGUMENTS) - - -def _f2py_signature_command(workdir: Path) -> tuple[str, ...]: - """Generate reviewed f2py signatures without compiling implementations.""" - module_name = "f2py_reference_lapack_example" - f2cmap = workdir / ".f2py_f2cmap" - f2cmap.write_text(F2PY_KIND_MAP, encoding="utf-8") - selected_routines = tuple(name for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) - return ( - sys.executable, - "-m", - "numpy.f2py", - "-m", - module_name, - "-h", - str(workdir / f"{module_name}.pyf"), - *(str(source) for source in _f2py_source_plan(workdir)), - "only:", - *selected_routines, - ":", - "--f2cmap", - str(f2cmap), - "--overwrite-signature", - ) - - -def _f2py_build_command(workdir: Path, native_library: Path) -> tuple[str, ...]: - """Build only f2py's wrapper and link the precompiled LAPACK implementation.""" - module_name = "f2py_reference_lapack_example" - return ( - sys.executable, - "-m", - "numpy.f2py", - "-c", - str(workdir / f"{module_name}.pyf"), - f"-L{native_library.parent}", - f"-l{linker_name(native_library)}", - "--f2cmap", - str(workdir / ".f2py_f2cmap"), - "--build-dir", - str(workdir / "generated"), - f"--f77flags={BUILD_FLAGS}", - f"--f90flags={BUILD_FLAGS}", - f"--opt={BUILD_FLAGS}", - ) - - -def _contract_command(workdir: Path) -> tuple[str, ...]: - """Generate the complete LAPACK semantic contract through the public CLI.""" - return ( - sys.executable, - "-m", - "prik", - "generate", - "--pyi", - str(NATIVE_ROOT), - "--language", - "fortran", - "--out", - str(workdir / "contracts" / "lapack"), - ) - - -def _prik_build_command( - runtime_entry: Path, - native_library: Path, - workdir: Path, - compiler: str, -) -> tuple[str, ...]: - """Build the projected complete-library contract through PRIK's public CLI.""" - jobs = max(1, min(os.cpu_count() or 1, 8)) - joined_wrapper_flags = " ".join(PRIK_WRAPPER_FLAGS) - return ( - sys.executable, - "-m", - "prik", - str(runtime_entry), - "--out", - "prik_reference_lapack_example", - "--out-dir", - str(workdir / "generated"), - "--compiler", - compiler, - "--native-objects", - str(native_library), - "--jobs", - str(jobs), - f"--wrapper-fortran-flags={joined_wrapper_flags}", - f"--wrapper-c-flags={joined_wrapper_flags}", - ) @pytest.fixture(scope="session") -def native_build(tmp_path_factory: pytest.TempPathFactory) -> NativeLibrary: - """Compile complete LAPACK plus its BLAS dependencies once for both wrappers.""" - compiler = _compiler() - cache_root = ( - native_cache_root() - if os.environ.get("PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR") - else tmp_path_factory.mktemp("reference-lapack-native") - ) +def f2py_lapack(): + """Return the already-built f2py LAPACK module.""" + old_flags = sys.getdlopenflags() + sys.setdlopenflags(getattr(os, "RTLD_LAZY", old_flags) | getattr(os, "RTLD_GLOBAL", 0)) try: - return build_reference_library("lapack", cache_root=cache_root, compiler=compiler) - except (RuntimeError, subprocess.CalledProcessError) as error: - pytest.fail(f"Reference LAPACK native build failed with {compiler_identity(compiler)}\n{error}") - - -@pytest.fixture(scope="session") -def prik_build(tmp_path_factory: pytest.TempPathFactory, native_build: NativeLibrary) -> BuiltLapack: - """Build the complete LAPACK wrapper through PRIK's public CLI once.""" - compiler = native_build.compiler - workdir = tmp_path_factory.mktemp("prik-reference-lapack-example") - _run_build(_contract_command(workdir), workdir, compiler) - entry = workdir / "contracts" / "lapack" / "__init__.pyi" - runtime_entry = remove_internal_root_imports(entry) - module_name = "prik_reference_lapack_example" - command = _prik_build_command(runtime_entry, native_build.shared_library, workdir, compiler) - result = _run_build(command, workdir, compiler) - return BuiltLapack( - module=_import_built_module(module_name, workdir), - module_name=module_name, - workdir=workdir, - command=command, - compiler_identity=compiler_identity(compiler), - stdout=result.stdout, - stderr=result.stderr, - native_library=native_build.shared_library, - ) - - -@pytest.fixture(scope="session") -def prik_lapack(prik_build: BuiltLapack): - """Return the complete session-scoped PRIK LAPACK module.""" - return prik_build.module - - -@pytest.fixture(scope="session") -def f2py_build(tmp_path_factory: pytest.TempPathFactory, native_build: NativeLibrary) -> BuiltLapack: - """Build f2py against the same complete native LAPACK library.""" - compiler = native_build.compiler - workdir = tmp_path_factory.mktemp("f2py-reference-lapack-example") - _run_build(_f2py_signature_command(workdir), workdir, compiler) - module_name = "f2py_reference_lapack_example" - command = _f2py_build_command(workdir, native_build.shared_library) - result = _run_build(command, workdir, compiler, native_build.shared_library) - return BuiltLapack( - module=_import_built_module(module_name, workdir), - module_name=module_name, - workdir=workdir, - command=command, - compiler_identity=compiler_identity(compiler), - stdout=result.stdout, - stderr=result.stderr, - native_library=native_build.shared_library, - ) - - -@pytest.fixture(scope="session") -def f2py_lapack(f2py_build: BuiltLapack): - """Return the session-scoped f2py comparison module.""" - return f2py_build.module + return importlib.import_module("f2py_reference_lapack_example") + finally: + sys.setdlopenflags(old_flags) @pytest.fixture(scope="session") diff --git a/examples/lapack/contracts.py b/examples/lapack/contracts.py deleted file mode 100644 index 1ab4a7b9e..000000000 --- a/examples/lapack/contracts.py +++ /dev/null @@ -1,27 +0,0 @@ -"""Helpers for LAPACK's generated root-only runtime contract.""" - -from __future__ import annotations - -from pathlib import Path - -from prik.pipeline.pyi import pyi_paths_to_semantic_modules - - -RUNTIME_EXCLUDED_IMPORTS = frozenset({"from . import LA_CONSTANTS\n", "from . import LA_XISNAN\n"}) - - -def remove_internal_root_imports(entry: Path) -> Path: - """Remove internal module imports from a generated LAPACK root contract.""" - lines = entry.read_text(encoding="utf-8").splitlines(keepends=True) - entry.write_text( - "".join(line for line in lines if line not in RUNTIME_EXCLUDED_IMPORTS), - encoding="utf-8", - ) - return entry - - -def root_function_names(package: Path) -> set[str]: - """Return the generated callable names owned by the root contract.""" - modules = pyi_paths_to_semantic_modules([package]) - root = next(module for module in modules if module.name == "__init__") - return {function.name for function in root.functions} diff --git a/examples/lapack/f2py_build.py b/examples/lapack/f2py_build.py new file mode 100644 index 000000000..4e74e13a1 --- /dev/null +++ b/examples/lapack/f2py_build.py @@ -0,0 +1,145 @@ +"""Build the reviewed f2py LAPACK wrapper against one native shared library.""" + +from __future__ import annotations + +import argparse +import os +import subprocess +import sys +from collections.abc import Sequence +from pathlib import Path + +from examples.f2py_intents import prepare_f2py_intent_sources +from examples.native_library import linker_name, require_tool + +from .routine_inventory import F2PY_EXPORT_LIMITATIONS, ROUTINES + + +EXAMPLE_ROOT = Path(__file__).resolve().parent +NATIVE_ROOT = EXAMPLE_ROOT / "native" +BUILD_FLAGS = "-O0" +FORTRAN_SUFFIXES = (".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn") +F2PY_BUILD_DEPENDENCIES = ("la_constants.f90",) +F2PY_KIND_MAP = "{'real': {'wp': 'double'}}\n" +F2PY_INOUT_ARGUMENTS: dict[str, tuple[str, ...]] = { + "dlarfg": ("alpha", "tau"), + "dlartg": ("c", "s", "r"), + "dgbcon": ("rcond", "info"), + "dgecon": ("rcond", "info"), + "dgtcon": ("rcond", "info"), + "dpocon": ("rcond", "info"), + "dppcon": ("rcond", "info"), + "dsycon": ("rcond", "info"), + "dtrcon": ("rcond", "info"), +} + + +def build_environment(compiler: str, native_library: Path) -> dict[str, str]: + """Return the compiler and runtime-link environment for f2py.""" + environment = dict(os.environ) + environment.update( + { + "CFLAGS": BUILD_FLAGS, + "FC": compiler, + "F77": compiler, + "F90": compiler, + "FFLAGS": BUILD_FLAGS, + "F90FLAGS": BUILD_FLAGS, + } + ) + rpath_flag = f"-Wl,-rpath,{native_library.parent}" + environment["LDFLAGS"] = " ".join(filter(None, (environment.get("LDFLAGS"), rpath_flag))) + return environment + + +def _selected_source(routine: str) -> Path: + matches = tuple(path for suffix in FORTRAN_SUFFIXES if (path := NATIVE_ROOT / f"{routine}{suffix}").is_file()) + if len(matches) != 1: + raise FileNotFoundError( + f"expected exactly one authoritative source for {routine}, found {[str(path) for path in matches]}" + ) + return matches[0] + + +def f2py_source_plan(workdir: Path) -> tuple[Path, ...]: + """Return reviewed signatures with intent overlays and their kind dependency.""" + dependencies = tuple(NATIVE_ROOT / name for name in F2PY_BUILD_DEPENDENCIES) + missing_dependencies = [str(path) for path in dependencies if not path.is_file()] + if missing_dependencies: + raise FileNotFoundError(f"missing f2py signature dependencies: {missing_dependencies}") + selected = tuple(_selected_source(name) for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) + return prepare_f2py_intent_sources(dependencies + selected, workdir, F2PY_INOUT_ARGUMENTS) + + +def f2py_signature_command(workdir: Path) -> tuple[str, ...]: + """Generate reviewed f2py signatures without compiling implementations.""" + module_name = "f2py_reference_lapack_example" + f2cmap = workdir / ".f2py_f2cmap" + f2cmap.write_text(F2PY_KIND_MAP, encoding="utf-8") + selected_routines = tuple(name for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) + return ( + sys.executable, + "-m", + "numpy.f2py", + "-m", + module_name, + "-h", + str(workdir / f"{module_name}.pyf"), + *(str(source) for source in f2py_source_plan(workdir)), + "only:", + *selected_routines, + ":", + "--f2cmap", + str(f2cmap), + "--overwrite-signature", + ) + + +def f2py_build_command(workdir: Path, native_library: Path) -> tuple[str, ...]: + """Build only f2py's wrapper and link the precompiled LAPACK implementation.""" + module_name = "f2py_reference_lapack_example" + return ( + sys.executable, + "-m", + "numpy.f2py", + "-c", + str(workdir / f"{module_name}.pyf"), + f"-L{native_library.parent}", + f"-l{linker_name(native_library)}", + "--f2cmap", + str(workdir / ".f2py_f2cmap"), + "--build-dir", + str(workdir / "generated"), + f"--f77flags={BUILD_FLAGS}", + f"--f90flags={BUILD_FLAGS}", + f"--opt={BUILD_FLAGS}", + ) + + +def build_f2py_wrapper(workdir: Path, native_library: Path, compiler: str) -> None: + """Generate and compile the f2py wrapper in one user-facing build directory.""" + workdir.mkdir(parents=True, exist_ok=True) + environment = build_environment(compiler, native_library) + for command in (f2py_signature_command(workdir), f2py_build_command(workdir, native_library)): + subprocess.run( # nosec B603 - explicit Python/f2py commands and copied example inputs + command, + cwd=workdir, + env=environment, + check=True, + ) + + +def main(argv: Sequence[str] | None = None) -> int: + """Build the documented f2py comparison wrapper.""" + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("workdir", type=Path) + parser.add_argument("native_library", type=Path) + parser.add_argument("--compiler", default=None) + args = parser.parse_args(argv) + compiler = args.compiler or require_tool("gfortran") + build_f2py_wrapper(args.workdir.resolve(), args.native_library.resolve(), compiler) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/examples/lapack/f2py_contract.py b/examples/lapack/f2py_contract.py deleted file mode 100644 index a389f5233..000000000 --- a/examples/lapack/f2py_contract.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Reviewed f2py intent additions for Reference LAPACK comparison calls.""" - -from __future__ import annotations - - -F2PY_INOUT_ARGUMENTS: dict[str, tuple[str, ...]] = { - "dlarfg": ("alpha", "tau"), - "dlartg": ("c", "s", "r"), - "dgbcon": ("rcond", "info"), - "dgecon": ("rcond", "info"), - "dgtcon": ("rcond", "info"), - "dpocon": ("rcond", "info"), - "dppcon": ("rcond", "info"), - "dsycon": ("rcond", "info"), - "dtrcon": ("rcond", "info"), -} diff --git a/examples/lapack/routine_inventory.py b/examples/lapack/routine_inventory.py index f6b6d5028..53c751e59 100644 --- a/examples/lapack/routine_inventory.py +++ b/examples/lapack/routine_inventory.py @@ -4,12 +4,12 @@ from dataclasses import dataclass -from .f2py_contract import F2PY_INOUT_ARGUMENTS - - SCIPY_VERSION = "1.18.0" EXPECTED_LAPACK_SOURCE_FILES = 2062 EXPECTED_LAPACK_ROOT_PROCEDURES = 2064 +F2PY_SCALAR_WRITEBACK_ROUTINES = frozenset( + {"dlarfg", "dlartg", "dgbcon", "dgecon", "dgtcon", "dpocon", "dppcon", "dsycon", "dtrcon"} +) F2PY_FUNCTION_RESULTS = frozenset({"dlamch", "dlangb", "dlange", "dlantr"}) ROUTINE_GROUPS = { @@ -480,7 +480,7 @@ class RoutineSpec: name, ( "build-local intent directives expose caller-owned scalar writeback storage" - if name in F2PY_INOUT_ARGUMENTS + if name in F2PY_SCALAR_WRITEBACK_ROUTINES else "none" ), ), diff --git a/examples/lapack/tests/__init__.py b/examples/lapack/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/examples/lapack/helpers.py b/examples/lapack/tests/helpers.py similarity index 100% rename from examples/lapack/helpers.py rename to examples/lapack/tests/helpers.py diff --git a/examples/lapack/test_auxiliary.py b/examples/lapack/tests/test_auxiliary.py similarity index 100% rename from examples/lapack/test_auxiliary.py rename to examples/lapack/tests/test_auxiliary.py diff --git a/examples/lapack/test_eigen_generalized.py b/examples/lapack/tests/test_eigen_generalized.py similarity index 100% rename from examples/lapack/test_eigen_generalized.py rename to examples/lapack/tests/test_eigen_generalized.py diff --git a/examples/lapack/test_eigen_nonsymmetric.py b/examples/lapack/tests/test_eigen_nonsymmetric.py similarity index 100% rename from examples/lapack/test_eigen_nonsymmetric.py rename to examples/lapack/tests/test_eigen_nonsymmetric.py diff --git a/examples/lapack/test_eigen_symmetric.py b/examples/lapack/tests/test_eigen_symmetric.py similarity index 100% rename from examples/lapack/test_eigen_symmetric.py rename to examples/lapack/tests/test_eigen_symmetric.py diff --git a/examples/lapack/test_least_squares.py b/examples/lapack/tests/test_least_squares.py similarity index 100% rename from examples/lapack/test_least_squares.py rename to examples/lapack/tests/test_least_squares.py diff --git a/examples/lapack/test_linear_banded_tridiagonal.py b/examples/lapack/tests/test_linear_banded_tridiagonal.py similarity index 100% rename from examples/lapack/test_linear_banded_tridiagonal.py rename to examples/lapack/tests/test_linear_banded_tridiagonal.py diff --git a/examples/lapack/test_linear_general.py b/examples/lapack/tests/test_linear_general.py similarity index 100% rename from examples/lapack/test_linear_general.py rename to examples/lapack/tests/test_linear_general.py diff --git a/examples/lapack/test_linear_positive_definite.py b/examples/lapack/tests/test_linear_positive_definite.py similarity index 100% rename from examples/lapack/test_linear_positive_definite.py rename to examples/lapack/tests/test_linear_positive_definite.py diff --git a/examples/lapack/test_linear_symmetric_indefinite.py b/examples/lapack/tests/test_linear_symmetric_indefinite.py similarity index 100% rename from examples/lapack/test_linear_symmetric_indefinite.py rename to examples/lapack/tests/test_linear_symmetric_indefinite.py diff --git a/examples/lapack/test_linear_triangular.py b/examples/lapack/tests/test_linear_triangular.py similarity index 100% rename from examples/lapack/test_linear_triangular.py rename to examples/lapack/tests/test_linear_triangular.py diff --git a/examples/lapack/test_orthogonal_factorizations.py b/examples/lapack/tests/test_orthogonal_factorizations.py similarity index 100% rename from examples/lapack/test_orthogonal_factorizations.py rename to examples/lapack/tests/test_orthogonal_factorizations.py diff --git a/examples/lapack/test_routine_coverage.py b/examples/lapack/tests/test_routine_coverage.py similarity index 81% rename from examples/lapack/test_routine_coverage.py rename to examples/lapack/tests/test_routine_coverage.py index 789ceda18..4cb5c999d 100644 --- a/examples/lapack/test_routine_coverage.py +++ b/examples/lapack/tests/test_routine_coverage.py @@ -8,23 +8,21 @@ import pytest -from .conftest import ( +from ..f2py_build import ( F2PY_BUILD_DEPENDENCIES, + F2PY_INOUT_ARGUMENTS, F2PY_KIND_MAP, - PRIK_WRAPPER_FLAGS, - _f2py_build_command, - _f2py_signature_command, - _f2py_source_plan, - _prik_build_command, + f2py_build_command, + f2py_signature_command, + f2py_source_plan, ) -from .contracts import remove_internal_root_imports -from .f2py_contract import F2PY_INOUT_ARGUMENTS -from .routine_inventory import ( +from ..routine_inventory import ( EXPLICIT_TEST_NAMES, EXPECTED_LAPACK_ROOT_PROCEDURES, EXPECTED_LAPACK_SOURCE_FILES, F2PY_EXPORT_LIMITATIONS, F2PY_FUNCTION_RESULTS, + F2PY_SCALAR_WRITEBACK_ROUTINES, PRIK_ABI_ADAPTERS, ROUTINE_FAMILIES, ROUTINE_GROUPS, @@ -34,7 +32,8 @@ ) -EXAMPLE_ROOT = Path(__file__).resolve().parent +TEST_ROOT = Path(__file__).resolve().parent +EXAMPLE_ROOT = TEST_ROOT.parent NATIVE_ROOT = EXAMPLE_ROOT / "native" FORTRAN_SUFFIXES = {".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"} pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] @@ -42,7 +41,7 @@ def _explicit_test_owners() -> dict[str, list[tuple[str, Path]]]: owners: dict[str, list[tuple[str, Path]]] = {} - for path in sorted(EXAMPLE_ROOT.glob("test_*.py")): + for path in sorted(TEST_ROOT.glob("test_*.py")): tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path)) for node in tree.body: if not isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)): @@ -92,6 +91,7 @@ def test_inventory_groups_form_one_complete_partition(): assert len(set(grouped)) == len(grouped) assert set(ROUTINE_FAMILIES) == set(ROUTINES) assert set(ROUTINE_SPECS) == set(ROUTINES) + assert set(F2PY_INOUT_ARGUMENTS) == F2PY_SCALAR_WRITEBACK_ROUTINES for routine, spec in ROUTINE_SPECS.items(): assert spec.native_name == routine assert spec.family == ROUTINE_FAMILIES[routine] @@ -118,7 +118,7 @@ def test_inventory_groups_form_one_complete_partition(): def test_f2py_source_plan_includes_required_kind_module(tmp_path: Path): """Signature discovery covers every selected implementation and reviewed overlay.""" - plan = _f2py_source_plan(tmp_path) + plan = f2py_source_plan(tmp_path) dependency_count = len(F2PY_BUILD_DEPENDENCIES) assert tuple(path.name for path in plan[:dependency_count]) == F2PY_BUILD_DEPENDENCIES assert {path.stem for path in plan[dependency_count:]} == set(ROUTINES) - set(F2PY_EXPORT_LIMITATIONS) @@ -131,7 +131,7 @@ def test_f2py_source_plan_includes_required_kind_module(tmp_path: Path): assert source.parent == tmp_path / "f2py-intent-sources" assert f"{prefix} intent(inout) {', '.join(arguments)}" in source.read_text(encoding="utf-8") - command = _f2py_signature_command(tmp_path) + command = f2py_signature_command(tmp_path) assert "only:" in command assert ":" in command assert (tmp_path / ".f2py_f2cmap").read_text(encoding="utf-8") == F2PY_KIND_MAP @@ -139,7 +139,7 @@ def test_f2py_source_plan_includes_required_kind_module(tmp_path: Path): def test_f2py_build_command_reuses_the_precompiled_native_library(tmp_path: Path): native_library = tmp_path / "native" / "libprik_full_lapack.so" - command = _f2py_build_command(tmp_path, native_library) + command = f2py_build_command(tmp_path, native_library) assert command[:4] == (sys.executable, "-m", "numpy.f2py", "-c") assert str(tmp_path / "f2py_reference_lapack_example.pyf") in command @@ -149,38 +149,10 @@ def test_f2py_build_command_reuses_the_precompiled_native_library(tmp_path: Path assert not any(str(NATIVE_ROOT) in value for value in command) -def test_both_wrappers_reuse_the_same_precompiled_native_library(prik_build, f2py_build): - assert prik_build.native_library == f2py_build.native_library - assert prik_build.native_library.name == "libprik_full_lapack.so" - - -def test_prik_build_command_uses_the_public_cli(tmp_path: Path): - """The documented LAPACK wrapper build is a real PRIK CLI invocation.""" - runtime_entry = tmp_path / "runtime" / "__init__.pyi" - native_library = tmp_path / "libprik_full_lapack.so" - command = _prik_build_command(runtime_entry, native_library, tmp_path, "/usr/bin/gfortran") - - assert command[:4] == (sys.executable, "-m", "prik", str(runtime_entry)) - assert command[command.index("--native-objects") + 1] == str(native_library) - assert "--native-shared-library" not in command - joined_flags = " ".join(PRIK_WRAPPER_FLAGS) - assert f"--wrapper-fortran-flags={joined_flags}" in command - assert f"--wrapper-c-flags={joined_flags}" in command - - -def test_runtime_contract_edit_removes_internal_imports_in_place(tmp_path: Path): - generated_package = tmp_path / "contracts" / "lapack" - generated_package.mkdir(parents=True) - entry = generated_package / "__init__.pyi" - entry.write_text( - "from . import LA_CONSTANTS\nfrom . import LA_XISNAN\ndef dgesv() -> None: ...\n", - encoding="utf-8", - ) - - runtime_entry = remove_internal_root_imports(entry) - - assert runtime_entry == entry - assert entry.read_text(encoding="utf-8") == "def dgesv() -> None: ...\n" +def test_documented_scripts_place_both_wrappers_under_one_build_root(prik_lapack, f2py_lapack): + prik_root = Path(prik_lapack.__file__).resolve().parent.parent + f2py_root = Path(f2py_lapack.__file__).resolve().parent.parent + assert prik_root == f2py_root def test_authoritative_native_source_boundary_is_complete_and_unique(): diff --git a/examples/lapack/test_svd.py b/examples/lapack/tests/test_svd.py similarity index 100% rename from examples/lapack/test_svd.py rename to examples/lapack/tests/test_svd.py diff --git a/pyproject.toml b/pyproject.toml index 578a9d776..2ecbd9633 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -110,7 +110,6 @@ extend-exclude = [ "tests/c/fixtures/pyi", "tests/fortran/*/end_to_end/fixtures", "tests/fortran/*/pipeline/fixtures", - "tests/fortran/building_shared_library/end_to_end/real_libraries/*/contracts", "tests/fortran/pyi_contracts/*/end_to_end/fixtures", "tests/fortran/semantic_pyi_format/pipeline/fixtures", "prik.egg-info", @@ -153,7 +152,6 @@ exclude = [ "tests/c/fixtures/pyi/", "tests/fortran/*/end_to_end/fixtures/", "tests/fortran/*/pipeline/fixtures/", - "tests/fortran/building_shared_library/end_to_end/real_libraries/*/contracts/", "tests/fortran/pyi_contracts/*/end_to_end/fixtures/", "tests/fortran/semantic_pyi_format/pipeline/fixtures/", "prik.egg-info/", diff --git a/tests/architecture/fortran/test_language_ownership.py b/tests/architecture/fortran/test_language_ownership.py index 4cb92e3be..aeadb60db 100644 --- a/tests/architecture/fortran/test_language_ownership.py +++ b/tests/architecture/fortran/test_language_ownership.py @@ -13,7 +13,6 @@ FEATURE_ROOT = FORTRAN_ROOT FORTRAN_INDEX = FORTRAN_ROOT / "README.md" ROADMAP = REPO_ROOT / "docs/maintainer/roadmap/fortran-test-suite-cleanup-checklist.md" -REAL_LIBRARY_ROOT = FEATURE_ROOT / "building_shared_library" / "end_to_end" / "real_libraries" BLAS_EXAMPLE_ROOT = REPO_ROOT / "examples" / "blas" LAPACK_EXAMPLE_ROOT = REPO_ROOT / "examples" / "lapack" @@ -183,13 +182,10 @@ def test_fortran_index_names_every_infrastructure_owner() -> None: def test_real_library_examples_have_single_native_source_owners() -> None: - assert {path.name for path in REAL_LIBRARY_ROOT.glob("test_*.py")} == {"test_full_libraries.py"} - assert {path.name for path in REAL_LIBRARY_ROOT.iterdir() if path.is_dir() and path.name != "__pycache__"} == set() assert (BLAS_EXAMPLE_ROOT / "native").is_dir() assert (LAPACK_EXAMPLE_ROOT / "native").is_dir() assert len(tuple((BLAS_EXAMPLE_ROOT / "native").iterdir())) == 155 assert len(tuple((LAPACK_EXAMPLE_ROOT / "native").iterdir())) == 2062 - assert sorted(REAL_LIBRARY_ROOT.rglob("*.pyi")) == [] def test_final_language_roots_do_not_cross_import_or_read_fixtures() -> None: diff --git a/tests/architecture/fortran/test_smoke_selection.py b/tests/architecture/fortran/test_smoke_selection.py index 70b86ce1b..e49cc73e2 100644 --- a/tests/architecture/fortran/test_smoke_selection.py +++ b/tests/architecture/fortran/test_smoke_selection.py @@ -27,7 +27,6 @@ "platforms", "profile", "profiles", - "real_libraries", } diff --git a/tests/fortran/CONTRACT_COVERAGE.md b/tests/fortran/CONTRACT_COVERAGE.md index f3a3e936c..706bcc0c4 100644 --- a/tests/fortran/CONTRACT_COVERAGE.md +++ b/tests/fortran/CONTRACT_COVERAGE.md @@ -191,7 +191,7 @@ Authoritative sources: | [Fortran Wrapper: Semantic Stub Output](../../docs/user/reference/fortran-wrapper.md#semantic-stub-output) | Supported | one flat combined package; one entry; native module leaves; no per-source or synthetic directory; entry-only semantic input | `tests/fortran/building_shared_library/end_to_end/test_multi_source_builds.py::test_multi_source_pyi_out_writes_one_flat_combined_package`
`tests/fortran/building_shared_library/pipeline/test_pyi_build_modes.py::test_generated_pyi_matches_checked_in_fixture` | `tests/fortran/building_shared_library/end_to_end/test_multi_source_builds.py::test_multi_source_generated_contract_build_matches_source_runtime_and_link_order` | — | canonical | | [Fortran Wrapper: Editable Makefile](../../docs/user/reference/fortran-wrapper.md#editable-makefile) | Supported | resolved compiler; Fortran and C wrapper flags; ordered source prerequisites; manifest-backed `.pyi` generation and replay | `tests/fortran/building_shared_library/pipeline/test_pyi_build_modes.py::test_pyi_makefile_manifest_and_replay_workflows` | `tests/fortran/building_shared_library/end_to_end/test_multi_source_builds.py::test_makefile_mode_reproduces_multi_source_build` | — | canonical | | [Fortran Wrapper: Advanced Multi-Source Integration](../../docs/user/reference/fortran-wrapper.md#advanced-multi-source-integration) | Partially supported | explicit caller-ordered sources, module directories, libraries, and runtime paths; no automatic dependency, prebuilt-module, or external-library discovery | `tests/fortran/building_shared_library/end_to_end/test_source_build_modes.py::test_source_build_reuses_native_plan_for_additional_compile_and_link_inputs` | `tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_required_transitive_named_library_resolves_runtime_symbol` | `tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_missing_module_directory_reports_compile_error` (`compiling`) | canonical | -| [Semantic `.pyi`: Native Artifacts And Link Resolution](../../docs/user/reference/semantic-pyi-format.md#native-artifacts-and-link-resolution) | Supported | no filename inference; objects, archives, direct and named shared libraries; transitive providers; archive groups; missing/duplicate/incompatible artifact diagnostics; full BLAS/LAPACK bundles | `tests/fortran/building_shared_library/pipeline/test_pyi_build_modes.py::test_pyi_cli_preserves_explicit_ordered_link_items`
`tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_static_archive_groups_resolve_cyclic_archive_dependencies` | `tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[blas]`
`tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py::test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library[lapack]` | `tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_missing_symbol_reports_native_link_or_loader_error` (`import`)
`tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_duplicate_native_definitions_report_linker_error` (`compiling`) | real-library | +| [Semantic `.pyi`: Native Artifacts And Link Resolution](../../docs/user/reference/semantic-pyi-format.md#native-artifacts-and-link-resolution) | Supported | no filename inference; objects, archives, direct and named shared libraries; transitive providers; archive groups; missing/duplicate/incompatible artifact diagnostics | `tests/fortran/building_shared_library/pipeline/test_pyi_build_modes.py::test_pyi_cli_preserves_explicit_ordered_link_items`
`tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_static_archive_groups_resolve_cyclic_archive_dependencies` | `tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_mixed_module_external_bundle_resolves_all_native_input_kinds` | `tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_missing_symbol_reports_native_link_or_loader_error` (`import`)
`tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_duplicate_native_definitions_report_linker_error` (`compiling`) | canonical | | [Semantic `.pyi`: Contract Imports](../../docs/user/reference/semantic-pyi-format.md#contract-imports) | Supported | explicit `prik.contracts` imports; arbitrary aliases; missing imports rejected; ordinary and relative imports preserved | `tests/fortran/semantic_pyi_format/semantics/test_imports_and_packages.py::test_convert_pyi_to_ir_requires_imported_contract_types`
`tests/fortran/semantic_pyi_format/semantics/test_types_and_values.py::test_convert_pyi_to_ir_follows_arbitrary_contract_aliases` | — | `tests/fortran/semantic_pyi_format/semantics/test_imports_and_packages.py::test_convert_pyi_to_ir_requires_imported_contract_types` (`semantics`) | canonical | | [Semantic `.pyi`: Misuse, Diagnostics And Risk](../../docs/user/reference/semantic-pyi-format.md#misuse-diagnostics-and-risk) | Supported | syntax, semantic shape, native contract, policy, and unsafe-boundary diagnostics; filename-aware failures; no silent fallback | `tests/fortran/semantic_pyi_format/semantics/test_imports_and_packages.py::test_pyi_file_to_semantic_module_and_modules_forward_module_name_encoding_and_filename` | — | `tests/fortran/semantic_pyi_format/parsing/test_python_ast_contracts.py::test_pyi_parser_reports_unsupported_lines_and_invalid_helpers` (`parsing`)
`tests/fortran/semantic_pyi_format/pipeline/test_contract_loading.py::test_pyi_python_api_rejects_invalid_projection_before_codegen` (`pipeline`) | canonical | | [Semantic `.pyi`: File Shape](../../docs/user/reference/semantic-pyi-format.md#file-shape) | Supported | Python AST boundary; imports, annotated declarations, classes, ellipsis-only functions, and supported decorators | `tests/fortran/semantic_pyi_format/parsing/test_python_ast_contracts.py::test_pyi_parser_returns_python_ast_only`
`tests/fortran/semantic_pyi_format/parsing/test_python_ast_contracts.py::test_convert_pyi_to_ir_accepts_parsed_pyi_ast_only` | — | `tests/fortran/semantic_pyi_format/parsing/test_python_ast_contracts.py::test_pyi_parser_reports_unsupported_lines_and_invalid_helpers` (`parsing`) | canonical | diff --git a/tests/fortran/README.md b/tests/fortran/README.md index 84e2bfe29..e113c5250 100644 --- a/tests/fortran/README.md +++ b/tests/fortran/README.md @@ -107,5 +107,6 @@ Run all migrated Fortran evidence with: python3 -m pytest -q tests/fortran ``` -Run the BLAS project directly with `python3 -m pytest -q examples/blas`. Never -run LAPACK locally without an explicit request. +Run the BLAS project by sourcing `examples/blas/build_all.sh`, then running +`python3 -m pytest -q examples/blas/tests`. Never run LAPACK locally without an +explicit request. diff --git a/tests/fortran/building_shared_library/README.md b/tests/fortran/building_shared_library/README.md index 8a5746211..8319d9992 100644 --- a/tests/fortran/building_shared_library/README.md +++ b/tests/fortran/building_shared_library/README.md @@ -12,19 +12,15 @@ Evidence is split by the stage that establishes it: - `pipeline/` checks generated contracts, manifests, Makefiles, explicit native inputs, and source-free `.pyi` build transitions; and - `end_to_end/` compiles and imports source, multi-source, runtime-compatibility, - mixed-native-bundle, and real-library extensions. + and mixed-native-bundle extensions. -Run the feature without the dedicated full-library test with: +Run the complete feature with: ```bash -python3 -m pytest -q tests/fortran/building_shared_library \ - --ignore=tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py +python3 -m pytest -q tests/fortran/building_shared_library ``` -Run the full BLAS node locally only when real-library verification is needed. -The full LAPACK node is intentionally left to its dedicated GitHub Actions job. -Each node generates its intermediate semantic `.pyi` package from the native -library sources inside its pytest temporary directory. BLAS and LAPACK keep no -checked generated contract, edited contract, or source-free replay fixture; -their only evidence is the full native-source build, wrapper compilation and -link, extension import, public-surface audit, and representative runtime call. +Full BLAS and LAPACK corpus coverage lives in `examples/blas/` and +`examples/lapack/`. Their dedicated GitHub Actions lane executes the documented +build scripts, user-facing correctness tests, and maintainer-only full-surface +audits without rebuilding a second wrapper. diff --git a/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py b/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py deleted file mode 100644 index 9663365dd..000000000 --- a/tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py +++ /dev/null @@ -1,163 +0,0 @@ -"""Real BLAS/LAPACK full-contract wrapper import and runtime tests.""" - -from __future__ import annotations - -import importlib -import os -import subprocess -import sys -from pathlib import Path - -import pytest - -from examples.blas.helpers import assert_runtime_smoke as assert_blas_runtime_smoke -from examples.lapack.contracts import remove_internal_root_imports -from examples.lapack.helpers import assert_runtime_smoke as assert_lapack_runtime_smoke -from examples.native_library import ( - BLAS_SOURCE_ROOT, - LAPACK_SOURCE_ROOT, - build_reference_library, - library_sources, - native_cache_root, - require_tool, -) -from prik import build_pyi_extension -from prik.pipeline.pyi import pyi_paths_to_semantic_modules - -pytestmark = pytest.mark.fortran_end_to_end -FULL_LIBRARY_WRAPPER_FLAGS = ("-O0", "-g0") -FULL_LIBRARY_CASES = { - "blas": { - "root_function_count": 155, - "source_stem_exceptions": set(), - "extra_function_names": set(), - "sentinel_functions": {"dasum", "daxpy", "ddot", "dgemm", "dscal", "lsame", "xerbla"}, - }, - "lapack": { - "root_function_count": 2064, - "source_stem_exceptions": {"la_constants", "la_xisnan"}, - "extra_function_names": {"dladiv1", "dladiv2", "sladiv1", "sladiv2"}, - "sentinel_functions": {"dgesv", "dgetrf", "dgetrs", "dlamch", "dlamrg", "zgesv"}, - }, -} - - -def _compiler() -> str: - try: - return require_tool("gfortran") - except RuntimeError as error: - pytest.skip(str(error)) - - -def _library_sources(library: str) -> tuple[Path, ...]: - return library_sources(library) - - -def _source_stems(library: str) -> set[str]: - return {path.stem.lower() for path in _library_sources(library)} - - -def _generate_contract(source_root: Path, package: Path) -> Path: - subprocess.run( - [ - sys.executable, - "-m", - "prik", - "generate", - "--pyi", - str(source_root), - "--language", - "fortran", - "--out", - str(package), - ], - capture_output=True, - text=True, - check=True, - ) - return package / "__init__.pyi" - - -def _contract_modules(package: Path): - return pyi_paths_to_semantic_modules([package]) - - -def _root_module(package: Path): - return next(module for module in _contract_modules(package) if module.name == "__init__") - - -def _function_names(package: Path) -> set[str]: - return {function.name for module in _contract_modules(package) for function in module.functions} - - -def _runtime_entry(library: str, entry: Path) -> Path: - if library != "lapack": - return entry - return remove_internal_root_imports(entry) - - -def _import_extension(module_name: str, build_dir: Path, *, lazy: bool = False): - sys.modules.pop(module_name, None) - sys.path.insert(0, str(build_dir)) - old_flags = sys.getdlopenflags() - if lazy: - sys.setdlopenflags(getattr(os, "RTLD_LAZY", old_flags) | getattr(os, "RTLD_GLOBAL", 0)) - try: - return importlib.import_module(module_name) - finally: - if lazy: - sys.setdlopenflags(old_flags) - sys.path.remove(str(build_dir)) - - -@pytest.mark.real_library -@pytest.mark.parametrize("library", ["blas", "lapack"]) -def test_full_library_wrapper_imports_every_root_procedure_from_cached_shared_library(library: str, tmp_path: Path): - source_root = BLAS_SOURCE_ROOT if library == "blas" else LAPACK_SOURCE_ROOT - entry = _generate_contract(source_root, tmp_path / "contracts" / library) - - root = _root_module(entry.parent) - all_function_names = _function_names(entry.parent) - case = FULL_LIBRARY_CASES[library] - - assert len(root.functions) == case["root_function_count"] - assert case["sentinel_functions"] <= all_function_names - assert _source_stems(library) - all_function_names == case["source_stem_exceptions"] - assert all_function_names - _source_stems(library) == case["extra_function_names"] - - cache_root = ( - native_cache_root() if os.environ.get("PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR") else tmp_path / "native-cache" - ) - shared = build_reference_library(library, cache_root=cache_root, compiler=_compiler()).shared_library - runtime_entry = _runtime_entry(library, entry) - expected_root_names = {function.name for function in _root_module(runtime_entry.parent).functions} - result = build_pyi_extension( - runtime_entry, - output_name=f"full_{library}", - output_dir=tmp_path / "build" / library, - native_objects=[shared], - wrapper_fortran_flags=FULL_LIBRARY_WRAPPER_FLAGS, - wrapper_c_flags=FULL_LIBRARY_WRAPPER_FLAGS, - ) - module = _import_extension(result.module_name, result.output_dir, lazy=library == "lapack") - - missing = sorted(name for name in expected_root_names if not hasattr(module, name)) - assert missing == [] - native_plan = result.native_build_plan.to_dict() - assert native_plan["link_items"] == [{"kind": "shared_library", "path": str(shared)}] - assert native_plan["compilation_units"] == [] - assert native_plan["module_dirs"] == [] - assert result.manifest is not None - assert result.manifest["compiler"]["wrapper_fortran_flags"] == list(FULL_LIBRARY_WRAPPER_FLAGS) - assert result.manifest["compiler"]["wrapper_c_flags"] == list(FULL_LIBRARY_WRAPPER_FLAGS) - - if library == "blas": - bridge = (result.output_dir / "bind_c_full_blas_wrapper.f90").read_text(encoding="utf-8").lower() - assert "use full_blas_interfaces" not in bridge - assert "external :: daxpy" in bridge - assert "subroutine daxpy(" not in bridge - assert "private\n" not in bridge - assert "public :: bind_c_daxpy" not in bridge - assert_blas_runtime_smoke(module) - else: - assert_lapack_runtime_smoke(module) diff --git a/tests/fortran/conftest.py b/tests/fortran/conftest.py index 580a0dfa9..5f1606c39 100644 --- a/tests/fortran/conftest.py +++ b/tests/fortran/conftest.py @@ -219,14 +219,6 @@ def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item errors.append( f"fortran_end_to_end path/marker mismatch ({is_end_to_end=}, {has_end_to_end_mark=}): {item.nodeid}" ) - real_library = item.get_closest_marker("real_library") is not None - is_full_library = ( - _relative_test_path(item).as_posix() - == "tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py" - and item.name.startswith("test_full_library_wrapper_imports_every_root_procedure") - ) - if real_library != is_full_library: - errors.append(f"real_library does not identify exactly a full BLAS/LAPACK node: {item.nodeid}") _validate_smoke_item(item, errors) if errors: diff --git a/tests/fortran/source_parsing/parsing/test_parser_benchmarks.py b/tests/fortran/source_parsing/parsing/test_parser_benchmarks.py index fb8096162..3e85a35ef 100644 --- a/tests/fortran/source_parsing/parsing/test_parser_benchmarks.py +++ b/tests/fortran/source_parsing/parsing/test_parser_benchmarks.py @@ -37,15 +37,7 @@ def test_parse_convert_emit_representative_fortran_module(benchmark): @pytest.mark.benchmark def test_parse_real_lapack_dgesv(benchmark): - source = ( - Path(__file__).resolve().parents[2] - / "building_shared_library" - / "end_to_end" - / "real_libraries" - / "lapack" - / "native" - / "dgesv.f" - ).read_text( + source = (Path(__file__).resolve().parents[4] / "examples" / "lapack" / "native" / "dgesv.f").read_text( encoding="utf-8", ) parsed = benchmark(parse_fortran_file, source, filename="lapack/dgesv.f") diff --git a/tests/shared/architecture/test_test_suite_layout.py b/tests/shared/architecture/test_test_suite_layout.py index 1a4ece4da..d4c6e69d0 100644 --- a/tests/shared/architecture/test_test_suite_layout.py +++ b/tests/shared/architecture/test_test_suite_layout.py @@ -26,9 +26,8 @@ PYPROJECT = REPO_ROOT / "pyproject.toml" CHANGELOG = REPO_ROOT / "CHANGELOG.md" MANIFEST = REPO_ROOT / "MANIFEST.in" -FULL_REAL_LIBRARY_TEST = "tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py" -BLAS_CI_FULL_SURFACE = "examples/blas/ci_full_surface.py" -LAPACK_CI_FULL_SURFACE = "examples/lapack/ci_full_surface.py" +BLAS_CI_FULL_SURFACE = "examples/blas/ci/full_surface.py" +LAPACK_CI_FULL_SURFACE = "examples/lapack/ci/full_surface.py" LEGACY_TEST_ROOTS = { "benchmarks", @@ -239,6 +238,30 @@ def test_native_library_examples_are_copyable_without_the_repository_test_packag assert repository_test_imports == [] +def test_native_library_examples_separate_user_tests_from_ci_audits() -> None: + fixture_names = { + "blas": {"prik_blas", "f2py_blas"}, + "lapack": {"prik_lapack", "f2py_lapack", "scipy_lapack"}, + } + for library, expected_fixtures in fixture_names.items(): + root = EXAMPLES_ROOT / library + assert (root / "tests" / "helpers.py").is_file() + assert sorted((root / "tests").glob("test_*.py")) + assert {path.name for path in (root / "ci").glob("*.py")} == { + "__init__.py", + "full_surface.py", + } + assert all((root / script).is_file() for script in ("build_prik.sh", "build_f2py.sh", "build_all.sh")) + + aggregate = (root / "build_all.sh").read_text(encoding="utf-8") + assert f"source examples/{library}/build_prik.sh" in aggregate + assert f'source "$EXAMPLE_WORKSPACE/examples/{library}/build_f2py.sh"' in aggregate + + fixture_tree = ast.parse((root / "conftest.py").read_text(encoding="utf-8")) + functions = {node.name for node in fixture_tree.body if isinstance(node, ast.FunctionDef)} + assert functions == expected_fixtures + + def test_test_index_links_and_language_directories_exist() -> None: text = TEST_INDEX.read_text(encoding="utf-8") for target in re.findall(r"\[[^]]+\]\(([^)#]+)", text): @@ -263,16 +286,14 @@ def test_real_library_examples_have_one_dedicated_workflow() -> None: assert '-m "not real_library and not toolchain_smoke"' in ordinary_jobs assert ordinary_jobs.count('-m "not real_library and not toolchain_smoke"') == 2 - assert FULL_REAL_LIBRARY_TEST not in ordinary_jobs assert "examples/blas" not in ordinary_jobs assert "examples/lapack" not in ordinary_jobs - assert 'python -m pytest -q -o "python_files=test_*.py ci_full_surface.py"' in dedicated_job - assert dedicated_job.count("python_files=test_*.py ci_full_surface.py") == 2 - assert f"examples/blas {BLAS_CI_FULL_SURFACE}" in dedicated_job - assert f"examples/lapack {LAPACK_CI_FULL_SURFACE}" in dedicated_job + assert "source examples/blas/build_all.sh" in dedicated_job + assert "source examples/lapack/build_all.sh" in dedicated_job + assert f"python -m pytest -q examples/blas/tests {BLAS_CI_FULL_SURFACE}" in dedicated_job + assert f"python -m pytest -q examples/lapack/tests {LAPACK_CI_FULL_SURFACE}" in dedicated_job assert BLAS_CI_FULL_SURFACE in dedicated_job assert LAPACK_CI_FULL_SURFACE in dedicated_job - assert FULL_REAL_LIBRARY_TEST not in dedicated_job assert '"meson==1.11.2"' in dedicated_job assert '"ninja==1.13.0"' in dedicated_job assert '"scipy==1.18.0"' in dedicated_job @@ -424,13 +445,12 @@ def test_pull_request_declares_direct_staged_jobs_and_always_reports_the_gate() native_libraries = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "native-libraries") assert "needs: [unit-tests, unit-tests-macos]" in native_libraries assert "ignore-real-library-wrappers" in native_libraries - assert 'python -m pytest -q -o "python_files=test_*.py ci_full_surface.py"' in native_libraries - assert native_libraries.count("python_files=test_*.py ci_full_surface.py") == 2 - assert f"examples/blas {BLAS_CI_FULL_SURFACE}" in native_libraries - assert f"examples/lapack {LAPACK_CI_FULL_SURFACE}" in native_libraries + assert "source examples/blas/build_all.sh" in native_libraries + assert "source examples/lapack/build_all.sh" in native_libraries + assert f"python -m pytest -q examples/blas/tests {BLAS_CI_FULL_SURFACE}" in native_libraries + assert f"python -m pytest -q examples/lapack/tests {LAPACK_CI_FULL_SURFACE}" in native_libraries assert BLAS_CI_FULL_SURFACE in native_libraries assert LAPACK_CI_FULL_SURFACE in native_libraries - assert FULL_REAL_LIBRARY_TEST not in native_libraries benchmark = _github_action_job_block(MERGE_VALIDATION_WORKFLOW, "documentation-benchmark") assert "needs: native-libraries" in benchmark From 4f32af182737c11cde4f0744955436a6c6fc0f93 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Mon, 3 Aug 2026 06:35:38 +0100 Subject: [PATCH 15/22] clean blas and lapack examples --- .github/workflows/blas-lapack.yml | 8 +- .github/workflows/merge-validation.yml | 8 +- docs/developer/testing-strategy.md | 25 +- docs/user/examples/blas-wrapper.md | 53 +- docs/user/examples/lapack-wrapper.md | 89 +- docs/user/reference/cli-commands.md | 8 + docs/user/reference/fortran-wrapper.md | 34 +- examples/blas/README.md | 507 +---- examples/blas/blas.pyf | 1562 ++++++++++++++++ examples/blas/build_f2py.sh | 22 +- examples/blas/build_prik.sh | 8 +- examples/blas/f2py_build.py | 111 -- examples/blas/tests/test_routine_coverage.py | 101 +- examples/f2py_intents.py | 58 - examples/lapack/README.md | 576 +----- examples/lapack/build_f2py.sh | 23 +- examples/lapack/build_prik.sh | 15 +- examples/lapack/ci/full_surface.py | 35 +- examples/lapack/f2py_build.py | 145 -- examples/lapack/lapack.f2cmap | 1 + examples/lapack/lapack.pyf | 1638 +++++++++++++++++ examples/lapack/routine_inventory.py | 2 +- .../lapack/tests/test_routine_coverage.py | 125 +- examples/native_library.py | 18 +- prik/cli.py | 39 +- prik/pipeline/build.py | 34 +- .../compiling/test_example_native_library.py | 52 + .../end_to_end/test_source_build_modes.py | 105 ++ .../pipeline/_support.py | 1 + .../pipeline/test_argument_contract.py | 40 +- 30 files changed, 3933 insertions(+), 1510 deletions(-) create mode 100644 examples/blas/blas.pyf delete mode 100644 examples/blas/f2py_build.py delete mode 100644 examples/f2py_intents.py delete mode 100644 examples/lapack/f2py_build.py create mode 100644 examples/lapack/lapack.f2cmap create mode 100644 examples/lapack/lapack.pyf create mode 100644 tests/fortran/building_shared_library/compiling/test_example_native_library.py diff --git a/.github/workflows/blas-lapack.yml b/.github/workflows/blas-lapack.yml index 73d139099..9849c7eef 100644 --- a/.github/workflows/blas-lapack.yml +++ b/.github/workflows/blas-lapack.yml @@ -72,10 +72,10 @@ jobs: PYTHONPATH: . run: | python - <<'PY' - from examples.lapack.f2py_build import F2PY_INOUT_ARGUMENTS from examples.lapack.routine_inventory import ( - EXPECTED_LAPACK_ROOT_PROCEDURES, + EXPECTED_LAPACK_PROCEDURES, EXPECTED_LAPACK_SOURCE_FILES, + F2PY_SCALAR_WRITEBACK_ROUTINES, ROUTINE_GROUPS, ROUTINES, SCIPY_VERSION, @@ -83,9 +83,9 @@ jobs: print(f"SciPy version: {SCIPY_VERSION}") print(f"LAPACK implementation sources: {EXPECTED_LAPACK_SOURCE_FILES}") - print(f"Expected PRIK root procedures: {EXPECTED_LAPACK_ROOT_PROCEDURES}") + print(f"Expected PRIK procedures: {EXPECTED_LAPACK_PROCEDURES}") print(f"Selected float64 correctness routines: {len(ROUTINES)}") - print(f"f2py scalar-writeback intent overlays: {len(F2PY_INOUT_ARGUMENTS)}") + print(f"f2py scalar writebacks: {len(F2PY_SCALAR_WRITEBACK_ROUTINES)}") for family, routines in ROUTINE_GROUPS.items(): print(f" {family}: {len(routines)}") PY diff --git a/.github/workflows/merge-validation.yml b/.github/workflows/merge-validation.yml index 11baa2051..fe277b838 100644 --- a/.github/workflows/merge-validation.yml +++ b/.github/workflows/merge-validation.yml @@ -627,10 +627,10 @@ jobs: PYTHONPATH: . run: | python - <<'PY' - from examples.lapack.f2py_build import F2PY_INOUT_ARGUMENTS from examples.lapack.routine_inventory import ( - EXPECTED_LAPACK_ROOT_PROCEDURES, + EXPECTED_LAPACK_PROCEDURES, EXPECTED_LAPACK_SOURCE_FILES, + F2PY_SCALAR_WRITEBACK_ROUTINES, ROUTINE_GROUPS, ROUTINES, SCIPY_VERSION, @@ -638,9 +638,9 @@ jobs: print(f"SciPy version: {SCIPY_VERSION}") print(f"LAPACK implementation sources: {EXPECTED_LAPACK_SOURCE_FILES}") - print(f"Expected PRIK root procedures: {EXPECTED_LAPACK_ROOT_PROCEDURES}") + print(f"Expected PRIK procedures: {EXPECTED_LAPACK_PROCEDURES}") print(f"Selected float64 correctness routines: {len(ROUTINES)}") - print(f"f2py scalar-writeback intent overlays: {len(F2PY_INOUT_ARGUMENTS)}") + print(f"f2py scalar writebacks: {len(F2PY_SCALAR_WRITEBACK_ROUTINES)}") for family, routines in ROUTINE_GROUPS.items(): print(f" {family}: {len(routines)}") PY diff --git a/docs/developer/testing-strategy.md b/docs/developer/testing-strategy.md index b63357789..2de46cdff 100644 --- a/docs/developer/testing-strategy.md +++ b/docs/developer/testing-strategy.md @@ -128,12 +128,13 @@ For BLAS behavior, source `examples/blas/build_all.sh`, then run `python3 -m pytest -q examples/blas/tests` or one of its named test functions. The aggregate script sources the exact documented `build_prik.sh` and `build_f2py.sh` sequences. This compiles the sorted 155-source implementation -once and builds each wrapper once; f2py links to the native artifact produced -by the PRIK script. +once and builds each wrapper once; the direct f2py script compiles the +committed reviewed `blas.pyf` and links the native artifact produced by the +PRIK script. Documentation source markers require the displayed commands to remain byte-for-byte equal to the executed scripts. `test_routine_coverage.py` audits -the parsed source inventory, both export sets, visible named tests, and terminal -outcomes. The dedicated CI lane explicitly adds +the parsed source inventory, f2py signature drift, both export sets, visible +named tests, and terminal outcomes. The dedicated CI lane explicitly adds `examples/blas/ci/full_surface.py` to the same pytest invocation and does not rebuild its wrappers afterward. User-run correctness tests and maintainer-only audits therefore have separate directories. @@ -142,14 +143,16 @@ For LAPACK behavior, the dedicated lane sources `examples/lapack/build_all.sh` and then runs `python3 -m pytest -q examples/lapack/tests`. The aggregate script sources the exact documented `build_prik.sh` and `build_f2py.sh` sequences. The complete native corpus is compiled once, each wrapper is built -once, and the f2py script reuses the native artifact produced by the PRIK -script while testing the reviewed 127-routine SciPy 1.18.0 `float64` -inventory. Documentation source markers keep the displayed commands equal to -the executed scripts. The inventory audit fails on SciPy drift, missing -sources or exports, missing explicitly named tests, and divergent -documentation totals. CI explicitly adds `examples/lapack/ci/full_surface.py` +once, and the direct f2py script compiles the committed reviewed `lapack.pyf` +against the native artifact produced by the PRIK script while testing the +127-routine SciPy 1.18.0 `float64` inventory. Documentation source markers keep +the displayed commands equal to the executed scripts. The inventory audit +fails on SciPy drift, signature drift, missing sources or exports, missing +explicitly named tests, and divergent documentation claims. CI explicitly +adds `examples/lapack/ci/full_surface.py` to the same pytest invocation, reusing the complete PRIK extension to require -all 2,064 root exports and run a non-inventory runtime smoke call. User-run +all 2,064 procedure exports, including module namespaces, and run a +non-inventory runtime smoke call. User-run correctness tests and maintainer-only audits have separate directories. The complete `examples/` tree is a copyable execution boundary. Example code diff --git a/docs/user/examples/blas-wrapper.md b/docs/user/examples/blas-wrapper.md index 1dca4aa26..551a8b28a 100644 --- a/docs/user/examples/blas-wrapper.md +++ b/docs/user/examples/blas-wrapper.md @@ -94,28 +94,24 @@ export BLAS_SHARED_LIBRARY="$( --jobs 8 )" -python -m prik generate \ - --pyi examples/blas/native \ - --language fortran \ - --out "$BLAS_BUILD_ROOT/contract/blas" - mkdir -p "$BLAS_BUILD_ROOT/prik/generated" cd "$BLAS_BUILD_ROOT/prik" -python -m prik "$BLAS_BUILD_ROOT/contract/blas/__init__.pyi" \ +python -m prik "$EXAMPLE_WORKSPACE/examples/blas/native" \ --out prik_reference_blas \ --out-dir "$BLAS_BUILD_ROOT/prik/generated" \ --compiler "$(command -v gfortran)" \ + --no-compile-input-sources \ --native-objects "$BLAS_SHARED_LIBRARY" \ --jobs 8 \ --wrapper-fortran-flags="-O0 -g0" \ --wrapper-c-flags="-O0 -g0" ``` -`examples.native_library` compiles all 155 implementations on the first call -and returns the resulting shared-library path. The cache is optional: an -identical later call reuses it. PRIK generates the complete contract and links -its wrapper to that artifact instead of compiling the implementations again. +`examples.native_library` compiles all 155 implementations and returns the +resulting shared-library path. PRIK reads the same source directory to build +the Python API, skips native implementation compilation, and links that +library. `-O0` keeps the PRIK and f2py correctness builds equivalent and avoids making optimization-dependent claims. This example focuses on correctness, not @@ -131,20 +127,35 @@ Run the same f2py build script exercised by the test suite: ```bash cd "$EXAMPLE_WORKSPACE" export BLAS_F2PY_ROOT="$BLAS_BUILD_ROOT/f2py" -python -m examples.blas.f2py_build \ - "$BLAS_F2PY_ROOT" \ - "$BLAS_SHARED_LIBRARY" \ - --compiler "$(command -v gfortran)" +mkdir -p "$BLAS_F2PY_ROOT/generated" +cd "$BLAS_F2PY_ROOT" + +export FC="$(command -v gfortran)" +export F77="$FC" +export F90="$FC" +export FFLAGS="-O0" +export F90FLAGS="-O0" +export LDFLAGS="${LDFLAGS:+$LDFLAGS }-Wl,-rpath,$(dirname "$BLAS_SHARED_LIBRARY")" + +python -m numpy.f2py -c \ + "$EXAMPLE_WORKSPACE/examples/blas/blas.pyf" \ + "-L$(dirname "$BLAS_SHARED_LIBRARY")" \ + -lprik_full_blas \ + --build-dir "$BLAS_F2PY_ROOT/generated" \ + --f77flags=-O0 \ + --f90flags=-O0 \ + --opt=-O0 ``` -f2py reads the source declarations to generate its `.pyf` signature, compiles -only its wrapper, and links that wrapper to `BLAS_SHARED_LIBRARY`. PRIK and -f2py therefore exercise the same compiled BLAS implementations. +The committed [`blas.pyf`](../../../examples/blas/blas.pyf) is the reviewed +f2py interface. f2py compiles only its wrapper and links it to +`BLAS_SHARED_LIBRARY`, so both wrappers exercise the same compiled BLAS +implementations. Six rotation routines document scalar writebacks without declaring Fortran -`intent`. The f2py build adds temporary intent directives and the tests pass -typed 0-D arrays. PRIK needs neither: it returns unannotated scalar writebacks -directly, with ordinary scalar arguments. +`intent`. Their reviewed `intent(inout)` declarations live directly in +`blas.pyf`, and the tests pass typed 0-D arrays. PRIK needs neither: it returns +unannotated scalar writebacks directly, with ordinary scalar arguments. Import both modules: @@ -315,7 +326,7 @@ python -m pytest -q examples/blas/tests -k dgemm - Authoritative classification → [`routine_inventory.py`](../../../examples/blas/routine_inventory.py) - Coverage guard → [`test_routine_coverage.py`](../../../examples/blas/tests/test_routine_coverage.py) -For the full explanation of increments, leading dimensions, packed/banded storage, Hermitian conjugation, tolerances, coverage totals and known wrapper differences, see the +For the copyable build scripts, test commands, and source provenance, see the [`examples/blas` project README](../../../examples/blas/README.md). --- diff --git a/docs/user/examples/lapack-wrapper.md b/docs/user/examples/lapack-wrapper.md index 1e2519f5a..c6c5485ff 100644 --- a/docs/user/examples/lapack-wrapper.md +++ b/docs/user/examples/lapack-wrapper.md @@ -35,12 +35,12 @@ You should already be comfortable with the BLAS wrapper example, NumPy arrays, a | PRIK | current repository checkout (`0.1.0`) | | Reference LAPACK | Netlib LAPACK 3.12.1 | | Reference BLAS | BLAS snapshot shipped in LAPACK 3.12.1 | -| Python | 3.12 (dedicated CI job) | +| Python | 3.12 or newer | | NumPy / f2py | NumPy 2.5.1 | | SciPy | exactly 1.18.0 (reviewed inventory) | | Meson | 1.11.2 | | Ninja | 1.13.0 | -| Fortran compiler | GNU Fortran 13 in CI (any compatible `gfortran` works locally) | +| Fortran compiler | compatible `gfortran` | --- @@ -60,8 +60,7 @@ python -m pip install -e ".[qa]" \ "meson==1.11.2" "ninja==1.13.0" ``` -Install GNU Fortran. The current repository setup also installs the LAPACK and -BLAS development packages used by the existing CI environment. On Ubuntu: +Install GNU Fortran and the LAPACK and BLAS development packages. On Ubuntu: ```bash sudo apt-get update @@ -92,72 +91,69 @@ export LAPACK_SHARED_LIBRARY="$( --compiler "$(command -v gfortran)" \ --jobs 8 )" - -python -m prik generate \ - --pyi examples/lapack/native \ - --language fortran \ - --out "$LAPACK_BUILD_ROOT/contracts/lapack" - -# Remove the LA_CONSTANTS and LA_XISNAN imports from the generated root contract. -python -c 'import sys; from pathlib import Path; p=Path(sys.argv[1]); s=p.read_text(encoding="utf-8") -p.write_text(s.replace("from . import LA_CONSTANTS\n", "").replace("from . import LA_XISNAN\n", ""), encoding="utf-8")' \ - "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" +export LAPACK_MODULE_DIR="$(dirname "$LAPACK_SHARED_LIBRARY")/modules" mkdir -p "$LAPACK_BUILD_ROOT/prik/generated" cd "$LAPACK_BUILD_ROOT/prik" -python -m prik "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" \ +python -m prik "$EXAMPLE_WORKSPACE/examples/lapack/native" \ --out prik_reference_lapack_example \ --out-dir "$LAPACK_BUILD_ROOT/prik/generated" \ --compiler "$(command -v gfortran)" \ + --no-compile-input-sources \ --native-objects "$LAPACK_SHARED_LIBRARY" \ + -I "$LAPACK_MODULE_DIR" \ --jobs 8 \ --wrapper-fortran-flags="-O0 -g0" \ --wrapper-c-flags="-O0 -g0" ``` -The short contract command removes only the internal `LA_CONSTANTS` and -`LA_XISNAN` root imports in place. +PRIK reads the sources to build the Python API, skips native implementation +compilation, and links the shared library. The include path supplies the module +metadata needed by the generated wrapper. --- ## 3. Build the reviewed f2py comparison surface -The f2py side does not compile the implementations again. It reads the 125 -selected routines and `la_constants.f90` to generate reviewed signatures, then -compiles only its wrapper and links it to `LAPACK_SHARED_LIBRARY`. +The committed [`lapack.pyf`](../../../examples/lapack/lapack.pyf) contains the +reviewed selected routines and `la_constants` module signature. f2py compiles +only its wrapper and links `LAPACK_SHARED_LIBRARY`. Nine routines document scalar writebacks without declaring Fortran `intent`. -The f2py build adds temporary intent directives and the tests pass typed 0-D -arrays. PRIK needs neither: it returns unannotated scalar writebacks directly, -with ordinary scalar arguments. +Their reviewed `intent(inout)` declarations live directly in `lapack.pyf`, and +the tests pass typed 0-D arrays. PRIK needs neither: it returns unannotated +scalar writebacks directly, with ordinary scalar arguments. -The example-owned f2py builder assembles the reviewed inventory. Run the same -script exercised by the test suite: +Run the same direct f2py command exercised by the test suite: ```bash cd "$EXAMPLE_WORKSPACE" export LAPACK_F2PY_ROOT="$LAPACK_BUILD_ROOT/f2py" -python -m examples.lapack.f2py_build \ - "$LAPACK_F2PY_ROOT" \ - "$LAPACK_SHARED_LIBRARY" \ - --compiler "$(command -v gfortran)" +mkdir -p "$LAPACK_F2PY_ROOT/generated" +cd "$LAPACK_F2PY_ROOT" + +export FC="$(command -v gfortran)" +export F77="$FC" +export F90="$FC" +export FFLAGS="-O0" +export F90FLAGS="-O0" +export LDFLAGS="${LDFLAGS:+$LDFLAGS }-Wl,-rpath,$(dirname "$LAPACK_SHARED_LIBRARY")" + +python -m numpy.f2py -c \ + "$EXAMPLE_WORKSPACE/examples/lapack/lapack.pyf" \ + "-L$(dirname "$LAPACK_SHARED_LIBRARY")" \ + -lprik_full_lapack \ + --f2cmap "$EXAMPLE_WORKSPACE/examples/lapack/lapack.f2cmap" \ + --build-dir "$LAPACK_F2PY_ROOT/generated" \ + --f77flags=-O0 \ + --f90flags="-O0 -I$LAPACK_MODULE_DIR" \ + --opt=-O0 ``` -The assembled command has this shape: - -```text -python -m numpy.f2py -m f2py_reference_lapack_example \ - -h f2py_reference_lapack_example.pyf \ - la_constants.f90 <125 reviewed implementation sources> \ - only: <125 reviewed routine names> : \ - --f2cmap --overwrite-signature -python -m numpy.f2py -c f2py_reference_lapack_example.pyf \ - -L -lprik_full_lapack \ - --f2cmap \ - --build-dir \ - --f77flags=-O0 --f90flags=-O0 --opt=-O0 -``` +The native build retains the compiler-specific module files required by the +generated wrapper. Support objects remain inside the shared library and are not +compiled again. `dgees` and `dgges` remain in the 127-routine correctness inventory, but raw f2py 2.5.1 cannot generate valid callback declarations from their unannotated selection-callback interfaces. They are validated through PRIK, SciPy and independent Schur reconstruction. @@ -281,7 +277,7 @@ Therefore byte-for-byte agreement is not the only oracle. Tests use explicit solutions, residuals, factor reconstructions, orthogonality, eigen equations and storage invariants. The two real tests below keep all three wrapper calls and the independent oracle visible. -Documentation CI verifies these blocks directly against their source functions. +The displayed blocks are copied directly from their source functions. ### DGESV – solve a general linear system @@ -383,10 +379,9 @@ python -m pytest -q examples/lapack/tests -k dgesvd - Authoritative mapping of all 127 routines → [`routine_inventory.py`](../../../examples/lapack/routine_inventory.py) - Coverage audit → [`test_routine_coverage.py`](../../../examples/lapack/tests/test_routine_coverage.py) -Repository maintainers normally leave this expensive LAPACK wrapper/runtime command to the dedicated BLAS + LAPACK GitHub Actions job unless local execution is explicitly requested. -The command is nevertheless complete and reproducible for users who have the listed native toolchain. +The command is complete and reproducible with the listed native toolchain. -For storage formats, workspaces, pivot conventions, the f2py callback limitation and scalar-intent overlays, all representative families and audited coverage totals, continue to the +For the copyable build scripts, test commands, and source provenance, see the [`examples/lapack` project README](../../../examples/lapack/README.md). --- diff --git a/docs/user/reference/cli-commands.md b/docs/user/reference/cli-commands.md index 398f75631..785b151d8 100644 --- a/docs/user/reference/cli-commands.md +++ b/docs/user/reference/cli-commands.md @@ -330,6 +330,7 @@ Generation without compilation belongs to the `generate` subcommand. | `-I DIR`, `--include-dir DIR` | Adds a build-wide compiler include directory. Source builds use it during preprocessing; source and `.pyi` builds use it for native and generated wrapper compilation. Repeat to preserve search order. | | `--strict-wrapper-names` | Rejects Python wrapper names that require escaping or collision suffixes. | | `--build-manifest PATH` | Reads an existing semantic `.pyi` wrapper build manifest and replays its saved build. It does not generate the manifest. | +| `--no-compile-input-sources` | Treats positional Fortran sources as semantic inputs only. Requires an explicit native input; `--native-fortran-sources` remain compiled hidden implementation sources. | | `--native-fortran-sources PATH [PATH ...]` | Compiles additional native Fortran implementation sources without using them as semantic inputs. | | `--native-compile-flags FLAG [FLAG ...]` | Adds compiler flags to native implementation source compilation. Native source compilation is currently Fortran-only. | | `--native-objects PATH [PATH ...]` | Links one or more native object, static archive, or shared library paths into the extension. | @@ -351,6 +352,13 @@ Important boundaries: - `.pyi` wrapper builds require at least one native implementation input such as `--native-fortran-sources`, `--native-objects`, `--native-library`, or `--native-link-item`. +- Source-driven builds accept individual Fortran files or directories. + Directories are expanded recursively in deterministic path order. +- `--no-compile-input-sources` keeps positional Fortran sources as semantic inputs + but removes them from native compilation. It requires an explicit native + implementation through `--native-fortran-sources`, `--native-objects`, + `--native-library`, or `--native-link-item`. Sources passed through + `--native-fortran-sources` are still compiled without becoming public API. - Source-driven builds may use the same native source, object, library, include-directory, library-directory, and ordered-link options to complete the extension build. These inputs augment the positional implementation diff --git a/docs/user/reference/fortran-wrapper.md b/docs/user/reference/fortran-wrapper.md index b25d2f376..420c78e5e 100644 --- a/docs/user/reference/fortran-wrapper.md +++ b/docs/user/reference/fortran-wrapper.md @@ -225,13 +225,19 @@ that mode the `.pyi` is the Python API source of truth; native source is not reparsed during wrapper generation. Both routes produce the same native extension build plan. In a source-driven -build, positional Fortran files are semantic inputs and native compilation -units. `--native-compile-flags` applies to those units, while additional -`--native-fortran-sources`, objects, libraries, include directories, library -directories, and ordered link items may complete the implementation without -changing the parsed Python API. `--wrapper-fortran-flags` applies only to the -generated Fortran bridge; `--wrapper-c-flags` applies to the generated binding -and extension-link command. +build, positional Fortran files are semantic inputs and, by default, native +compilation units. Add `--no-compile-input-sources` to use them only as semantic +inputs and link an already-built object, archive, shared library, or named +library instead. Explicit `--native-fortran-sources` remain hidden +implementation sources and are still compiled. + +`--native-compile-flags` applies to native compilation when it is enabled and +always describes the compile model used for preprocessing and datatype +measurement. Objects, libraries, include directories, library directories, +and ordered link items may complete the implementation without changing the +parsed Python API. `--wrapper-fortran-flags` applies only to the generated +Fortran bridge; `--wrapper-c-flags` applies to the generated binding and +extension-link command. For example, this command supplies every common build input shown by `python3 -m prik --help` and produces the Python shared library under @@ -295,6 +301,20 @@ least one native implementation input is required. Use `--native-fortran-sources` when prik should compile the implementation and `--native-objects` when objects, archives, or shared libraries are already built. +To wrap an already-built library directly from its source directory, keep the +sources as the semantic input and disable their automatic native compilation: + +```bash +python3 -m prik path/to/fortran-sources \ + --no-compile-input-sources \ + --native-objects path/to/libsolver.so \ + -I path/to/mod-files \ + --out solver +``` + +PRIK reads the directory recursively in deterministic path order, compiles +only its generated bridge and binding, and links the supplied native library. + Semantic `.pyi` Makefile mode writes `/prik-build.json` first and then generates `/Makefile.prik` from that manifest. The manifest can be replayed directly: diff --git a/examples/blas/README.md b/examples/blas/README.md index 77c5fc7c8..e6748a717 100644 --- a/examples/blas/README.md +++ b/examples/blas/README.md @@ -1,47 +1,26 @@ -# Complete Reference BLAS correctness example +# Wrap Reference BLAS with PRIK -This directory is a runnable, correctness-only example of building the complete -Reference BLAS with both PRIK and NumPy's f2py. It validates every one of the -155 callable routines discovered in the 155 source files. The tests compare -both wrappers with an independent mathematical result and then with each other; -f2py is useful differential evidence, but it is not the behavioral oracle. +This copyable example builds the complete Reference BLAS once, then links both +PRIK and NumPy f2py wrappers to the same native library. Its 155 named tests +compare both wrappers with small independent formulas, storage checks, and each +other. -The authoritative source set is [`native/`](native/). It is the repository's -only copy of the full BLAS sources and is also consumed by the full-library -integration test, the LAPACK CI build, and the build comparison tooling. +All 155 routines are exported and validated through both wrappers, with no +unsupported or skipped routines. -## Provenance and license +## Requirements -The sources are the Reference BLAS distributed by the University of Tennessee -through [Netlib BLAS](https://www.netlib.org/blas/). More precisely, all 155 -files are byte-for-byte the `BLAS/SRC/` snapshot shipped in -[Netlib LAPACK 3.12.1](https://www.netlib.org/lapack/lapack-3.12.1.html); the -audited archive has SHA-256 -`37b00c90947488521f475b5a187fff4da4a5cfe61b525efcacf7a97f39a45ec6`. -The repository imported this corpus in commit -`9113acde1f7d30af4c3eb3d90bb9f9da422639f2` on 2026-05-02; this change -relocates those bytes without modifying or duplicating them. Their upstream -provenance notices are retained in the files. No separate license file was -present beside the imported corpus. The -[Netlib BLAS FAQ](https://www.netlib.org/blas/faq.html#1_5) describes BLAS as -freely available, permits commercial use, and asks users to acknowledge Netlib -and the authors. Consult that upstream statement when redistributing the native -sources; this example's Python test code remains covered by the repository -license. - -## Reproduce the two builds - -On Python 3.12 and newer, NumPy's f2py uses its Meson backend. Install the -same Meson and Ninja versions used by the dedicated BLAS/LAPACK CI lane before -running the example: +Install GNU Fortran and the Python build tools: ```console -python3 -m pip install "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" +python3 -m pip install "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" pytest ``` -`build_all.sh` compiles the implementations once at `-O0`, then links both -wrappers to that same native library. All artifacts stay in a temporary -directory. It sources these two scripts: +Run every command from the directory that contains `examples/`. + +## Build both wrappers + +`build_all.sh` runs these two scripts: ```bash @@ -53,18 +32,14 @@ export BLAS_SHARED_LIBRARY="$( --jobs 8 )" -python -m prik generate \ - --pyi examples/blas/native \ - --language fortran \ - --out "$BLAS_BUILD_ROOT/contract/blas" - mkdir -p "$BLAS_BUILD_ROOT/prik/generated" cd "$BLAS_BUILD_ROOT/prik" -python -m prik "$BLAS_BUILD_ROOT/contract/blas/__init__.pyi" \ +python -m prik "$EXAMPLE_WORKSPACE/examples/blas/native" \ --out prik_reference_blas \ --out-dir "$BLAS_BUILD_ROOT/prik/generated" \ --compiler "$(command -v gfortran)" \ + --no-compile-input-sources \ --native-objects "$BLAS_SHARED_LIBRARY" \ --jobs 8 \ --wrapper-fortran-flags="-O0 -g0" \ @@ -75,423 +50,63 @@ python -m prik "$BLAS_BUILD_ROOT/contract/blas/__init__.pyi" \ ```bash cd "$EXAMPLE_WORKSPACE" export BLAS_F2PY_ROOT="$BLAS_BUILD_ROOT/f2py" -python -m examples.blas.f2py_build \ - "$BLAS_F2PY_ROOT" \ - "$BLAS_SHARED_LIBRARY" \ - --compiler "$(command -v gfortran)" +mkdir -p "$BLAS_F2PY_ROOT/generated" +cd "$BLAS_F2PY_ROOT" + +export FC="$(command -v gfortran)" +export F77="$FC" +export F90="$FC" +export FFLAGS="-O0" +export F90FLAGS="-O0" +export LDFLAGS="${LDFLAGS:+$LDFLAGS }-Wl,-rpath,$(dirname "$BLAS_SHARED_LIBRARY")" + +python -m numpy.f2py -c \ + "$EXAMPLE_WORKSPACE/examples/blas/blas.pyf" \ + "-L$(dirname "$BLAS_SHARED_LIBRARY")" \ + -lprik_full_blas \ + --build-dir "$BLAS_F2PY_ROOT/generated" \ + --f77flags=-O0 \ + --f90flags=-O0 \ + --opt=-O0 ``` -f2py reads the sources only to generate signatures and compiles its wrapper -against `BLAS_SHARED_LIBRARY`. - -Six rotation routines document scalar writebacks without declaring Fortran -`intent`. The f2py build adds local intent directives, and the tests pass typed -0-D arrays so those writes are testable. PRIK needs neither the overlay nor -carrier arrays: it returns unannotated scalar writebacks directly. - -Import the modules from their build directories: - -```python -import os -import sys - -build_root = os.environ["BLAS_BUILD_ROOT"] -sys.path.insert(0, f"{build_root}/prik") -sys.path.insert(0, f"{build_root}/f2py") -import prik_reference_blas -import f2py_reference_blas -``` - -Build once, then run any user-facing test selection: +Build and validate the example: ```bash source examples/blas/build_all.sh python3 -m pytest -q examples/blas/tests -python3 -m pytest -q examples/blas/tests/test_level1_real.py -python3 -m pytest -q examples/blas/tests/test_level1_real.py::test_daxpy -python3 -m pytest -q examples/blas/tests -k dgemm -``` - -User-run correctness tests live in `tests/`. The separate `ci/` directory owns -the maintainer-only full-surface audit. - -## What each test proves - -Numerical tests normally establish all three relationships: - -```text -PRIK result == independent expected result -f2py result == independent expected result -PRIK result == f2py result -``` - -Small explicit formulas are preferred. Matrix cases first reconstruct the -logical matrix from the declared storage and then calculate the operation. -Solve routines additionally use residuals. Input-only arrays are copied and -checked exactly; output arrays are checked with dtype-aware tolerances; unused -triangles, band rows, leading-dimension padding, and stride gaps retain their -NaN or finite sentinels exactly. - -`assert_allclose_for_dtype` starts from machine epsilon for the real component -of `float32`, `float64`, `complex64`, or `complex128`, then scales the tolerance -by the reduction or multiplication length and expected magnitude. Integers, -native indexes, shapes, dtypes, and untouched storage use exact checks. NumPy -matrix operations are concise secondary calculations in some cases; explicit -scalar formulas and residual identities keep the independent oracle from -being merely another BLAS call. - -### Increments and indexes - -A BLAS vector is represented by its full storage plus `N` and `INCX`/`INCY`. -For positive increments the first logical element is storage index zero. For a -negative increment the native starting index is `(N - 1) * -INCX`; subsequent -logical positions add the signed increment. Tests cover `1`, values greater -than one, and negative increments while checking all gaps. - -`ISAMAX`, `IDAMAX`, `ICAMAX`, and `IZAMAX` expose the native one-based BLAS -index through both wrappers. Their tests independently identify the maximum -and assert the one-based value; no automatic Python zero-basing is assumed. - -### Matrix storage - -The PRIK calls preserve the native argument order, including explicit leading -dimensions. f2py infers leading dimensions and moves them to optional keyword -arguments. Tests allocate non-minimal Fortran-order matrices and prove that -padding is not modified. - -General routines cover no-transpose, transpose, and conjugate-transpose. -Symmetric, Hermitian, and triangular cases reconstruct only the selected upper -or lower triangle; the unused triangle contains NaNs. Hermitian reconstruction -conjugates the reflected entries and ignores stored diagonal imaginary parts. -Unit-diagonal triangular cases put NaNs on the stored diagonal and validate the -operation against a logical diagonal of ones. Level 3 triangular tests cover -both left and right multiplication and solve residuals. - -Packed helpers implement the column-major BLAS packed order before reconstructing -the full logical matrix. Banded helpers use the BLAS row mapping for general, -symmetric, Hermitian, and triangular band storage. The tests reconstruct the -logical matrix before calculating the independent expectation and preserve -unused band rows exactly. - -### Test fixtures and helper vocabulary - -`prik_blas` and `f2py_blas` are session-scoped pytest fixtures from -[`conftest.py`](conftest.py). After `build_all.sh` completes, they import each -complete wrapper once and reuse the modules across `tests/`. -The named tests use narrow helpers from [`tests/helpers.py`](tests/helpers.py): - -| Helper | Responsibility | -| --- | --- | -| `assert_allclose_for_dtype` | Compares floating results with a tolerance derived from the real component dtype, expected magnitude, and operation length. | -| `assert_storage_unchanged` | Uses exact equality, including NaNs, for input-only arrays, padding, and sentinel storage. | -| `logical_vector` / `logical_positions` | Maps native positive or negative BLAS increments to logical vector elements. | -| `packed_*` and `*_band_*` helpers | Reconstructs the logical matrix represented by packed or banded native storage. | -| `symmetric_from_triangle`, `hermitian_from_triangle`, `triangular_from_triangle` | Reconstructs only the triangle the BLAS contract permits the routine to read. | - -Every wrapper call and independent formula remains visible in its test; these -helpers only handle comparison or storage mechanics. The examples below assume -`import numpy as np` and the corresponding imports from `tests/helpers.py`, exactly as -shown in the linked test files. - -## Representative tests (source verified) - -These examples are copied verbatim from the real tests. Documentation tests -select the named function from its source AST and fail if a displayed example -diverges. - -### DAXPY - - -```python -def test_daxpy(prik_blas, f2py_blas): - alpha = np.float64(-1.5) - x = np.array([2.0, -4.0, 1.0], dtype=np.float64) - original_y = np.array([3.0, 5.0, -2.0], dtype=np.float64) - prik_x, f2py_x = x.copy(), x.copy() - prik_y, f2py_y = original_y.copy(), original_y.copy() - - prik_scalars = prik_blas.daxpy(np.int32(3), alpha, prik_x, np.int32(1), prik_y, np.int32(1)) - f2py_result = f2py_blas.daxpy(np.int32(3), alpha, f2py_x, np.int32(1), f2py_y, np.int32(1)) - - expected_y = alpha * x + original_y - assert_allclose_for_dtype(prik_y, expected_y) - assert_allclose_for_dtype(f2py_y, expected_y) - assert_allclose_for_dtype(prik_y, f2py_y) - assert prik_scalars == (np.int32(3), alpha, np.int32(1), np.int32(1)) - assert f2py_result is None - assert_storage_unchanged(prik_x, x) - assert_storage_unchanged(f2py_x, x) -``` - -### DDOT - - -```python -def test_ddot(prik_blas, f2py_blas): - x = np.array([1.0, -2.0, 4.0], dtype=np.float64) - y = np.array([3.0, 5.0, -1.0], dtype=np.float64) - prik_x, f2py_x = x.copy(), x.copy() - prik_y, f2py_y = y.copy(), y.copy() - - prik_value, n, incx, incy = prik_blas.ddot(np.int32(3), prik_x, np.int32(1), prik_y, np.int32(1)) - f2py_value = f2py_blas.ddot(np.int32(3), f2py_x, np.int32(1), f2py_y, np.int32(1)) - - expected = np.float64(1.0 * 3.0 + (-2.0) * 5.0 + 4.0 * (-1.0)) - assert_allclose_for_dtype(prik_value, expected, operation_size=3) - assert_allclose_for_dtype(f2py_value, expected, operation_size=3) - assert_allclose_for_dtype(prik_value, f2py_value, operation_size=3) - assert (n, incx, incy) == (np.int32(3), np.int32(1), np.int32(1)) - assert_storage_unchanged(prik_x, x) - assert_storage_unchanged(f2py_x, x) - assert_storage_unchanged(prik_y, y) - assert_storage_unchanged(f2py_y, y) -``` - -### DGEMV - - -```python -def test_dgemv_no_transpose(prik_blas, f2py_blas): - alpha, beta = np.float64(2.0), np.float64(-1.0) - matrix = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [91.0, 92.0]], dtype=np.float64) - x = np.array([5.0, -2.0], dtype=np.float64) - original_y = np.array([7.0, 11.0], dtype=np.float64) - prik_a, f2py_a = matrix.copy(order="F"), matrix.copy(order="F") - prik_x, f2py_x = x.copy(), x.copy() - prik_y, f2py_y = original_y.copy(), original_y.copy() - - prik_scalars = prik_blas.dgemv( - "N", np.int32(2), np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1) - ) - # f2py places its inferred optional leading dimension after the native arrays. - f2py_result = f2py_blas.dgemv( - b"N", np.int32(2), np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3) - ) - - product = np.array([1.0 * 5.0 + 2.0 * (-2.0), 3.0 * 5.0 + 4.0 * (-2.0)]) - expected_y = alpha * product + beta * original_y - assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) - assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) - assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) - assert prik_scalars == (2, 2, alpha, 3, 1, beta, 1) - assert f2py_result is None - assert_storage_unchanged(prik_a, matrix) - assert_storage_unchanged(f2py_a, matrix) - assert_storage_unchanged(prik_x, x) - assert_storage_unchanged(f2py_x, x) -``` - -### DGEMM - - -```python -def test_dgemm(prik_blas, f2py_blas): - alpha, beta = np.float64(2.0), np.float64(-0.5) - a = np.asfortranarray([[1.0, 2.0], [3.0, 4.0], [91.0, 92.0]], dtype=np.float64) - b = np.asfortranarray([[5.0, 6.0], [7.0, 8.0], [93.0, 94.0]], dtype=np.float64) - original_c = np.asfortranarray([[9.0, 10.0], [11.0, 12.0], [95.0, 96.0]], dtype=np.float64) - prik_a, f2py_a = a.copy(order="F"), a.copy(order="F") - prik_b, f2py_b = b.copy(order="F"), b.copy(order="F") - prik_c, f2py_c = original_c.copy(order="F"), original_c.copy(order="F") - - prik_scalars = prik_blas.dgemm( - "N", - "N", - np.int32(2), - np.int32(2), - np.int32(2), - alpha, - prik_a, - np.int32(3), - prik_b, - np.int32(3), - beta, - prik_c, - np.int32(3), - ) - # f2py moves its inferred optional leading dimensions to keyword arguments. - f2py_result = f2py_blas.dgemm( - b"N", - b"N", - np.int32(2), - np.int32(2), - np.int32(2), - alpha, - f2py_a, - f2py_b, - beta, - f2py_c, - lda=np.int32(3), - ldb=np.int32(3), - ldc=np.int32(3), - ) - - product = np.array( - [[1.0 * 5.0 + 2.0 * 7.0, 1.0 * 6.0 + 2.0 * 8.0], [3.0 * 5.0 + 4.0 * 7.0, 3.0 * 6.0 + 4.0 * 8.0]], - dtype=np.float64, - ) - expected_active = alpha * product + beta * original_c[:2, :] - assert_allclose_for_dtype(prik_c[:2, :], expected_active, operation_size=2) - assert_allclose_for_dtype(f2py_c[:2, :], expected_active, operation_size=2) - assert_allclose_for_dtype(prik_c[:2, :], f2py_c[:2, :], operation_size=2) - np.testing.assert_array_equal(prik_c[2, :], original_c[2, :], strict=True) - np.testing.assert_array_equal(f2py_c[2, :], original_c[2, :], strict=True) - assert prik_scalars == (2, 2, 2, alpha, 3, 3, beta, 3) - assert f2py_result is None - assert_storage_unchanged(prik_a, a) - assert_storage_unchanged(f2py_a, a) - assert_storage_unchanged(prik_b, b) - assert_storage_unchanged(f2py_b, b) -``` - -### DTRSV - - -```python -def test_dtrsv_upper_nonunit(prik_blas, f2py_blas): - original_a = np.asfortranarray([[2.0, -1.0], [np.nan, 3.0], [91.0, 92.0]], dtype=np.float64) - expected_solution = np.array([4.0, -2.0], dtype=np.float64) - logical_a = triangular_from_triangle(original_a, 2, "U", unit_diagonal=False) - original_b = logical_a.T @ expected_solution - prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") - prik_x, f2py_x = original_b.copy(), original_b.copy() - - prik_blas.dtrsv("U", "T", "N", np.int32(2), prik_a, np.int32(3), prik_x, np.int32(1)) - f2py_blas.dtrsv(b"U", b"T", b"N", np.int32(2), f2py_a, f2py_x, np.int32(1), lda=np.int32(3)) - - assert_allclose_for_dtype(logical_a.T @ prik_x, original_b, operation_size=2) - assert_allclose_for_dtype(logical_a.T @ f2py_x, original_b, operation_size=2) - assert_allclose_for_dtype(prik_x, expected_solution, operation_size=2) - assert_allclose_for_dtype(f2py_x, expected_solution, operation_size=2) - assert_allclose_for_dtype(prik_x, f2py_x, operation_size=2) - assert_storage_unchanged(prik_a, original_a) - assert_storage_unchanged(f2py_a, original_a) -``` - -### CHEMV (complex Hermitian) - - -```python -def test_chemv(prik_blas, f2py_blas): - alpha, beta = np.complex64(1.0 - 0.5j), np.complex64(0.25j) - original_a = np.asfortranarray( - [[2.0 + 77.0j, 1.0 - 2.0j], [np.nan + 1.0j * np.nan, 3.0 - 88.0j], [91.0j, 92.0j]], dtype=np.complex64 - ) - x = np.array([2.0 + 1.0j, -1.0 + 0.5j], dtype=np.complex64) - original_y = np.array([4.0 - 2.0j, 5.0 + 3.0j], dtype=np.complex64) - logical_a = hermitian_from_triangle(original_a, 2, "U") - prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") - prik_x, f2py_x = x.copy(), x.copy() - prik_y, f2py_y = original_y.copy(), original_y.copy() - - prik_blas.chemv("U", np.int32(2), alpha, prik_a, np.int32(3), prik_x, np.int32(1), beta, prik_y, np.int32(1)) - f2py_blas.chemv(b"U", np.int32(2), alpha, f2py_a, f2py_x, np.int32(1), beta, f2py_y, np.int32(1), lda=np.int32(3)) - - expected_y = alpha * logical_a @ x + beta * original_y - assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) - assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) - assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) - assert_storage_unchanged(prik_a, original_a) - assert_storage_unchanged(f2py_a, original_a) - assert_storage_unchanged(prik_x, x) - assert_storage_unchanged(f2py_x, x) ``` -### SGBMV (general band) - - -```python -def test_sgbmv(prik_blas, f2py_blas): - alpha, beta = np.float32(1.5), np.float32(-0.5) - original_a = np.asfortranarray([[91.0, -1.0], [2.0, 3.0], [4.0, 92.0], [93.0, 94.0]], dtype=np.float32) - x = np.array([2.0, -3.0], dtype=np.float32) - original_y = np.array([4.0, 5.0], dtype=np.float32) - logical_a = general_from_band(original_a, 2, 2, 1, 1) - prik_a, f2py_a = original_a.copy(order="F"), original_a.copy(order="F") - prik_x, f2py_x = x.copy(), x.copy() - prik_y, f2py_y = original_y.copy(), original_y.copy() +You can also run one family or routine: - prik_blas.sgbmv( - "N", - np.int32(2), - np.int32(2), - np.int32(1), - np.int32(1), - alpha, - prik_a, - np.int32(4), - prik_x, - np.int32(1), - beta, - prik_y, - np.int32(1), - ) - f2py_blas.sgbmv( - b"N", - np.int32(2), - np.int32(2), - np.int32(1), - np.int32(1), - alpha, - f2py_a, - f2py_x, - np.int32(1), - beta, - f2py_y, - np.int32(1), - lda=np.int32(4), - ) - - expected_y = alpha * logical_a @ x + beta * original_y - assert_allclose_for_dtype(prik_y, expected_y, operation_size=2) - assert_allclose_for_dtype(f2py_y, expected_y, operation_size=2) - assert_allclose_for_dtype(prik_y, f2py_y, operation_size=2) - assert_storage_unchanged(prik_a, original_a) - assert_storage_unchanged(f2py_a, original_a) - assert_storage_unchanged(prik_x, x) - assert_storage_unchanged(f2py_x, x) +```bash +python3 -m pytest -q examples/blas/tests/test_level1_real.py +python3 -m pytest -q \ + examples/blas/tests/test_level1_real.py::test_daxpy +python3 -m pytest -q examples/blas/tests -k dgemm ``` -## Coverage and known API differences - -`routine_inventory.py` classifies all routines by BLAS level and storage -family. `test_routine_coverage.py` parses the source files and fails on a -missing/extra classification, missing PRIK or f2py export, absent explicitly -named test, duplicate test name, routine-level skip, or unaudited outcome. - -Current audited counts: - -| Outcome | Count | -| --- | ---: | -| Native source files | 155 | -| Discovered callable routines | 155 | -| PRIK exports and independently validated routines | 155 | -| f2py exports | 155 | -| Full independent plus differential success | 155 | -| f2py scalar-writeback intent overlays | 6 | -| Unsupported routines | 0 | -| Environmentally skipped routines | 0 | +## What the comparison shows -The overlays cover `srotg`, `drotg`, `crotg`, `zrotg`, `srotmg`, and `drotmg`. -Their tests validate f2py's 0-D scalar storage against PRIK and independent -mathematics; no routine is excluded from differential coverage. +PRIK preserves the native BLAS argument order and returns visible scalar +writebacks. f2py compiles the committed reviewed [`blas.pyf`](blas.pyf) and +links the existing shared library. -PRIK uses Python `str` for native character arguments while f2py uses `bytes`. -PRIK returns detached scalar arguments alongside function/subroutine results; -f2py generally returns only a function result and returns `None` for -subroutines. `LSAME` is a Python `bool` through PRIK and an integer truth value -through f2py. Tests keep both calls visible wherever these APIs differ. +The 6 rotation routines do not declare Fortran `intent` for scalar writebacks. +The reviewed signature records their `intent(inout)` declarations and the +comparison passes typed NumPy 0-D arrays. PRIK needs neither: it returns those +scalar writebacks directly. -## Diagnose a failure +The tests cover positive and negative increments, leading-dimension padding, +packed and banded layouts, triangular and Hermitian storage, native one-based +indexes, input preservation, and dtype-aware numerical tolerances. The +independent oracle remains visible beside every wrapper call. -Keep a named temporary directory and display build output: +## Sources and license -```bash -python3 -m pytest -vv -s examples/blas/tests -k dgemm --basetemp=/tmp/prik-blas-debug -``` - -Build failures include the compiler identity, complete command, stdout, and -stderr. For numerical failures, run the single named test and inspect the -visible inputs, wrapper calls, independent expectation, and preservation -assertions in that function. The suite performs no timing collection and makes -no performance claims. +[`native/`](native/) contains the 155 files from `BLAS/SRC/` in Netlib LAPACK +3.12.1. The audited archive has SHA-256 +`37b00c90947488521f475b5a187fff4da4a5cfe61b525efcacf7a97f39a45ec6`. +See the [Netlib BLAS FAQ](https://www.netlib.org/blas/faq.html#1_5) and the +[LAPACK license](https://www.netlib.org/lapack/LICENSE.txt) before +redistributing the native sources. diff --git a/examples/blas/blas.pyf b/examples/blas/blas.pyf new file mode 100644 index 000000000..2ca693fe4 --- /dev/null +++ b/examples/blas/blas.pyf @@ -0,0 +1,1562 @@ +! -*- f90 -*- +! Note: the context of this file is case sensitive. + +python module f2py_reference_blas + interface + subroutine caxpy(n,ca,cx,incx,cy,incy) + integer :: n + complex :: ca + complex dimension(*) :: cx + integer :: incx + complex dimension(*) :: cy + integer :: incy + end subroutine caxpy + subroutine ccopy(n,cx,incx,cy,incy) + integer :: n + complex dimension(*) :: cx + integer :: incx + complex dimension(*) :: cy + integer :: incy + end subroutine ccopy + function cdotc(n,cx,incx,cy,incy) + integer :: n + complex dimension(*) :: cx + integer :: incx + complex dimension(*) :: cy + integer :: incy + complex :: cdotc + end function cdotc + function cdotu(n,cx,incx,cy,incy) + integer :: n + complex dimension(*) :: cx + integer :: incx + complex dimension(*) :: cy + integer :: incy + complex :: cdotu + end function cdotu + subroutine cgbmv(trans,m,n,kl,ku,alpha,a,lda,x,incx,beta,y,incy) + character :: trans + integer :: m + integer :: n + integer :: kl + integer :: ku + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(*) :: x + integer :: incx + complex :: beta + complex dimension(*) :: y + integer :: incy + end subroutine cgbmv + subroutine cgemm(transa,transb,m,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: transa + character :: transb + integer :: m + integer :: n + integer :: k + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + complex :: beta + complex dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine cgemm + subroutine cgemmtr(uplo,transa,transb,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: uplo + character :: transa + character :: transb + integer :: n + integer :: k + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + complex :: beta + complex dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine cgemmtr + subroutine cgemv(trans,m,n,alpha,a,lda,x,incx,beta,y,incy) + character :: trans + integer :: m + integer :: n + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(*) :: x + integer :: incx + complex :: beta + complex dimension(*) :: y + integer :: incy + end subroutine cgemv + subroutine cgerc(m,n,alpha,x,incx,y,incy,a,lda) + integer :: m + integer :: n + complex :: alpha + complex dimension(*) :: x + integer :: incx + complex dimension(*) :: y + integer :: incy + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine cgerc + subroutine cgeru(m,n,alpha,x,incx,y,incy,a,lda) + integer :: m + integer :: n + complex :: alpha + complex dimension(*) :: x + integer :: incx + complex dimension(*) :: y + integer :: incy + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine cgeru + subroutine chbmv(uplo,n,k,alpha,a,lda,x,incx,beta,y,incy) + character :: uplo + integer :: n + integer :: k + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(*) :: x + integer :: incx + complex :: beta + complex dimension(*) :: y + integer :: incy + end subroutine chbmv + subroutine chemm(side,uplo,m,n,alpha,a,lda,b,ldb,beta,c,ldc) + character :: side + character :: uplo + integer :: m + integer :: n + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + complex :: beta + complex dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine chemm + subroutine chemv(uplo,n,alpha,a,lda,x,incx,beta,y,incy) + character :: uplo + integer :: n + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(*) :: x + integer :: incx + complex :: beta + complex dimension(*) :: y + integer :: incy + end subroutine chemv + subroutine cher(uplo,n,alpha,x,incx,a,lda) + character :: uplo + integer :: n + real :: alpha + complex dimension(*) :: x + integer :: incx + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine cher + subroutine cher2(uplo,n,alpha,x,incx,y,incy,a,lda) + character :: uplo + integer :: n + complex :: alpha + complex dimension(*) :: x + integer :: incx + complex dimension(*) :: y + integer :: incy + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine cher2 + subroutine cher2k(uplo,trans,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + real :: beta + complex dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine cher2k + subroutine cherk(uplo,trans,n,k,alpha,a,lda,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + real :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real :: beta + complex dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine cherk + subroutine chpmv(uplo,n,alpha,ap,x,incx,beta,y,incy) + character :: uplo + integer :: n + complex :: alpha + complex dimension(*) :: ap + complex dimension(*) :: x + integer :: incx + complex :: beta + complex dimension(*) :: y + integer :: incy + end subroutine chpmv + subroutine chpr(uplo,n,alpha,x,incx,ap) + character :: uplo + integer :: n + real :: alpha + complex dimension(*) :: x + integer :: incx + complex dimension(*) :: ap + end subroutine chpr + subroutine chpr2(uplo,n,alpha,x,incx,y,incy,ap) + character :: uplo + integer :: n + complex :: alpha + complex dimension(*) :: x + integer :: incx + complex dimension(*) :: y + integer :: incy + complex dimension(*) :: ap + end subroutine chpr2 + subroutine crotg(a,b,c,s) + complex(kind=4) intent(inout) :: a + complex(kind=4) :: b + real(kind=4) intent(inout) :: c + complex(kind=4) intent(inout) :: s + end subroutine crotg + subroutine cscal(n,ca,cx,incx) + integer :: n + complex :: ca + complex dimension(*) :: cx + integer :: incx + end subroutine cscal + subroutine csrot(n,cx,incx,cy,incy,c,s) + integer :: n + complex dimension(*) :: cx + integer :: incx + complex dimension(*) :: cy + integer :: incy + real :: c + real :: s + end subroutine csrot + subroutine csscal(n,sa,cx,incx) + integer :: n + real :: sa + complex dimension(*) :: cx + integer :: incx + end subroutine csscal + subroutine cswap(n,cx,incx,cy,incy) + integer :: n + complex dimension(*) :: cx + integer :: incx + complex dimension(*) :: cy + integer :: incy + end subroutine cswap + subroutine csymm(side,uplo,m,n,alpha,a,lda,b,ldb,beta,c,ldc) + character :: side + character :: uplo + integer :: m + integer :: n + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + complex :: beta + complex dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine csymm + subroutine csyr2k(uplo,trans,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + complex :: beta + complex dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine csyr2k + subroutine csyrk(uplo,trans,n,k,alpha,a,lda,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex :: beta + complex dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine csyrk + subroutine ctbmv(uplo,trans,diag,n,k,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + integer :: k + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(*) :: x + integer :: incx + end subroutine ctbmv + subroutine ctbsv(uplo,trans,diag,n,k,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + integer :: k + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(*) :: x + integer :: incx + end subroutine ctbsv + subroutine ctpmv(uplo,trans,diag,n,ap,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + complex dimension(*) :: ap + complex dimension(*) :: x + integer :: incx + end subroutine ctpmv + subroutine ctpsv(uplo,trans,diag,n,ap,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + complex dimension(*) :: ap + complex dimension(*) :: x + integer :: incx + end subroutine ctpsv + subroutine ctrmm(side,uplo,transa,diag,m,n,alpha,a,lda,b,ldb) + character :: side + character :: uplo + character :: transa + character :: diag + integer :: m + integer :: n + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + end subroutine ctrmm + subroutine ctrmv(uplo,trans,diag,n,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(*) :: x + integer :: incx + end subroutine ctrmv + subroutine ctrsm(side,uplo,transa,diag,m,n,alpha,a,lda,b,ldb) + character :: side + character :: uplo + character :: transa + character :: diag + integer :: m + integer :: n + complex :: alpha + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + end subroutine ctrsm + subroutine ctrsv(uplo,trans,diag,n,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + complex dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex dimension(*) :: x + integer :: incx + end subroutine ctrsv + function dasum(n,dx,incx) + integer :: n + double precision dimension(*) :: dx + integer :: incx + double precision :: dasum + end function dasum + subroutine daxpy(n,da,dx,incx,dy,incy) + integer :: n + double precision :: da + double precision dimension(*) :: dx + integer :: incx + double precision dimension(*) :: dy + integer :: incy + end subroutine daxpy + function dcabs1(z) + complex*16 :: z + double precision :: dcabs1 + end function dcabs1 + subroutine dcopy(n,dx,incx,dy,incy) + integer :: n + double precision dimension(*) :: dx + integer :: incx + double precision dimension(*) :: dy + integer :: incy + end subroutine dcopy + function ddot(n,dx,incx,dy,incy) + integer :: n + double precision dimension(*) :: dx + integer :: incx + double precision dimension(*) :: dy + integer :: incy + double precision :: ddot + end function ddot + subroutine dgbmv(trans,m,n,kl,ku,alpha,a,lda,x,incx,beta,y,incy) + character :: trans + integer :: m + integer :: n + integer :: kl + integer :: ku + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: x + integer :: incx + double precision :: beta + double precision dimension(*) :: y + integer :: incy + end subroutine dgbmv + subroutine dgemm(transa,transb,m,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: transa + character :: transb + integer :: m + integer :: n + integer :: k + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision :: beta + double precision dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine dgemm + subroutine dgemmtr(uplo,transa,transb,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: uplo + character :: transa + character :: transb + integer :: n + integer :: k + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision :: beta + double precision dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine dgemmtr + subroutine dgemv(trans,m,n,alpha,a,lda,x,incx,beta,y,incy) + character :: trans + integer :: m + integer :: n + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: x + integer :: incx + double precision :: beta + double precision dimension(*) :: y + integer :: incy + end subroutine dgemv + subroutine dger(m,n,alpha,x,incx,y,incy,a,lda) + integer :: m + integer :: n + double precision :: alpha + double precision dimension(*) :: x + integer :: incx + double precision dimension(*) :: y + integer :: incy + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine dger + function dnrm2(n,x,incx) + integer :: n + real(kind=8) dimension(*) :: x + integer :: incx + real(kind=8) :: dnrm2 + end function dnrm2 + subroutine drot(n,dx,incx,dy,incy,c,s) + integer :: n + double precision dimension(*) :: dx + integer :: incx + double precision dimension(*) :: dy + integer :: incy + double precision :: c + double precision :: s + end subroutine drot + subroutine drotg(a,b,c,s) + real(kind=8) intent(inout) :: a + real(kind=8) intent(inout) :: b + real(kind=8) intent(inout) :: c + real(kind=8) intent(inout) :: s + end subroutine drotg + subroutine drotm(n,dx,incx,dy,incy,dparam) + integer :: n + double precision dimension(*) :: dx + integer :: incx + double precision dimension(*) :: dy + integer :: incy + double precision dimension(5) :: dparam + end subroutine drotm + subroutine drotmg(dd1,dd2,dx1,dy1,dparam) + double precision intent(inout) :: dd1 + double precision intent(inout) :: dd2 + double precision intent(inout) :: dx1 + double precision :: dy1 + double precision dimension(5),intent(inout) :: dparam + end subroutine drotmg + subroutine dsbmv(uplo,n,k,alpha,a,lda,x,incx,beta,y,incy) + character :: uplo + integer :: n + integer :: k + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: x + integer :: incx + double precision :: beta + double precision dimension(*) :: y + integer :: incy + end subroutine dsbmv + subroutine dscal(n,da,dx,incx) + integer :: n + double precision :: da + double precision dimension(*) :: dx + integer :: incx + end subroutine dscal + function dsdot(n,sx,incx,sy,incy) + integer :: n + real dimension(*) :: sx + integer :: incx + real dimension(*) :: sy + integer :: incy + double precision :: dsdot + end function dsdot + subroutine dspmv(uplo,n,alpha,ap,x,incx,beta,y,incy) + character :: uplo + integer :: n + double precision :: alpha + double precision dimension(*) :: ap + double precision dimension(*) :: x + integer :: incx + double precision :: beta + double precision dimension(*) :: y + integer :: incy + end subroutine dspmv + subroutine dspr(uplo,n,alpha,x,incx,ap) + character :: uplo + integer :: n + double precision :: alpha + double precision dimension(*) :: x + integer :: incx + double precision dimension(*) :: ap + end subroutine dspr + subroutine dspr2(uplo,n,alpha,x,incx,y,incy,ap) + character :: uplo + integer :: n + double precision :: alpha + double precision dimension(*) :: x + integer :: incx + double precision dimension(*) :: y + integer :: incy + double precision dimension(*) :: ap + end subroutine dspr2 + subroutine dswap(n,dx,incx,dy,incy) + integer :: n + double precision dimension(*) :: dx + integer :: incx + double precision dimension(*) :: dy + integer :: incy + end subroutine dswap + subroutine dsymm(side,uplo,m,n,alpha,a,lda,b,ldb,beta,c,ldc) + character :: side + character :: uplo + integer :: m + integer :: n + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision :: beta + double precision dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine dsymm + subroutine dsymv(uplo,n,alpha,a,lda,x,incx,beta,y,incy) + character :: uplo + integer :: n + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: x + integer :: incx + double precision :: beta + double precision dimension(*) :: y + integer :: incy + end subroutine dsymv + subroutine dsyr(uplo,n,alpha,x,incx,a,lda) + character :: uplo + integer :: n + double precision :: alpha + double precision dimension(*) :: x + integer :: incx + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine dsyr + subroutine dsyr2(uplo,n,alpha,x,incx,y,incy,a,lda) + character :: uplo + integer :: n + double precision :: alpha + double precision dimension(*) :: x + integer :: incx + double precision dimension(*) :: y + integer :: incy + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine dsyr2 + subroutine dsyr2k(uplo,trans,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision :: beta + double precision dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine dsyr2k + subroutine dsyrk(uplo,trans,n,k,alpha,a,lda,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision :: beta + double precision dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine dsyrk + subroutine dtbmv(uplo,trans,diag,n,k,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + integer :: k + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: x + integer :: incx + end subroutine dtbmv + subroutine dtbsv(uplo,trans,diag,n,k,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + integer :: k + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: x + integer :: incx + end subroutine dtbsv + subroutine dtpmv(uplo,trans,diag,n,ap,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + double precision dimension(*) :: ap + double precision dimension(*) :: x + integer :: incx + end subroutine dtpmv + subroutine dtpsv(uplo,trans,diag,n,ap,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + double precision dimension(*) :: ap + double precision dimension(*) :: x + integer :: incx + end subroutine dtpsv + subroutine dtrmm(side,uplo,transa,diag,m,n,alpha,a,lda,b,ldb) + character :: side + character :: uplo + character :: transa + character :: diag + integer :: m + integer :: n + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + end subroutine dtrmm + subroutine dtrmv(uplo,trans,diag,n,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: x + integer :: incx + end subroutine dtrmv + subroutine dtrsm(side,uplo,transa,diag,m,n,alpha,a,lda,b,ldb) + character :: side + character :: uplo + character :: transa + character :: diag + integer :: m + integer :: n + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + end subroutine dtrsm + subroutine dtrsv(uplo,trans,diag,n,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: x + integer :: incx + end subroutine dtrsv + function dzasum(n,zx,incx) + integer :: n + complex*16 dimension(*) :: zx + integer :: incx + double precision :: dzasum + end function dzasum + function dznrm2(n,x,incx) + integer :: n + complex(kind=8) dimension(*) :: x + integer :: incx + real(kind=8) :: dznrm2 + end function dznrm2 + function icamax(n,cx,incx) + integer :: n + complex dimension(*) :: cx + integer :: incx + integer :: icamax + end function icamax + function idamax(n,dx,incx) + integer :: n + double precision dimension(*) :: dx + integer :: incx + integer :: idamax + end function idamax + function isamax(n,sx,incx) + integer :: n + real dimension(*) :: sx + integer :: incx + integer :: isamax + end function isamax + function izamax(n,zx,incx) + integer :: n + complex*16 dimension(*) :: zx + integer :: incx + integer :: izamax + end function izamax + function lsame(ca,cb) + character :: ca + character :: cb + logical :: lsame + end function lsame + function sasum(n,sx,incx) + integer :: n + real dimension(*) :: sx + integer :: incx + real :: sasum + end function sasum + subroutine saxpy(n,sa,sx,incx,sy,incy) + integer :: n + real :: sa + real dimension(*) :: sx + integer :: incx + real dimension(*) :: sy + integer :: incy + end subroutine saxpy + function scabs1(z) + complex :: z + real :: scabs1 + end function scabs1 + function scasum(n,cx,incx) + integer :: n + complex dimension(*) :: cx + integer :: incx + real :: scasum + end function scasum + function scnrm2(n,x,incx) + integer :: n + complex(kind=4) dimension(*) :: x + integer :: incx + real(kind=4) :: scnrm2 + end function scnrm2 + subroutine scopy(n,sx,incx,sy,incy) + integer :: n + real dimension(*) :: sx + integer :: incx + real dimension(*) :: sy + integer :: incy + end subroutine scopy + function sdot(n,sx,incx,sy,incy) + integer :: n + real dimension(*) :: sx + integer :: incx + real dimension(*) :: sy + integer :: incy + real :: sdot + end function sdot + function sdsdot(n,sb,sx,incx,sy,incy) + integer :: n + real :: sb + real dimension(*) :: sx + integer :: incx + real dimension(*) :: sy + integer :: incy + real :: sdsdot + end function sdsdot + subroutine sgbmv(trans,m,n,kl,ku,alpha,a,lda,x,incx,beta,y,incy) + character :: trans + integer :: m + integer :: n + integer :: kl + integer :: ku + real :: alpha + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(*) :: x + integer :: incx + real :: beta + real dimension(*) :: y + integer :: incy + end subroutine sgbmv + subroutine sgemm(transa,transb,m,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: transa + character :: transb + integer :: m + integer :: n + integer :: k + real :: alpha + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + real :: beta + real dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine sgemm + subroutine sgemmtr(uplo,transa,transb,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: uplo + character :: transa + character :: transb + integer :: n + integer :: k + real :: alpha + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + real :: beta + real dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine sgemmtr + subroutine sgemv(trans,m,n,alpha,a,lda,x,incx,beta,y,incy) + character :: trans + integer :: m + integer :: n + real :: alpha + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(*) :: x + integer :: incx + real :: beta + real dimension(*) :: y + integer :: incy + end subroutine sgemv + subroutine sger(m,n,alpha,x,incx,y,incy,a,lda) + integer :: m + integer :: n + real :: alpha + real dimension(*) :: x + integer :: incx + real dimension(*) :: y + integer :: incy + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine sger + function snrm2(n,x,incx) + integer :: n + real(kind=4) dimension(*) :: x + integer :: incx + real(kind=4) :: snrm2 + end function snrm2 + subroutine srot(n,sx,incx,sy,incy,c,s) + integer :: n + real dimension(*) :: sx + integer :: incx + real dimension(*) :: sy + integer :: incy + real :: c + real :: s + end subroutine srot + subroutine srotg(a,b,c,s) + real(kind=4) intent(inout) :: a + real(kind=4) intent(inout) :: b + real(kind=4) intent(inout) :: c + real(kind=4) intent(inout) :: s + end subroutine srotg + subroutine srotm(n,sx,incx,sy,incy,sparam) + integer :: n + real dimension(*) :: sx + integer :: incx + real dimension(*) :: sy + integer :: incy + real dimension(5) :: sparam + end subroutine srotm + subroutine srotmg(sd1,sd2,sx1,sy1,sparam) + real intent(inout) :: sd1 + real intent(inout) :: sd2 + real intent(inout) :: sx1 + real :: sy1 + real dimension(5),intent(inout) :: sparam + end subroutine srotmg + subroutine ssbmv(uplo,n,k,alpha,a,lda,x,incx,beta,y,incy) + character :: uplo + integer :: n + integer :: k + real :: alpha + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(*) :: x + integer :: incx + real :: beta + real dimension(*) :: y + integer :: incy + end subroutine ssbmv + subroutine sscal(n,sa,sx,incx) + integer :: n + real :: sa + real dimension(*) :: sx + integer :: incx + end subroutine sscal + subroutine sspmv(uplo,n,alpha,ap,x,incx,beta,y,incy) + character :: uplo + integer :: n + real :: alpha + real dimension(*) :: ap + real dimension(*) :: x + integer :: incx + real :: beta + real dimension(*) :: y + integer :: incy + end subroutine sspmv + subroutine sspr(uplo,n,alpha,x,incx,ap) + character :: uplo + integer :: n + real :: alpha + real dimension(*) :: x + integer :: incx + real dimension(*) :: ap + end subroutine sspr + subroutine sspr2(uplo,n,alpha,x,incx,y,incy,ap) + character :: uplo + integer :: n + real :: alpha + real dimension(*) :: x + integer :: incx + real dimension(*) :: y + integer :: incy + real dimension(*) :: ap + end subroutine sspr2 + subroutine sswap(n,sx,incx,sy,incy) + integer :: n + real dimension(*) :: sx + integer :: incx + real dimension(*) :: sy + integer :: incy + end subroutine sswap + subroutine ssymm(side,uplo,m,n,alpha,a,lda,b,ldb,beta,c,ldc) + character :: side + character :: uplo + integer :: m + integer :: n + real :: alpha + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + real :: beta + real dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine ssymm + subroutine ssymv(uplo,n,alpha,a,lda,x,incx,beta,y,incy) + character :: uplo + integer :: n + real :: alpha + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(*) :: x + integer :: incx + real :: beta + real dimension(*) :: y + integer :: incy + end subroutine ssymv + subroutine ssyr(uplo,n,alpha,x,incx,a,lda) + character :: uplo + integer :: n + real :: alpha + real dimension(*) :: x + integer :: incx + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine ssyr + subroutine ssyr2(uplo,n,alpha,x,incx,y,incy,a,lda) + character :: uplo + integer :: n + real :: alpha + real dimension(*) :: x + integer :: incx + real dimension(*) :: y + integer :: incy + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine ssyr2 + subroutine ssyr2k(uplo,trans,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + real :: alpha + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + real :: beta + real dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine ssyr2k + subroutine ssyrk(uplo,trans,n,k,alpha,a,lda,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + real :: alpha + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real :: beta + real dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine ssyrk + subroutine stbmv(uplo,trans,diag,n,k,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + integer :: k + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(*) :: x + integer :: incx + end subroutine stbmv + subroutine stbsv(uplo,trans,diag,n,k,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + integer :: k + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(*) :: x + integer :: incx + end subroutine stbsv + subroutine stpmv(uplo,trans,diag,n,ap,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + real dimension(*) :: ap + real dimension(*) :: x + integer :: incx + end subroutine stpmv + subroutine stpsv(uplo,trans,diag,n,ap,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + real dimension(*) :: ap + real dimension(*) :: x + integer :: incx + end subroutine stpsv + subroutine strmm(side,uplo,transa,diag,m,n,alpha,a,lda,b,ldb) + character :: side + character :: uplo + character :: transa + character :: diag + integer :: m + integer :: n + real :: alpha + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + end subroutine strmm + subroutine strmv(uplo,trans,diag,n,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(*) :: x + integer :: incx + end subroutine strmv + subroutine strsm(side,uplo,transa,diag,m,n,alpha,a,lda,b,ldb) + character :: side + character :: uplo + character :: transa + character :: diag + integer :: m + integer :: n + real :: alpha + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + end subroutine strsm + subroutine strsv(uplo,trans,diag,n,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + real dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + real dimension(*) :: x + integer :: incx + end subroutine strsv + subroutine xerbla(srname,info) + character*(*) :: srname + integer :: info + end subroutine xerbla + subroutine xerbla_array(srname_array,srname_len,info) + character(len=1) dimension(srname_len) :: srname_array + integer, optional,check(shape(srname_array, 0) == srname_len),depend(srname_array) :: srname_len=shape(srname_array, 0) + integer :: info + end subroutine xerbla_array + subroutine zaxpy(n,za,zx,incx,zy,incy) + integer :: n + complex*16 :: za + complex*16 dimension(*) :: zx + integer :: incx + complex*16 dimension(*) :: zy + integer :: incy + end subroutine zaxpy + subroutine zcopy(n,zx,incx,zy,incy) + integer :: n + complex*16 dimension(*) :: zx + integer :: incx + complex*16 dimension(*) :: zy + integer :: incy + end subroutine zcopy + function zdotc(n,zx,incx,zy,incy) + integer :: n + complex*16 dimension(*) :: zx + integer :: incx + complex*16 dimension(*) :: zy + integer :: incy + complex*16 :: zdotc + end function zdotc + function zdotu(n,zx,incx,zy,incy) + integer :: n + complex*16 dimension(*) :: zx + integer :: incx + complex*16 dimension(*) :: zy + integer :: incy + complex*16 :: zdotu + end function zdotu + subroutine zdrot(n,zx,incx,zy,incy,c,s) + integer :: n + complex*16 dimension(*) :: zx + integer :: incx + complex*16 dimension(*) :: zy + integer :: incy + double precision :: c + double precision :: s + end subroutine zdrot + subroutine zdscal(n,da,zx,incx) + integer :: n + double precision :: da + complex*16 dimension(*) :: zx + integer :: incx + end subroutine zdscal + subroutine zgbmv(trans,m,n,kl,ku,alpha,a,lda,x,incx,beta,y,incy) + character :: trans + integer :: m + integer :: n + integer :: kl + integer :: ku + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(*) :: x + integer :: incx + complex*16 :: beta + complex*16 dimension(*) :: y + integer :: incy + end subroutine zgbmv + subroutine zgemm(transa,transb,m,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: transa + character :: transb + integer :: m + integer :: n + integer :: k + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + complex*16 :: beta + complex*16 dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine zgemm + subroutine zgemmtr(uplo,transa,transb,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: uplo + character :: transa + character :: transb + integer :: n + integer :: k + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + complex*16 :: beta + complex*16 dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine zgemmtr + subroutine zgemv(trans,m,n,alpha,a,lda,x,incx,beta,y,incy) + character :: trans + integer :: m + integer :: n + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(*) :: x + integer :: incx + complex*16 :: beta + complex*16 dimension(*) :: y + integer :: incy + end subroutine zgemv + subroutine zgerc(m,n,alpha,x,incx,y,incy,a,lda) + integer :: m + integer :: n + complex*16 :: alpha + complex*16 dimension(*) :: x + integer :: incx + complex*16 dimension(*) :: y + integer :: incy + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine zgerc + subroutine zgeru(m,n,alpha,x,incx,y,incy,a,lda) + integer :: m + integer :: n + complex*16 :: alpha + complex*16 dimension(*) :: x + integer :: incx + complex*16 dimension(*) :: y + integer :: incy + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine zgeru + subroutine zhbmv(uplo,n,k,alpha,a,lda,x,incx,beta,y,incy) + character :: uplo + integer :: n + integer :: k + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(*) :: x + integer :: incx + complex*16 :: beta + complex*16 dimension(*) :: y + integer :: incy + end subroutine zhbmv + subroutine zhemm(side,uplo,m,n,alpha,a,lda,b,ldb,beta,c,ldc) + character :: side + character :: uplo + integer :: m + integer :: n + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + complex*16 :: beta + complex*16 dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine zhemm + subroutine zhemv(uplo,n,alpha,a,lda,x,incx,beta,y,incy) + character :: uplo + integer :: n + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(*) :: x + integer :: incx + complex*16 :: beta + complex*16 dimension(*) :: y + integer :: incy + end subroutine zhemv + subroutine zher(uplo,n,alpha,x,incx,a,lda) + character :: uplo + integer :: n + double precision :: alpha + complex*16 dimension(*) :: x + integer :: incx + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine zher + subroutine zher2(uplo,n,alpha,x,incx,y,incy,a,lda) + character :: uplo + integer :: n + complex*16 :: alpha + complex*16 dimension(*) :: x + integer :: incx + complex*16 dimension(*) :: y + integer :: incy + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + end subroutine zher2 + subroutine zher2k(uplo,trans,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision :: beta + complex*16 dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine zher2k + subroutine zherk(uplo,trans,n,k,alpha,a,lda,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + double precision :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision :: beta + complex*16 dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine zherk + subroutine zhpmv(uplo,n,alpha,ap,x,incx,beta,y,incy) + character :: uplo + integer :: n + complex*16 :: alpha + complex*16 dimension(*) :: ap + complex*16 dimension(*) :: x + integer :: incx + complex*16 :: beta + complex*16 dimension(*) :: y + integer :: incy + end subroutine zhpmv + subroutine zhpr(uplo,n,alpha,x,incx,ap) + character :: uplo + integer :: n + double precision :: alpha + complex*16 dimension(*) :: x + integer :: incx + complex*16 dimension(*) :: ap + end subroutine zhpr + subroutine zhpr2(uplo,n,alpha,x,incx,y,incy,ap) + character :: uplo + integer :: n + complex*16 :: alpha + complex*16 dimension(*) :: x + integer :: incx + complex*16 dimension(*) :: y + integer :: incy + complex*16 dimension(*) :: ap + end subroutine zhpr2 + subroutine zrotg(a,b,c,s) + complex(kind=8) intent(inout) :: a + complex(kind=8) :: b + real(kind=8) intent(inout) :: c + complex(kind=8) intent(inout) :: s + end subroutine zrotg + subroutine zscal(n,za,zx,incx) + integer :: n + complex*16 :: za + complex*16 dimension(*) :: zx + integer :: incx + end subroutine zscal + subroutine zswap(n,zx,incx,zy,incy) + integer :: n + complex*16 dimension(*) :: zx + integer :: incx + complex*16 dimension(*) :: zy + integer :: incy + end subroutine zswap + subroutine zsymm(side,uplo,m,n,alpha,a,lda,b,ldb,beta,c,ldc) + character :: side + character :: uplo + integer :: m + integer :: n + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + complex*16 :: beta + complex*16 dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine zsymm + subroutine zsyr2k(uplo,trans,n,k,alpha,a,lda,b,ldb,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + complex*16 :: beta + complex*16 dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine zsyr2k + subroutine zsyrk(uplo,trans,n,k,alpha,a,lda,beta,c,ldc) + character :: uplo + character :: trans + integer :: n + integer :: k + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 :: beta + complex*16 dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + end subroutine zsyrk + subroutine ztbmv(uplo,trans,diag,n,k,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + integer :: k + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(*) :: x + integer :: incx + end subroutine ztbmv + subroutine ztbsv(uplo,trans,diag,n,k,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + integer :: k + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(*) :: x + integer :: incx + end subroutine ztbsv + subroutine ztpmv(uplo,trans,diag,n,ap,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + complex*16 dimension(*) :: ap + complex*16 dimension(*) :: x + integer :: incx + end subroutine ztpmv + subroutine ztpsv(uplo,trans,diag,n,ap,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + complex*16 dimension(*) :: ap + complex*16 dimension(*) :: x + integer :: incx + end subroutine ztpsv + subroutine ztrmm(side,uplo,transa,diag,m,n,alpha,a,lda,b,ldb) + character :: side + character :: uplo + character :: transa + character :: diag + integer :: m + integer :: n + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + end subroutine ztrmm + subroutine ztrmv(uplo,trans,diag,n,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(*) :: x + integer :: incx + end subroutine ztrmv + subroutine ztrsm(side,uplo,transa,diag,m,n,alpha,a,lda,b,ldb) + character :: side + character :: uplo + character :: transa + character :: diag + integer :: m + integer :: n + complex*16 :: alpha + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + end subroutine ztrsm + subroutine ztrsv(uplo,trans,diag,n,a,lda,x,incx) + character :: uplo + character :: trans + character :: diag + integer :: n + complex*16 dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + complex*16 dimension(*) :: x + integer :: incx + end subroutine ztrsv + end interface +end python module f2py_reference_blas + +! This file was auto-generated with f2py (version:2.5.1). +! See: +! https://web.archive.org/web/20140822061353/http://cens.ioc.ee/projects/f2py2e diff --git a/examples/blas/build_f2py.sh b/examples/blas/build_f2py.sh index 6d6a80b40..834582305 100644 --- a/examples/blas/build_f2py.sh +++ b/examples/blas/build_f2py.sh @@ -1,6 +1,20 @@ cd "$EXAMPLE_WORKSPACE" export BLAS_F2PY_ROOT="$BLAS_BUILD_ROOT/f2py" -python -m examples.blas.f2py_build \ - "$BLAS_F2PY_ROOT" \ - "$BLAS_SHARED_LIBRARY" \ - --compiler "$(command -v gfortran)" +mkdir -p "$BLAS_F2PY_ROOT/generated" +cd "$BLAS_F2PY_ROOT" + +export FC="$(command -v gfortran)" +export F77="$FC" +export F90="$FC" +export FFLAGS="-O0" +export F90FLAGS="-O0" +export LDFLAGS="${LDFLAGS:+$LDFLAGS }-Wl,-rpath,$(dirname "$BLAS_SHARED_LIBRARY")" + +python -m numpy.f2py -c \ + "$EXAMPLE_WORKSPACE/examples/blas/blas.pyf" \ + "-L$(dirname "$BLAS_SHARED_LIBRARY")" \ + -lprik_full_blas \ + --build-dir "$BLAS_F2PY_ROOT/generated" \ + --f77flags=-O0 \ + --f90flags=-O0 \ + --opt=-O0 diff --git a/examples/blas/build_prik.sh b/examples/blas/build_prik.sh index b630611d3..e303b13fc 100644 --- a/examples/blas/build_prik.sh +++ b/examples/blas/build_prik.sh @@ -6,18 +6,14 @@ export BLAS_SHARED_LIBRARY="$( --jobs 8 )" -python -m prik generate \ - --pyi examples/blas/native \ - --language fortran \ - --out "$BLAS_BUILD_ROOT/contract/blas" - mkdir -p "$BLAS_BUILD_ROOT/prik/generated" cd "$BLAS_BUILD_ROOT/prik" -python -m prik "$BLAS_BUILD_ROOT/contract/blas/__init__.pyi" \ +python -m prik "$EXAMPLE_WORKSPACE/examples/blas/native" \ --out prik_reference_blas \ --out-dir "$BLAS_BUILD_ROOT/prik/generated" \ --compiler "$(command -v gfortran)" \ + --no-compile-input-sources \ --native-objects "$BLAS_SHARED_LIBRARY" \ --jobs 8 \ --wrapper-fortran-flags="-O0 -g0" \ diff --git a/examples/blas/f2py_build.py b/examples/blas/f2py_build.py deleted file mode 100644 index 1f38f9385..000000000 --- a/examples/blas/f2py_build.py +++ /dev/null @@ -1,111 +0,0 @@ -"""Build the reviewed f2py BLAS wrapper against one native shared library.""" - -from __future__ import annotations - -import argparse -import os -import subprocess -import sys -from collections.abc import Sequence -from pathlib import Path - -from examples.f2py_intents import prepare_f2py_intent_sources -from examples.native_library import linker_name, require_tool - - -EXAMPLE_ROOT = Path(__file__).resolve().parent -NATIVE_ROOT = EXAMPLE_ROOT / "native" -FORTRAN_SUFFIXES = frozenset({".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"}) -BLAS_SOURCES = tuple( - sorted(path for path in NATIVE_ROOT.iterdir() if path.is_file() and path.suffix.lower() in FORTRAN_SUFFIXES) -) -BUILD_FLAGS = "-O0" -F2PY_INOUT_ARGUMENTS: dict[str, tuple[str, ...]] = { - "srotg": ("a", "b", "c", "s"), - "drotg": ("a", "b", "c", "s"), - "crotg": ("a", "c", "s"), - "zrotg": ("a", "c", "s"), - "srotmg": ("sd1", "sd2", "sx1", "sparam"), - "drotmg": ("dd1", "dd2", "dx1", "dparam"), -} - - -def build_environment(compiler: str, native_library: Path) -> dict[str, str]: - """Return the compiler and runtime-link environment for f2py.""" - environment = dict(os.environ) - environment.update( - { - "CFLAGS": BUILD_FLAGS, - "FC": compiler, - "F77": compiler, - "F90": compiler, - "FFLAGS": BUILD_FLAGS, - "F90FLAGS": BUILD_FLAGS, - } - ) - rpath_flag = f"-Wl,-rpath,{native_library.parent}" - environment["LDFLAGS"] = " ".join(filter(None, (environment.get("LDFLAGS"), rpath_flag))) - return environment - - -def f2py_signature_command(workdir: Path) -> tuple[str, ...]: - """Generate f2py signatures from reviewed build-local intent overlays.""" - sources = prepare_f2py_intent_sources(BLAS_SOURCES, workdir, F2PY_INOUT_ARGUMENTS) - return ( - sys.executable, - "-m", - "numpy.f2py", - "-m", - "f2py_reference_blas", - "-h", - str(workdir / "f2py_reference_blas.pyf"), - *(str(source) for source in sources), - "--overwrite-signature", - ) - - -def f2py_build_command(workdir: Path, native_library: Path) -> tuple[str, ...]: - """Build only f2py's wrapper and link the precompiled BLAS implementation.""" - return ( - sys.executable, - "-m", - "numpy.f2py", - "-c", - str(workdir / "f2py_reference_blas.pyf"), - f"-L{native_library.parent}", - f"-l{linker_name(native_library)}", - "--build-dir", - str(workdir / "generated"), - f"--f77flags={BUILD_FLAGS}", - f"--f90flags={BUILD_FLAGS}", - f"--opt={BUILD_FLAGS}", - ) - - -def build_f2py_wrapper(workdir: Path, native_library: Path, compiler: str) -> None: - """Generate and compile the f2py wrapper in one user-facing build directory.""" - workdir.mkdir(parents=True, exist_ok=True) - environment = build_environment(compiler, native_library) - for command in (f2py_signature_command(workdir), f2py_build_command(workdir, native_library)): - subprocess.run( # nosec B603 - explicit Python/f2py commands and copied example inputs - command, - cwd=workdir, - env=environment, - check=True, - ) - - -def main(argv: Sequence[str] | None = None) -> int: - """Build the documented f2py comparison wrapper.""" - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("workdir", type=Path) - parser.add_argument("native_library", type=Path) - parser.add_argument("--compiler", default=None) - args = parser.parse_args(argv) - compiler = args.compiler or require_tool("gfortran") - build_f2py_wrapper(args.workdir.resolve(), args.native_library.resolve(), compiler) - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/examples/blas/tests/test_routine_coverage.py b/examples/blas/tests/test_routine_coverage.py index 3abb82b32..45107bba1 100644 --- a/examples/blas/tests/test_routine_coverage.py +++ b/examples/blas/tests/test_routine_coverage.py @@ -3,19 +3,13 @@ from __future__ import annotations import ast -import sys +import re from pathlib import Path import pytest from prik.parsers.fortran.parser import parse_fortran_file -from ..f2py_build import ( - BLAS_SOURCES, - F2PY_INOUT_ARGUMENTS, - f2py_build_command, - f2py_signature_command, -) from ..routine_inventory import ( ALL_ROUTINES, DIFFERENTIALLY_TESTED_ROUTINES, @@ -30,6 +24,24 @@ pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] TEST_ROOT = Path(__file__).resolve().parent EXAMPLE_ROOT = TEST_ROOT.parent +NATIVE_ROOT = EXAMPLE_ROOT / "native" +BLAS_PYF = EXAMPLE_ROOT / "blas.pyf" +FORTRAN_SUFFIXES = frozenset({".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"}) +BLAS_SOURCES = tuple( + sorted(path for path in NATIVE_ROOT.iterdir() if path.is_file() and path.suffix.lower() in FORTRAN_SUFFIXES) +) +F2PY_INOUT_ARGUMENTS: dict[str, tuple[str, ...]] = { + "srotg": ("a", "b", "c", "s"), + "drotg": ("a", "b", "c", "s"), + "crotg": ("a", "c", "s"), + "zrotg": ("a", "c", "s"), + "srotmg": ("sd1", "sd2", "sx1", "sparam"), + "drotmg": ("dd1", "dd2", "dx1", "dparam"), +} +PYF_PROCEDURE = re.compile( + r"^\s*(subroutine|function)\s+([a-z]\w*)\s*\(.*?^\s*end\s+\1\s+\2\s*$", + re.IGNORECASE | re.MULTILINE | re.DOTALL, +) TEST_MODULES = ( "test_level1_real.py", @@ -48,32 +60,39 @@ ) -def test_f2py_commands_generate_signatures_and_reuse_the_native_library(tmp_path: Path): - native_library = tmp_path / "native" / "libprik_full_blas.so" - signature_command = f2py_signature_command(tmp_path / "f2py") - f2py_command = f2py_build_command(tmp_path / "f2py", native_library) +def _pyf_procedures() -> dict[str, str]: + text = BLAS_PYF.read_text(encoding="utf-8") + return {match.group(2).lower(): match.group(0) for match in PYF_PROCEDURE.finditer(text)} - assert signature_command[:5] == (sys.executable, "-m", "numpy.f2py", "-m", "f2py_reference_blas") - assert f2py_command[:4] == (sys.executable, "-m", "numpy.f2py", "-c") - assert f"-L{native_library.parent}" in f2py_command - assert "-lprik_full_blas" in f2py_command - for source in BLAS_SOURCES: - expected_f2py_source = ( - tmp_path / "f2py" / "f2py-intent-sources" / source.name if source.stem in F2PY_INOUT_ARGUMENTS else source - ) - assert str(expected_f2py_source) in signature_command - assert str(source) not in f2py_command + +def _inout_arguments(block: str) -> set[str]: + return { + argument.strip().lower() + for line in block.splitlines() + if "intent(inout)" in line.lower() and "::" in line + for argument in line.split("::", 1)[1].split(",") + } -def test_f2py_scalar_writeback_overlays_are_explicit(tmp_path: Path): - command = f2py_signature_command(tmp_path) +def test_committed_f2py_signature_matches_source_inventory(): + procedures = _pyf_procedures() + assert len(procedures) == len(BLAS_SOURCES) == 155 + assert set(procedures) == set(_source_routines()) - for routine, arguments in F2PY_INOUT_ARGUMENTS.items(): - source = next(source for source in BLAS_SOURCES if source.stem == routine) - overlay = tmp_path / "f2py-intent-sources" / source.name - prefix = "Cf2py" if source.suffix == ".f" else "!f2py" - assert str(overlay) in command - assert f"{prefix} intent(inout) {', '.join(arguments)}" in overlay.read_text(encoding="utf-8") + +def test_committed_f2py_signature_records_scalar_writebacks(): + observed = { + routine: arguments for routine, block in _pyf_procedures().items() if (arguments := _inout_arguments(block)) + } + assert observed == {routine: set(arguments) for routine, arguments in F2PY_INOUT_ARGUMENTS.items()} + + +def test_f2py_script_compiles_the_signature_and_reuses_the_native_library(): + script = (EXAMPLE_ROOT / "build_f2py.sh").read_text(encoding="utf-8") + assert 'python -m numpy.f2py -c \\\n "$EXAMPLE_WORKSPACE/examples/blas/blas.pyf"' in script + assert '"-L$(dirname "$BLAS_SHARED_LIBRARY")"' in script + assert "-lprik_full_blas" in script + assert "examples/blas/native" not in script def _source_routines() -> tuple[str, ...]: @@ -152,17 +171,13 @@ def test_every_routine_has_exactly_one_audited_outcome(): assert PERMANENTLY_SKIPPED_ROUTINES == {} -def test_documented_coverage_totals_match_inventory(): - readme = (EXAMPLE_ROOT / "README.md").read_text(encoding="utf-8") - expected_rows = { - "Native source files": len(BLAS_SOURCES), - "Discovered callable routines": len(ALL_ROUTINES), - "PRIK exports and independently validated routines": len(PRIK_TESTED_ROUTINES), - "f2py exports": len(ALL_ROUTINES), - "Full independent plus differential success": len(DIFFERENTIALLY_TESTED_ROUTINES), - "f2py scalar-writeback intent overlays": len(F2PY_INOUT_ARGUMENTS), - "Unsupported routines": len(UNSUPPORTED_ROUTINES), - "Environmentally skipped routines": len(PERMANENTLY_SKIPPED_ROUTINES), - } - for label, count in expected_rows.items(): - assert f"| {label} | {count:,} |" in readme +def test_documented_coverage_claims_match_inventory(): + readme = " ".join((EXAMPLE_ROOT / "README.md").read_text(encoding="utf-8").split()) + assert len(BLAS_SOURCES) == len(ALL_ROUTINES) == len(PRIK_TESTED_ROUTINES) + assert len(ALL_ROUTINES) == len(DIFFERENTIALLY_TESTED_ROUTINES) + assert f"All {len(ALL_ROUTINES):,} routines are exported and validated through both wrappers" in readme + assert f"The {len(F2PY_INOUT_ARGUMENTS)} rotation routines" in readme + assert f"contains the {len(BLAS_SOURCES):,} files" in readme + assert UNSUPPORTED_ROUTINES == {} + assert PERMANENTLY_SKIPPED_ROUTINES == {} + assert "no unsupported or skipped routines" in readme diff --git a/examples/f2py_intents.py b/examples/f2py_intents.py deleted file mode 100644 index d882de43f..000000000 --- a/examples/f2py_intents.py +++ /dev/null @@ -1,58 +0,0 @@ -"""Build-local f2py intent overlays for caller-owned scalar storage.""" - -from __future__ import annotations - -from collections.abc import Mapping, Sequence -from pathlib import Path -import re - - -_FIXED_FORM_SUFFIXES = frozenset({".f", ".for", ".f77", ".ftn"}) - - -def prepare_f2py_intent_sources( - sources: Sequence[Path], - workdir: Path, - inout_arguments: Mapping[str, tuple[str, ...]], -) -> tuple[Path, ...]: - """Copy selected sources and add f2py-only ``intent(inout)`` directives.""" - overlay_root = workdir / "f2py-intent-sources" - prepared: list[Path] = [] - for source in sources: - arguments = inout_arguments.get(source.stem.lower()) - if arguments is None: - prepared.append(source) - continue - - overlay_root.mkdir(parents=True, exist_ok=True) - target = overlay_root / source.name - target.write_text(_with_inout_directive(source, arguments), encoding="utf-8") - prepared.append(target) - return tuple(prepared) - - -def _with_inout_directive(source: Path, arguments: tuple[str, ...]) -> str: - text = source.read_text(encoding="utf-8") - lines = text.splitlines(keepends=True) - declaration = re.compile(rf"^\s*subroutine\s+{re.escape(source.stem)}\s*\(", re.IGNORECASE) - matches = [index for index, line in enumerate(lines) if declaration.match(line)] - if len(matches) != 1: - raise ValueError(f"expected one SUBROUTINE declaration for {source.stem}, found {len(matches)}") - - insertion_index = _statement_end(lines, matches[0], fixed_form=source.suffix.lower() in _FIXED_FORM_SUFFIXES) - prefix = "Cf2py" if source.suffix.lower() in _FIXED_FORM_SUFFIXES else "!f2py" - directive = f"{prefix} intent(inout) {', '.join(arguments)}\n" - lines.insert(insertion_index, directive) - return "".join(lines) - - -def _statement_end(lines: list[str], start: int, *, fixed_form: bool) -> int: - index = start + 1 - if fixed_form: - while index < len(lines) and len(lines[index]) > 5 and lines[index][5] not in {" ", "0", "\n", "\r"}: - index += 1 - return index - - while index < len(lines) and lines[index - 1].rstrip().endswith("&"): - index += 1 - return index diff --git a/examples/lapack/README.md b/examples/lapack/README.md index b2a263dae..56df55d6c 100644 --- a/examples/lapack/README.md +++ b/examples/lapack/README.md @@ -1,62 +1,34 @@ -# LAPACK correctness example +# Wrap Reference LAPACK with PRIK -This maintained example wraps and compiles the complete Reference LAPACK -implementation corpus once, then validates the reviewed SciPy-backed -double-precision real surface. The two scopes are deliberately different: +This copyable example builds the complete Reference LAPACK once and links PRIK +and NumPy f2py wrappers to the same native library. It validates 127 reviewed +double-precision routines with SciPy and independent residuals, +reconstructions, and storage checks. -- compilation covers 2,062 LAPACK implementation sources and the required - authoritative BLAS sources; -- correctness covers the 127 native `d*` routines exposed by - `scipy.linalg.lapack` in pinned SciPy 1.18.0 for `dtype=np.float64`. +PRIK wraps all 2,064 discovered procedures. The comparison suite selects +the 127 `float64` routines exposed by SciPy 1.18.0; raw f2py supports 125 of +those source interfaces. All 127 selected routines have explicit correctness +tests, with no unsupported or skipped routines. -SciPy selects eligibility. Standard LAPACK problem families determine the test -layout. PRIK support is not a selection condition: a missing PRIK export fails -the coverage audit instead of shrinking the inventory. +## Requirements -## Source ownership, provenance, and license - -`examples/lapack/native/` is the repository's only owner of the Reference -LAPACK implementation sources. Of its 2,062 files, 2,061 are byte-for-byte the -`SRC/` directory from -[Netlib LAPACK 3.12.1](https://www.netlib.org/lapack/lapack-3.12.1.html); the -repository adds its project-local `dlamch.f` machine-parameter implementation -to the wrapper corpus. The audited upstream archive has SHA-256 -`37b00c90947488521f475b5a187fff4da4a5cfe61b525efcacf7a97f39a45ec6`. -The boundary contains library implementation routines and the -`la_constants`/`la_xisnan` modules required by the build; it excludes upstream -testing programs, timing programs, examples, and matrix generators. The -upstream source is covered by the LAPACK three-clause BSD-style license. See -the [Reference LAPACK site](https://www.netlib.org/lapack/) and -[license](https://www.netlib.org/lapack/LICENSE.txt). - -BLAS remains separately owned by `examples/blas/native/`. The complete LAPACK -native artifact consumes that source set directly, excluding any BLAS routine -stem already supplied by LAPACK. No BLAS source is copied below this directory. - -## Build topology - -On Python 3.12 and newer, NumPy's f2py uses its Meson backend. The maintained -environment currently installs the same system development packages and -pinned Meson, Ninja, and SciPy versions as the dedicated CI lane: +Install GNU Fortran, `ar`, and the pinned Python tools: ```console -sudo apt-get install libblas-dev liblapack-dev -python3 -m pip install "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" "scipy==1.18.0" +python3 -m pip install \ + "numpy==2.5.1" "scipy==1.18.0" \ + "meson==1.11.2" "ninja==1.13.0" pytest ``` -The copyable builder in `examples/native_library.py` performs these operations -once when `build_all.sh` runs: +Run every command from the directory that contains `examples/`. -1. generate one semantic package for all LAPACK sources; -2. compile all 2,062 LAPACK sources plus required BLAS dependencies into one - cached shared library; -3. build one PRIK extension from the complete generated contract and shared - library; -4. generate f2py signatures for the 125 reviewed compatible routines and link - its wrapper to the same shared library; and -5. reuse the three imported comparison surfaces for every correctness file. +## Build both wrappers -The complete build is one command sequence: +The native builder compiles LAPACK and its BLAS dependencies once. Internal +support objects are included once in the shared library, while their +compiler-specific `.mod` files are retained for generated wrappers. + +`build_all.sh` runs these two scripts: ```bash @@ -67,487 +39,91 @@ export LAPACK_SHARED_LIBRARY="$( --compiler "$(command -v gfortran)" \ --jobs 8 )" - -python -m prik generate \ - --pyi examples/lapack/native \ - --language fortran \ - --out "$LAPACK_BUILD_ROOT/contracts/lapack" - -# Remove the LA_CONSTANTS and LA_XISNAN imports from the generated root contract. -python -c 'import sys; from pathlib import Path; p=Path(sys.argv[1]); s=p.read_text(encoding="utf-8") -p.write_text(s.replace("from . import LA_CONSTANTS\n", "").replace("from . import LA_XISNAN\n", ""), encoding="utf-8")' \ - "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" +export LAPACK_MODULE_DIR="$(dirname "$LAPACK_SHARED_LIBRARY")/modules" mkdir -p "$LAPACK_BUILD_ROOT/prik/generated" cd "$LAPACK_BUILD_ROOT/prik" -python -m prik "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" \ +python -m prik "$EXAMPLE_WORKSPACE/examples/lapack/native" \ --out prik_reference_lapack_example \ --out-dir "$LAPACK_BUILD_ROOT/prik/generated" \ --compiler "$(command -v gfortran)" \ + --no-compile-input-sources \ --native-objects "$LAPACK_SHARED_LIBRARY" \ + -I "$LAPACK_MODULE_DIR" \ --jobs 8 \ --wrapper-fortran-flags="-O0 -g0" \ --wrapper-c-flags="-O0 -g0" ``` -The short contract command removes only the internal `LA_CONSTANTS` and -`LA_XISNAN` root imports in place. The f2py build uses the same tested script: - ```bash cd "$EXAMPLE_WORKSPACE" export LAPACK_F2PY_ROOT="$LAPACK_BUILD_ROOT/f2py" -python -m examples.lapack.f2py_build \ - "$LAPACK_F2PY_ROOT" \ - "$LAPACK_SHARED_LIBRARY" \ - --compiler "$(command -v gfortran)" -``` - -The assembled f2py commands are equivalent to: - -```console -python3 -m numpy.f2py -m f2py_reference_lapack_example \ - -h /tmp/prik-lapack/f2py_reference_lapack_example.pyf \ - examples/lapack/native/la_constants.f90 \ - \ - only: : \ - --f2cmap /tmp/prik-lapack/.f2py_f2cmap \ - --overwrite-signature -python3 -m numpy.f2py -c /tmp/prik-lapack/f2py_reference_lapack_example.pyf \ - -L -lprik_full_lapack \ - --f2cmap /tmp/prik-lapack/.f2py_f2cmap \ - --build-dir /tmp/prik-lapack/f2py --f77flags=-O0 --f90flags=-O0 --opt=-O0 +mkdir -p "$LAPACK_F2PY_ROOT/generated" +cd "$LAPACK_F2PY_ROOT" + +export FC="$(command -v gfortran)" +export F77="$FC" +export F90="$FC" +export FFLAGS="-O0" +export F90FLAGS="-O0" +export LDFLAGS="${LDFLAGS:+$LDFLAGS }-Wl,-rpath,$(dirname "$LAPACK_SHARED_LIBRARY")" + +python -m numpy.f2py -c \ + "$EXAMPLE_WORKSPACE/examples/lapack/lapack.pyf" \ + "-L$(dirname "$LAPACK_SHARED_LIBRARY")" \ + -lprik_full_lapack \ + --f2cmap "$EXAMPLE_WORKSPACE/examples/lapack/lapack.f2cmap" \ + --build-dir "$LAPACK_F2PY_ROOT/generated" \ + --f77flags=-O0 \ + --f90flags="-O0 -I$LAPACK_MODULE_DIR" \ + --opt=-O0 ``` -`dlartg.f90` imports the `LA_CONSTANTS` module and declares its arguments as -`REAL(wp)`. The f2py build therefore includes `la_constants.f90` as a build-only -dependency and supplies a kind map that resolves `wp` to C `double`. The -`only:` list makes the 125 f2py-compatible routine wrappers explicit; module -support metadata is not counted as a selected routine. Those files provide -signature information only. f2py compiles its generated wrapper and reuses the -complete native artifact already linked by PRIK. - -Build products stay outside the source tree. Neither build dirties the -repository. - -After `build_all.sh` completes, the fixtures import the complete PRIK module, -the f2py comparison module, and -`scipy.linalg.lapack`. Character flags are Python `str` through PRIK and -`bytes` through SciPy/f2py. PRIK retains the complete native argument order. -f2py retains the order of the arguments it exposes, but infers and hides -leading dimensions and a few other shape-only scalar arguments; each visible -f2py call follows the generated wrapper signature. SciPy projects arrays and -optional arguments into its documented Python API. - -Nine routines document essential scalar writebacks without declaring Fortran -`intent`. The f2py build adds local intent directives, and the tests pass typed -0-D arrays so every writeback is validated. PRIK needs neither the overlay nor -carrier arrays: it returns unannotated scalar writebacks directly. - -`dgees` and `dgges` remain in the 127-routine correctness inventory but are -recorded in `F2PY_EXPORT_LIMITATIONS`. Their Reference LAPACK interfaces accept -external selection callbacks. From the unannotated implementation sources, -NumPy f2py 2.5.1 generates incomplete callback declarations (`select_t` and -`selctg_t`) and invalid C wrapper code. Those two routines are therefore -validated through PRIK, SciPy, and independent Schur reconstruction without a -f2py call; the remaining 125 selected names must be exported by the one -f2py comparison module. - -## Correctness evidence - -The official LAPACK contract defines behavior. An independent mathematical -identity is the primary executable oracle. SciPy and f2py are differential -implementations, not the definition of correctness. Each applicable test keeps -the three calls visible and checks solutions, residuals, reconstructions, -orthogonality, eigen equations, singular values, storage, mutation, shape, -dtype, workspace, pivots, and `INFO` as appropriate. - -Equivalent decompositions are compared by invariants. Eigenvectors and singular -vectors may change sign; repeated eigenspaces may use another orthonormal basis; -pivot ties may choose another valid permutation. Tests therefore use residuals, -subspaces, factor reconstruction, and orthogonality instead of byte equality -where the contract permits freedom. +PRIK keeps the module namespaces discovered from the complete sources. The +committed reviewed [`lapack.pyf`](lapack.pyf) exposes `la_constants`, and f2py +compiles its generated wrapper with the retained module directory. -All numerical arrays use `dtype=np.float64`. PRIK exposes the native scalar -contract exactly, so its visible calls use `np.int32(...)` for LAPACK `INTEGER` -arguments, `np.float64(...)` for scalar `DOUBLE PRECISION` arguments, and -`np.bool_(...)` for scalar `LOGICAL` arguments. SciPy and f2py calls retain their -own accepted Python conventions beside the PRIK call. `assert_allclose_float64` -scales tolerance with double-precision epsilon and operation length. Residual -checks also scale by matrix and solution norms. Integer results, `INFO`, shapes, -dtypes, pivot bounds, and untouched sentinel storage use exact comparisons. +No LAPACK implementation or support object is compiled twice. -`DTGSEN` and `DTRSEN` accept default-Fortran `LOGICAL` selection arrays. The -pinned GFortran ABI stores each such element in four bytes, while PRIK's Python -surface accepts a NumPy bool buffer. `gfortran_logical_mask` makes that genuine -ABI difference explicit by placing each truth byte at the start of its native -four-byte cell. The two affected calls remain visible, independently validate -the requested reorder, and are recorded in `PRIK_ABI_ADAPTERS` rather than -silently treating an ordinary two-byte NumPy mask as native storage. +Build and validate the example: -## Arrays, storage, workspaces, and indexes - -Matrices are explicitly Fortran contiguous where the native contract requires -column-major storage. Leading dimensions remain visible in PRIK calls and are -omitted only where the generated f2py signature explicitly infers them. -Tests use NaNs or sentinel values in unused triangles and padding, then prove -that those locations remain untouched. Helpers reconstruct general band, -symmetric band, tridiagonal, packed, triangular, and rectangular-full-packed -(RFP) representations before evaluating the logical matrix. - -Workspace-bearing tests allocate the native `WORK`/`IWORK` arrays and keep -`LWORK`/`LIWORK` visible. The suite uses reviewed safe sizes; query behavior is -covered where the exposed API supports it. `INFO == 0` is exact on normal paths. -Invalid argument calls that could route through `XERBLA` are not made in-process. - -Native LAPACK pivots and positions are one-based. PRIK and the f2py comparison surface -preserve native values. SciPy converts several low-level pivot/index APIs to -zero-based values, but preserves one-based `JPVT` for `DGELSY`/`DGEQP3`, one-based -`IPIV` for the general-tridiagonal `DGTTRF`/`DGTTRS` family, and one-based Schur -reorder positions for `DTGEXC`/`DTREXC`. Each affected test keeps the observed -convention beside the call. The inventory marks every pivot/index-bearing -routine so a new conversion cannot be hidden in a generic adapter. - -## Run and diagnose - -The dedicated BLAS + LAPACK GitHub Actions lane runs runtime verification: - -```console +```bash source examples/lapack/build_all.sh python3 -m pytest -q examples/lapack/tests -python3 -m pytest -q examples/lapack/tests/test_linear_general.py -python3 -m pytest -q examples/lapack/tests/test_linear_general.py::test_dgesv_solves_general_system -python3 -m pytest -q examples/lapack/tests -k dgesvd ``` -User-run correctness tests live in `tests/`. The separate `ci/` directory owns -the maintainer-only full-surface audit. - -Repository policy leaves LAPACK wrapper/runtime execution to that lane unless a -maintainer explicitly requests a local run. Local work may collect tests and run -the structural inventory, documentation, architecture, and static-analysis -checks. - -To diagnose CI, rerun the single named test with `-vv -s` and a retained -`--basetemp`; inspect the reported compiler command and the visible arrays, -wrapper calls, residual, `INFO`, and preservation assertions. The project is -deterministic and correctness-only: it collects no timings and makes no speed -claims. - -## Coverage - -`routine_inventory.py` explicitly classifies all 127 selected routines and -records their source, wrapper names, family, mutation/return/workspace/index -behavior, oracle class, and exact pytest owner. `test_routine_coverage.py` -fails on SciPy drift, duplicate or missing classification, a source-boundary -change, an absent explicit test, a missing PRIK/f2py export, or divergent -documented totals. - -| Outcome | Count | -| --- | ---: | -| Authoritative LAPACK implementation sources | 2,062 | -| Discovered root LAPACK procedures | 2,064 | -| Selected SciPy-backed float64 routines | 127 | -| Explicit correctness tests | 127 | -| PRIK root exports required in CI | 2,064 | -| Selected PRIK routines independently validated | 127 | -| SciPy exports used | 127 | -| f2py exports required in CI | 125 | -| Routines satisfying the independent oracle through f2py | 125 | -| Documented f2py source-parser export limitations | 2 | -| f2py scalar-writeback intent overlays | 9 | -| Documented PRIK default-LOGICAL ABI adapters | 2 | -| Documented unsupported/skipped routines | 0 | - -Runtime success, f2py export limitations, and any PRIK failures are CI -outcomes and must be reported honestly; structural completion does not predict -them. - -## Test fixtures and helper vocabulary - -`prik_lapack`, `f2py_lapack`, and `scipy_lapack` are session-scoped pytest -fixtures from [`conftest.py`](conftest.py). They provide the complete PRIK -wrapper, the selected f2py comparison module, and SciPy's pinned low-level -LAPACK module to `tests/` after `build_all.sh` completes. - -The tests use explicit mechanics from [`tests/helpers.py`](tests/helpers.py): - -| Helper | Responsibility | -| --- | --- | -| `column_major` | Creates a Fortran-contiguous `np.float64` matrix for the native column-major contract. | -| `active` | Selects the logical matrix while excluding leading-dimension padding. | -| `native_pivots` | Converts SciPy's zero-based general-LU pivots to LAPACK's native one-based convention. | -| `assert_allclose_float64` | Scales a float64-epsilon tolerance by operation length and expected magnitude. | -| `assert_small_residual` | Checks an infinity-norm backward residual relative to the matrix and solution norms. | -| `assert_storage_unchanged` | Uses exact equality, including NaNs, for unused triangles, padding, and input-only storage. | -| `gfortran_logical_mask` | Represents the documented four-byte default-`LOGICAL` ABI used by the two selection-array tests. | -| reconstruction helpers | Converts banded, tridiagonal, packed, RFP, LU, QR, and related native storage into matrices used by visible residuals and identities. | +You can also run one family or routine: -The helpers never invoke LAPACK and never hide a PRIK, SciPy, or f2py routine -call. The source-verified examples below assume `import numpy as np` and the -corresponding imports from `tests/helpers.py`, as shown in their linked test modules. - -## Representative source-verified tests - -The documentation checker extracts each named function from the real test AST -and fails if the displayed source diverges. - -### DGESV - - -```python -def test_dgesv_solves_general_system(prik_lapack, scipy_lapack, f2py_lapack): - original_a = np.array([[3.0, 1.0], [1.0, 2.0]], dtype=np.float64) - original_b = np.array([[5.0], [5.0]], dtype=np.float64) - expected_x = np.array([[1.0], [2.0]], dtype=np.float64) - prik_a, f2py_a = column_major(original_a), column_major(original_a) - prik_b, f2py_b = column_major(original_b), column_major(original_b) - prik_piv = np.empty(2, dtype=np.int32) - f2py_piv = np.empty(2, dtype=np.int32) - - prik_scalars = prik_lapack.dgesv( - np.int32(2), np.int32(1), prik_a, np.int32(2), prik_piv, prik_b, np.int32(2), np.int32(0) - ) - f2py_result = f2py_lapack.dgesv(2, 1, f2py_a, f2py_piv, f2py_b, 0) - scipy_lu, scipy_piv, scipy_x, scipy_info = scipy_lapack.dgesv( - original_a.copy(order="F"), original_b.copy(order="F") - ) - - assert prik_scalars == (2, 1, 2, 2, 0) - assert f2py_result is None - assert scipy_info == 0 - assert_allclose_float64(active(prik_b, 2, 1), expected_x, operation_size=2) - assert_allclose_float64(active(f2py_b, 2, 1), expected_x, operation_size=2) - assert_allclose_float64(scipy_x, expected_x, operation_size=2) - assert_allclose_float64(prik_a, scipy_lu, operation_size=2) - assert_allclose_float64(f2py_a, scipy_lu, operation_size=2) - np.testing.assert_array_equal(prik_piv, native_pivots(scipy_piv)) - np.testing.assert_array_equal(f2py_piv, native_pivots(scipy_piv)) - assert_small_residual( - original_a @ prik_b - original_b, - matrix_norm=np.linalg.norm(original_a, ord=np.inf), - solution_norm=np.linalg.norm(prik_b, ord=np.inf), - operation_size=2, - ) -``` - -### DGETRF - - -```python -def test_dgetrf_reconstructs_pivoted_lu(prik_lapack, scipy_lapack, f2py_lapack): - original = np.array([[0.0, 2.0], [3.0, 4.0]], dtype=np.float64) - prik_a, f2py_a = column_major(original), column_major(original) - prik_piv = np.empty(2, dtype=np.int32) - f2py_piv = np.empty(2, dtype=np.int32) - - prik_scalars = prik_lapack.dgetrf(np.int32(2), np.int32(2), prik_a, np.int32(2), prik_piv, np.int32(0)) - f2py_result = f2py_lapack.dgetrf(2, 2, f2py_a, f2py_piv, 0) - scipy_lu, scipy_piv, scipy_info = scipy_lapack.dgetrf(original.copy(order="F")) - - assert prik_scalars == (2, 2, 2, 0) - assert f2py_result is None - assert scipy_info == 0 - expected_native_piv = native_pivots(scipy_piv) - np.testing.assert_array_equal(prik_piv, expected_native_piv) - np.testing.assert_array_equal(f2py_piv, expected_native_piv) - assert_allclose_float64(prik_a, scipy_lu, operation_size=2) - assert_allclose_float64(f2py_a, scipy_lu, operation_size=2) - lower, upper = unpack_lu(prik_a) - permutation = pivot_matrix(prik_piv, 2, one_based=True) - assert_allclose_float64(permutation @ original, lower @ upper, operation_size=2) -``` - -### DPOTRF - - -```python -def test_dpotrf_reconstructs_spd_matrix(prik_lapack, scipy_lapack, f2py_lapack): - logical = np.array([[4.0, 1.0], [1.0, 3.0]], dtype=np.float64) - stored = np.array([[4.0, np.nan], [1.0, 3.0]], dtype=np.float64, order="F") - prik_a, f2py_a = column_major(stored), column_major(stored) - - prik_scalars = prik_lapack.dpotrf("L", np.int32(2), prik_a, np.int32(2), np.int32(0)) - f2py_result = f2py_lapack.dpotrf(b"L", 2, f2py_a, 0) - scipy_factor, scipy_info = scipy_lapack.dpotrf(stored.copy(order="F"), lower=1, clean=0) - - assert prik_scalars == (2, 2, 0) - assert f2py_result is None - assert scipy_info == 0 - prik_lower = np.tril(prik_a) - f2py_lower = np.tril(f2py_a) - scipy_lower = np.tril(scipy_factor) - assert_allclose_float64(prik_lower @ prik_lower.T, logical, operation_size=2) - assert_allclose_float64(f2py_lower @ f2py_lower.T, logical, operation_size=2) - assert_allclose_float64(scipy_lower @ scipy_lower.T, logical, operation_size=2) - assert_allclose_float64(prik_lower, scipy_lower, operation_size=2) - assert_allclose_float64(f2py_lower, scipy_lower, operation_size=2) - assert_storage_unchanged(np.triu(prik_a, 1), np.triu(stored, 1)) - assert_storage_unchanged(np.triu(f2py_a, 1), np.triu(stored, 1)) -``` - -### DGEQRF - - -```python -def test_dgeqrf_reconstructs_qr_factorization(prik_lapack, scipy_lapack, f2py_lapack): - matrix = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 7.0]], dtype=np.float64) - prik_a, f2py_a = column_major(matrix), column_major(matrix) - prik_tau = np.empty(2, dtype=np.float64) - f2py_tau = np.empty(2, dtype=np.float64) - - prik_scalars = prik_lapack.dgeqrf( - np.int32(3), np.int32(2), prik_a, np.int32(3), prik_tau, np.empty(16), np.int32(16), np.int32(0) - ) - f2py_result = f2py_lapack.dgeqrf(3, 2, f2py_a, f2py_tau, np.empty(16), 16, 0) - scipy_qr, scipy_tau, _scipy_work, scipy_info = scipy_lapack.dgeqrf(matrix.copy(order="F"), lwork=16) - - assert prik_scalars == (3, 2, 3, 16, 0) - assert f2py_result is None - assert scipy_info == 0 - for factor, tau in ((prik_a, prik_tau), (f2py_a, f2py_tau), (scipy_qr, scipy_tau)): - q = qr_q_from_reflectors(factor, tau) - r = np.triu(factor[:2, :]) - assert_orthogonal(q) - assert_allclose_float64(q @ r, matrix, operation_size=3) - assert_allclose_float64(prik_a, scipy_qr, operation_size=3) - assert_allclose_float64(f2py_a, scipy_qr, operation_size=3) - assert_allclose_float64(prik_tau, scipy_tau, operation_size=3) - assert_allclose_float64(f2py_tau, scipy_tau, operation_size=3) -``` - -### DSYEV - - -```python -def test_dsyev_returns_orthonormal_eigenvectors(prik_lapack, scipy_lapack, f2py_lapack): - matrix = np.array([[2.0, 1.0], [1.0, 2.0]], dtype=np.float64) - expected_w = np.array([1.0, 3.0], dtype=np.float64) - prik_vectors, f2py_vectors = column_major(matrix), column_major(matrix) - prik_w = np.empty(2, dtype=np.float64) - f2py_w = np.empty(2, dtype=np.float64) - - prik_scalars = prik_lapack.dsyev( - "V", "U", np.int32(2), prik_vectors, np.int32(2), prik_w, np.empty(16), np.int32(16), np.int32(0) - ) - f2py_result = f2py_lapack.dsyev(b"V", b"U", 2, f2py_vectors, f2py_w, np.empty(16), 16, 0) - scipy_w, scipy_vectors, scipy_info = scipy_lapack.dsyev(matrix.copy(order="F"), compute_v=1, lower=0, lwork=16) - - assert prik_scalars == (2, 2, 16, 0) - assert f2py_result is None - assert scipy_info == 0 - for values, vectors in ( - (prik_w, prik_vectors), - (f2py_w, f2py_vectors), - (scipy_w, scipy_vectors), - ): - assert_allclose_float64(values, expected_w, operation_size=2) - assert_orthogonal(vectors) - assert_allclose_float64(matrix @ vectors, vectors @ np.diag(values), operation_size=2) -``` - -### DGESVD - - -```python -def test_dgesvd_reconstructs_matrix(prik_lapack, scipy_lapack, f2py_lapack): - matrix = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 7.0]], dtype=np.float64) - prik_a, f2py_a = column_major(matrix), column_major(matrix) - prik_s, f2py_s = np.empty(2, dtype=np.float64), np.empty(2, dtype=np.float64) - prik_u, f2py_u = column_major(np.zeros((3, 3))), column_major(np.zeros((3, 3))) - prik_vt, f2py_vt = column_major(np.zeros((2, 2))), column_major(np.zeros((2, 2))) - - prik_scalars = prik_lapack.dgesvd( - "A", - "A", - np.int32(3), - np.int32(2), - prik_a, - np.int32(3), - prik_s, - prik_u, - np.int32(3), - prik_vt, - np.int32(2), - np.empty(32), - np.int32(32), - np.int32(0), - ) - f2py_result = f2py_lapack.dgesvd(b"A", b"A", 3, 2, f2py_a, f2py_s, f2py_u, f2py_vt, np.empty(32), 32, 0) - scipy_u, scipy_s, scipy_vt, scipy_info = scipy_lapack.dgesvd( - matrix.copy(order="F"), compute_uv=1, full_matrices=1, lwork=32 - ) - - assert prik_scalars == (3, 2, 3, 3, 2, 32, 0) - assert f2py_result is None - assert scipy_info == 0 - for u, values, vt in ( - (prik_u, prik_s, prik_vt), - (f2py_u, f2py_s, f2py_vt), - (scipy_u, scipy_s, scipy_vt), - ): - assert np.all(np.diff(values) <= 0.0) - assert_orthogonal(u) - assert_orthogonal(vt.T) - assert_allclose_float64(u[:, :2] @ np.diag(values) @ vt, matrix, operation_size=3) - assert_allclose_float64(prik_s, scipy_s, operation_size=3) - assert_allclose_float64(f2py_s, scipy_s, operation_size=3) +```bash +python3 -m pytest -q examples/lapack/tests/test_linear_general.py +python3 -m pytest -q \ + examples/lapack/tests/test_linear_general.py::test_dgesv_solves_general_system +python3 -m pytest -q examples/lapack/tests -k dgesvd ``` -### DTBTRS (banded storage) +## What the comparison shows - -```python -def test_dtbtrs_solves_triangular_band_system(prik_lapack, scipy_lapack, f2py_lapack): - matrix = np.array([[2.0, 1.0], [0.0, 3.0]], dtype=np.float64) - band = symmetric_band_storage(matrix, 1, lower=False) - rhs = np.array([[4.0], [6.0]], dtype=np.float64, order="F") - expected = np.array([[1.0], [2.0]], dtype=np.float64) - prik_b, f2py_b = rhs.copy(order="F"), rhs.copy(order="F") +PRIK preserves native argument order, storage, indexes, and scalar writebacks. +The 9 scalar-writeback routines omit Fortran `intent` for scalar outputs. +Their reviewed signature declarations use `intent(inout)` and typed NumPy 0-D +arrays, while PRIK returns those values directly. - prik_scalars = prik_lapack.dtbtrs( - "U", "N", "N", np.int32(2), np.int32(1), np.int32(1), band, np.int32(2), prik_b, np.int32(2), np.int32(0) - ) - f2py_result = f2py_lapack.dtbtrs(b"U", b"N", b"N", 2, 1, 1, band, f2py_b, 0) - scipy_x, scipy_info = scipy_lapack.dtbtrs(band, rhs.copy(order="F"), uplo=b"U", trans=b"N", diag=b"N") +The tests cover linear solves, factorizations, eigenproblems, singular values, +banded and packed layouts, workspaces, pivots, untouched storage, and `INFO`. +Equivalent decompositions are checked with mathematical invariants rather than +byte equality. - assert f2py_result is None - assert prik_scalars[-1] == scipy_info == 0 - assert_allclose_float64(prik_b, expected, operation_size=2) - assert_allclose_float64(f2py_b, expected, operation_size=2) - assert_allclose_float64(scipy_x, expected, operation_size=2) - assert_allclose_float64(matrix @ prik_b, rhs, operation_size=2) -``` +`dgees` and `dgges` use unannotated selection callbacks that raw f2py 2.5.1 +cannot generate safely. They remain covered through PRIK, SciPy, and independent +Schur reconstruction. -### DGECON (condition estimation) +## Sources and license - -```python -def test_dgecon_estimates_reciprocal_condition(prik_lapack, scipy_lapack, f2py_lapack): - factor = np.array([[4.0]], dtype=np.float64, order="F") - expected = 1.0 - f2py_rcond = np.array(0.0, dtype=np.float64) - f2py_info = np.array(0, dtype=np.int32) - - prik_scalars = prik_lapack.dgecon( - "1", - np.int32(1), - factor.copy(order="F"), - np.int32(1), - np.float64(4.0), - np.float64(0.0), - np.empty(4), - np.empty(1, dtype=np.int32), - np.int32(0), - ) - f2py_result = f2py_lapack.dgecon( - b"1", 1, factor.copy(order="F"), 4.0, f2py_rcond, np.empty(4), np.empty(1, dtype=np.int32), f2py_info - ) - scipy_rcond, scipy_info = scipy_lapack.dgecon(factor.copy(order="F"), 4.0, norm=b"1") - - assert f2py_result is None - assert prik_scalars[-1] == f2py_info == scipy_info == 0 - assert_allclose_float64(prik_scalars[-2], expected) - assert_allclose_float64(f2py_rcond, expected) - assert_allclose_float64(scipy_rcond, expected) -``` +[`native/`](native/) owns 2,062 LAPACK implementation sources: 2,061 from +Netlib LAPACK 3.12.1 plus the project-local `dlamch.f`. BLAS dependencies come +from [`../blas/native/`](../blas/native/) and are not duplicated here. The +audited upstream archive has SHA-256 +`37b00c90947488521f475b5a187fff4da4a5cfe61b525efcacf7a97f39a45ec6`. +See the [Reference LAPACK site](https://www.netlib.org/lapack/) and its +[three-clause BSD-style license](https://www.netlib.org/lapack/LICENSE.txt). diff --git a/examples/lapack/build_f2py.sh b/examples/lapack/build_f2py.sh index 38ae685e6..26ecc63ad 100644 --- a/examples/lapack/build_f2py.sh +++ b/examples/lapack/build_f2py.sh @@ -1,6 +1,21 @@ cd "$EXAMPLE_WORKSPACE" export LAPACK_F2PY_ROOT="$LAPACK_BUILD_ROOT/f2py" -python -m examples.lapack.f2py_build \ - "$LAPACK_F2PY_ROOT" \ - "$LAPACK_SHARED_LIBRARY" \ - --compiler "$(command -v gfortran)" +mkdir -p "$LAPACK_F2PY_ROOT/generated" +cd "$LAPACK_F2PY_ROOT" + +export FC="$(command -v gfortran)" +export F77="$FC" +export F90="$FC" +export FFLAGS="-O0" +export F90FLAGS="-O0" +export LDFLAGS="${LDFLAGS:+$LDFLAGS }-Wl,-rpath,$(dirname "$LAPACK_SHARED_LIBRARY")" + +python -m numpy.f2py -c \ + "$EXAMPLE_WORKSPACE/examples/lapack/lapack.pyf" \ + "-L$(dirname "$LAPACK_SHARED_LIBRARY")" \ + -lprik_full_lapack \ + --f2cmap "$EXAMPLE_WORKSPACE/examples/lapack/lapack.f2cmap" \ + --build-dir "$LAPACK_F2PY_ROOT/generated" \ + --f77flags=-O0 \ + --f90flags="-O0 -I$LAPACK_MODULE_DIR" \ + --opt=-O0 diff --git a/examples/lapack/build_prik.sh b/examples/lapack/build_prik.sh index ad702b02c..6b85ecb38 100644 --- a/examples/lapack/build_prik.sh +++ b/examples/lapack/build_prik.sh @@ -5,24 +5,17 @@ export LAPACK_SHARED_LIBRARY="$( --compiler "$(command -v gfortran)" \ --jobs 8 )" - -python -m prik generate \ - --pyi examples/lapack/native \ - --language fortran \ - --out "$LAPACK_BUILD_ROOT/contracts/lapack" - -# Remove the LA_CONSTANTS and LA_XISNAN imports from the generated root contract. -python -c 'import sys; from pathlib import Path; p=Path(sys.argv[1]); s=p.read_text(encoding="utf-8") -p.write_text(s.replace("from . import LA_CONSTANTS\n", "").replace("from . import LA_XISNAN\n", ""), encoding="utf-8")' \ - "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" +export LAPACK_MODULE_DIR="$(dirname "$LAPACK_SHARED_LIBRARY")/modules" mkdir -p "$LAPACK_BUILD_ROOT/prik/generated" cd "$LAPACK_BUILD_ROOT/prik" -python -m prik "$LAPACK_BUILD_ROOT/contracts/lapack/__init__.pyi" \ +python -m prik "$EXAMPLE_WORKSPACE/examples/lapack/native" \ --out prik_reference_lapack_example \ --out-dir "$LAPACK_BUILD_ROOT/prik/generated" \ --compiler "$(command -v gfortran)" \ + --no-compile-input-sources \ --native-objects "$LAPACK_SHARED_LIBRARY" \ + -I "$LAPACK_MODULE_DIR" \ --jobs 8 \ --wrapper-fortran-flags="-O0 -g0" \ --wrapper-c-flags="-O0 -g0" diff --git a/examples/lapack/ci/full_surface.py b/examples/lapack/ci/full_surface.py index 46ebb4d3e..a7d7ec229 100644 --- a/examples/lapack/ci/full_surface.py +++ b/examples/lapack/ci/full_surface.py @@ -6,22 +6,37 @@ import pytest -from ..routine_inventory import EXPECTED_LAPACK_ROOT_PROCEDURES +from ..routine_inventory import EXPECTED_LAPACK_PROCEDURES from examples.lapack.tests.helpers import assert_runtime_smoke -from prik.pipeline.pyi import pyi_paths_to_semantic_modules +from prik.parsers.fortran.parser import parse_fortran_file pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] +NATIVE_ROOT = Path(__file__).resolve().parents[1] / "native" +FORTRAN_SUFFIXES = {".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"} + + +def _source_procedure_exports() -> set[tuple[str | None, str]]: + expected: set[tuple[str | None, str]] = set() + for path in sorted(NATIVE_ROOT.iterdir()): + if not path.is_file() or path.suffix.lower() not in FORTRAN_SUFFIXES: + continue + parsed = parse_fortran_file(path.read_text(encoding="utf-8"), filename=path.name) + expected.update((None, procedure.name.lower()) for procedure in parsed.procedures) + for module in parsed.modules: + expected.update((module.name.lower(), procedure.name.lower()) for procedure in module.procedures) + return expected def test_ci_complete_prik_surface_reuses_example_extension(prik_lapack): - build_root = Path(prik_lapack.__file__).resolve().parent.parent - runtime_package = build_root / "contracts" / "lapack" - modules = pyi_paths_to_semantic_modules([runtime_package]) - root = next(module for module in modules if module.name == "__init__") - expected = {function.name for function in root.functions} - assert len(expected) == EXPECTED_LAPACK_ROOT_PROCEDURES - - missing = sorted(name for name in expected if not callable(getattr(prik_lapack, name, None))) + expected = _source_procedure_exports() + assert len(expected) == EXPECTED_LAPACK_PROCEDURES + assert all(getattr(prik_lapack, name, None) is not None for name in ("la_constants", "la_xisnan")) + + missing = [] + for namespace, name in sorted(expected, key=lambda item: (item[0] or "", item[1])): + owner = prik_lapack if namespace is None else getattr(prik_lapack, namespace, None) + if owner is None or not callable(getattr(owner, name, None)): + missing.append(".".join(filter(None, (namespace, name)))) assert missing == [] assert_runtime_smoke(prik_lapack) diff --git a/examples/lapack/f2py_build.py b/examples/lapack/f2py_build.py deleted file mode 100644 index 4e74e13a1..000000000 --- a/examples/lapack/f2py_build.py +++ /dev/null @@ -1,145 +0,0 @@ -"""Build the reviewed f2py LAPACK wrapper against one native shared library.""" - -from __future__ import annotations - -import argparse -import os -import subprocess -import sys -from collections.abc import Sequence -from pathlib import Path - -from examples.f2py_intents import prepare_f2py_intent_sources -from examples.native_library import linker_name, require_tool - -from .routine_inventory import F2PY_EXPORT_LIMITATIONS, ROUTINES - - -EXAMPLE_ROOT = Path(__file__).resolve().parent -NATIVE_ROOT = EXAMPLE_ROOT / "native" -BUILD_FLAGS = "-O0" -FORTRAN_SUFFIXES = (".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn") -F2PY_BUILD_DEPENDENCIES = ("la_constants.f90",) -F2PY_KIND_MAP = "{'real': {'wp': 'double'}}\n" -F2PY_INOUT_ARGUMENTS: dict[str, tuple[str, ...]] = { - "dlarfg": ("alpha", "tau"), - "dlartg": ("c", "s", "r"), - "dgbcon": ("rcond", "info"), - "dgecon": ("rcond", "info"), - "dgtcon": ("rcond", "info"), - "dpocon": ("rcond", "info"), - "dppcon": ("rcond", "info"), - "dsycon": ("rcond", "info"), - "dtrcon": ("rcond", "info"), -} - - -def build_environment(compiler: str, native_library: Path) -> dict[str, str]: - """Return the compiler and runtime-link environment for f2py.""" - environment = dict(os.environ) - environment.update( - { - "CFLAGS": BUILD_FLAGS, - "FC": compiler, - "F77": compiler, - "F90": compiler, - "FFLAGS": BUILD_FLAGS, - "F90FLAGS": BUILD_FLAGS, - } - ) - rpath_flag = f"-Wl,-rpath,{native_library.parent}" - environment["LDFLAGS"] = " ".join(filter(None, (environment.get("LDFLAGS"), rpath_flag))) - return environment - - -def _selected_source(routine: str) -> Path: - matches = tuple(path for suffix in FORTRAN_SUFFIXES if (path := NATIVE_ROOT / f"{routine}{suffix}").is_file()) - if len(matches) != 1: - raise FileNotFoundError( - f"expected exactly one authoritative source for {routine}, found {[str(path) for path in matches]}" - ) - return matches[0] - - -def f2py_source_plan(workdir: Path) -> tuple[Path, ...]: - """Return reviewed signatures with intent overlays and their kind dependency.""" - dependencies = tuple(NATIVE_ROOT / name for name in F2PY_BUILD_DEPENDENCIES) - missing_dependencies = [str(path) for path in dependencies if not path.is_file()] - if missing_dependencies: - raise FileNotFoundError(f"missing f2py signature dependencies: {missing_dependencies}") - selected = tuple(_selected_source(name) for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) - return prepare_f2py_intent_sources(dependencies + selected, workdir, F2PY_INOUT_ARGUMENTS) - - -def f2py_signature_command(workdir: Path) -> tuple[str, ...]: - """Generate reviewed f2py signatures without compiling implementations.""" - module_name = "f2py_reference_lapack_example" - f2cmap = workdir / ".f2py_f2cmap" - f2cmap.write_text(F2PY_KIND_MAP, encoding="utf-8") - selected_routines = tuple(name for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS) - return ( - sys.executable, - "-m", - "numpy.f2py", - "-m", - module_name, - "-h", - str(workdir / f"{module_name}.pyf"), - *(str(source) for source in f2py_source_plan(workdir)), - "only:", - *selected_routines, - ":", - "--f2cmap", - str(f2cmap), - "--overwrite-signature", - ) - - -def f2py_build_command(workdir: Path, native_library: Path) -> tuple[str, ...]: - """Build only f2py's wrapper and link the precompiled LAPACK implementation.""" - module_name = "f2py_reference_lapack_example" - return ( - sys.executable, - "-m", - "numpy.f2py", - "-c", - str(workdir / f"{module_name}.pyf"), - f"-L{native_library.parent}", - f"-l{linker_name(native_library)}", - "--f2cmap", - str(workdir / ".f2py_f2cmap"), - "--build-dir", - str(workdir / "generated"), - f"--f77flags={BUILD_FLAGS}", - f"--f90flags={BUILD_FLAGS}", - f"--opt={BUILD_FLAGS}", - ) - - -def build_f2py_wrapper(workdir: Path, native_library: Path, compiler: str) -> None: - """Generate and compile the f2py wrapper in one user-facing build directory.""" - workdir.mkdir(parents=True, exist_ok=True) - environment = build_environment(compiler, native_library) - for command in (f2py_signature_command(workdir), f2py_build_command(workdir, native_library)): - subprocess.run( # nosec B603 - explicit Python/f2py commands and copied example inputs - command, - cwd=workdir, - env=environment, - check=True, - ) - - -def main(argv: Sequence[str] | None = None) -> int: - """Build the documented f2py comparison wrapper.""" - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("workdir", type=Path) - parser.add_argument("native_library", type=Path) - parser.add_argument("--compiler", default=None) - args = parser.parse_args(argv) - compiler = args.compiler or require_tool("gfortran") - build_f2py_wrapper(args.workdir.resolve(), args.native_library.resolve(), compiler) - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/examples/lapack/lapack.f2cmap b/examples/lapack/lapack.f2cmap new file mode 100644 index 000000000..3fe0a8866 --- /dev/null +++ b/examples/lapack/lapack.f2cmap @@ -0,0 +1 @@ +{'real': {'wp': 'double'}} diff --git a/examples/lapack/lapack.pyf b/examples/lapack/lapack.pyf new file mode 100644 index 000000000..32cfaa817 --- /dev/null +++ b/examples/lapack/lapack.pyf @@ -0,0 +1,1638 @@ +! -*- f90 -*- +! Note: the context of this file is case sensitive. + +python module f2py_reference_lapack_example + interface + module la_constants + integer, parameter,optional :: sp=kind(1.e0) + real(kind=4), parameter,optional :: szero=0.0_sp + real(kind=4), parameter,optional :: shalf=0.5_sp + real(kind=4), parameter,optional :: sone=1.0_sp + real(kind=4), parameter,optional :: stwo=2.0_sp + real(kind=4), parameter,optional :: sthree=3.0_sp + real(kind=4), parameter,optional :: sfour=4.0_sp + real(kind=4), parameter,optional :: seight=8.0_sp + real(kind=4), parameter,optional :: sten=10.0_sp + complex(kind=4), parameter,optional :: czero=(0.0_sp, 0.0_sp) + complex(kind=4), parameter,optional :: chalf=(0.5_sp, 0.0_sp) + complex(kind=4), parameter,optional :: cone=(1.0_sp, 0.0_sp) + character*1, parameter,optional :: sprefix='s' + character*1, parameter,optional :: cprefix='c' + real(kind=4), parameter,optional :: sulp=epsilon(0._sp) + real(kind=4), parameter,optional,depend(sulp) :: seps=sulp*0.5_sp + real(kind=4), parameter,optional,depend(sp) :: ssafmin=real(radix(0._sp),sp)**max(minexponent(0._sp)-1,1-maxexponent(0._sp)) + real(kind=4), parameter,optional,depend(sone,ssafmin,sp) :: ssafmax=1.0 + real(kind=4), parameter,optional,depend(sulp,ssafmin,sp) :: ssmlnum=1.0 + real(kind=4), parameter,optional,depend(sulp,ssafmax,sone,ssafmin,sp) :: sbignum=4.0 + real(kind=4), parameter,optional,depend(ssmlnum,sulp,ssafmin,sp) :: srtmin=sqrt(ssmlnum) + real(kind=4), parameter,optional,depend(sbignum,sulp,ssafmax,sone,ssafmin,sp) :: srtmax=sqrt(sbignum) + real(kind=4), parameter,optional,depend(sp) :: stsml=real(radix(0._sp), sp)**ceiling((minexponent(0._sp)-1)*0.5_sp) + real(kind=4), parameter,optional,depend(sp) :: stbig=real(radix(0._sp), sp)**floor((maxexponent(0._sp)-digits(0._sp)+1)*0.5_sp) + real(kind=4), parameter,optional,depend(sp) :: sssml=real(radix(0._sp), sp)**(-floor((minexponent(0._sp)-digits(0._sp))*0.5_sp)) + real(kind=4), parameter,optional,depend(sp) :: ssbig=real(radix(0._sp), sp)**(-ceiling((maxexponent(0._sp)+digits(0._sp)-1)*0.5_sp)) + integer, parameter,optional :: dp=kind(1.d0) + real(kind=8), parameter,optional :: dzero=0.0_dp + real(kind=8), parameter,optional :: dhalf=0.5_dp + real(kind=8), parameter,optional :: done=1.0_dp + real(kind=8), parameter,optional :: dtwo=2.0_dp + real(kind=8), parameter,optional :: dthree=3.0_dp + real(kind=8), parameter,optional :: dfour=4.0_dp + real(kind=8), parameter,optional :: deight=8.0_dp + real(kind=8), parameter,optional :: dten=10.0_dp + complex(kind=8), parameter,optional :: zzero=(0.0_dp, 0.0_dp) + complex(kind=8), parameter,optional :: zhalf=(0.5_dp, 0.0_dp) + complex(kind=8), parameter,optional :: zone=(1.0_dp, 0.0_dp) + character*1, parameter,optional :: dprefix='d' + character*1, parameter,optional :: zprefix='z' + real(kind=8), parameter,optional :: dulp=epsilon(0._dp) + real(kind=8), parameter,optional,depend(dulp) :: deps=dulp*0.5_dp + real(kind=8), parameter,optional,depend(dp) :: dsafmin=real(radix(0._dp),dp)**max(minexponent(0._dp)-1,1-maxexponent(0._dp)) + real(kind=8), parameter,optional,depend(done,dsafmin,dp) :: dsafmax=1.0 + real(kind=8), parameter,optional,depend(dulp,dsafmin,dp) :: dsmlnum=1.0 + real(kind=8), parameter,optional,depend(dulp,dsafmax,done,dsafmin,dp) :: dbignum=4.0 + real(kind=8), parameter,optional,depend(dsmlnum,dulp,dsafmin,dp) :: drtmin=sqrt(dsmlnum) + real(kind=8), parameter,optional,depend(dbignum,dulp,dsafmax,done,dsafmin,dp) :: drtmax=sqrt(dbignum) + real(kind=8), parameter,optional,depend(dp) :: dtsml=real(radix(0._dp), dp)**ceiling((minexponent(0._dp)-1)*0.5_dp) + real(kind=8), parameter,optional,depend(dp) :: dtbig=real(radix(0._dp), dp)**floor((maxexponent(0._dp)-digits(0._dp)+1)*0.5_dp) + real(kind=8), parameter,optional,depend(dp) :: dssml=real(radix(0._dp), dp)**(-floor((minexponent(0._dp)-digits(0._dp))*0.5_dp)) + real(kind=8), parameter,optional,depend(dp) :: dsbig=real(radix(0._dp), dp)**(-ceiling((maxexponent(0._dp)+digits(0._dp)-1)*0.5_dp)) + end module la_constants + function dlamch(cmach) + character :: cmach + double precision :: dlamch + end function dlamch + function dlangb(norm,n,kl,ku,ab,ldab,work) + character :: norm + integer :: n + integer :: kl + integer :: ku + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + double precision dimension(*) :: work + double precision :: dlangb + end function dlangb + function dlange(norm,m,n,a,lda,work) + character :: norm + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: work + double precision :: dlange + end function dlange + function dlantr(norm,uplo,diag,m,n,a,lda,work) + character :: norm + character :: uplo + character :: diag + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: work + double precision :: dlantr + end function dlantr + subroutine dlarf(side,m,n,v,incv,tau,c,ldc,work) + character :: side + integer :: m + integer :: n + double precision dimension(*) :: v + integer :: incv + double precision :: tau + double precision dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + double precision dimension(*) :: work + end subroutine dlarf + subroutine dlarfg(n,alpha,x,incx,tau) + integer :: n + double precision intent(inout) :: alpha + double precision dimension(*) :: x + integer :: incx + double precision intent(inout) :: tau + end subroutine dlarfg + subroutine dlartg(f,g,c,s,r) + use la_constants, only: wp=>dp,zero=>dzero,half=>dhalf,one=>done,safmin=>dsafmin,safmax=>dsafmax + real(kind=wp) :: f + real(kind=wp) :: g + real(kind=wp) intent(inout) :: c + real(kind=wp) intent(inout) :: s + real(kind=wp) intent(inout) :: r + end subroutine dlartg + subroutine dlaswp(n,a,lda,k1,k2,ipiv,incx) + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer :: k1 + integer :: k2 + integer dimension(*) :: ipiv + integer :: incx + end subroutine dlaswp + subroutine dgecon(norm,n,a,lda,anorm,rcond,work,iwork,info) + character :: norm + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision :: anorm + double precision intent(inout) :: rcond + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer intent(inout) :: info + end subroutine dgecon + subroutine dgeequ(m,n,a,lda,r,c,rowcnd,colcnd,amax,info) + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: r + double precision dimension(*) :: c + double precision :: rowcnd + double precision :: colcnd + double precision :: amax + integer :: info + end subroutine dgeequ + subroutine dgeequb(m,n,a,lda,r,c,rowcnd,colcnd,amax,info) + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: r + double precision dimension(*) :: c + double precision :: rowcnd + double precision :: colcnd + double precision :: amax + integer :: info + end subroutine dgeequb + subroutine dgesc2(n,a,lda,rhs,ipiv,jpiv,scale) + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: rhs + integer dimension(*) :: ipiv + integer dimension(*) :: jpiv + double precision :: scale + end subroutine dgesc2 + subroutine dgesv(n,nrhs,a,lda,ipiv,b,ldb,info) + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dgesv + subroutine dgesvx(fact,trans,n,nrhs,a,lda,af,ldaf,ipiv,equed,r,c,b,ldb,x,ldx,rcond,ferr,berr,work,iwork,info) + character :: fact + character :: trans + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldaf,*) :: af + integer, optional,check(shape(af, 0) == ldaf),depend(af) :: ldaf=shape(af, 0) + integer dimension(*) :: ipiv + character :: equed + double precision dimension(*) :: r + double precision dimension(*) :: c + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(ldx,*) :: x + integer, optional,check(shape(x, 0) == ldx),depend(x) :: ldx=shape(x, 0) + double precision :: rcond + double precision dimension(*) :: ferr + double precision dimension(*) :: berr + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer :: info + end subroutine dgesvx + subroutine dgetc2(n,a,lda,ipiv,jpiv,info) + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + integer dimension(*) :: jpiv + integer :: info + end subroutine dgetc2 + subroutine dgetrf(m,n,a,lda,ipiv,info) + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + integer :: info + end subroutine dgetrf + subroutine dgetri(n,a,lda,ipiv,work,lwork,info) + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgetri + subroutine dgetrs(trans,n,nrhs,a,lda,ipiv,b,ldb,info) + character :: trans + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dgetrs + subroutine dsycon(uplo,n,a,lda,ipiv,anorm,rcond,work,iwork,info) + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + double precision :: anorm + double precision intent(inout) :: rcond + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer intent(inout) :: info + end subroutine dsycon + subroutine dsyconv(uplo,way,n,a,lda,ipiv,e,info) + character :: uplo + character :: way + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + double precision dimension(*) :: e + integer :: info + end subroutine dsyconv + subroutine dsyequb(uplo,n,a,lda,s,scond,amax,work,info) + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: s + double precision :: scond + double precision :: amax + double precision dimension(*) :: work + integer :: info + end subroutine dsyequb + subroutine dsysv(uplo,n,nrhs,a,lda,ipiv,b,ldb,work,lwork,info) + character :: uplo + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dsysv + subroutine dsysvx(fact,uplo,n,nrhs,a,lda,af,ldaf,ipiv,b,ldb,x,ldx,rcond,ferr,berr,work,lwork,iwork,info) + character :: fact + character :: uplo + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldaf,*) :: af + integer, optional,check(shape(af, 0) == ldaf),depend(af) :: ldaf=shape(af, 0) + integer dimension(*) :: ipiv + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(ldx,*) :: x + integer, optional,check(shape(x, 0) == ldx),depend(x) :: ldx=shape(x, 0) + double precision :: rcond + double precision dimension(*) :: ferr + double precision dimension(*) :: berr + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: info + end subroutine dsysvx + subroutine dsytf2(uplo,n,a,lda,ipiv,info) + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + integer :: info + end subroutine dsytf2 + subroutine dsytrf(uplo,n,a,lda,ipiv,work,lwork,info) + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dsytrf + subroutine dsytri(uplo,n,a,lda,ipiv,work,info) + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + double precision dimension(*) :: work + integer :: info + end subroutine dsytri + subroutine dsytrs(uplo,n,nrhs,a,lda,ipiv,b,ldb,info) + character :: uplo + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: ipiv + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dsytrs + subroutine dlauum(uplo,n,a,lda,info) + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer :: info + end subroutine dlauum + subroutine dpftrf(transr,uplo,n,a,info) + character :: transr + character :: uplo + integer :: n + double precision dimension(*) :: a + integer :: info + end subroutine dpftrf + subroutine dpftri(transr,uplo,n,a,info) + character :: transr + character :: uplo + integer :: n + double precision dimension(*) :: a + integer :: info + end subroutine dpftri + subroutine dpftrs(transr,uplo,n,nrhs,a,b,ldb,info) + character :: transr + character :: uplo + integer :: n + integer :: nrhs + double precision dimension(*) :: a + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dpftrs + subroutine dpocon(uplo,n,a,lda,anorm,rcond,work,iwork,info) + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision :: anorm + double precision intent(inout) :: rcond + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer intent(inout) :: info + end subroutine dpocon + subroutine dposv(uplo,n,nrhs,a,lda,b,ldb,info) + character :: uplo + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dposv + subroutine dposvx(fact,uplo,n,nrhs,a,lda,af,ldaf,equed,s,b,ldb,x,ldx,rcond,ferr,berr,work,iwork,info) + character :: fact + character :: uplo + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldaf,*) :: af + integer, optional,check(shape(af, 0) == ldaf),depend(af) :: ldaf=shape(af, 0) + character :: equed + double precision dimension(*) :: s + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(ldx,*) :: x + integer, optional,check(shape(x, 0) == ldx),depend(x) :: ldx=shape(x, 0) + double precision :: rcond + double precision dimension(*) :: ferr + double precision dimension(*) :: berr + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer :: info + end subroutine dposvx + subroutine dpotrf(uplo,n,a,lda,info) + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer :: info + end subroutine dpotrf + subroutine dpotri(uplo,n,a,lda,info) + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer :: info + end subroutine dpotri + subroutine dpotrs(uplo,n,nrhs,a,lda,b,ldb,info) + character :: uplo + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dpotrs + subroutine dppcon(uplo,n,ap,anorm,rcond,work,iwork,info) + character :: uplo + integer :: n + double precision dimension(*) :: ap + double precision :: anorm + double precision intent(inout) :: rcond + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer intent(inout) :: info + end subroutine dppcon + subroutine dppsv(uplo,n,nrhs,ap,b,ldb,info) + character :: uplo + integer :: n + integer :: nrhs + double precision dimension(*) :: ap + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dppsv + subroutine dpptrf(uplo,n,ap,info) + character :: uplo + integer :: n + double precision dimension(*) :: ap + integer :: info + end subroutine dpptrf + subroutine dpptri(uplo,n,ap,info) + character :: uplo + integer :: n + double precision dimension(*) :: ap + integer :: info + end subroutine dpptri + subroutine dpptrs(uplo,n,nrhs,ap,b,ldb,info) + character :: uplo + integer :: n + integer :: nrhs + double precision dimension(*) :: ap + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dpptrs + subroutine dpstf2(uplo,n,a,lda,piv,rank_bn,tol,work,info) + character :: uplo + integer, optional,check(shape(piv, 0) == n),depend(piv) :: n=shape(piv, 0) + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(n) :: piv + integer :: rank_bn + double precision :: tol + double precision dimension(2 * n),depend(n) :: work + integer :: info + end subroutine dpstf2 + subroutine dpstrf(uplo,n,a,lda,piv,rank_bn,tol,work,info) + character :: uplo + integer, optional,check(shape(piv, 0) == n),depend(piv) :: n=shape(piv, 0) + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(n) :: piv + integer :: rank_bn + double precision :: tol + double precision dimension(2 * n),depend(n) :: work + integer :: info + end subroutine dpstrf + subroutine dsfrk(transr,uplo,trans,n,k,alpha,a,lda,beta,c) + character :: transr + character :: uplo + character :: trans + integer :: n + integer :: k + double precision :: alpha + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision :: beta + double precision dimension(*) :: c + end subroutine dsfrk + subroutine dgbcon(norm,n,kl,ku,ab,ldab,ipiv,anorm,rcond,work,iwork,info) + character :: norm + integer :: n + integer :: kl + integer :: ku + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + integer dimension(*) :: ipiv + double precision :: anorm + double precision intent(inout) :: rcond + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer intent(inout) :: info + end subroutine dgbcon + subroutine dgbsv(n,kl,ku,nrhs,ab,ldab,ipiv,b,ldb,info) + integer :: n + integer :: kl + integer :: ku + integer :: nrhs + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + integer dimension(*) :: ipiv + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dgbsv + subroutine dgbtrf(m,n,kl,ku,ab,ldab,ipiv,info) + integer :: m + integer :: n + integer :: kl + integer :: ku + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + integer dimension(*) :: ipiv + integer :: info + end subroutine dgbtrf + subroutine dgbtrs(trans,n,kl,ku,nrhs,ab,ldab,ipiv,b,ldb,info) + character :: trans + integer :: n + integer :: kl + integer :: ku + integer :: nrhs + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + integer dimension(*) :: ipiv + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dgbtrs + subroutine dgtcon(norm,n,dl,d,du,du2,ipiv,anorm,rcond,work,iwork,info) + character :: norm + integer :: n + double precision dimension(*) :: dl + double precision dimension(*) :: d + double precision dimension(*) :: du + double precision dimension(*) :: du2 + integer dimension(*) :: ipiv + double precision :: anorm + double precision intent(inout) :: rcond + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer intent(inout) :: info + end subroutine dgtcon + subroutine dgtsv(n,nrhs,dl,d,du,b,ldb,info) + integer :: n + integer :: nrhs + double precision dimension(*) :: dl + double precision dimension(*) :: d + double precision dimension(*) :: du + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dgtsv + subroutine dgtsvx(fact,trans,n,nrhs,dl,d,du,dlf,df,duf,du2,ipiv,b,ldb,x,ldx,rcond,ferr,berr,work,iwork,info) + character :: fact + character :: trans + integer :: n + integer :: nrhs + double precision dimension(*) :: dl + double precision dimension(*) :: d + double precision dimension(*) :: du + double precision dimension(*) :: dlf + double precision dimension(*) :: df + double precision dimension(*) :: duf + double precision dimension(*) :: du2 + integer dimension(*) :: ipiv + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(ldx,*) :: x + integer, optional,check(shape(x, 0) == ldx),depend(x) :: ldx=shape(x, 0) + double precision :: rcond + double precision dimension(*) :: ferr + double precision dimension(*) :: berr + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer :: info + end subroutine dgtsvx + subroutine dgttrf(n,dl,d,du,du2,ipiv,info) + integer :: n + double precision dimension(*) :: dl + double precision dimension(*) :: d + double precision dimension(*) :: du + double precision dimension(*) :: du2 + integer dimension(*) :: ipiv + integer :: info + end subroutine dgttrf + subroutine dgttrs(trans,n,nrhs,dl,d,du,du2,ipiv,b,ldb,info) + character :: trans + integer :: n + integer :: nrhs + double precision dimension(*) :: dl + double precision dimension(*) :: d + double precision dimension(*) :: du + double precision dimension(*) :: du2 + integer dimension(*) :: ipiv + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dgttrs + subroutine dpbsv(uplo,n,kd,nrhs,ab,ldab,b,ldb,info) + character :: uplo + integer :: n + integer :: kd + integer :: nrhs + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dpbsv + subroutine dpbtrf(uplo,n,kd,ab,ldab,info) + character :: uplo + integer :: n + integer :: kd + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + integer :: info + end subroutine dpbtrf + subroutine dpbtrs(uplo,n,kd,nrhs,ab,ldab,b,ldb,info) + character :: uplo + integer :: n + integer :: kd + integer :: nrhs + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dpbtrs + subroutine dptsv(n,nrhs,d,e,b,ldb,info) + integer :: n + integer :: nrhs + double precision dimension(*) :: d + double precision dimension(*) :: e + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dptsv + subroutine dptsvx(fact,n,nrhs,d,e,df,ef,b,ldb,x,ldx,rcond,ferr,berr,work,info) + character :: fact + integer :: n + integer :: nrhs + double precision dimension(*) :: d + double precision dimension(*) :: e + double precision dimension(*) :: df + double precision dimension(*) :: ef + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(ldx,*) :: x + integer, optional,check(shape(x, 0) == ldx),depend(x) :: ldx=shape(x, 0) + double precision :: rcond + double precision dimension(*) :: ferr + double precision dimension(*) :: berr + double precision dimension(*) :: work + integer :: info + end subroutine dptsvx + subroutine dpttrf(n,d,e,info) + integer :: n + double precision dimension(*) :: d + double precision dimension(*) :: e + integer :: info + end subroutine dpttrf + subroutine dpttrs(n,nrhs,d,e,b,ldb,info) + integer :: n + integer :: nrhs + double precision dimension(*) :: d + double precision dimension(*) :: e + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dpttrs + subroutine dtbtrs(uplo,trans,diag,n,kd,nrhs,ab,ldab,b,ldb,info) + character :: uplo + character :: trans + character :: diag + integer :: n + integer :: kd + integer :: nrhs + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dtbtrs + subroutine dtfsm(transr,side,uplo,trans,diag,m,n,alpha,a,b,ldb) + character :: transr + character :: side + character :: uplo + character :: trans + character :: diag + integer :: m + integer :: n + double precision :: alpha + double precision dimension(*) :: a + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + end subroutine dtfsm + subroutine dtfttp(transr,uplo,n,arf,ap,info) + character :: transr + character :: uplo + integer :: n + double precision dimension(*) :: arf + double precision dimension(*) :: ap + integer :: info + end subroutine dtfttp + subroutine dtfttr(transr,uplo,n,arf,a,lda,info) + character :: transr + character :: uplo + integer :: n + double precision dimension(*) :: arf + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer :: info + end subroutine dtfttr + subroutine dtpttf(transr,uplo,n,ap,arf,info) + character :: transr + character :: uplo + integer :: n + double precision dimension(*) :: ap + double precision dimension(*) :: arf + integer :: info + end subroutine dtpttf + subroutine dtpttr(uplo,n,ap,a,lda,info) + character :: uplo + integer :: n + double precision dimension(*) :: ap + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer :: info + end subroutine dtpttr + subroutine dtrcon(norm,uplo,diag,n,a,lda,rcond,work,iwork,info) + character :: norm + character :: uplo + character :: diag + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision intent(inout) :: rcond + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer intent(inout) :: info + end subroutine dtrcon + subroutine dtrtri(uplo,diag,n,a,lda,info) + character :: uplo + character :: diag + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer :: info + end subroutine dtrtri + subroutine dtrtrs(uplo,trans,diag,n,nrhs,a,lda,b,ldb,info) + character :: uplo + character :: trans + character :: diag + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dtrtrs + subroutine dtrttf(transr,uplo,n,a,lda,arf,info) + character :: transr + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: arf + integer :: info + end subroutine dtrttf + subroutine dtrttp(uplo,n,a,lda,ap,info) + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: ap + integer :: info + end subroutine dtrttp + subroutine dgels(trans,m,n,nrhs,a,lda,b,ldb,work,lwork,info) + character :: trans + integer :: m + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgels + subroutine dgelsd(m,n,nrhs,a,lda,b,ldb,s,rcond,rank_bn,work,lwork,iwork,info) + integer :: m + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(*) :: s + double precision :: rcond + integer :: rank_bn + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: info + end subroutine dgelsd + subroutine dgelss(m,n,nrhs,a,lda,b,ldb,s,rcond,rank_bn,work,lwork,info) + integer :: m + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(*) :: s + double precision :: rcond + integer :: rank_bn + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgelss + subroutine dgelsy(m,n,nrhs,a,lda,b,ldb,jpvt,rcond,rank_bn,work,lwork,info) + integer :: m + integer :: n + integer :: nrhs + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer dimension(*) :: jpvt + double precision :: rcond + integer :: rank_bn + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgelsy + subroutine dgglse(m,n,p,a,lda,b,ldb,c,d,x,work,lwork,info) + integer :: m + integer :: n + integer :: p + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(*) :: c + double precision dimension(*) :: d + double precision dimension(*) :: x + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgglse + subroutine dgemqrt(side,trans,m,n,k,nb,v,ldv,t,ldt,c,ldc,work,info) + character :: side + character :: trans + integer :: m + integer :: n + integer :: k + integer :: nb + double precision dimension(ldv,*) :: v + integer, optional,check(shape(v, 0) == ldv),depend(v) :: ldv=shape(v, 0) + double precision dimension(ldt,*) :: t + integer, optional,check(shape(t, 0) == ldt),depend(t) :: ldt=shape(t, 0) + double precision dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + double precision dimension(*) :: work + integer :: info + end subroutine dgemqrt + subroutine dgeqp3(m,n,a,lda,jpvt,tau,work,lwork,info) + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer dimension(*) :: jpvt + double precision dimension(*) :: tau + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgeqp3 + subroutine dgeqrf(m,n,a,lda,tau,work,lwork,info) + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: tau + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgeqrf + subroutine dgeqrfp(m,n,a,lda,tau,work,lwork,info) + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: tau + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgeqrfp + subroutine dgeqrt(m,n,nb,a,lda,t,ldt,work,info) + integer :: m + integer :: n + integer :: nb + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldt,*) :: t + integer, optional,check(shape(t, 0) == ldt),depend(t) :: ldt=shape(t, 0) + double precision dimension(*) :: work + integer :: info + end subroutine dgeqrt + subroutine dgerqf(m,n,a,lda,tau,work,lwork,info) + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: tau + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgerqf + subroutine dorgqr(m,n,k,a,lda,tau,work,lwork,info) + integer :: m + integer :: n + integer :: k + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: tau + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dorgqr + subroutine dorgrq(m,n,k,a,lda,tau,work,lwork,info) + integer :: m + integer :: n + integer :: k + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: tau + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dorgrq + subroutine dormqr(side,trans,m,n,k,a,lda,tau,c,ldc,work,lwork,info) + character :: side + character :: trans + integer :: m + integer :: n + integer :: k + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: tau + double precision dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dormqr + subroutine dormrz(side,trans,m,n,k,l,a,lda,tau,c,ldc,work,lwork,info) + character :: side + character :: trans + integer :: m + integer :: n + integer :: k + integer :: l + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: tau + double precision dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dormrz + subroutine dtpmqrt(side,trans,m,n,k,l,nb,v,ldv,t,ldt,a,lda,b,ldb,work,info) + character :: side + character :: trans + integer :: m + integer :: n + integer :: k + integer :: l + integer :: nb + double precision dimension(ldv,*) :: v + integer, optional,check(shape(v, 0) == ldv),depend(v) :: ldv=shape(v, 0) + double precision dimension(ldt,*) :: t + integer, optional,check(shape(t, 0) == ldt),depend(t) :: ldt=shape(t, 0) + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(*) :: work + integer :: info + end subroutine dtpmqrt + subroutine dtpqrt(m,n,l,nb,a,lda,b,ldb,t,ldt,work,info) + integer :: m + integer :: n + integer :: l + integer :: nb + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(ldt,*) :: t + integer, optional,check(shape(t, 0) == ldt),depend(t) :: ldt=shape(t, 0) + double precision dimension(*) :: work + integer :: info + end subroutine dtpqrt + subroutine dtzrzf(m,n,a,lda,tau,work,lwork,info) + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: tau + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dtzrzf + subroutine dgebal(job,n,a,lda,ilo,ihi,scale,info) + character :: job + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + integer :: ilo + integer :: ihi + double precision dimension(*) :: scale + integer :: info + end subroutine dgebal + subroutine dgeev(jobvl,jobvr,n,a,lda,wr,wi,vl,ldvl,vr,ldvr,work,lwork,info) + character :: jobvl + character :: jobvr + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: wr + double precision dimension(*) :: wi + double precision dimension(ldvl,*) :: vl + integer, optional,check(shape(vl, 0) == ldvl),depend(vl) :: ldvl=shape(vl, 0) + double precision dimension(ldvr,*) :: vr + integer, optional,check(shape(vr, 0) == ldvr),depend(vr) :: ldvr=shape(vr, 0) + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgeev + subroutine dgehrd(n,ilo,ihi,a,lda,tau,work,lwork,info) + integer :: n + integer :: ilo + integer :: ihi + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: tau + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgehrd + subroutine dorghr(n,ilo,ihi,a,lda,tau,work,lwork,info) + integer :: n + integer :: ilo + integer :: ihi + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: tau + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dorghr + subroutine dtrexc(compq,n,t,ldt,q,ldq,ifst,ilst,work,info) + character :: compq + integer :: n + double precision dimension(ldt,*) :: t + integer, optional,check(shape(t, 0) == ldt),depend(t) :: ldt=shape(t, 0) + double precision dimension(ldq,*) :: q + integer, optional,check(shape(q, 0) == ldq),depend(q) :: ldq=shape(q, 0) + integer :: ifst + integer :: ilst + double precision dimension(*) :: work + integer :: info + end subroutine dtrexc + subroutine dtrsen(job,compq,select,n,t,ldt,q,ldq,wr,wi,m,s,sep,work,lwork,iwork,liwork,info) + character :: job + character :: compq + logical dimension(*) :: select + integer :: n + double precision dimension(ldt,*) :: t + integer, optional,check(shape(t, 0) == ldt),depend(t) :: ldt=shape(t, 0) + double precision dimension(ldq,*) :: q + integer, optional,check(shape(q, 0) == ldq),depend(q) :: ldq=shape(q, 0) + double precision dimension(*) :: wr + double precision dimension(*) :: wi + integer :: m + double precision :: s + double precision :: sep + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: liwork + integer :: info + end subroutine dtrsen + subroutine dtrsyl(trana,tranb,isgn,m,n,a,lda,b,ldb,c,ldc,scale,info) + character :: trana + character :: tranb + integer :: isgn + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + double precision :: scale + integer :: info + end subroutine dtrsyl + subroutine dpteqr(compz,n,d,e,z,ldz,work,info) + character :: compz + integer :: n + double precision dimension(*) :: d + double precision dimension(*) :: e + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + double precision dimension(*) :: work + integer :: info + end subroutine dpteqr + subroutine dsbev(jobz,uplo,n,kd,ab,ldab,w,z,ldz,work,info) + character :: jobz + character :: uplo + integer :: n + integer :: kd + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + double precision dimension(*) :: w + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + double precision dimension(*) :: work + integer :: info + end subroutine dsbev + subroutine dsbevd(jobz,uplo,n,kd,ab,ldab,w,z,ldz,work,lwork,iwork,liwork,info) + character :: jobz + character :: uplo + integer :: n + integer :: kd + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + double precision dimension(*) :: w + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: liwork + integer :: info + end subroutine dsbevd + subroutine dsbevx(jobz,range,uplo,n,kd,ab,ldab,q,ldq,vl,vu,il,iu,abstol,m,w,z,ldz,work,iwork,ifail,info) + character :: jobz + character :: range + character :: uplo + integer :: n + integer :: kd + double precision dimension(ldab,*) :: ab + integer, optional,check(shape(ab, 0) == ldab),depend(ab) :: ldab=shape(ab, 0) + double precision dimension(ldq,*) :: q + integer, optional,check(shape(q, 0) == ldq),depend(q) :: ldq=shape(q, 0) + double precision :: vl + double precision :: vu + integer :: il + integer :: iu + double precision :: abstol + integer :: m + double precision dimension(*) :: w + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer dimension(*) :: ifail + integer :: info + end subroutine dsbevx + subroutine dstebz(range,order,n,vl,vu,il,iu,abstol,d,e,m,nsplit,w,iblock,isplit,work,iwork,info) + character :: range + character :: order + integer :: n + double precision :: vl + double precision :: vu + integer :: il + integer :: iu + double precision :: abstol + double precision dimension(*) :: d + double precision dimension(*) :: e + integer :: m + integer :: nsplit + double precision dimension(*) :: w + integer dimension(*) :: iblock + integer dimension(*) :: isplit + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer :: info + end subroutine dstebz + subroutine dstein(n,d,e,m,w,iblock,isplit,z,ldz,work,iwork,ifail,info) + integer :: n + double precision dimension(*) :: d + double precision dimension(*) :: e + integer :: m + double precision dimension(*) :: w + integer dimension(*) :: iblock + integer dimension(*) :: isplit + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + double precision dimension(*) :: work + integer dimension(*) :: iwork + integer dimension(*) :: ifail + integer :: info + end subroutine dstein + subroutine dstemr(jobz,range,n,d,e,vl,vu,il,iu,m,w,z,ldz,nzc,isuppz,tryrac,work,lwork,iwork,liwork,info) + character :: jobz + character :: range + integer :: n + double precision dimension(*) :: d + double precision dimension(*) :: e + double precision :: vl + double precision :: vu + integer :: il + integer :: iu + integer :: m + double precision dimension(*) :: w + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + integer :: nzc + integer dimension(*) :: isuppz + logical :: tryrac + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: liwork + integer :: info + end subroutine dstemr + subroutine dsterf(n,d,e,info) + integer :: n + double precision dimension(*) :: d + double precision dimension(*) :: e + integer :: info + end subroutine dsterf + subroutine dstev(jobz,n,d,e,z,ldz,work,info) + character :: jobz + integer :: n + double precision dimension(*) :: d + double precision dimension(*) :: e + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + double precision dimension(*) :: work + integer :: info + end subroutine dstev + subroutine dstevd(jobz,n,d,e,z,ldz,work,lwork,iwork,liwork,info) + character :: jobz + integer :: n + double precision dimension(*) :: d + double precision dimension(*) :: e + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: liwork + integer :: info + end subroutine dstevd + subroutine dsyev(jobz,uplo,n,a,lda,w,work,lwork,info) + character :: jobz + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: w + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dsyev + subroutine dsyevd(jobz,uplo,n,a,lda,w,work,lwork,iwork,liwork,info) + character :: jobz + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: w + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: liwork + integer :: info + end subroutine dsyevd + subroutine dsyevr(jobz,range,uplo,n,a,lda,vl,vu,il,iu,abstol,m,w,z,ldz,isuppz,work,lwork,iwork,liwork,info) + character :: jobz + character :: range + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision :: vl + double precision :: vu + integer :: il + integer :: iu + double precision :: abstol + integer :: m + double precision dimension(*) :: w + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + integer dimension(*) :: isuppz + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: liwork + integer :: info + end subroutine dsyevr + subroutine dsyevx(jobz,range,uplo,n,a,lda,vl,vu,il,iu,abstol,m,w,z,ldz,work,lwork,iwork,ifail,info) + character :: jobz + character :: range + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision :: vl + double precision :: vu + integer :: il + integer :: iu + double precision :: abstol + integer :: m + double precision dimension(*) :: w + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer dimension(*) :: ifail + integer :: info + end subroutine dsyevx + subroutine dsytrd(uplo,n,a,lda,d,e,tau,work,lwork,info) + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: d + double precision dimension(*) :: e + double precision dimension(*) :: tau + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dsytrd + subroutine dggev(jobvl,jobvr,n,a,lda,b,ldb,alphar,alphai,beta,vl,ldvl,vr,ldvr,work,lwork,info) + character :: jobvl + character :: jobvr + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(*) :: alphar + double precision dimension(*) :: alphai + double precision dimension(*) :: beta + double precision dimension(ldvl,*) :: vl + integer, optional,check(shape(vl, 0) == ldvl),depend(vl) :: ldvl=shape(vl, 0) + double precision dimension(ldvr,*) :: vr + integer, optional,check(shape(vr, 0) == ldvr),depend(vr) :: ldvr=shape(vr, 0) + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dggev + subroutine dsygst(itype,uplo,n,a,lda,b,ldb,info) + integer :: itype + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + integer :: info + end subroutine dsygst + subroutine dsygv(itype,jobz,uplo,n,a,lda,b,ldb,w,work,lwork,info) + integer :: itype + character :: jobz + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(*) :: w + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dsygv + subroutine dsygvd(itype,jobz,uplo,n,a,lda,b,ldb,w,work,lwork,iwork,liwork,info) + integer :: itype + character :: jobz + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(*) :: w + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: liwork + integer :: info + end subroutine dsygvd + subroutine dsygvx(itype,jobz,range,uplo,n,a,lda,b,ldb,vl,vu,il,iu,abstol,m,w,z,ldz,work,lwork,iwork,ifail,info) + integer :: itype + character :: jobz + character :: range + character :: uplo + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision :: vl + double precision :: vu + integer :: il + integer :: iu + double precision :: abstol + integer :: m + double precision dimension(*) :: w + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer dimension(*) :: ifail + integer :: info + end subroutine dsygvx + subroutine dtgexc(wantq,wantz,n,a,lda,b,ldb,q,ldq,z,ldz,ifst,ilst,work,lwork,info) + logical :: wantq + logical :: wantz + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(ldq,*) :: q + integer, optional,check(shape(q, 0) == ldq),depend(q) :: ldq=shape(q, 0) + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + integer :: ifst + integer :: ilst + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dtgexc + subroutine dtgsen(ijob,wantq,wantz,select,n,a,lda,b,ldb,alphar,alphai,beta,q,ldq,z,ldz,m,pl,pr,dif,work,lwork,iwork,liwork,info) + integer :: ijob + logical :: wantq + logical :: wantz + logical dimension(*) :: select + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(*) :: alphar + double precision dimension(*) :: alphai + double precision dimension(*) :: beta + double precision dimension(ldq,*) :: q + integer, optional,check(shape(q, 0) == ldq),depend(q) :: ldq=shape(q, 0) + double precision dimension(ldz,*) :: z + integer, optional,check(shape(z, 0) == ldz),depend(z) :: ldz=shape(z, 0) + integer :: m + double precision :: pl + double precision :: pr + double precision dimension(*) :: dif + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: liwork + integer :: info + end subroutine dtgsen + subroutine dtgsyl(trans,ijob,m,n,a,lda,b,ldb,c,ldc,d,ldd,e,lde,f,ldf,scale,dif,work,lwork,iwork,info) + character :: trans + integer :: ijob + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(ldb,*) :: b + integer, optional,check(shape(b, 0) == ldb),depend(b) :: ldb=shape(b, 0) + double precision dimension(ldc,*) :: c + integer, optional,check(shape(c, 0) == ldc),depend(c) :: ldc=shape(c, 0) + double precision dimension(ldd,*) :: d + integer, optional,check(shape(d, 0) == ldd),depend(d) :: ldd=shape(d, 0) + double precision dimension(lde,*) :: e + integer, optional,check(shape(e, 0) == lde),depend(e) :: lde=shape(e, 0) + double precision dimension(ldf,*) :: f + integer, optional,check(shape(f, 0) == ldf),depend(f) :: ldf=shape(f, 0) + double precision :: scale + double precision :: dif + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: info + end subroutine dtgsyl + subroutine dgejsv(joba,jobu,jobv,jobr,jobt,jobp,m,n,a,lda,sva,u,ldu,v,ldv,work,lwork,iwork,info) + character*1 :: joba + character*1 :: jobu + character*1 :: jobv + character*1 :: jobr + character*1 :: jobt + character*1 :: jobp + integer :: m + integer, optional,check(shape(sva, 0) == n),depend(sva) :: n=shape(sva, 0) + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(n) :: sva + double precision dimension(ldu,*) :: u + integer, optional,check(shape(u, 0) == ldu),depend(u) :: ldu=shape(u, 0) + double precision dimension(ldv,*) :: v + integer, optional,check(shape(v, 0) == ldv),depend(v) :: ldv=shape(v, 0) + double precision dimension(lwork) :: work + integer, optional,check(shape(work, 0) == lwork),depend(work) :: lwork=shape(work, 0) + integer dimension(*) :: iwork + integer :: info + end subroutine dgejsv + subroutine dgesdd(jobz,m,n,a,lda,s,u,ldu,vt,ldvt,work,lwork,iwork,info) + character :: jobz + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: s + double precision dimension(ldu,*) :: u + integer, optional,check(shape(u, 0) == ldu),depend(u) :: ldu=shape(u, 0) + double precision dimension(ldvt,*) :: vt + integer, optional,check(shape(vt, 0) == ldvt),depend(vt) :: ldvt=shape(vt, 0) + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: info + end subroutine dgesdd + subroutine dgesvd(jobu,jobvt,m,n,a,lda,s,u,ldu,vt,ldvt,work,lwork,info) + character :: jobu + character :: jobvt + integer :: m + integer :: n + double precision dimension(lda,*) :: a + integer, optional,check(shape(a, 0) == lda),depend(a) :: lda=shape(a, 0) + double precision dimension(*) :: s + double precision dimension(ldu,*) :: u + integer, optional,check(shape(u, 0) == ldu),depend(u) :: ldu=shape(u, 0) + double precision dimension(ldvt,*) :: vt + integer, optional,check(shape(vt, 0) == ldvt),depend(vt) :: ldvt=shape(vt, 0) + double precision dimension(*) :: work + integer :: lwork + integer :: info + end subroutine dgesvd + subroutine dorcsd(jobu1,jobu2,jobv1t,jobv2t,trans,signs,m,p,q,x11,ldx11,x12,ldx12,x21,ldx21,x22,ldx22,theta,u1,ldu1,u2,ldu2,v1t,ldv1t,v2t,ldv2t,work,lwork,iwork,info) + character :: jobu1 + character :: jobu2 + character :: jobv1t + character :: jobv2t + character :: trans + character :: signs + integer :: m + integer :: p + integer :: q + double precision dimension(ldx11,*) :: x11 + integer, optional,check(shape(x11, 0) == ldx11),depend(x11) :: ldx11=shape(x11, 0) + double precision dimension(ldx12,*) :: x12 + integer, optional,check(shape(x12, 0) == ldx12),depend(x12) :: ldx12=shape(x12, 0) + double precision dimension(ldx21,*) :: x21 + integer, optional,check(shape(x21, 0) == ldx21),depend(x21) :: ldx21=shape(x21, 0) + double precision dimension(ldx22,*) :: x22 + integer, optional,check(shape(x22, 0) == ldx22),depend(x22) :: ldx22=shape(x22, 0) + double precision dimension(*) :: theta + double precision dimension(ldu1,*) :: u1 + integer, optional,check(shape(u1, 0) == ldu1),depend(u1) :: ldu1=shape(u1, 0) + double precision dimension(ldu2,*) :: u2 + integer, optional,check(shape(u2, 0) == ldu2),depend(u2) :: ldu2=shape(u2, 0) + double precision dimension(ldv1t,*) :: v1t + integer, optional,check(shape(v1t, 0) == ldv1t),depend(v1t) :: ldv1t=shape(v1t, 0) + double precision dimension(ldv2t,*) :: v2t + integer, optional,check(shape(v2t, 0) == ldv2t),depend(v2t) :: ldv2t=shape(v2t, 0) + double precision dimension(*) :: work + integer :: lwork + integer dimension(*) :: iwork + integer :: info + end subroutine dorcsd + subroutine dlasd4(n,i,d,z,delta,rho,sigma,work,info) + integer :: n + integer :: i + double precision dimension(*) :: d + double precision dimension(*) :: z + double precision dimension(*) :: delta + double precision :: rho + double precision :: sigma + double precision dimension(*) :: work + integer :: info + end subroutine dlasd4 + end interface +end python module f2py_reference_lapack_example + +! This file was auto-generated with f2py (version:2.5.1). +! See: +! https://web.archive.org/web/20140822061353/http://cens.ioc.ee/projects/f2py2e diff --git a/examples/lapack/routine_inventory.py b/examples/lapack/routine_inventory.py index 53c751e59..0ce9eae6c 100644 --- a/examples/lapack/routine_inventory.py +++ b/examples/lapack/routine_inventory.py @@ -6,7 +6,7 @@ SCIPY_VERSION = "1.18.0" EXPECTED_LAPACK_SOURCE_FILES = 2062 -EXPECTED_LAPACK_ROOT_PROCEDURES = 2064 +EXPECTED_LAPACK_PROCEDURES = 2064 F2PY_SCALAR_WRITEBACK_ROUTINES = frozenset( {"dlarfg", "dlartg", "dgbcon", "dgecon", "dgtcon", "dpocon", "dppcon", "dsycon", "dtrcon"} ) diff --git a/examples/lapack/tests/test_routine_coverage.py b/examples/lapack/tests/test_routine_coverage.py index 4cb5c999d..319aaa37a 100644 --- a/examples/lapack/tests/test_routine_coverage.py +++ b/examples/lapack/tests/test_routine_coverage.py @@ -3,22 +3,14 @@ from __future__ import annotations import ast -import sys +import re from pathlib import Path import pytest -from ..f2py_build import ( - F2PY_BUILD_DEPENDENCIES, - F2PY_INOUT_ARGUMENTS, - F2PY_KIND_MAP, - f2py_build_command, - f2py_signature_command, - f2py_source_plan, -) from ..routine_inventory import ( EXPLICIT_TEST_NAMES, - EXPECTED_LAPACK_ROOT_PROCEDURES, + EXPECTED_LAPACK_PROCEDURES, EXPECTED_LAPACK_SOURCE_FILES, F2PY_EXPORT_LIMITATIONS, F2PY_FUNCTION_RESULTS, @@ -35,10 +27,41 @@ TEST_ROOT = Path(__file__).resolve().parent EXAMPLE_ROOT = TEST_ROOT.parent NATIVE_ROOT = EXAMPLE_ROOT / "native" +LAPACK_PYF = EXAMPLE_ROOT / "lapack.pyf" +LAPACK_F2CMAP = EXAMPLE_ROOT / "lapack.f2cmap" FORTRAN_SUFFIXES = {".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"} +F2PY_INOUT_ARGUMENTS: dict[str, tuple[str, ...]] = { + "dlarfg": ("alpha", "tau"), + "dlartg": ("c", "s", "r"), + "dgbcon": ("rcond", "info"), + "dgecon": ("rcond", "info"), + "dgtcon": ("rcond", "info"), + "dpocon": ("rcond", "info"), + "dppcon": ("rcond", "info"), + "dsycon": ("rcond", "info"), + "dtrcon": ("rcond", "info"), +} +PYF_PROCEDURE = re.compile( + r"^\s*(subroutine|function)\s+([a-z]\w*)\s*\(.*?^\s*end\s+\1\s+\2\s*$", + re.IGNORECASE | re.MULTILINE | re.DOTALL, +) pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] +def _pyf_procedures() -> dict[str, str]: + text = LAPACK_PYF.read_text(encoding="utf-8") + return {match.group(2).lower(): match.group(0) for match in PYF_PROCEDURE.finditer(text)} + + +def _inout_arguments(block: str) -> set[str]: + return { + argument.strip().lower() + for line in block.splitlines() + if "intent(inout)" in line.lower() and "::" in line + for argument in line.split("::", 1)[1].split(",") + } + + def _explicit_test_owners() -> dict[str, list[tuple[str, Path]]]: owners: dict[str, list[tuple[str, Path]]] = {} for path in sorted(TEST_ROOT.glob("test_*.py")): @@ -116,37 +139,31 @@ def test_inventory_groups_form_one_complete_partition(): assert set(PRIK_ABI_ADAPTERS) <= set(ROUTINES) -def test_f2py_source_plan_includes_required_kind_module(tmp_path: Path): - """Signature discovery covers every selected implementation and reviewed overlay.""" - plan = f2py_source_plan(tmp_path) - dependency_count = len(F2PY_BUILD_DEPENDENCIES) - assert tuple(path.name for path in plan[:dependency_count]) == F2PY_BUILD_DEPENDENCIES - assert {path.stem for path in plan[dependency_count:]} == set(ROUTINES) - set(F2PY_EXPORT_LIMITATIONS) - assert len(plan) == dependency_count + len(ROUTINES) - len(F2PY_EXPORT_LIMITATIONS) - assert F2PY_KIND_MAP == "{'real': {'wp': 'double'}}\n" - - for routine, arguments in F2PY_INOUT_ARGUMENTS.items(): - source = next(path for path in plan if path.stem == routine) - prefix = "Cf2py" if source.suffix == ".f" else "!f2py" - assert source.parent == tmp_path / "f2py-intent-sources" - assert f"{prefix} intent(inout) {', '.join(arguments)}" in source.read_text(encoding="utf-8") +def test_committed_f2py_signature_matches_selected_surface(): + """The reviewed signature exposes exactly the supported comparison surface.""" + procedures = _pyf_procedures() + expected = set(ROUTINES) - set(F2PY_EXPORT_LIMITATIONS) + assert len(procedures) == len(expected) == 125 + assert set(procedures) == expected + assert re.search(r"^\s*module\s+la_constants\s*$", LAPACK_PYF.read_text(encoding="utf-8"), re.MULTILINE) + assert LAPACK_F2CMAP.read_text(encoding="utf-8") == "{'real': {'wp': 'double'}}\n" - command = f2py_signature_command(tmp_path) - assert "only:" in command - assert ":" in command - assert (tmp_path / ".f2py_f2cmap").read_text(encoding="utf-8") == F2PY_KIND_MAP +def test_committed_f2py_signature_records_scalar_writebacks(): + observed = { + routine: arguments for routine, block in _pyf_procedures().items() if (arguments := _inout_arguments(block)) + } + assert observed == {routine: set(arguments) for routine, arguments in F2PY_INOUT_ARGUMENTS.items()} -def test_f2py_build_command_reuses_the_precompiled_native_library(tmp_path: Path): - native_library = tmp_path / "native" / "libprik_full_lapack.so" - command = f2py_build_command(tmp_path, native_library) - assert command[:4] == (sys.executable, "-m", "numpy.f2py", "-c") - assert str(tmp_path / "f2py_reference_lapack_example.pyf") in command - assert f"-L{native_library.parent}" in command - assert "-lprik_full_lapack" in command - assert "--dep" not in command - assert not any(str(NATIVE_ROOT) in value for value in command) +def test_f2py_script_compiles_the_signature_and_reuses_the_native_library(): + script = (EXAMPLE_ROOT / "build_f2py.sh").read_text(encoding="utf-8") + assert 'python -m numpy.f2py -c \\\n "$EXAMPLE_WORKSPACE/examples/lapack/lapack.pyf"' in script + assert '"-L$(dirname "$LAPACK_SHARED_LIBRARY")"' in script + assert "-lprik_full_lapack" in script + assert '--f2cmap "$EXAMPLE_WORKSPACE/examples/lapack/lapack.f2cmap"' in script + assert '--f90flags="-O0 -I$LAPACK_MODULE_DIR"' in script + assert "examples/lapack/native" not in script def test_documented_scripts_place_both_wrappers_under_one_build_root(prik_lapack, f2py_lapack): @@ -162,7 +179,7 @@ def test_authoritative_native_source_boundary_is_complete_and_unique(): ) stems = {path.stem.lower() for path in sources} assert len(sources) == EXPECTED_LAPACK_SOURCE_FILES - assert EXPECTED_LAPACK_ROOT_PROCEDURES == EXPECTED_LAPACK_SOURCE_FILES - 2 + 4 + assert EXPECTED_LAPACK_PROCEDURES == EXPECTED_LAPACK_SOURCE_FILES - 2 + 4 assert set(ROUTINES) <= stems for routine, spec in ROUTINE_SPECS.items(): assert (NATIVE_ROOT / spec.source_file).is_file(), routine @@ -191,26 +208,17 @@ def test_selected_tests_keep_all_wrapper_calls_visible(): assert missing == {} -def test_documented_coverage_totals_match_inventory(): - """Published totals are derived from the reviewed inventory, not hand-waved.""" - readme = (EXAMPLE_ROOT / "README.md").read_text(encoding="utf-8") - expected_rows = { - "Authoritative LAPACK implementation sources": EXPECTED_LAPACK_SOURCE_FILES, - "Discovered root LAPACK procedures": EXPECTED_LAPACK_ROOT_PROCEDURES, - "Selected SciPy-backed float64 routines": len(ROUTINES), - "Explicit correctness tests": len(EXPLICIT_TEST_NAMES), - "PRIK root exports required in CI": EXPECTED_LAPACK_ROOT_PROCEDURES, - "Selected PRIK routines independently validated": len(ROUTINES), - "SciPy exports used": len(ROUTINES), - "f2py exports required in CI": len(ROUTINES) - len(F2PY_EXPORT_LIMITATIONS), - "Routines satisfying the independent oracle through f2py": len(ROUTINES) - len(F2PY_EXPORT_LIMITATIONS), - "Documented f2py source-parser export limitations": len(F2PY_EXPORT_LIMITATIONS), - "f2py scalar-writeback intent overlays": len(F2PY_INOUT_ARGUMENTS), - "Documented PRIK default-LOGICAL ABI adapters": len(PRIK_ABI_ADAPTERS), - "Documented unsupported/skipped routines": 0, - } - for label, count in expected_rows.items(): - assert f"| {label} | {count:,} |" in readme +def test_documented_coverage_claims_match_inventory(): + """Published claims are derived from the reviewed inventory.""" + readme = " ".join((EXAMPLE_ROOT / "README.md").read_text(encoding="utf-8").split()) + assert len(EXPLICIT_TEST_NAMES) == len(ROUTINES) + assert f"PRIK wraps all {EXPECTED_LAPACK_PROCEDURES:,} discovered procedures" in readme + assert f"the {len(ROUTINES)} `float64` routines" in readme + assert f"raw f2py supports {len(ROUTINES) - len(F2PY_EXPORT_LIMITATIONS)}" in readme + assert f"All {len(EXPLICIT_TEST_NAMES)} selected routines have explicit correctness tests" in readme + assert f"The {len(F2PY_INOUT_ARGUMENTS)} scalar-writeback routines" in readme + assert f"owns {EXPECTED_LAPACK_SOURCE_FILES:,} LAPACK implementation sources" in readme + assert "no unsupported or skipped routines" in readme def test_selected_routines_are_exported_by_prik(prik_lapack): @@ -221,6 +229,7 @@ def test_selected_routines_are_exported_by_prik(prik_lapack): def test_expected_f2py_routines_are_exported(f2py_lapack): """Only reproduced and documented f2py limitations may lack an export.""" + assert getattr(f2py_lapack, "la_constants", None) is not None expected = [name for name in ROUTINES if name not in F2PY_EXPORT_LIMITATIONS] missing = [name for name in expected if not hasattr(f2py_lapack, name)] assert missing == [] diff --git a/examples/native_library.py b/examples/native_library.py index 96831451c..c1d61db76 100644 --- a/examples/native_library.py +++ b/examples/native_library.py @@ -20,7 +20,7 @@ LAPACK_SOURCE_ROOT = EXAMPLES_ROOT / "lapack" / "native" NATIVE_CACHE_ENV = "PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR" NATIVE_JOBS_ENV = "PRIK_REAL_LIBRARY_NATIVE_JOBS" -NATIVE_CACHE_VERSION = "copyable-examples-v1" +NATIVE_CACHE_VERSION = "copyable-examples-v2-modules" NATIVE_MODULE_SOURCE_STEMS = frozenset({"la_constants", "la_xisnan"}) DEFAULT_NATIVE_COMPILE_JOB_LIMIT = 8 FORTRAN_SUFFIXES = frozenset({".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"}) @@ -35,6 +35,7 @@ class NativeLibrary: shared_library: Path archive: Path cache_dir: Path + module_dir: Path sources: tuple[Path, ...] compiler: str @@ -191,9 +192,17 @@ def _cached_objects( jobs: int, ) -> tuple[Path, ...]: objects_dir = cache_dir / "objects" + modules_dir = cache_dir / "modules" complete = cache_dir / "objects.complete" objects = tuple(_cached_object_path(objects_dir, source) for source in sources) - if complete.is_file() and all(native_object.is_file() for native_object in objects): + module_sources = tuple(source for source in sources if source.stem.lower() in NATIVE_MODULE_SOURCE_STEMS) + modules = tuple(modules_dir / f"{source.stem.lower()}.mod" for source in module_sources) + if ( + complete.is_file() + and modules_dir.is_dir() + and all(native_object.is_file() for native_object in objects) + and all(module.is_file() for module in modules) + ): return objects process_suffix = str(os.getpid()) @@ -203,7 +212,6 @@ def _cached_objects( shutil.rmtree(temporary_modules, ignore_errors=True) temporary_objects.mkdir(parents=True) temporary_modules.mkdir(parents=True) - module_sources = tuple(source for source in sources if source.stem.lower() in NATIVE_MODULE_SOURCE_STEMS) module_source_set = set(module_sources) independent_sources = tuple(source for source in sources if source not in module_source_set) for source in module_sources: @@ -211,7 +219,8 @@ def _cached_objects( _compile_independent_sources(compiler, independent_sources, temporary_objects, temporary_modules, jobs) shutil.rmtree(objects_dir, ignore_errors=True) temporary_objects.rename(objects_dir) - shutil.rmtree(temporary_modules, ignore_errors=True) + shutil.rmtree(modules_dir, ignore_errors=True) + temporary_modules.rename(modules_dir) complete.write_text(f"{NATIVE_CACHE_VERSION}\n", encoding="utf-8") (cache_dir / "archive.complete").unlink(missing_ok=True) (cache_dir / "shared.complete").unlink(missing_ok=True) @@ -284,6 +293,7 @@ def build_reference_library( shared_library=shared_library, archive=archive, cache_dir=cache_dir, + module_dir=cache_dir / "modules", sources=selected_sources, compiler=selected_compiler, ) diff --git a/prik/cli.py b/prik/cli.py index 38ebd2c3a..f5c6ecac7 100644 --- a/prik/cli.py +++ b/prik/cli.py @@ -881,7 +881,8 @@ def _wrapper_build_uses_pyi_contract(args: argparse.Namespace) -> bool: def _native_link_options_used(args: argparse.Namespace) -> bool: return bool( - getattr(args, "native_fortran_sources", None) + getattr(args, "no_compile_input_sources", False) + or getattr(args, "native_fortran_sources", None) or getattr(args, "native_compile_flags", None) or getattr(args, "native_objects", None) or getattr(args, "native_libraries", None) @@ -890,6 +891,14 @@ def _native_link_options_used(args: argparse.Namespace) -> bool: ) +def _prebuilt_native_link_input_used(args: argparse.Namespace) -> bool: + return bool( + getattr(args, "native_objects", None) + or getattr(args, "native_libraries", None) + or getattr(args, "native_link_items", None) + ) + + def _wrapper_compile_options_used(args: argparse.Namespace) -> bool: return bool( getattr(args, "wrapper_compiler_debug", False) @@ -914,6 +923,8 @@ def _validate_pyi_wrapper_options(args: argparse.Namespace, parser: argparse.Arg parser.error("A .pyi wrapper build cannot mix positional native sources; pass native artifacts with flags") if len(args.paths) != 1: parser.error("A .pyi wrapper build accepts exactly one entry contract") + if getattr(args, "no_compile_input_sources", False): + parser.error("--no-compile-input-sources applies only to source-driven wrapper builds") if not ( getattr(args, "native_fortran_sources", None) or getattr(args, "native_objects", None) @@ -953,15 +964,23 @@ def _validate_manifest_wrapper_options(args: argparse.Namespace, parser: argpars def _validate_source_wrapper_options(args: argparse.Namespace, parser: argparse.ArgumentParser) -> None: if not args.paths: - parser.error("A wrapper build expects at least one Fortran source file or a semantic .pyi contract") - if any(Path(path).is_dir() for path in args.paths): - parser.error("A wrapper build expects Fortran source files, not directories") - unsupported = [path for path in args.paths if not _path_is_fortran_source(path)] + parser.error("A wrapper build expects at least one Fortran source, source directory, or semantic .pyi contract") + unsupported = [path for path in args.paths if not Path(path).is_dir() and not _path_is_fortran_source(path)] if unsupported: parser.error( "A wrapper build expects recognized Fortran source suffixes or one semantic .pyi contract; " f"unsupported input: {unsupported[0]}" ) + empty_directories = [path for path in args.paths if Path(path).is_dir() and not _collect_extensions(Path(path))] + if empty_directories: + parser.error(f"A wrapper build found no recognized Fortran sources under: {empty_directories[0]}") + if not getattr(args, "no_compile_input_sources", False): + return + if not (getattr(args, "native_fortran_sources", None) or _prebuilt_native_link_input_used(args)): + parser.error( + "--no-compile-input-sources requires --native-fortran-sources, --native-objects, " + "--native-library, or --native-link-item" + ) def _validate_wrapper_out(args: argparse.Namespace, parser: argparse.ArgumentParser) -> None: @@ -1282,6 +1301,7 @@ def record_total_build_time(elapsed: float) -> None: output_name=_wrapper_output_name(args), preprocessing=preprocessing, strict_wrapper_names=getattr(args, "strict_wrapper_names", False), + compile_input_sources=not getattr(args, "no_compile_input_sources", False), native_fortran_sources=getattr(args, "native_fortran_sources", None), native_fortran_flags=_cli_native_compile_flags(getattr(args, "native_compile_flags", None)), native_objects=getattr(args, "native_objects", None), @@ -1805,6 +1825,11 @@ def _add_build_manifest_option( def _add_native_compilation_options(group: argparse._ArgumentGroup) -> None: + group.add_argument( + "--no-compile-input-sources", + action="store_true", + help="Read positional Fortran sources without compiling them; require an explicit native implementation", + ) group.add_argument( "--native-fortran-sources", dest="native_fortran_sources", @@ -1901,6 +1926,7 @@ def _add_diagnostic_controls(group: argparse._ArgumentGroup, *, allow_verbose: b "print_limit": None, "vars_limit": None, "build_manifest": None, + "no_compile_input_sources": False, "native_fortran_sources": None, "native_compile_flags": None, "jobs": None, @@ -1935,7 +1961,7 @@ def _add_build_arguments(parser: argparse.ArgumentParser) -> None: _add_paths( positional_group, metavar="INPUT", - help_text="Fortran source file(s), or exactly one semantic .pyi contract", + help_text="Fortran source file(s), one source directory, or exactly one semantic .pyi contract", ) input_group = parser.add_argument_group("input selection") _add_language_option( @@ -1943,6 +1969,7 @@ def _add_build_arguments(parser: argparse.ArgumentParser) -> None: choices=("fortran",), help_text="Input language (default: fortran)", ) + parser.set_defaults(language="fortran") _add_build_manifest_option(input_group) output_group = parser.add_argument_group("output options") diff --git a/prik/pipeline/build.py b/prik/pipeline/build.py index 88e704988..a5b1a1cb8 100644 --- a/prik/pipeline/build.py +++ b/prik/pipeline/build.py @@ -802,13 +802,28 @@ def _project_compile_batches( def _source_paths(sources: str | Path | Iterable[str | Path]) -> tuple[Path, ...]: - paths = (Path(sources),) if isinstance(sources, str | Path) else tuple(Path(source) for source in sources) - if not paths: - raise ValueError("wrapper build requires at least one Fortran source file") - for path in paths: + inputs = (Path(sources),) if isinstance(sources, str | Path) else tuple(Path(source) for source in sources) + if not inputs: + raise ValueError("wrapper build requires at least one Fortran source file or directory") + + paths: list[Path] = [] + for path in inputs: + if path.is_dir(): + discovered = sorted( + candidate + for candidate in path.rglob("*") + if candidate.is_file() and candidate.suffix.lower() in _FORTRAN_SOURCE_SUFFIXES + ) + if not discovered: + raise ValueError(f"No recognized Fortran sources found under: {path}") + paths.extend(discovered) + continue if not path.is_file(): raise FileNotFoundError(f"Fortran source not found: {path}") - return paths + if path.suffix.lower() not in _FORTRAN_SOURCE_SUFFIXES: + raise ValueError(f"Unrecognized Fortran source suffix: {path}") + paths.append(path) + return tuple(dict.fromkeys(paths)) def _wrapper_output_paths(output_dir: str | Path | None) -> tuple[Path, Path]: @@ -1341,7 +1356,7 @@ def _native_build_inputs( and not complete_link_items ): raise ValueError( - ".pyi wrapper build requires at least one native source, object, archive, shared library, " + "Wrapper build requires at least one native source, object, archive, shared library, " "ordered link item, or -l name" ) return _NativeBuildInputs( @@ -1913,6 +1928,7 @@ def build_fortran_extension( fortran_type_probe_runner: list[str] | None = None, fortran_type_probe_cache_dir: str | Path | None = None, refresh_fortran_type_probe: bool = False, + compile_input_sources: bool = True, native_fortran_sources: Iterable[str | Path] | None = None, native_fortran_flags: Iterable[str] | None = None, native_objects: Iterable[str | Path] | None = None, @@ -1946,8 +1962,10 @@ def build_fortran_extension( output_path.mkdir(parents=True, exist_ok=True) preprocessing = preprocessing or _default_preprocessing_config() supplemental_source_paths = tuple(Path(path) for path in (native_fortran_sources or ())) + input_implementation_paths = source_paths if compile_input_sources else () + implementation_source_paths = (*input_implementation_paths, *supplemental_source_paths) native_inputs = _native_build_inputs( - native_fortran_sources=(*source_paths, *supplemental_source_paths), + native_fortran_sources=implementation_source_paths, native_fortran_flags=native_fortran_flags, native_objects=native_objects, native_libraries=native_libraries, @@ -2018,7 +2036,7 @@ def build_fortran_extension( library_dirs=native_inputs.library_dirs, explicit_include_dirs=native_inputs.explicit_include_dirs, include_dirs=include_dirs, - module_dir=output_path, + module_dir=output_path if native_source_objects else None, ) _validate_native_link_paths(native_build_plan) native_compile_batches = _project_compile_batches(parsed, native_source_objects) diff --git a/tests/fortran/building_shared_library/compiling/test_example_native_library.py b/tests/fortran/building_shared_library/compiling/test_example_native_library.py new file mode 100644 index 000000000..8b111c259 --- /dev/null +++ b/tests/fortran/building_shared_library/compiling/test_example_native_library.py @@ -0,0 +1,52 @@ +"""Focused checks for the copyable example native-library builder.""" + +from __future__ import annotations + +from pathlib import Path + +from examples import native_library + + +def test_native_cache_preserves_module_files_for_wrapper_compilation(tmp_path: Path, monkeypatch) -> None: + sources = ( + native_library.LAPACK_SOURCE_ROOT / "la_constants.f90", + native_library.LAPACK_SOURCE_ROOT / "la_xisnan.F90", + native_library.LAPACK_SOURCE_ROOT / "dlamch.f", + ) + + def compile_source(_compiler: str, source: Path, native_object: Path, module_dir: Path) -> None: + native_object.parent.mkdir(parents=True, exist_ok=True) + native_object.touch() + if source.stem.lower() in native_library.NATIVE_MODULE_SOURCE_STEMS: + (module_dir / f"{source.stem.lower()}.mod").touch() + + def compile_independent_sources( + compiler: str, + selected_sources: tuple[Path, ...], + objects_dir: Path, + module_dir: Path, + _jobs: int, + ) -> None: + for source in selected_sources: + compile_source( + compiler, + source, + native_library._cached_object_path(objects_dir, source), + module_dir, + ) + + monkeypatch.setattr(native_library, "_compile_source", compile_source) + monkeypatch.setattr(native_library, "_compile_independent_sources", compile_independent_sources) + + cache_dir = tmp_path / "native" + objects = native_library._cached_objects(cache_dir, sources, "gfortran", 2) + + assert all(path.is_file() for path in objects) + assert (cache_dir / "modules" / "la_constants.mod").is_file() + assert (cache_dir / "modules" / "la_xisnan.mod").is_file() + + def fail_if_recompiled(*_args) -> None: + raise AssertionError("warm cache recompiled a module") + + monkeypatch.setattr(native_library, "_compile_source", fail_if_recompiled) + assert native_library._cached_objects(cache_dir, sources, "gfortran", 2) == objects diff --git a/tests/fortran/building_shared_library/end_to_end/test_source_build_modes.py b/tests/fortran/building_shared_library/end_to_end/test_source_build_modes.py index f39ebdb58..fa96b35de 100644 --- a/tests/fortran/building_shared_library/end_to_end/test_source_build_modes.py +++ b/tests/fortran/building_shared_library/end_to_end/test_source_build_modes.py @@ -392,6 +392,111 @@ def test_source_build_reuses_native_plan_for_additional_compile_and_link_inputs( ) +def test_source_directory_can_plan_a_wrapper_without_compiling_input_sources(tmp_path: Path): + source_dir = tmp_path / "native" + nested_dir = source_dir / "nested" + output_dir = tmp_path / "generated" + native_library = tmp_path / "libnative.so" + source_dir.mkdir() + nested_dir.mkdir() + shutil.copyfile(VERBOSE_SOURCE, source_dir / VERBOSE_SOURCE.name) + shutil.copyfile(SCALE_SOURCE, nested_dir / SCALE_SOURCE.name) + native_library.write_bytes(b"prebuilt native library fixture") + + result = build_fortran_extension( + source_dir, + output_name="prebuilt_sources", + output_dir=output_dir, + compile_input_sources=False, + native_objects=[native_library], + generate_sources=True, + ) + + plan = result.native_build_plan + assert result.sources == (nested_dir / SCALE_SOURCE.name, source_dir / VERBOSE_SOURCE.name) + assert plan.compilation_units == () + assert plan.produced_objects == () + assert [artifact.path for artifact in plan.prebuilt_artifacts] == [native_library] + assert plan.module_dirs == () + assert plan.link_items == (NativeLinkItem("shared_library", native_library),) + + +def test_source_build_still_compiles_explicit_hidden_sources_when_input_compilation_is_disabled(tmp_path: Path): + source = tmp_path / SCALAR_SOURCE.name + support = tmp_path / VERBOSE_SOURCE.name + native_library = tmp_path / "libnative.so" + shutil.copyfile(SCALAR_SOURCE, source) + shutil.copyfile(VERBOSE_SOURCE, support) + native_library.write_bytes(b"prebuilt native library fixture") + + result = build_fortran_extension( + source, + output_dir=tmp_path / "generated", + compile_input_sources=False, + native_fortran_sources=[support], + native_objects=[native_library], + generate_sources=True, + ) + + plan = result.native_build_plan + assert [unit.source for unit in plan.compilation_units] == [support] + assert source not in [unit.source for unit in plan.compilation_units] + + +def test_cli_builds_from_a_source_directory_and_prebuilt_object_only(tmp_path: Path): + source_dir = tmp_path / "native" + native_dir = tmp_path / "prebuilt" + output_dir = tmp_path / "wrapper" + source_dir.mkdir() + native_dir.mkdir() + source = source_dir / SCALE_SOURCE.name + native_object = native_dir / "scale.o" + shutil.copyfile(SCALE_SOURCE, source) + subprocess.run( + ["gfortran", "-c", "-fPIC", str(source), "-o", str(native_object)], + check=True, + capture_output=True, + text=True, + ) + + completed = subprocess.run( + [ + sys.executable, + "-m", + "prik", + str(source_dir), + "--no-compile-input-sources", + "--native-objects", + str(native_object), + "--out", + "prebuilt_scale", + "--out-dir", + str(output_dir), + "--json", + ], + check=True, + capture_output=True, + text=True, + cwd=tmp_path, + ) + payload = json.loads(completed.stdout) + plan = payload["native_build_plan"] + + assert payload["sources"] == [str(source)] + assert plan["compilation_units"] == [] + assert plan["produced_objects"] == [] + assert plan["prebuilt_artifacts"] == [{"kind": "object", "path": str(native_object)}] + assert not (output_dir / "scale.o").exists() + + sys.modules.pop("prebuilt_scale", None) + sys.path.insert(0, str(tmp_path)) + try: + module = importlib.import_module("prebuilt_scale") + finally: + sys.path.remove(str(tmp_path)) + assert module.scale(np.float64(3.0), np.float64(2.5)) == np.float64(7.5) + + def test_native_link_plan_serializes_interleaved_item_kinds(): plan = NativeBuildPlan( link_items=( diff --git a/tests/fortran/command_line_interface/pipeline/_support.py b/tests/fortran/command_line_interface/pipeline/_support.py index 96e9860fb..e2a1e959a 100644 --- a/tests/fortran/command_line_interface/pipeline/_support.py +++ b/tests/fortran/command_line_interface/pipeline/_support.py @@ -57,6 +57,7 @@ def _main_args(**overrides): "makefile": False, "generate_sources": False, "build_manifest": None, + "no_compile_input_sources": False, "native_fortran_sources": None, "native_compile_flags": None, "native_objects": None, diff --git a/tests/fortran/command_line_interface/pipeline/test_argument_contract.py b/tests/fortran/command_line_interface/pipeline/test_argument_contract.py index ae03f81ed..21c71c2a6 100644 --- a/tests/fortran/command_line_interface/pipeline/test_argument_contract.py +++ b/tests/fortran/command_line_interface/pipeline/test_argument_contract.py @@ -148,6 +148,19 @@ class extra(Opaque): "A wrapper build expects recognized Fortran source suffixes or one semantic .pyi contract; " "unsupported input: input.unknown", ), + ( + {"no_compile_input_sources": True}, + "--no-compile-input-sources requires --native-fortran-sources, --native-objects, " + "--native-library, or --native-link-item", + ), + ( + { + "paths": ["input.pyi"], + "no_compile_input_sources": True, + "native_objects": ["implementation.o"], + }, + "--no-compile-input-sources applies only to source-driven wrapper builds", + ), ], ) def test_prik_main_preserves_validation_diagnostics(monkeypatch, overrides, expected): @@ -284,6 +297,28 @@ def test_cli_native_compile_flags_split_grouped_shell_words(): ) +def test_source_build_routes_disabled_input_compilation_to_the_pipeline(monkeypatch): + from prik.pipeline import build as pipeline_build + + calls = [] + result = types.SimpleNamespace(compiled=False) + monkeypatch.setattr( + pipeline_build, + "build_fortran_extension", + lambda *args, **kwargs: calls.append((args, kwargs)) or result, + ) + args = _main_args( + paths=["native"], + no_compile_input_sources=True, + native_objects=["libnative.so"], + ) + + assert prik_cli._run_wrap_build(args, types.SimpleNamespace(compiler="gfortran")) is result + assert calls[0][0] == (["native"],) + assert calls[0][1]["compile_input_sources"] is False + assert calls[0][1]["native_objects"] == ["libnative.so"] + + @pytest.mark.parametrize("jobs", ("0", "many")) def test_cli_compile_jobs_rejects_non_positive_or_non_integer_values(jobs: str, capsys) -> None: with pytest.raises(SystemExit) as exc_info: @@ -520,7 +555,10 @@ def assert_group_order(help_text, *headings): assert "Add a compiler include search directory" in build_help assert "default: gfortran" in normalized_build_help assert "default: ./__prik__" in normalized_build_help - assert "Fortran source file(s), or exactly one semantic .pyi contract" in normalized_build_help + assert ( + "Fortran source file(s), one source directory, or exactly one semantic .pyi contract" in normalized_build_help + ) + assert "--no-compile-input-sources" in build_help assert "Input language (default: fortran)" in normalized_build_help assert "Rebuild the extension from an existing prik-build.json" in normalized_build_help assert "Name the Python extension and stable NAME.so library" in normalized_build_help From f5fe94860fd9ab7fafc306a81d4010849803571c Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Mon, 3 Aug 2026 06:58:02 +0100 Subject: [PATCH 16/22] clean blas and lapack examples --- examples/blas/build_all.sh | 1 + examples/lapack/build_all.sh | 1 + .../compiling/test_example_native_library.py | 13 +++++++++++++ 3 files changed, 15 insertions(+) diff --git a/examples/blas/build_all.sh b/examples/blas/build_all.sh index 1939382b7..ced6adc4f 100644 --- a/examples/blas/build_all.sh +++ b/examples/blas/build_all.sh @@ -1,3 +1,4 @@ source examples/blas/build_prik.sh source "$EXAMPLE_WORKSPACE/examples/blas/build_f2py.sh" +cd "$EXAMPLE_WORKSPACE" export PYTHONPATH="$BLAS_BUILD_ROOT/prik:$BLAS_F2PY_ROOT${PYTHONPATH:+:$PYTHONPATH}" diff --git a/examples/lapack/build_all.sh b/examples/lapack/build_all.sh index a99544d65..119576aff 100644 --- a/examples/lapack/build_all.sh +++ b/examples/lapack/build_all.sh @@ -1,3 +1,4 @@ source examples/lapack/build_prik.sh source "$EXAMPLE_WORKSPACE/examples/lapack/build_f2py.sh" +cd "$EXAMPLE_WORKSPACE" export PYTHONPATH="$LAPACK_BUILD_ROOT/prik:$LAPACK_F2PY_ROOT${PYTHONPATH:+:$PYTHONPATH}" diff --git a/tests/fortran/building_shared_library/compiling/test_example_native_library.py b/tests/fortran/building_shared_library/compiling/test_example_native_library.py index 8b111c259..c5e9f58ed 100644 --- a/tests/fortran/building_shared_library/compiling/test_example_native_library.py +++ b/tests/fortran/building_shared_library/compiling/test_example_native_library.py @@ -4,9 +4,22 @@ from pathlib import Path +import pytest + from examples import native_library +@pytest.mark.parametrize("example", ("blas", "lapack")) +def test_aggregate_example_build_restores_the_workspace(example: str) -> None: + script = (native_library.EXAMPLES_ROOT / example / "build_all.sh").read_text(encoding="utf-8") + lines = script.splitlines() + + f2py_build = next(index for index, line in enumerate(lines) if "build_f2py.sh" in line) + restore_workspace = lines.index('cd "$EXAMPLE_WORKSPACE"') + python_path_export = next(index for index, line in enumerate(lines) if line.startswith("export PYTHONPATH=")) + assert f2py_build < restore_workspace < python_path_export + + def test_native_cache_preserves_module_files_for_wrapper_compilation(tmp_path: Path, monkeypatch) -> None: sources = ( native_library.LAPACK_SOURCE_ROOT / "la_constants.f90", From cc75390ad58707953bd217a33952e61f37813eb4 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Mon, 3 Aug 2026 07:23:03 +0100 Subject: [PATCH 17/22] fix double symbol error bug --- prik/parsers/fortran/parser.py | 25 ++++++++++++----- .../test_declaration_and_scope_regressions.py | 27 +++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/prik/parsers/fortran/parser.py b/prik/parsers/fortran/parser.py index 58d513d73..e6071eb42 100644 --- a/prik/parsers/fortran/parser.py +++ b/prik/parsers/fortran/parser.py @@ -995,12 +995,7 @@ def _helper_index_project_file(self, project: FortranProject, parsed_file: Fortr for program in parsed_file.programs: self._helper_index_project_program(project, program) for procedure in parsed_file.procedures: - self._insert_unique_scope_symbol( - project.procedures, - procedure.name.lower(), - procedure, - label="project procedure scope", - ) + self._helper_index_project_standalone_procedure(project, procedure) for dtype in parsed_file.derived_types: self._insert_unique_scope_symbol( project.derived_types, @@ -1061,6 +1056,24 @@ def _helper_index_project_owner_members( for interface in owner.interfaces: self._helper_index_project_interface(project, interface, owner_key) + def _helper_index_project_standalone_procedure( + self, + project: FortranProject, + procedure: FortranProcedureSignature, + ) -> None: + """Index a standalone procedure ahead of any unqualified owner alias.""" + procedure_key = procedure.name.lower() + existing = project.procedures.get(procedure_key) + if existing is not None and existing.module is not None: + project.procedures[procedure_key] = procedure + return + self._insert_unique_scope_symbol( + project.procedures, + procedure_key, + procedure, + label="project procedure scope", + ) + def _helper_index_project_program(self, project: FortranProject, program: FortranProgram) -> None: """Index one named program and its module dependencies.""" if not program.name: diff --git a/tests/fortran/source_parsing/parsing/test_declaration_and_scope_regressions.py b/tests/fortran/source_parsing/parsing/test_declaration_and_scope_regressions.py index b65b8c9cf..02b4cffbe 100644 --- a/tests/fortran/source_parsing/parsing/test_declaration_and_scope_regressions.py +++ b/tests/fortran/source_parsing/parsing/test_declaration_and_scope_regressions.py @@ -404,6 +404,33 @@ def test_project_registries_preserve_qualified_aliases_values_and_dependencies() assert project.interfaces["child_mod.child_callback"] is project.interfaces["child_callback"] +@pytest.mark.parametrize("standalone_first", [False, True]) +def test_standalone_procedure_owns_unqualified_name_shared_with_module_member(standalone_first): + module_source = """ +module nan_mod +contains + logical function sisnan(value) + real, intent(in) :: value + end function sisnan +end module nan_mod +""" + standalone_source = """ +logical function sisnan(value) + real, intent(in) :: value +end function sisnan +""" + sources = [("standalone.f90", standalone_source), ("module.f90", module_source)] + if not standalone_first: + sources.reverse() + + project = parse_fortran_project(dict(sources)) + module_procedure = project.modules["nan_mod"].procedures[0] + standalone_procedure = next(procedure for parsed_file in project.files for procedure in parsed_file.procedures) + + assert project.procedures["nan_mod.sisnan"] is module_procedure + assert project.procedures["sisnan"] is standalone_procedure + + def test_parse_file_preserves_top_level_models_but_limits_file_symbol_registry(): parsed = FortranParser().parse_file( """ From 8db3a982cec50d5f9aa2e54309c7180a4f01e70e Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Mon, 3 Aug 2026 08:25:24 +0100 Subject: [PATCH 18/22] use getters to read the parameters value --- docs/developer/development-workflow.md | 5 ++ docs/user/reference/fortran-wrapper.md | 10 +-- prik/parsers/fortran/parser.py | 2 +- prik/semantics/README.md | 3 + prik/semantics/wrapper_policy.py | 53 +++++++++++++--- prik/wrapper_codegen/c/binding.py | 62 ++++++++++++++----- prik/wrapper_codegen/docstrings.py | 5 +- prik/wrapper_codegen/fortran/bridge.py | 2 + prik/wrapper_codegen/generator.py | 46 +++++++++++--- .../test_scalar_module_variable_plan.py | 7 +++ .../policy/test_module_variable_policy.py | 37 +++++++++++ .../test_scalar_module_variable_lowering.py | 43 +++++++++++++ ...test_real_world_interaction_regressions.py | 4 ++ 13 files changed, 242 insertions(+), 37 deletions(-) diff --git a/docs/developer/development-workflow.md b/docs/developer/development-workflow.md index 71ebe0b71..d28ddd6cb 100644 --- a/docs/developer/development-workflow.md +++ b/docs/developer/development-workflow.md @@ -811,6 +811,11 @@ probe configuration from preprocessing plus the native Fortran compiler flags; this keeps flags such as `-fdefault-real-8` aligned between semantic lowering and native compilation. The standalone `prik probe` report is an inspection and verification output, not an alternate semantic-stage input. + +Post-IR module-variable policy distinguishes literal constants from symbolic +numeric source parameters. Literal constants use binding-owned materialization; +symbolic numeric source parameters use a read-only Fortran bridge getter and +never require binding or bridge lowering to recover the initializer value. PRIK_C_DOCS_END --> ```bash diff --git a/examples/lapack/README.md b/examples/lapack/README.md index 56df55d6c..f6b27d42d 100644 --- a/examples/lapack/README.md +++ b/examples/lapack/README.md @@ -12,7 +12,14 @@ tests, with no unsupported or skipped routines. ## Requirements -Install GNU Fortran, `ar`, and the pinned Python tools: +Install GNU Fortran, `ar`, the LAPACK and BLAS development libraries, and the +pinned Python tools. On Ubuntu: + +```console +sudo apt-get install gfortran liblapack-dev libblas-dev +``` + +Then install the Python tools: ```console python3 -m pip install \ @@ -24,9 +31,10 @@ Run every command from the directory that contains `examples/`. ## Build both wrappers -The native builder compiles LAPACK and its BLAS dependencies once. Internal -support objects are included once in the shared library, while their -compiler-specific `.mod` files are retained for generated wrappers. +The native builder compiles the bundled LAPACK and BLAS sources once and links +the development libraries for companion support symbols. Internal support +objects are included once in the shared library, while their compiler-specific +`.mod` files are retained for generated wrappers. `build_all.sh` runs these two scripts: diff --git a/examples/native_library.py b/examples/native_library.py index c1d61db76..3cefd1053 100644 --- a/examples/native_library.py +++ b/examples/native_library.py @@ -20,8 +20,12 @@ LAPACK_SOURCE_ROOT = EXAMPLES_ROOT / "lapack" / "native" NATIVE_CACHE_ENV = "PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR" NATIVE_JOBS_ENV = "PRIK_REAL_LIBRARY_NATIVE_JOBS" -NATIVE_CACHE_VERSION = "copyable-examples-v2-modules" +NATIVE_CACHE_VERSION = "copyable-examples-v3-link-dependencies" NATIVE_MODULE_SOURCE_STEMS = frozenset({"la_constants", "la_xisnan"}) +NATIVE_LINK_DEPENDENCIES = { + "blas": (), + "lapack": ("-llapack", "-lblas"), +} DEFAULT_NATIVE_COMPILE_JOB_LIMIT = 8 FORTRAN_SUFFIXES = frozenset({".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"}) SUPPORTED_LIBRARIES = ("blas", "lapack") @@ -259,6 +263,7 @@ def _cached_shared_library(cache_dir: Path, library: str, archive: Path, compile "-Wl,--whole-archive", str(archive), "-Wl,--no-whole-archive", + *NATIVE_LINK_DEPENDENCIES[library], ), check=True, ) diff --git a/tests/fortran/building_shared_library/compiling/test_example_native_library.py b/tests/fortran/building_shared_library/compiling/test_example_native_library.py index c5e9f58ed..585746869 100644 --- a/tests/fortran/building_shared_library/compiling/test_example_native_library.py +++ b/tests/fortran/building_shared_library/compiling/test_example_native_library.py @@ -2,6 +2,7 @@ from __future__ import annotations +import os from pathlib import Path import pytest @@ -63,3 +64,41 @@ def fail_if_recompiled(*_args) -> None: monkeypatch.setattr(native_library, "_compile_source", fail_if_recompiled) assert native_library._cached_objects(cache_dir, sources, "gfortran", 2) == objects + + +@pytest.mark.parametrize( + ("library", "expected_dependencies"), + (("blas", ()), ("lapack", ("-llapack", "-lblas"))), +) +def test_shared_example_library_links_its_native_dependencies( + tmp_path: Path, + monkeypatch, + library: str, + expected_dependencies: tuple[str, ...], +) -> None: + commands = [] + + def run(command: tuple[str, ...], *, check: bool) -> None: + assert check is True + commands.append(command) + Path(command[3]).touch() + + monkeypatch.setattr(native_library.subprocess, "run", run) + archive = tmp_path / f"libprik_full_{library}.a" + archive.touch() + + shared_library = native_library._cached_shared_library(tmp_path, library, archive, "gfortran") + + assert shared_library.is_file() + assert commands == [ + ( + "gfortran", + "-shared", + "-o", + str(tmp_path / f"{shared_library.name}.{os.getpid()}.tmp"), + "-Wl,--whole-archive", + str(archive), + "-Wl,--no-whole-archive", + *expected_dependencies, + ) + ] From cb1fbb343817351aac2fefc53c71bb21088dc914 Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Mon, 3 Aug 2026 09:43:10 +0100 Subject: [PATCH 21/22] fix bug --- docs/developer/testing-strategy.md | 2 +- examples/lapack/README.md | 2 +- examples/lapack/ci/full_surface.py | 14 +++++++++++++- examples/lapack/routine_inventory.py | 2 +- examples/lapack/tests/test_routine_coverage.py | 2 +- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/developer/testing-strategy.md b/docs/developer/testing-strategy.md index 2de46cdff..45fc72e58 100644 --- a/docs/developer/testing-strategy.md +++ b/docs/developer/testing-strategy.md @@ -151,7 +151,7 @@ fails on SciPy drift, signature drift, missing sources or exports, missing explicitly named tests, and divergent documentation claims. CI explicitly adds `examples/lapack/ci/full_surface.py` to the same pytest invocation, reusing the complete PRIK extension to require -all 2,064 procedure exports, including module namespaces, and run a +all 2,066 procedure exports, including module namespaces, and run a non-inventory runtime smoke call. User-run correctness tests and maintainer-only audits have separate directories. diff --git a/examples/lapack/README.md b/examples/lapack/README.md index f6b27d42d..33bdc3cc1 100644 --- a/examples/lapack/README.md +++ b/examples/lapack/README.md @@ -5,7 +5,7 @@ and NumPy f2py wrappers to the same native library. It validates 127 reviewed double-precision routines with SciPy and independent residuals, reconstructions, and storage checks. -PRIK wraps all 2,064 discovered procedures. The comparison suite selects +PRIK wraps all 2,066 discovered procedures. The comparison suite selects the 127 `float64` routines exposed by SciPy 1.18.0; raw f2py supports 125 of those source interfaces. All 127 selected routines have explicit correctness tests, with no unsupported or skipped routines. diff --git a/examples/lapack/ci/full_surface.py b/examples/lapack/ci/full_surface.py index a7d7ec229..0552e1d39 100644 --- a/examples/lapack/ci/full_surface.py +++ b/examples/lapack/ci/full_surface.py @@ -9,11 +9,23 @@ from ..routine_inventory import EXPECTED_LAPACK_PROCEDURES from examples.lapack.tests.helpers import assert_runtime_smoke from prik.parsers.fortran.parser import parse_fortran_file +from prik.pipeline.preprocessing import PreprocessingConfig, preprocess_source pytestmark = [pytest.mark.fortran_end_to_end, pytest.mark.real_library] NATIVE_ROOT = Path(__file__).resolve().parents[1] / "native" FORTRAN_SUFFIXES = {".f", ".f90", ".f95", ".f03", ".f08", ".for", ".f77", ".ftn"} +PREPROCESSED_FORTRAN_SUFFIXES = {suffix.upper() for suffix in FORTRAN_SUFFIXES} + + +def _source_for_parser(path: Path) -> str: + if path.suffix in PREPROCESSED_FORTRAN_SUFFIXES: + return preprocess_source( + path, + language="fortran", + config=PreprocessingConfig(mode="compiler", compiler="gfortran"), + ).source + return path.read_text(encoding="utf-8") def _source_procedure_exports() -> set[tuple[str | None, str]]: @@ -21,7 +33,7 @@ def _source_procedure_exports() -> set[tuple[str | None, str]]: for path in sorted(NATIVE_ROOT.iterdir()): if not path.is_file() or path.suffix.lower() not in FORTRAN_SUFFIXES: continue - parsed = parse_fortran_file(path.read_text(encoding="utf-8"), filename=path.name) + parsed = parse_fortran_file(_source_for_parser(path), filename=path.name) expected.update((None, procedure.name.lower()) for procedure in parsed.procedures) for module in parsed.modules: expected.update((module.name.lower(), procedure.name.lower()) for procedure in module.procedures) diff --git a/examples/lapack/routine_inventory.py b/examples/lapack/routine_inventory.py index 0ce9eae6c..3998db07d 100644 --- a/examples/lapack/routine_inventory.py +++ b/examples/lapack/routine_inventory.py @@ -6,7 +6,7 @@ SCIPY_VERSION = "1.18.0" EXPECTED_LAPACK_SOURCE_FILES = 2062 -EXPECTED_LAPACK_PROCEDURES = 2064 +EXPECTED_LAPACK_PROCEDURES = 2066 F2PY_SCALAR_WRITEBACK_ROUTINES = frozenset( {"dlarfg", "dlartg", "dgbcon", "dgecon", "dgtcon", "dpocon", "dppcon", "dsycon", "dtrcon"} ) diff --git a/examples/lapack/tests/test_routine_coverage.py b/examples/lapack/tests/test_routine_coverage.py index 319aaa37a..1ee6c578e 100644 --- a/examples/lapack/tests/test_routine_coverage.py +++ b/examples/lapack/tests/test_routine_coverage.py @@ -179,7 +179,7 @@ def test_authoritative_native_source_boundary_is_complete_and_unique(): ) stems = {path.stem.lower() for path in sources} assert len(sources) == EXPECTED_LAPACK_SOURCE_FILES - assert EXPECTED_LAPACK_PROCEDURES == EXPECTED_LAPACK_SOURCE_FILES - 2 + 4 + assert EXPECTED_LAPACK_PROCEDURES == EXPECTED_LAPACK_SOURCE_FILES + 4 assert set(ROUTINES) <= stems for routine, spec in ROUTINE_SPECS.items(): assert (NATIVE_ROOT / spec.source_file).is_file(), routine From 0590051f10f415388ca77bc8ec7ddacb35c3961b Mon Sep 17 00:00:00 2001 From: Said Hadjout Date: Mon, 3 Aug 2026 10:18:27 +0100 Subject: [PATCH 22/22] improve READMEs --- docs/user/examples/lapack-wrapper.md | 14 +++-- examples/blas/README.md | 70 +++++++++++++++-------- examples/lapack/README.md | 84 +++++++++++++++++----------- 3 files changed, 105 insertions(+), 63 deletions(-) diff --git a/docs/user/examples/lapack-wrapper.md b/docs/user/examples/lapack-wrapper.md index dbef161e7..76266a830 100644 --- a/docs/user/examples/lapack-wrapper.md +++ b/docs/user/examples/lapack-wrapper.md @@ -152,12 +152,14 @@ python -m numpy.f2py -c \ --opt=-O0 ``` -The native build retains the compiler-specific module files required by the -generated wrapper. Support objects remain inside the shared library and are not -compiled again. - -`dgees` and `dgges` remain in the 127-routine correctness inventory, but raw f2py 2.5.1 cannot generate valid callback declarations from their unannotated selection-callback interfaces. -They are validated through PRIK, SciPy and independent Schur reconstruction. +`LAPACK_MODULE_DIR` provides the compiler-generated module files needed to +compile each wrapper. Both wrappers link the existing shared library instead of +recompiling LAPACK. + +The committed `lapack.pyf` excludes `dgees` and `dgges` because f2py 2.5.1 +generates incomplete declarations for their selection callbacks. Their tests +exercise PRIK and SciPy, then independently verify the resulting Schur +decompositions. Import the two built modules and SciPy's comparison surface from the repository root: diff --git a/examples/blas/README.md b/examples/blas/README.md index e6748a717..08359086e 100644 --- a/examples/blas/README.md +++ b/examples/blas/README.md @@ -1,26 +1,53 @@ # Wrap Reference BLAS with PRIK -This copyable example builds the complete Reference BLAS once, then links both -PRIK and NumPy f2py wrappers to the same native library. Its 155 named tests -compare both wrappers with small independent formulas, storage checks, and each -other. +Build the complete Reference BLAS once, wrap it with PRIK and NumPy f2py, and +compare both Python APIs with 155 named correctness tests. All 155 routines are exported and validated through both wrappers, with no -unsupported or skipped routines. +unsupported or skipped routines. The tests use small independent formulas and +storage checks, so the comparison does not depend on either wrapper as its sole +oracle. ## Requirements -Install GNU Fortran and the Python build tools: +Install GNU Fortran. On Ubuntu: + +```console +sudo apt-get update +sudo apt-get install --yes gfortran +``` + +Install the pinned Python build tools: ```console python3 -m pip install "numpy==2.5.1" "meson==1.11.2" "ninja==1.13.0" pytest ``` -Run every command from the directory that contains `examples/`. +Run the remaining commands from the repository root. + +## Quick start + +Build both wrappers and run the complete comparison: + +```bash +source examples/blas/build_all.sh +python3 -m pytest -q examples/blas/tests +``` + +Use `source` so the build paths exported by `build_all.sh` remain available to +the test process. + +## How the build works -## Build both wrappers +The native sources are compiled once into a shared library. PRIK reads the +complete source tree to generate its Python API, skips native source +compilation, and links that library. f2py compiles the committed reviewed +[`blas.pyf`](blas.pyf) and links the same library. -`build_all.sh` runs these two scripts: +`build_all.sh` runs the following two scripts. The commands are shown so you +can reuse or adapt either build independently. + +### Build the PRIK wrapper ```bash @@ -46,6 +73,8 @@ python -m prik "$EXAMPLE_WORKSPACE/examples/blas/native" \ --wrapper-c-flags="-O0 -g0" ``` +### Build the f2py comparison wrapper + ```bash cd "$EXAMPLE_WORKSPACE" @@ -70,14 +99,9 @@ python -m numpy.f2py -c \ --opt=-O0 ``` -Build and validate the example: - -```bash -source examples/blas/build_all.sh -python3 -m pytest -q examples/blas/tests -``` +## Run focused tests -You can also run one family or routine: +After the quick-start build, run one family or routine: ```bash python3 -m pytest -q examples/blas/tests/test_level1_real.py @@ -86,21 +110,19 @@ python3 -m pytest -q \ python3 -m pytest -q examples/blas/tests -k dgemm ``` -## What the comparison shows +## What is validated PRIK preserves the native BLAS argument order and returns visible scalar -writebacks. f2py compiles the committed reviewed [`blas.pyf`](blas.pyf) and -links the existing shared library. +writebacks. -The 6 rotation routines do not declare Fortran `intent` for scalar writebacks. -The reviewed signature records their `intent(inout)` declarations and the -comparison passes typed NumPy 0-D arrays. PRIK needs neither: it returns those -scalar writebacks directly. +The 6 rotation routines omit Fortran `intent` for scalar writebacks. +[`blas.pyf`](blas.pyf) records them as `intent(inout)`, so f2py receives typed +NumPy 0-D arrays. PRIK returns the same writebacks directly. The tests cover positive and negative increments, leading-dimension padding, packed and banded layouts, triangular and Hermitian storage, native one-based indexes, input preservation, and dtype-aware numerical tolerances. The -independent oracle remains visible beside every wrapper call. +independent formula or invariant remains visible beside each wrapper call. ## Sources and license diff --git a/examples/lapack/README.md b/examples/lapack/README.md index 33bdc3cc1..78402785d 100644 --- a/examples/lapack/README.md +++ b/examples/lapack/README.md @@ -1,14 +1,13 @@ # Wrap Reference LAPACK with PRIK -This copyable example builds the complete Reference LAPACK once and links PRIK -and NumPy f2py wrappers to the same native library. It validates 127 reviewed -double-precision routines with SciPy and independent residuals, -reconstructions, and storage checks. +Build the complete Reference LAPACK once, wrap it with PRIK and NumPy f2py, and +validate a reviewed double-precision surface against SciPy and independent +numerical checks. -PRIK wraps all 2,066 discovered procedures. The comparison suite selects -the 127 `float64` routines exposed by SciPy 1.18.0; raw f2py supports 125 of -those source interfaces. All 127 selected routines have explicit correctness -tests, with no unsupported or skipped routines. +PRIK wraps all 2,066 discovered procedures. For focused validation, the suite +selects the 127 `float64` routines exposed by SciPy 1.18.0; raw f2py supports +125 of those source interfaces. All 127 selected routines have explicit +correctness tests, with no unsupported or skipped routines. ## Requirements @@ -27,16 +26,35 @@ python3 -m pip install \ "meson==1.11.2" "ninja==1.13.0" pytest ``` -Run every command from the directory that contains `examples/`. +Run the remaining commands from the repository root. -## Build both wrappers +## Quick start -The native builder compiles the bundled LAPACK and BLAS sources once and links -the development libraries for companion support symbols. Internal support -objects are included once in the shared library, while their compiler-specific -`.mod` files are retained for generated wrappers. +Build both wrappers and run the 127-routine comparison: -`build_all.sh` runs these two scripts: +```bash +source examples/lapack/build_all.sh +python3 -m pytest -q examples/lapack/tests +``` + +Use `source` so the build paths exported by `build_all.sh` remain available to +the test process. + +## How the build works + +The builder compiles the bundled LAPACK and BLAS sources once. It also links +the installed LAPACK and BLAS libraries for support routines outside the +bundled source set. PRIK and f2py then link the same shared library, so LAPACK +implementation code is not compiled twice. + +The native build also retains its compiler-generated module files in +`LAPACK_MODULE_DIR`. Both generated wrappers use that directory when they +compile. + +`build_all.sh` runs the following two scripts. The commands are shown so you +can reuse or adapt either build independently. + +### Build the PRIK wrapper ```bash @@ -63,6 +81,12 @@ python -m prik "$EXAMPLE_WORKSPACE/examples/lapack/native" \ --wrapper-c-flags="-O0 -g0" ``` +PRIK reads the complete source tree to generate its Python API. +`--no-compile-input-sources` makes it reuse `LAPACK_SHARED_LIBRARY` instead of +compiling those native sources again. + +### Build the f2py comparison wrapper + ```bash cd "$EXAMPLE_WORKSPACE" @@ -88,20 +112,13 @@ python -m numpy.f2py -c \ --opt=-O0 ``` -PRIK keeps the module namespaces discovered from the complete sources. The -committed reviewed [`lapack.pyf`](lapack.pyf) exposes `la_constants`, and f2py -compiles its generated wrapper with the retained module directory. - -No LAPACK implementation or support object is compiled twice. - -Build and validate the example: +The committed reviewed [`lapack.pyf`](lapack.pyf) defines the 125-routine f2py +comparison surface and exposes `la_constants`. f2py compiles only its generated +wrapper and reuses the native library and module directory. -```bash -source examples/lapack/build_all.sh -python3 -m pytest -q examples/lapack/tests -``` +## Run focused tests -You can also run one family or routine: +After the quick-start build, run one family or routine: ```bash python3 -m pytest -q examples/lapack/tests/test_linear_general.py @@ -110,21 +127,22 @@ python3 -m pytest -q \ python3 -m pytest -q examples/lapack/tests -k dgesvd ``` -## What the comparison shows +## What is validated PRIK preserves native argument order, storage, indexes, and scalar writebacks. The 9 scalar-writeback routines omit Fortran `intent` for scalar outputs. -Their reviewed signature declarations use `intent(inout)` and typed NumPy 0-D -arrays, while PRIK returns those values directly. +[`lapack.pyf`](lapack.pyf) records them as `intent(inout)`, so f2py receives +typed NumPy 0-D arrays. PRIK returns the same writebacks directly. The tests cover linear solves, factorizations, eigenproblems, singular values, banded and packed layouts, workspaces, pivots, untouched storage, and `INFO`. Equivalent decompositions are checked with mathematical invariants rather than byte equality. -`dgees` and `dgges` use unannotated selection callbacks that raw f2py 2.5.1 -cannot generate safely. They remain covered through PRIK, SciPy, and independent -Schur reconstruction. +The committed [`lapack.pyf`](lapack.pyf) excludes `dgees` and `dgges` because +f2py 2.5.1 generates incomplete declarations for their selection callbacks. +Their tests exercise PRIK and SciPy, then independently verify the resulting +Schur decompositions. ## Sources and license