Code Monkey home page Code Monkey logo

libprima / prima Goto Github PK

View Code? Open in Web Editor NEW
281.0 2.0 33.0 20.7 MB

PRIMA is a package for solving general nonlinear optimization problems without using derivatives. It provides the reference implementation for Powell's derivative-free optimization methods, i.e., COBYLA, UOBYQA, NEWUOA, BOBYQA, and LINCOA. PRIMA means Reference Implementation for Powell's methods with Modernization and Amelioration, P for Powell.

Home Page: http://libprima.net

License: BSD 3-Clause "New" or "Revised" License

Fortran 73.85% Makefile 1.02% MATLAB 21.57% C 0.82% Shell 1.31% M 0.01% CMake 0.33% C++ 0.20% Python 0.90%
derivative-free-optimization optimization powell cobyla bobyqa modern-fortran lincoa newuoa uobyqa blackbox-optimization

prima's Introduction

PRIMA: Reference Implementation for Powell's Methods with Modernization and Amelioration

Dedicated to the late Professor M. J. D. Powell FRS (1936--2015)

What

PRIMA is a package for solving general nonlinear optimization problems without using derivatives. It provides the reference implementation for Powell's renowned derivative-free optimization methods, i.e., COBYLA, UOBYQA, NEWUOA, BOBYQA, and LINCOA. The "P" in the name stands for Powell, and "RIMA" is an acronym for "Reference Implementation with Modernization and Amelioration".

PRIMA is part of a research project funded by the Hong Kong Research Grants Council and the Department of Applied Mathematics (AMA) at the Hong Kong Polytechnic University (PolyU). The current version is ready to be used in Fortran, in C, in Python, in MATLAB, and in Julia.

PRIMA was initiated by Zaikun Zhang in July 2020, based on the PDFO package by Tom M. Ragonneau and Zaikun Zhang.

See Zaikun Zhang's talk on PRIMA at The 10th International Congress on Industrial and Applied Mathematics for more information.

Why

Professor Powell carefully implemented his derivative-free optimization methods into publicly available solvers, which are genuine masterpieces. They are widely used by engineers and scientists. For instance, see Section 1 of a recent paper on Powell's solvers as well as the Google searches of COBYLA and BOBYQA.

However, Professor Powell's implementation was done in Fortran 77. The code is nontrivial to understand or maintain, let alone extend. For many practitioners, this has become an obstacle to exploiting these solvers in their applications. Even worse, it has hindered researchers from exploring the wealth left by Professor Powell. By all means, it is necessary to make the solvers available in languages other than Fortran promptly, first wrapping Powell's code, which is the objective of PDFO, and then providing native and modernized implementations, which is the mission of PRIMA.

Before he passed, Professor Powell had asked me and Professor Nick Gould to maintain his solvers. This is an honorable mission. To make the solvers more accessible, I started PRIMA. It is a project similar to the translation, interpretation, and annotation of Euclid’s Elements. It will make Powell's solvers easily understandable to everyone, not only the experts. Few people remember who translated Elements, but it is a job that must be done.

PRIMA aims to provide the reference implementation of Powell's methods in modern languages, including modern Fortran (F2008 or newer), C/C++, Python, MATLAB, Julia, and R. It will be a faithful implementation, in the sense that the code will be mathematically equivalent to Powell’s, except for the bug fixes and improvements made intentionally.

The focus is to implement these methods in a structured and modularized way so that they are understandable, maintainable, extendable, fault-tolerant, and future-proof. The code will have no GOTO (of course) and will use matrix-vector procedures instead of loops whenever possible. In doing so, PRIMA codes the algorithms in a way that we would present them on a blackboard. Such an implementation will enable us to get a deeper understanding of Powell's methods and pave the way for new developments based on them.

There do exist "translations" of Powell's Fortran 77 code in other languages. For example, NLopt contains a C version of COBYLA, NEWUOA, and BOBYQA, but the C code in NLopt is translated from the Fortran 77 code straightforwardly, if not automatically by f2c, and hence inherits the style, structure, and probably bugs of the original Fortran 77 implementation. Note, however, that Py-BOBYQA is a true translation of BOBYQA to Python, with significant improvements.

How

The mission of PRIMA is nontrivial due to the delicacy of Powell's algorithms and the unique style of his code. To ensure the faithfulness of PRIMA, the modern Fortran version was started by refactoring Powell's code into the free form via a small MATLAB tool. However, such refactored code is far from what is desired, because it inherits completely the structure and style of Powell's code except for the layout. Significant modifications are needed to reorganize (indeed, to rewrite) the code. To maintain the faithfulness and quality of the reference implementation, extensive tests are conducted after each and every tiny modification, using the CUTEst problems via MatCUTEst. The tests do not only verify the faithfulness of the implementation but also check that the solvers behave properly even if they are invoked with improper inputs or encounter failures of function evaluations. Stress tests are also conducted periodically to verify that the solvers work correctly without running into errors when applied to excessively large problems.

The tests are automated by GitHub Actions. As of August 2023, more than 45,000 "workflows" have been successfully run by GitHub Actions. Normally, each workflow consists of ~ 5 (sometimes more than 200) randomized tests, each test taking from tens of minutes to several hours (the maximum is 6 hours, after which the test will be canceled automatically). In other words, PRIMA has been verified by more than 200,000 hours (or more than 20 years) of randomized tests. Code must be battle-tested before becoming software.

Since each GitHub Team account can only run at most 60 GitHub Actions workflows concurrently, I have to distribute this large amount of tests to multiple Team accounts as follows.

Current status

Modern Fortran

After almost three years of intensive coding, the modern Fortran version of PRIMA was finished by December 2022. It can be compiled using CMake as follows.

git clone --depth 1 https://github.com/libprima/prima.git
cd prima
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install
cmake --build build --target install

This should create the primaf library for Fortran usage, located in the install/lib/ directory to be used with the module files in install/include/prima/mod/. In case CMake fails to find your Fortran compiler, you can indicate it by specifying -DCMAKE_Fortran_COMPILER=/path/to/your/Fortran/compiler. Similarly, set -DCMAKE_C_COMPILER=/path/to/your/C/compiler for your C compiler if needed.

Examples on how to use the library from an external code are available in fortran/examples/. Below is an illustration with COBYLA.

cd fortran/examples/cobyla
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DPRIMA_DIR=$PWD/../../../install/lib/cmake/prima/
cmake --build build --target install
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/../../../install/lib ./install/bin/cobyla_example_1

C

A C binding to the Fortran library is available in the c/ folder. In the same way as the Fortran library, it can be compiled using CMake, which should also create the primac library for C compilation, located in install/lib/ to be used with the prima.h header in install/include/prima/.

Examples on how to use the library from an external code are available in c/examples/. Below is an illustration with COBYLA.

cd c/examples/cobyla
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DPRIMA_DIR=$PWD/../../../install/lib/cmake/prima/
cmake --build build --target install
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/../../../install/lib ./install/bin/cobyla_example

Python

MATLAB

Julia

Other languages

  • Interfaces for using the modern Fortran implementation in other languages will be available later.
  • Given the modern Fortran version, native implementations in other languages become much easier, because we now have a structured and modularized implementation as a reference. My team will implement the methods in other languages in this way. This is the main motivation for developing the modern Fortran version first — to provide a modernized reference implementation for the development in other languages.

Bug fixes

PRIMA has fixed some serious issues in the original Fortran 77 implementation of Powell's methods. Note that all of them are problems in the Fortran 77 code rather than flaws in the algorithms.

The examples given below are bugs or requests sent to SciPy, NLopt, nloptr, OpenTURNS, etc., which are reputable packages that wrap/interface the original Fortran 77 implementation of Powell's solver. Inevitably, they suffer from the bugs in the Fortran 77 code.

Improvements

Thanks to the improvements introduced into the new implementation, PRIMA outperforms Powell's original code in terms of the number of function evaluations, which is the standard performance indicator in derivative-free optimization. Below are the performance profiles of the PRIMA solvers compared with Powell's implementation, the convergence tolerance being $\tau = 10^{-6}$. Roughly speaking, performance profiles plot the percentage of test problems solved against the budget, which is measured relative to the cost of the most efficient solver in the comparison. A higher curve indicates a better solver. See Benchmarking Derivative-Free Optimization Algorithms (J. J. Moré and S. M. Wild) for more information.

  • NEWUOA on unconstrained CUTEst problems of at most 200 variables

  • BOBYQA on bound-constrained CUTEst problems of at most 200 variables

  • LINCOA on linearly constrained CUTEst problems of at most 200 variables and 20000 constraints

  • COBYLA on nonlinearly constrained CUTEst problems of at most 100 variables and 10000 constraints

  • UOBYQA on unconstrained CUTEst problems of at most 100 variables

Who was Powell?

Michael James David Powell FRS was "a British numerical analyst who was among the pioneers of computational mathematics". He was the inventor/early contributor of quasi-Newton method, trust region method, augmented Lagrangian method, and SQP method. Each of them is a pillar of modern numerical optimization. He also made significant contributions to approximation theory and methods.

Among numerous honors, Powell was one of the two recipients of the first Dantzig Prize from the Mathematical Programming Society (MOS) and Society for Industrial and Applied Mathematics (SIAM). This is considered the highest award in optimization.

A "fun" fact

In the past years, while working on PRIMA, I have spotted a dozen of bugs in reputable Fortran compilers and three bugs in MATLAB. Each of them represents days of bitter debugging, which finally led to the conclusion that it was not a problem in my code but a flaw in the Fortran compilers or in MATLAB. From a very unusual angle, this reflects how intensive the coding has been.

The bitterness behind this "fun" fact is exactly why I work on PRIMA: I hope that all the frustrations that I have experienced will not happen to any user of Powell's methods anymore. I hope I am the last one in the world to decode a maze of 244 GOTOs in 7939 lines of Fortran 77 code — I did this for three years and I do not want anyone else to do it again.

Acknowledgment

PRIMA is dedicated to the memory of the late Professor Powell with gratitude for his inspiration and for the wealth he left to us.

I am grateful to Professor Ya-xiang Yuan for his everlasting encouragement and support.

The development of PRIMA would have been a mission impossible without the groundwork laid by the PDFO package of Tom M. Ragonneau and Zaikun Zhang. PDFO is Chapter 3 of Ragonneau's thesis co-supervised by Zaikun Zhang and Professor Xiaojun Chen, with financial support from the Hong Kong Ph.D. Fellowship Scheme (ref. PF18-24698).

PRIMA is a long-term project, which would not have been sustainable without the continued funds from the Hong Kong Research Grants Council (ref. PolyU 253012/17P, PolyU 153054/20P, PolyU 153066/21P, and PolyU 153086/23P) and The Hong Kong Polytechnic University (PolyU), in particular the Department of Applied Mathematics (AMA).

Citing PRIMA

PRIMA has taken me significant energy and time. I will be delighted if it is useful to you. All I need is a citation / acknowledgment. Note that PRIMA contains bug fixes and improvements that do not exist in Powell's original implementation of the solvers. Results produced by PRIMA may not be reproducible using the original solvers.

If you use PRIMA, please cite it as follows. The citation will be pointed to my paper on PRIMA when I finish it.

[1] Z. Zhang, PRIMA: Reference Implementation for Powell's Methods with Modernization and Amelioration, available at http://www.libprima.net, DOI: 10.5281/zenodo.8052654, 2023

@misc{Zhang_2023,
    title        = {{PRIMA: Reference Implementation for Powell's Methods with Modernization and Amelioration}},
    author       = {Zhang, Z.},
    howpublished = {available at http://www.libprima.net, DOI: 10.5281/zenodo.8052654},
    year         = {2023}
}

In addition, Powell’s methods can be cited as follows.

[2] M. J. D. Powell, A direct search optimization method that models the objective and constraint functions by linear interpolation, In Advances in Optimization and Numerical Analysis, eds. S. Gomez and J. P. Hennart, pages 51--67, Springer Verlag, Dordrecht, Netherlands, 1994

[3] M. J. D. Powell, UOBYQA: unconstrained optimization by quadratic approximation, Math. Program., 92(B):555--582, 2002

[4] M. J. D. Powell, The NEWUOA software for unconstrained optimization without derivatives, In Large-Scale Nonlinear Optimization, eds. G. Di Pillo and M. Roma, pages 255--297, Springer, New York, US, 2006

[5] M. J. D. Powell, The BOBYQA algorithm for bound constrained optimization without derivatives, Technical Report DAMTP 2009/NA06, Department of Applied Mathematics and Theoretical Physics, Cambridge University, Cambridge, UK, 2009

[6] T. M. Ragonneau and Z. Zhang, PDFO: a cross-platform package for Powell's derivative-free optimization solvers, arXiv:2302.13246, 2023

Remarks

  • LINCOA seeks the least value of a nonlinear function subject to linear inequality constraints without using derivatives of the objective function. Powell did not publish a paper to introduce the algorithm.

  • The paper [6] introduces the PDFO package rather than PRIMA. Nevertheless, it provides a good introduction to Powell's methods.

Charityware

PRIMA is charityware, distributed for free under its license. If you appreciate it, you may consider making a donation to a charity that you trust (in addition to citing & acknowledging PRIMA). This is only a suggestion, not an obligation.

The inspiration comes from Vim, with which Zaikun Zhang typed all his PRIMA code.

Contact

In case of problems, open a GitHub issue or contact Zaikun Zhang.

Mirrors

stardev ranking: 28 among 30,975 Fortran repos as of Jan. 2024.

Thank you for your support.

prima's People

Contributors

amontoison avatar dependabot[bot] avatar jschueller avatar nbelakovski avatar zaikunzhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

prima's Issues

Wrap the objective & constraint function evaluation and catch exceptions if any

This is related to

#80

In general, we should keep in mind that function evaluations may fail or return exceptional values. A robust and reliable solver must handle such cases properly.

The capability of handling such cases can be tested by the TOUGH test. The following is a MATLAB implementation of such a test.
https://github.com/libprima/prima/blob/main/matlab/tests/private/tough.m

The MATLAB interface of PRIMA handles exceptions and exceptional values as follows.
https://github.com/libprima/prima/blob/main/matlab/interfaces/private/evalobj.m
https://github.com/libprima/prima/blob/main/matlab/interfaces/private/evalcon.m

In this way, the function evaluations are wrapped using a try ... catch ... so that exceptions will be taken care of. The solvers will not crash even if the function evaluation fails.

Is it possible to do similar things in C? I understand that C does not have a native try ... catch ....

Either make tests and examples independent or enable examples when building tests

Tests do not run if examples are not explicitly enabled in the build. This is somewhat counter-intuitive: perhaps, either make these separate or make examples a part of tests without a separate configure setting. Otherwise running tests with -DPRIMA_ENABLE_TESTING=ON but without -DPRIMA_ENABLE_EXAMPLES=ON leaves all tests broken.

Provide some sensible settings for stress tests on 32-bit platforms, otherwise they freeze forever

I am testing prima on powerpc 32-bit, and test suite freezes on stress tests. Prior to that tests (examples really) pass.

Then I have to interrupt the process, since nothing is happening.

Process sample, if it is helpful:

Analysis of sampling stress_c_exe (pid 52062) every 1 millisecond
Call graph:
    2530 Thread_360f
      2530 0xffc
        2530 start
          2530 main
            2530 prima_bobyqa
              2530 bobyqa_c
                2530 __bobyqa_mod_MOD_bobyqa
                  2530 __bobyqb_mod_MOD_bobyqb
                    2091 __geometry_bobyqa_mod_MOD_geostep
                      1200 __linalg_mod_MOD_trueloc
                        808 __linalg_mod_MOD_linspace_i
                          381 __linalg_mod_MOD_linspace_i
                            381 lround
                              381 lround
                          307 __linalg_mod_MOD_linspace_r
                            307 __linalg_mod_MOD_linspace_r
                          46 dyld_stub_lround
                            46 dyld_stub_lround
                          38 __linalg_mod_MOD_linspace_i
                          35 lround
                            35 lround
                          1 malloc
                            1 malloc_zone_malloc
                              1 szone_malloc
                                1 small_malloc_from_free_list
                                  1 small_malloc_from_free_list
                        284 _gfortran_pow_c16_i8
                          149 _gfortran_pow_c16_i8
                          134 backtrace_alloc
                            134 backtrace_alloc
                          1 _gfortran_set_max_subrecord_length
                            1 dyld_stub_malloc
                              1 dyld_stub_malloc
                        79 __linalg_mod_MOD_trueloc
                        22 __memory_mod_MOD_alloc_ivector
                          19 __memory_mod_MOD_alloc_ivector
                          3 malloc
                            3 malloc_zone_malloc
                              3 szone_malloc
                                2 szone_malloc
                                1 small_malloc_from_free_list
                                  1 small_malloc_from_free_list
                        4 szone_free
                          4 szone_free
                        1 dyld_stub__gfortran_pack
                          1 dyld_stub__gfortran_pack
                        1 malloc_zone_free
                          1 malloc_zone_free
                        1 small_free_list_remove_ptr
                          1 small_free_list_remove_ptr
                      437 _gfortran_pow_c16_i8
                        437 _gfortran_pow_c16_i8
                          437 _gfortran_pow_c16_i8
                      269 __geometry_bobyqa_mod_MOD_geostep
                      92 __infnan_mod_MOD_is_nan_dp
                        37 __inf_mod_MOD_is_finite_dp
                          27 __inf_mod_MOD_is_finite_dp
                          10 __huge_mod_MOD_huge_value_dp
                            10 __huge_mod_MOD_huge_value_dp
                        36 __infnan_mod_MOD_is_nan_dp
                        16 __inf_mod_MOD_is_inf_dp
                          12 __inf_mod_MOD_is_inf_dp
                          4 __huge_mod_MOD_huge_value_dp
                            4 __huge_mod_MOD_huge_value_dp
                        3 __huge_mod_MOD_huge_value_dp
                          3 __huge_mod_MOD_huge_value_dp
                      34 __powalg_mod_MOD_hess_mul
                        18 __linalg_mod_MOD_matprod12
                          17 __linalg_mod_MOD_inprod
                            17 __linalg_mod_MOD_inprod
                          1 __linalg_mod_MOD_matprod12
                        15 __linalg_mod_MOD_matprod21
                          15 __linalg_mod_MOD_matprod21
                        1 __powalg_mod_MOD_hess_mul
                      18 __linalg_mod_MOD_matprod12
                        18 __linalg_mod_MOD_inprod
                          18 __linalg_mod_MOD_inprod
                      18 _gfortran_sum_r8
                        18 _gfortran_sum_r8
                      15 __linalg_mod_MOD_matprod21
                        15 __linalg_mod_MOD_matprod21
                      4 szone_free
                        2 small_free_list_remove_ptr
                          2 small_free_list_remove_ptr
                        2 szone_free
                      2 deallocate_pages
                        2 munmap$UNIX2003
                          2 munmap$UNIX2003
                      1 dyld_stub_free
                        1 dyld_stub_free
                      1 malloc
                        1 malloc_zone_malloc
                          1 szone_malloc
                            1 small_malloc_from_free_list
                              1 small_free_list_add_ptr
                                1 small_free_list_add_ptr
                    315 _gfortran_pow_c16_i8
                      315 _gfortran_pow_c16_i8
                        315 _gfortran_pow_c16_i8
                    103 __bobyqb_mod_MOD_bobyqb
                    18 _gfortran_sum_r8
                      18 _gfortran_sum_r8
                    2 deallocate_pages
                      2 munmap$UNIX2003
                        2 munmap$UNIX2003
                    1 restGPRx
                      1 restGPRx

Total number in stack (recursive counted multiple, when >=5):
        5       _gfortran_pow_c16_i8

Sort by top of stack, same collapsed (when >= 5):
        _gfortran_pow_c16_i8        901
        lround        416
        __linalg_mod_MOD_linspace_r        307
        __geometry_bobyqa_mod_MOD_geostep        269
        backtrace_alloc        134
        __bobyqb_mod_MOD_bobyqb        103
        __linalg_mod_MOD_trueloc        79
        dyld_stub_lround        46
        __linalg_mod_MOD_linspace_i        38
        __infnan_mod_MOD_is_nan_dp        36
        _gfortran_sum_r8        36
        __linalg_mod_MOD_inprod        35
        __linalg_mod_MOD_matprod21        30
        __inf_mod_MOD_is_finite_dp        27
        __memory_mod_MOD_alloc_ivector        19
        __huge_mod_MOD_huge_value_dp        17
        __inf_mod_MOD_is_inf_dp        12
        szone_free        6

This is a reasonably fast machine with plenty of RAM. So I think something just overloads address space or alike.

The examples in README do not work anymore after merging https://github.com/libprima/prima/pull/105

This is what I got:

z$ git clone --depth 1 https://github.com/libprima/prima.git
cd prima
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install
cmake --build build --target install
Cloning into 'prima'...
remote: Enumerating objects: 942, done.
remote: Counting objects: 100% (942/942), done.
remote: Compressing objects: 100% (752/752), done.
remote: Total 942 (delta 441), reused 458 (delta 173), pack-reused 0
Receiving objects: 100% (942/942), 6.24 MiB | 2.10 MiB/s, done.
Resolving deltas: 100% (441/441), done.
-- The Fortran compiler identification is GNU 11.4.0
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/f95 - skipped
-- Performing Test HAVE_WARN_EXECSTACK
-- Performing Test HAVE_WARN_EXECSTACK - Failed
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zaikunzhang/tmp/prima/build
Scanning dependencies of target primaf
[  1%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/consts.F90.o
[  3%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/infos.f90.o
[  4%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/debug.F90.o
[  6%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/huge.F90.o
[  7%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/inf.F90.o
[  9%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/infnan.F90.o
[ 10%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/checkexit.f90.o
[ 12%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/memory.F90.o
[ 14%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/string.f90.o
[ 15%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/linalg.f90.o
[ 17%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/pintrf.f90.o
[ 18%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/evaluate.f90.o
[ 20%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/powalg.f90.o
[ 21%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/geometry.f90.o
[ 23%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/history.f90.o
[ 25%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/fprint.f90.o
[ 26%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/message.f90.o
[ 28%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/xinbd.f90.o
[ 29%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/initialize.f90.o
[ 31%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/ratio.f90.o
[ 32%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/redrho.f90.o
[ 34%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/rescue.f90.o
[ 35%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/shiftbase.f90.o
[ 37%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/univar.f90.o
[ 39%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/trustregion.f90.o
[ 40%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/update.f90.o
[ 42%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/bobyqb.f90.o
[ 43%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/preproc.f90.o
[ 45%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/bobyqa.f90.o
[ 46%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/geometry.f90.o
[ 48%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/selectx.f90.o
[ 50%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/initialize.f90.o
[ 51%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/trustregion.f90.o
[ 53%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/update.f90.o
[ 54%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/cobylb.f90.o
[ 56%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/cobyla.f90.o
[ 57%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/geometry.f90.o
[ 59%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/getact.f90.o
[ 60%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/initialize.f90.o
[ 62%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/trustregion.f90.o
[ 64%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/update.f90.o
[ 65%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/lincob.f90.o
[ 67%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/lincoa.f90.o
[ 68%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/geometry.f90.o
[ 70%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/initialize.f90.o
[ 71%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/trustregion.f90.o
[ 73%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/update.f90.o
[ 75%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/newuob.f90.o
[ 76%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/newuoa.f90.o
[ 78%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/geometry.f90.o
[ 79%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/initialize.f90.o
[ 81%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/trustregion.f90.o
[ 82%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/update.f90.o
[ 84%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/uobyqb.f90.o
[ 85%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/uobyqa.f90.o
[ 87%] Linking Fortran shared library libprimaf.so
[ 87%] Built target primaf
Scanning dependencies of target primac
[ 89%] Building Fortran object c/CMakeFiles/primac.dir/cintrf.f90.o
[ 90%] Building Fortran object c/CMakeFiles/primac.dir/bobyqa_c.f90.o
[ 92%] Building Fortran object c/CMakeFiles/primac.dir/cobyla_c.f90.o
[ 93%] Building Fortran object c/CMakeFiles/primac.dir/lincoa_c.f90.o
[ 95%] Building Fortran object c/CMakeFiles/primac.dir/newuoa_c.f90.o
[ 96%] Building Fortran object c/CMakeFiles/primac.dir/uobyqa_c.f90.o
[ 98%] Building C object c/CMakeFiles/primac.dir/prima.c.o
[100%] Linking Fortran shared library libprimac.so
[100%] Built target primac
Install the project...
-- Install configuration: "Release"
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.so
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/libprimac.so
-- Set runtime path of "/home/zaikunzhang/tmp/prima/install/lib/libprimac.so" to ""
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/cmake/prima/prima-targets.cmake
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/cmake/prima/prima-targets-release.cmake
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/cmake/prima/prima-config.cmake
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/cmake/prima/prima-config-version.cmake
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/bobyqb_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/huge_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/initialize_lincoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/inf_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/uobyqb_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/consts_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/history_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/update_lincoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/fprint_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/lincob_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/preproc_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/update_bobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/trustregion_uobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/debug_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/infos_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/redrho_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/update_newuoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/cobyla_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/update_uobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/geometry_lincoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/trustregion_cobyla_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/univar_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/message_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/evaluate_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/newuob_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/xinbd_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/initialize_uobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/string_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/selectx_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/bobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/initialize_cobyla_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/geometry_bobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/memory_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/cobylb_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/shiftbase_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/initialize_bobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/linalg_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/geometry_newuoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/update_cobyla_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/trustregion_newuoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/uobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/geometry_cobyla_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/newuoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/infnan_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/trustregion_bobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/trustregion_lincoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/checkexit_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/ratio_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/pintrf_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/rescue_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/lincoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/getact_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/initialize_newuoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/geometry_uobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/powalg_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/prima.h
z$ cd c/examples/cobyla
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DPRIMA_DIR=$PWD/../../../install/lib/cmake/prima/
cmake --build build --target install
./install/bin/cobyla_example
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zaikunzhang/tmp/prima/c/examples/cobyla/build
[ 50%] Building C object CMakeFiles/cobyla_example.dir/cobyla_example.c.o
[100%] Linking C executable cobyla_example
[100%] Built target cobyla_example
Install the project...
-- Install configuration: ""
-- Installing: /home/zaikunzhang/tmp/prima/c/examples/cobyla/install/bin/cobyla_example
-- Set runtime path of "/home/zaikunzhang/tmp/prima/c/examples/cobyla/install/bin/cobyla_example" to ""
./install/bin/cobyla_example: error while loading shared libraries: libprimac.so: cannot open shared object file: No such file or directory
z$ cd fortran/examples/cobyla
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DPRIMA_DIR=$PWD/../../../install/lib/cmake/prima/
cmake --build build --target install
./install/bin/cobyla_example
-- The Fortran compiler identification is GNU 11.4.0
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/f95 - skipped
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zaikunzhang/tmp/prima/fortran/examples/cobyla/build
Scanning dependencies of target cobyla_example
[ 50%] Building Fortran object CMakeFiles/cobyla_example.dir/cobyla_example.f90.o
[100%] Linking Fortran executable cobyla_example
[100%] Built target cobyla_example
Install the project...
-- Install configuration: ""
-- Installing: /home/zaikunzhang/tmp/prima/fortran/examples/cobyla/install/bin/cobyla_example
-- Set runtime path of "/home/zaikunzhang/tmp/prima/fortran/examples/cobyla/install/bin/cobyla_example" to ""
./install/bin/cobyla_example: error while loading shared libraries: libprimaf.so: cannot open shared object file: No such file or directory

CMake had difficulty finding the Fortran compiler

Hi @jschueller ,

Could you fix this? See https://fortran-lang.discourse.group/t/prima-cmake-building-system-and-c-interface-available/6499/3?u=zaikunzhang

Excellent work. The organization and code/documentation quality is remarkable. I just built the library in WSL. CMake had difficulty finding the Fortran compiler with -- The Fortran compiler identification is unknown, despite having 5 Fortran compilers in the OS bin directory. I could readily solve it by specifying -DCMAKE_Fortran_COMPILER=/usr/bin/gfortran-13. This may be an exception, but it might be worth having a brief troubleshooting discussion in the installation guidelines just in case people unfamiliar with Fortran or CMake face the same problem. I have used Powell methods in the past and look forward to using the modernized version in the coming months.

This reminds me of the following, which I hope you could also kindly handle. We should provide options so that users can choose to

  • compile the Fortran library, or
  • compile the C library, or
  • compile everything.

Of course, since the C library depends on the Fortran one (before we have a pure C implementation), the second case would necessitate the compilation of the Fortran library as well, but the user does not need to say so.

Why do we separate these cases? Because a Fortran user does not necessarily have a C compiler installed. Anyway, he/she does not intend to use the C library, so it is illogical (indeed confusing) to compile it.

Thank you very much for taking care of these.

Best regards,
Zaikun

[RFC] add a callback function

for scipy integration we should be able to pass an optional callback function to report at least the current best x/f values

subroutine CALLBACK(x, f)
    use consts_mod, only : RP
    implicit none
    real(RP), intent(in) :: bestx(:)
    real(RP), intent(in) :: bestf
    integer(RK), intent(out) :: stop
end subroutine CALLBACK

I propose it could also to cancel the minimization (or via the objective function) according to a "stop" argument (and add a new return code for this):

I dont know if there are other useful stuff we want to track, like the number of evaluations ...

in C it is usual to pass an additional pointer argument to hook back to struct/data:

typedef int (*cbfunc)(unsigned n, const double *bestx, conda double bestf, void *func_data);

see the "callback" argument of minimize:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html

could also be useful for nlopt:
stevengj/nlopt#37

error in matlab mex bulid

Dear Sir, I meet an error in mex build.

Can you help me fix it?

OS: Windows 11

MATLAB version: R2023a

image

Leverage GitHub cache to improve setup-matlab time

This repository is very active building MATLAB projects many times a day. Also, it is leveraging the v2-beta of the setup-matlab action. You may be interesting in caching the MATLAB installations for improved performance. Note this may use a significant portion of your cache space, but nonetheless may be worth it for this project. To see an example of a project leveraging GitHub actions cache for MATLAB look here.

Create the Fortran documentation using standard tools

It is necessary to creat the documentation for the Fortran version of PRIMA using standard tools, e.g., FORD or Sphinx. Hugo seems also a very good choice (does it support Fortran)?

We must take other languages into consideration. The documentation for different languages should be consistent in terms of both content and style.

Finally, all documentation should be available under libprima.net.

The Fortran 77 version of UOBYQA encounters infinite cyclings very often if `PRIMA_REAL_PRECISION` is 32

The Fortran 77 version of UOBYQA encounters infinite cyclings very often if PRIMA_REAL_PRECISION is 32. This has been observed on the following CUTEst problems:

BEALE
BENNETT5LS
BOXBODLS
BROWNBS
CUBE
EXP2
HIELOW
HIMMELBB
JUDGE
S308
PRICE4

There do exist problems where the solver works, e.g., HILBERTA and PRICE3, but they seem to be rare among problems under 3 dimensions.

This is observed via the workflow https://github.com/fortlab/prima/actions/workflows/profile_uobyqa_small_sq.yml with 2394f47 . To reproduce it locally, do the following in a MATLAB command window.

! git clone https://github.com/libprima/prima.git
cd('prima');
! git checkout 2337c68
options.classical = true; options.single = true;
setup('uobyqa', options);
problem = macup('beale');  % This needs MatCUTEst at https://github.com/matcutest/matcutest_compiled
problem.options.classical = true; problem.options.precision = 'single'; 
uobyqa(problem);

This will drive UOBYQA into an infinite cycling.

Surely, this is not a concern for us, because it happens only to the original Fortran 77 implementation. Nevertheless, it is still interesting to investigate the reason underneath, to further understand the shortcomings of the original Fortran 77 implementation.

How should I install the package (to be used as a fortran dependency)?

Hi, I saw this package some week ago in the Fortran-lang discourse. It rose a lot of interest in my group, as we have widespread needs for well written optimization packages. Now we are starting to explore a bit on a new project and came here to try adding PRIMA as a dependency. I know there are plans to make it buildable with fpm, but since we are not there yet, and I cannot see a CMake or other build systems around (except for the matlab-specific MEX setup), how can we deal with fortran source building? Looking at the actions for the testsuite has not helped so far, maybe we are missing something.

Unclear how to create shared dynamic libraries on Windows

Hi,

I'm currently trying to wrap PRIMA into a C# interface and, well, building is already an issue. :)
Judging from the CMakeFiles, I thought I'd only have to switch on BUILD_SHARED_LIBS but maybe I'm missing something.

My output right now is

PS C:\MyWS\prima> cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DBUILD_SHARED_LIBS=1
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22621.
-- The Fortran compiler identification is Intel 2021.10.0.20230609
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Determine Intel Fortran Compiler Implicit Link Path
-- Determine Intel Fortran Compiler Implicit Link Path - done
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/2023.2.1/windows/bin/intel64/ifort.exe - skipped
-- The C compiler identification is MSVC 19.29.30151.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (15.4s)
-- Generating done (0.1s)
-- Build files have been written to: C:/MyWS/prima/build
PS C:\MyWS\prima> cmake --build build --target install

Microsoft Visual Studio 2019 Version 16.11.28.
Copyright (C) Microsoft Corp. Alle Rechte vorbehalten.
Erstellen gestartet...
1>------ Erstellen gestartet: Projekt: ZERO_CHECK, Konfiguration: Debug x64 ------
1>1>Checking Build System
2>------ Erstellen gestartet: Projekt: primaf, Konfiguration: Debug x64 ------
Compiling with Intel® Fortran Compiler Classic 2021.10.0 [Intel(R) 64]...
consts.F90
pintrf.f90
huge.F90
infos.f90
debug.F90
inf.F90
memory.F90
redrho.f90
infnan.F90
string.f90
ratio.f90
linalg.f90
history.f90
selectx.f90
checkexit.f90
preproc.f90
fprint.f90
powalg.f90
evaluate.f90
trustregion.f90
univar.f90
trustregion.f90
message.f90
geometry.f90
trustregion.f90
trustregion.f90
xinbd.f90
update.f90
update.f90
shiftbase.f90
getact.f90
update.f90
geometry.f90
update.f90
initialize.f90
geometry.f90
initialize.f90
geometry.f90
uobyqb.f90
rescue.f90
update.f90
geometry.f90
trustregion.f90
initialize.f90
initialize.f90
initialize.f90
uobyqa.f90
lincob.f90
lincoa.f90
cobylb.f90
bobyqb.f90
newuob.f90
cobyla.f90
bobyqa.f90
newuoa.f90
Performing Pre-Link Event...
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation.  All rights reserved.
Linking...
Microsoft (R) Incremental Linker Version 14.29.30151.0
Copyright (C) Microsoft Corporation.  All rights reserved.
/OUT:C:\MyWS\prima\build\bin\Debug\primaf.dll
/VERSION:0.0
/DEF:C:\MyWS\prima\fortran\primaf-Intel.def
/MANIFEST
/MANIFESTFILE:primaf.dir\Debug\primaf.dll.intermediate.manifest
"/MANIFESTUAC:level='asInvoker' uiAccess='false'"
/DEBUG
/PDB:C:\MyWS\prima\build\bin\Debug\primaf.pdb
/IMPLIB:C:\MyWS\prima\build\fortran\Debug\primaf.lib
/DLL
user32.lib
/machine:x64
/debug
/INCREMENTAL
primaf.dir\Debug\consts.obj
primaf.dir\Debug\pintrf.obj
primaf.dir\Debug\huge.obj
primaf.dir\Debug\infos.obj
primaf.dir\Debug\debug.obj
primaf.dir\Debug\inf.obj
primaf.dir\Debug\memory.obj
primaf.dir\Debug\redrho.obj
primaf.dir\Debug\infnan.obj
primaf.dir\Debug\string.obj
primaf.dir\Debug\ratio.obj
primaf.dir\Debug\linalg.obj
primaf.dir\Debug\history.obj
primaf.dir\Debug\selectx.obj
primaf.dir\Debug\checkexit.obj
primaf.dir\Debug\preproc.obj
primaf.dir\Debug\fprint.obj
primaf.dir\Debug\powalg.obj
primaf.dir\Debug\evaluate.obj
primaf.dir\Debug/uobyqa/trustregion.f90.obj
primaf.dir\Debug\univar.obj
primaf.dir\Debug/bobyqa/trustregion.f90.obj
primaf.dir\Debug\message.obj
primaf.dir\Debug/cobyla/geometry.f90.obj
primaf.dir\Debug/newuoa/trustregion.f90.obj
primaf.dir\Debug/cobyla/trustregion.f90.obj
primaf.dir\Debug\xinbd.obj
primaf.dir\Debug/uobyqa/update.f90.obj
primaf.dir\Debug/cobyla/update.f90.obj
primaf.dir\Debug\shiftbase.obj
primaf.dir\Debug\getact.obj
primaf.dir\Debug/newuoa/update.f90.obj
primaf.dir\Debug/uobyqa/geometry.f90.obj
primaf.dir\Debug/bobyqa/update.f90.obj
primaf.dir\Debug/cobyla/initialize.f90.obj
primaf.dir\Debug/bobyqa/geometry.f90.obj
primaf.dir\Debug/uobyqa/initialize.f90.obj
primaf.dir\Debug/lincoa/geometry.f90.obj
primaf.dir\Debug\uobyqb.obj
primaf.dir\Debug\rescue.obj
primaf.dir\Debug/lincoa/update.f90.obj
primaf.dir\Debug/newuoa/geometry.f90.obj
primaf.dir\Debug/lincoa/trustregion.f90.obj
primaf.dir\Debug/lincoa/initialize.f90.obj
primaf.dir\Debug/newuoa/initialize.f90.obj
primaf.dir\Debug/bobyqa/initialize.f90.obj
primaf.dir\Debug\uobyqa.obj
primaf.dir\Debug\lincob.obj
primaf.dir\Debug\lincoa.obj
primaf.dir\Debug\cobylb.obj
primaf.dir\Debug\bobyqb.obj
primaf.dir\Debug\newuob.obj
primaf.dir\Debug\cobyla.obj
primaf.dir\Debug\bobyqa.obj
primaf.dir\Debug\newuoa.obj
primaf.dir\Debug\primaf.dll.embed.manifest.res
   Bibliothek "C:\MyWS\prima\build\fortran\Debug\primaf.lib" und Objekt "C:\MyWS\prima\build\fortran\Debug\primaf.exp" werden erstellt.
Embedding manifest...
Microsoft (R) Manifest Tool
Copyright (c) Microsoft Corporation.
All rights reserved.

Build log written to  "file://C:/MyWS/prima/build/fortran/primaf.dir/Debug/BuildLog.htm"
primaf - 0 error(s), 0 warning(s)
3>------ Erstellen gestartet: Projekt: primac, Konfiguration: Debug x64 ------
3>Building Custom Rule C:/MyWS/prima/c/CMakeLists.txt
3>cl : befehlszeile warning D9002: Unbekannte Option "/fpp" wird ignoriert.
3>cl : befehlszeile warning D9002: Unbekannte Option "/libs:dll" wird ignoriert.
3>cl : befehlszeile warning D9002: Unbekannte Option "/threads" wird ignoriert.
3>cl : befehlszeile warning D9002: Unbekannte Option "/heap-arrays" wird ignoriert.
3>cl : befehlszeile warning D9002: Unbekannte Option "/assume:recursion" wird ignoriert.
3>cl : befehlszeile warning D9002: Unbekannte Option "/debug:full" wird ignoriert.
3>cl : befehlszeile warning D9002: Unbekannte Option "/dbglibs" wird ignoriert.
3>prima.c
3>primac.def : error LNK2001: Nicht aufgelöstes externes Symbol "bobyqa_c".
3>primac.def : error LNK2001: Nicht aufgelöstes externes Symbol "cobyla_c".
3>primac.def : error LNK2001: Nicht aufgelöstes externes Symbol "lincoa_c".
3>primac.def : error LNK2001: Nicht aufgelöstes externes Symbol "newuoa_c".
3>primac.def : error LNK2001: Nicht aufgelöstes externes Symbol "uobyqa_c".
3>C:/MyWS/prima/build/c/Debug/primac.lib : fatal error LNK1120: 5 nicht aufgelöste Externe
3>Die Erstellung des Projekts "primac.vcxproj" ist abgeschlossen -- FEHLER.
4>------ Erstellen gestartet: Projekt: ALL_BUILD, Konfiguration: Debug x64 ------
4>Building Custom Rule C:/MyWS/prima/CMakeLists.txt
5>------ Erstellen gestartet: Projekt: INSTALL, Konfiguration: Debug x64 ------
5>1>
5>-- Install configuration: "Debug"
5>-- Installing: C:/MyWS/prima/install/lib/primaf.lib
5>-- Installing: C:/MyWS/prima/install/bin/primaf.dll
5>-- Installing: C:/MyWS/prima/install/bin/primac.dll
5>-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-targets.cmake
5>-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-targets-debug.cmake
5>-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-config.cmake
5>-- Installing: C:/MyWS/prima/install/lib/cmake/prima/prima-config-version.cmake
5>-- Installing: C:/MyWS/prima/install/include/prima/mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/bobyqa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/bobyqb_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/checkexit_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/cobyla_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/cobylb_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/consts_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/debug_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/evaluate_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/fprint_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/geometry_bobyqa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/geometry_cobyla_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/geometry_lincoa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/geometry_newuoa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/geometry_uobyqa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/getact_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/history_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/huge_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/infnan_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/infos_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/inf_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/initialize_bobyqa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/initialize_cobyla_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/initialize_lincoa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/initialize_newuoa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/initialize_uobyqa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/linalg_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/lincoa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/lincob_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/memory_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/message_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/newuoa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/newuob_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/pintrf_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/powalg_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/preproc_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/ratio_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/redrho_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/rescue_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/selectx_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/shiftbase_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/string_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/trustregion_bobyqa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/trustregion_cobyla_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/trustregion_lincoa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/trustregion_newuoa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/trustregion_uobyqa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/univar_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/uobyqa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/uobyqb_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/update_bobyqa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/update_cobyla_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/update_lincoa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/update_newuoa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/update_uobyqa_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/mod/Debug/xinbd_mod.mod
5>-- Installing: C:/MyWS/prima/install/include/prima/prima.h
========== Erstellen: 4 erfolgreich, 1 fehlerhaft, 0 aktuell, 0 übersprungen ==========

I've seen in #28 that this was discussed already, I suspect that I'm just not passing the correct build flags. Any ideas?

handle evaluation error

the current code makes the assumption that the objective is always well defined
however in real life the evaluation may fail (finite difference solver convergence, numerical error etc)

I dont think prima can handle that yet,
for example at OpenTURNS our cobyla version (translated in C from the old fortran 77 version) can end the minimization according to a boolean returned by the objective:
https://github.com/openturns/openturns/blob/master/lib/src/Base/Optim/algocobyla.c#L310

it didnt occured to me when I wrote #69, but the termination boolean is needed the objective function level
(the one at #69 can stay as we can have a termination bool not related to the objective function call, ie the user clicks stop in a GUI)

so I propose to add a boolean to the OBJ, OBJCON Fortran callbacks similarly to what is done in #69
probaby a lot of the example/test/matlab code has to be changed because of this
what do you think ?

Make LINCOA and COBYLA respect bounds

The same as BOBYQA and COBYQA, it will be desirable to make LINCOA and COBYLA respect bounds, meaning that they never visit points that violate the bound constraints. This is because such constraints often represent mathematical or physical restrictions that cannot be lifted, and the objective/constraint functions may be undefined if they are violated.

This will first be implemented in the Fortran version. We will adopt the approach used by Powell in BOBYQA. See #28 (comment).

N.B.:

  1. Both LINCOA and COBYLA are infeasible methods, which can visit points that do not satisfy the constraints. Nevertheless, the iterates are expected to satisfy the constraints asymptotically (i.e., after infinitely many iterations, which is only on theoretical interests). This type of method is not uncommon in optimization. Unless there is a failure, a point returned by these methods should approximately satisfy the constraints.

  2. Here, we are only concerned about the bound constraints. We hope to make the iterates always respect the bounds, although they may still violate other linear or nonlinear constraints. This is because bound constraints often represent mathematical or physical restrictions that cannot be lifted, and the objective/constraint functions may be undefined if they are violated.

MATLAB parallel test fails from time to time on macOS-12 with R2023a

MATLAB parallel test fails from time to time with the following message. Example:
https://github.com/zequipe/prima/actions/runs/6588753377/job/17901744851

  [Warning: A worker aborted during execution of the parfor loop. The parfor loop
  will now run again on the remaining workers.]
  [> In parallel.internal.parfor/ParforEngine/handleIntervalErrorResult (line 297)
  In parallel.internal.parfor/ParforEngine/getCompleteIntervals (line 240)
  In parallel_function>distributed_execution (line 746)
  In parallel_function (line 578)
  In parallel (line 77)
  In command_39b82181_5879_4ca7_9e81_bc8161597223 (line 30)]
  Starting parallel pool (parpool) using the 'Processes' profile ...
  Connected to parallel pool with 3 workers.
  Parallel pool using the 'Processes' profile is shutting down.

Up to 20231008, this seems to happen only on macOS-12 with MATLAB R2023a. It has not been observed on macOS-13.

To be tested on MATLAB R2023b, which is not available yet.

`gtest` does not run correctly under macOS with GitHub Actions

gtest fails with the following message when testing macOS on GitHub Actions.

ld: library not found for -lgcrt1.o
collect2: error: ld returned 1 exit status

It used to work, but now it fails, with the gfortran version being 9, 10, 11, or, 12.

N.B.:

  1. Despite the failure, the test did not terminate with an error but continued. This is not really ideal. Probably the makefile needs revision.
  2. In the GitHub Actions tests, the gfortran is provided by awvwgk / setup-fortran.

Add R binding

With the binding / implementation of PRIMA in C, Python, Julia, and MATLAB all being worked on, the only major scientific-computing-oriented language missing from the list is R.

See also lme4/lme4#744.

`fortran/cobyla` does not pass `dtest`

With flang in AMD clang version 14.0.6, fortran/cobyla of 54e66dd does not pass dtest.

  1. With
git checkout 54e66dd && cd fortran/tests/ && make clean && make dtest_i2_r4_d1_tst.cobyla

we get

dtest_i2_r4_d1_tst_g starts.
Warning: COBYLA: MAXFILT is too small; it is set to 200.
0: ALLOCATE: 395136991236 bytes requested; not enough memory
[Inferior 1 (process 1077021) exited with code 0177]
No stack.
dtest_i2_r4_d1_tst ends at 2023.08.04_18.17.13.

Cleaning up miscellaneous files ...
Done.
  1. With
git checkout 54e66dd && cd fortran/examples/cobyla && make clean && make dtest

we get

HEAD is now at 54e66dde 230804.180548.CST fix a memory leak in example/cobyla_example.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o consts.o ../../common/consts.F90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o infos.o ../../common/infos.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o debug.o ../../common/debug.F90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o inf.o ../../common/inf.F90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o infnan.o ../../common/infnan.F90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o memory.o ../../common/memory.F90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o string.o ../../common/string.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o linalg.o ../../common/linalg.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o powalg.o ../../common/powalg.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o ratio.o ../../common/ratio.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o redrho.o ../../common/redrho.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o history.o ../../common/history.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o selectx.o ../../common/selectx.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o checkexit.o ../../common/checkexit.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o fprint.o ../../common/fprint.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o message.o ../../common/message.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o preproc.o ../../common/preproc.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o pintrf.o ../../common/pintrf.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o evaluate.o ../../common/evaluate.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o update.o ../../cobyla/update.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o initialize.o ../../cobyla/initialize.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o trustregion.o ../../cobyla/trustregion.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o geometry.o ../../cobyla/geometry.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o cobylb.o ../../cobyla/cobylb.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -c -o cobyla.o ../../cobyla/cobyla.f90
/opt/AMD/aocc-compiler-4.0.0/bin/flang -Wall -Wextra -std=f2018   -Mstandard -O3 -g -o dtest cobyla_example.f90 *.o
./dtest
make: *** [Makefile:84: dtest] Segmentation fault (core dumped)
make: *** Deleting file 'dtest'
rm inf.o preproc.o ratio.o trustregion.o redrho.o infnan.o pintrf.o debug.o geometry.o message.o evaluate.o selectx.o infos.o fprint.o string.o powalg.o cobylb.o initialize.o consts.o update.o cobyla.o history.o checkexit.o linalg.o memory.o

gdb ./dtest THE_CORE_FILE gives us

gdb ./dtest core.1080251 
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./dtest...

[New LWP 1080251]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./dtest'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  calcfc_mod::calcfc_chebyquad (f=<error reading variable: Cannot access memory at address 0x0>, x=..., constr=...) at cobyla_example.f90:41
41	f = 0.0_RP
(gdb) bt
#0  calcfc_mod::calcfc_chebyquad (f=<error reading variable: Cannot access memory at address 0x0>, x=..., constr=...) at cobyla_example.f90:41
#1  0x0000000000217479 in calcfc_internal (f_internal=<error reading variable: Cannot access memory at address 0x5>, x_internal=..., constr_internal=...) at ../../cobyla/cobylb.f90:667
#2  0x000000000021c43a in evaluate_mod::evaluatefc (calcfc=0x4155415641574155, f=0.04642817229746083, x=..., constr=...) at ../../common/evaluate.f90:191
#3  0x000000000022663c in initialize_mod::initxfc (calcfc=-1840700268, iprint=0, maxfun=3000, ctol=1.4901161193847656e-08, f0=0.04642817229746083, ftarget=6.9528757905928421e-310, rhobeg=6.9528757905774272e-310, 
    nf=-1125723076, info=-1125729508, constr0=<error reading variable: value requires 1125822181566848 bytes, which is more than max-value-size>, x0=..., chist=..., conhist=..., conmat=..., 
    cval=<error reading variable: value requires 228731392 bytes, which is more than max-value-size>, fhist=..., fval=..., sim=..., simi=..., xhist=..., 
    evaluated=<error reading variable: value requires 114301120 bytes, which is more than max-value-size>) at ../../cobyla/initialize.f90:161
#4  0x0000000000213330 in cobylb_mod::cobylb (calcfc=<optimized out>, iprint=<error reading variable: Cannot access memory at address 0x5>, maxfilt=<optimized out>, maxfun=434684319, ctol=<optimized out>, 
    cweight=<optimized out>, eta1=<optimized out>, eta2=<optimized out>, ftarget=<optimized out>, gamma1=<optimized out>, gamma2=<optimized out>, rhobeg=<optimized out>, rhoend=<optimized out>, 
    f=<optimized out>, nf=<optimized out>, cstrv=<optimized out>, info=<optimized out>, amat=..., bvec=..., constr=..., x=..., chist=..., conhist=..., fhist=..., xhist=...) at ../../cobyla/cobylb.f90:215
#5  0x000000000020da6b in cobyla_mod::cobyla (calcfc=-1840700268, m_nlcon=0, f=0.04642817229746083, cstrv=0, f0=0, nf=0, rhobeg=0, rhoend=0, ftarget=0, ctol=0, cweight=0, maxfun=0, iprint=0, eta1=0, eta2=0, 
    gamma1=0, gamma2=0, maxhist=0, maxfilt=0, info=0, x=<error reading variable: value requires 4431462850816 bytes, which is more than max-value-size>, 
    nlconstr=<error reading variable: Cannot access memory at address 0x0>, aineq=<error reading variable: value requires 241256040910333888 bytes, which is more than max-value-size>, 
    bineq=<error reading variable: value requires 113962208 bytes, which is more than max-value-size>, aeq=<error reading variable: value requires 11518432 bytes, which is more than max-value-size>, beq=..., 
    xl=<error reading variable: value requires 319772152347648672 bytes, which is more than max-value-size>, xu=..., 
    nlconstr0=<error reading variable: value requires 241256040910333888 bytes, which is more than max-value-size>, xhist=<not allocated>, fhist=<not allocated>, chist=<not allocated>, nlchist=<not allocated>)
    at ../../cobyla/cobyla.f90:600
#6  0x00000000002090c7 in cobyla_exmp () at cobyla_example.f90:106

Algorithm details for preprocessing of initial starting point in lincoa

For lincoa, pre-processing of initial starting point is done in preprima function in Matlab and python code. There seems to be a lot going on in the code - I couldn't figure out the method of pre-processing from it. It would be very helpful to have the details of the method that is implemented there (for up to linear constraints - we can leave out non-linear constraints). Perhaps this could be added a PDF or markdown note in this repository so that users know how to implement this.

If I have the details of the method, and pseudo-code to implement, I could implement this in c/c++. Alternatively, if this is implemented reliably in c/c++/fortran already, I could re-use that instead if you point me to it.

I have C++ bindings to lincoa but not pre-processing step in native code. Hence, this request.

Implement a test on huge problems

This test will serve as a stress test to make sure that PRIMA does not crash on huge problems (e.g., 500 for COBYLA and UOBYQA, 1000 for the others).

gcc -Wmaybe-uninitialized warnings

I enabled -Wall with gfortran 11.3 and saw some -Wmaybe-uninitialized warnings:

/home/schueller/projects/prima/fortran/bobyqa/trustregion.f90:540:111:

  540 |         xbdi(iact) = nint(sign(ONE, d(iact) - diact), kind(xbdi))  !!MATLAB: xbdi(iact) = sign(d(iact) - diact)
      |                                                                                                               ^
Warning: ‘diact’ may be used uninitialized in this function [-Wmaybe-uninitialized]
[ 63%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/trustregion.f90.o
/home/schueller/projects/prima/fortran/bobyqa/rescue.f90:504:52:

  504 |             xxpt = xp * xpt(ip, :) + xq * xpt(iq, :)
      |                                                    ^
Warning: ‘xq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
/home/schueller/projects/prima/fortran/bobyqa/rescue.f90:504:52: Warning: ‘xp’ may be used uninitialized in this function [-Wmaybe-uninitialized]

it goes away if I set these to 0 after declaration

`!DEC$ attributes dllexport` is not standard Fortran

Hi @jschueller Julien and @amontoison Alexis,

!DEC$ attributes dllexport is not standard Fortran.

For example, with 6e9b334 , running

cd fortran/examples/cobyla && make itest

we will get

../../common/debug.F90(38): warning #7025: This directive is not standard F2018.
!DEC$ attributes dllexport :: assert
------^
../../common/debug.F90(38): remark #7841: DLL IMPORT/EXPORT is not supported on this platform.   [DLLEXPORT]
!DEC$ attributes dllexport :: assert

How to fix this? Is there a standard-conforming way to do the same?

In general, PRIMA does not tolerate warnings --- each warning is considered a (future) bug. In addition, PRIMA uses only standard Fortran, conforming to F2008 as of September 2023.

Thanks.

Zaikun

Test the examples on README in CI

Hi @jschueller ,

Due to #108 and #107 , I guess we need to test the examples on README in CI, literally and exactly.

"Stupid" tests are never stupid :P After working on PRIMA for more than three years, I have learned not to trust myself regarding code. I do not know what will happen before I have taken some "stupid" tests.

Thanks.

Zaikun

maxfun=8000 for cobyla in `t_large.c`

Hi @jschueller ,

Is there a particular reason for setting maxfun=8000 for cobyla in t_large.c, but not others? Will it be OK if we simply use the same maxfun as other solvers in t_large.c?

BTW, would you mind if this file is renamed to stress.c?

Thanks.

Zaikun

`cmake.yml` encounters this error frequently on Windows

Hi Julien @jschueller ,

The following error occurs very often by cmake.yml for `cmake-main (windows-latest, intel-classic, 2021.9):

error #31000: corrupt PDB file vc140.pdb; delete and rebuild; if problem persists, delete and try /Z7 instead
error code 3 ( can't write file, out of disk, etc.) opening pdb vc140.pdb

For example, see
https://github.com/libprima/prima/actions/runs/6205028892/job/16847753926

It may be related to the parallel building. See https://community.intel.com/t5/Intel-C-Compiler/improper-PDB-files-handling-by-ICC-on-Windows/m-p/1090488 (not sure).

It would be great if you could take a look.

Thanks.

Zaikun

RFC: Tracking progress to integrate with SciPy

As noted over at SciPy, I'll be able to spend some time ensuring the integration of PRIMA into SciPy via Python-C extension module. :)

The first step is to have a meson build backend. This is needed also because the goal is to use prima as a subproject, e.g. as is done for HiGHs.

I/O issues

Hello,

I recently became aware of this project and took a look, and I have to say it's a really nice example of well written modern Fortran. One thing that raised my eyebrow was the handling of I/O, which seems a bit convoluted. Part of this might be due to the need to interface with matlab (a topic on which I'm not familiar with myself), but some issues are, I think, fixable.

  1. The use of a hard-coded unit number (OUTUNIT = 42). This can lead to issues if an application that uses PRIMA accidentally uses the same unit number for it's own use. Luckily modern Fortran has a solution for this, namely the newunit= specifier for the open statement. By using newunit= the Fortran runtime library assigns a unit number which is guaranteed to not be in use. Similar to fopen in MATLAB and C, or open in POSIX.
  2. Reopening and closing the file for every message. It would be more efficient to open the file once when writing the first message, and then only close it at the end of the optimization.
  3. For integrating into other applications or higher level environments like scipy, I wonder if it would be more flexible if the optimization routines would take an additional optional callback procedure argument for handling messages. Then the user could decide what to do with them, and e.g. printing them to the screen would be integrated with the I/O buffering of the calling application, or it could process the messages somehow and log them somewhere etc.

Add Java binding

I note that there are "Java versions" of COBYLA based on the F77 implementation:

https://github.com/cureos/jcobyla

On one hand, this means there is a need for these solvers in the Java community. On the other hand, these implementations should be switched to the PRIMA ASAP, or people will be bitten by bugs.

Ideally, there should be a pure Rust implementation. But that is possible only in the long run. An interface / binding will meet the need more timely.

Help needed.

Implement recursive test

PRIMA should support recursive calling. For example, cobyla should be able to minimize a function whose definition involves cobyla. The depth of the recursion can be larger than one. We have to test this.

The recursive test has been implemented in MATLAB:

https://github.com/libprima/prima/blob/main/matlab/tests/recursive.m

The MATLAB interface passes the recursive test on Linux, but not on Windows or macOS. I am not sure whether this is a limitation of MATLAB, OS, or PRIMA.

The same test should be conducted on the Fortran implementation, the C interface, and any other implementation or interface added in the future.

Add Rust binding

I note that there are "Rust versions" of COBYLA based on the F77 implementation:

relf/cobyla#11

On one hand, this means there is a need for these solvers in the Rust community. On the other hand, these implementations should be switched to the PRIMA ASAP, or people will be bitten by bugs.

Ideally, there should be a pure Rust implementation. But that is possible only in the long run. An interface / binding will meet the need more timely.

Help needed.

Enable the C interface to accept `nlconstr0` and `f0`

See the discussion at

libprima/PRIMA.jl#14 (comment)

for the reason.

Since C does not support optional inputs (unfortunately), let us do the following:

  1. if the user does not want to input nlconstr0, then it should be set to NULL;
  2. if the user does not want to input f0, then it should be set to NaN;
  3. in cobyla_c.f90, check the values of nlconstr0 and f0 to decide whether to call cobyla with nlconstr0 &f0 or without them (they are optional inputs to cobyla);
  4. (an alternative to 3) in cobyla_c.f90, check the values of nlconstr0 and f0. If nlconstr0 is NULL of f0 is NaN, then call calcfc to evaluate them; afterwards, call cobyla with nlconstr0 and f0.

Thanks.

`PRIMA_INTEGER_KIND = 16` affects solvers' behavior if compiled with `gfortran -Ofast -fno-stack-arrays`

If we set PRIMA_INTEGER_KIND to 16, meaning to use 16-bit integers for internal calculations, then the following solvers behave visibly differently from the standard version when the Fortran code is compiled by gfortran -Ofast -fno-stack-arrays.

UOBYQA, 1--100-dimensional problems
NEWUOA, 1--200-dimensional problems
BOBYQA, 1--200-dimensional bound-constrained problems

The same difference is not observable on other solvers or when the code is compiled with gfortran -ffast-math.

This is unexpected.

See the artifacts of https://github.com/primalib/prima/actions/workflows/profile_int16.yml for the results.

6bec05b25ff7926dd8a21a36ec059f3cc51b22ad: The C example in README does not work

This is what I got:

$ git clone [email protected]:libprima/prima.git && cd prima && git checkout  6bec05b25ff7926dd8a21a36ec059f3cc51b22ad
...

$ cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DBUILD_SHARED_LIBS=OFF
cmake --build build --target install
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zaikunzhang/tmp/prima/build
Scanning dependencies of target primaf
[  1%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/linalg.f90.o
[  3%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/pintrf.f90.o
[  4%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/evaluate.f90.o
[  6%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/powalg.f90.o
[  7%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/geometry.f90.o
[  9%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/history.f90.o
[ 10%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/fprint.f90.o
[ 12%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/message.f90.o
[ 14%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/xinbd.f90.o
[ 15%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/initialize.f90.o
[ 17%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/ratio.f90.o
[ 18%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/redrho.f90.o
[ 20%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/rescue.f90.o
[ 21%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/shiftbase.f90.o
[ 23%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/univar.f90.o
[ 25%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/trustregion.f90.o
[ 26%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/update.f90.o
[ 28%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/bobyqb.f90.o
[ 29%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/preproc.f90.o
[ 31%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/bobyqa.f90.o
[ 32%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/geometry.f90.o
[ 34%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/selectx.f90.o
[ 35%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/initialize.f90.o
[ 37%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/trustregion.f90.o
[ 39%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/update.f90.o
[ 40%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/cobylb.f90.o
[ 42%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/cobyla.f90.o
[ 43%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/geometry.f90.o
[ 45%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/getact.f90.o
[ 46%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/initialize.f90.o
[ 48%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/trustregion.f90.o
[ 50%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/update.f90.o
[ 51%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/lincob.f90.o
[ 53%] Building Fortran object fortran/CMakeFiles/primaf.dir/lincoa/lincoa.f90.o
[ 54%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/geometry.f90.o
[ 56%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/initialize.f90.o
[ 57%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/trustregion.f90.o
[ 59%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/update.f90.o
[ 60%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/newuob.f90.o
[ 62%] Building Fortran object fortran/CMakeFiles/primaf.dir/newuoa/newuoa.f90.o
[ 64%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/geometry.f90.o
[ 65%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/initialize.f90.o
[ 67%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/trustregion.f90.o
[ 68%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/update.f90.o
[ 70%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/uobyqb.f90.o
[ 71%] Building Fortran object fortran/CMakeFiles/primaf.dir/uobyqa/uobyqa.f90.o
[ 73%] Linking Fortran static library libprimaf.a
[ 87%] Built target primaf
Scanning dependencies of target primac
[ 89%] Building Fortran object c/CMakeFiles/primac.dir/cintrf.f90.o
[ 90%] Building Fortran object c/CMakeFiles/primac.dir/bobyqa_c.f90.o
[ 92%] Building Fortran object c/CMakeFiles/primac.dir/cobyla_c.f90.o
[ 93%] Building Fortran object c/CMakeFiles/primac.dir/lincoa_c.f90.o
[ 95%] Building Fortran object c/CMakeFiles/primac.dir/newuoa_c.f90.o
[ 96%] Building Fortran object c/CMakeFiles/primac.dir/uobyqa_c.f90.o
[ 98%] Building C object c/CMakeFiles/primac.dir/prima.c.o
[100%] Linking Fortran static library libprimac.a
[100%] Built target primac
Install the project...
-- Install configuration: "Release"
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/libprimac.a
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/cmake/prima/prima-targets.cmake
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/cmake/prima/prima-targets-release.cmake
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/cmake/prima/prima-config.cmake
-- Installing: /home/zaikunzhang/tmp/prima/install/lib/cmake/prima/prima-config-version.cmake
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/bobyqb_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/huge_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/initialize_lincoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/inf_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/uobyqb_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/consts_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/history_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/update_lincoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/fprint_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/lincob_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/preproc_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/update_bobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/trustregion_uobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/debug_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/infos_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/redrho_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/update_newuoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/cobyla_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/update_uobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/geometry_lincoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/trustregion_cobyla_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/univar_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/message_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/evaluate_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/newuob_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/xinbd_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/initialize_uobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/string_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/selectx_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/bobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/initialize_cobyla_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/geometry_bobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/memory_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/cobylb_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/shiftbase_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/initialize_bobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/linalg_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/geometry_newuoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/update_cobyla_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/trustregion_newuoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/uobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/geometry_cobyla_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/newuoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/infnan_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/trustregion_bobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/trustregion_lincoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/checkexit_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/ratio_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/pintrf_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/rescue_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/lincoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/getact_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/initialize_newuoa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/geometry_uobyqa_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/mod/powalg_mod.mod
-- Installing: /home/zaikunzhang/tmp/prima/install/include/prima/prima.h
[26-Thu-22:34:00 zX11 ~/tmp/prima]
z$ cd fortran/examples/cobyla
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DPRIMA_DIR=$PWD/../../../install/lib/cmake/prima/
cmake --build build --target install
./install/bin/cobyla_example
-- The Fortran compiler identification is GNU 11.4.0
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/f95 - skipped
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zaikunzhang/tmp/prima/fortran/examples/cobyla/build
Scanning dependencies of target cobyla_example
[ 50%] Building Fortran object CMakeFiles/cobyla_example.dir/cobyla_example.f90.o
[100%] Linking Fortran executable cobyla_example
[100%] Built target cobyla_example
Install the project...
-- Install configuration: ""
-- Installing: /home/zaikunzhang/tmp/prima/fortran/examples/cobyla/install/bin/cobyla_example

Return from COBYLA because the trust region radius reaches its lower bound.
Number of function values = 642   Least value of F =  7.348005527767969E-011
The corresponding X is:
 6.687654693497622E-002   2.887373308458359E-001   3.666880613642483E-001   6.333153906725660E-001
 7.112679740025477E-001   9.331256571155258E-001

Return from COBYLA because the trust region radius reaches its lower bound.
Number of function values = 117   Least value of F = -8.660253768922790E-001   Constraint violation =  4.013687715520575E-010
The corresponding X is:
 8.661407979395734E-001   1.306240386801172E+000  -1.591365235013622E-010   9.999999998756539E-001
 8.660254038891088E-001   4.999999999312115E-001   2.308425905718184E-004   1.806440287472845E+000
 8.064403183272396E-001
The constraint value is:
-2.486921779620843E-010  -3.496540129762604E-001   1.125055049122636E-010  -9.698051695039567E-009
-3.499764252639898E-001  -8.595537948075105E-009   4.013687715520575E-010  -3.496540092517841E-001
-8.420485864135685E-009  -8.661407980397428E-001   1.283341086699288E-010  -6.983978023918092E-001
-1.564307758264958E+000  -8.064403183272396E-001
[26-Thu-22:34:05 zX11 ~/tmp/prima/fortran/examples/cobyla]
z$ cd ../../../
[26-Thu-22:34:15 zX11 ~/tmp/prima]
z$ cd c/examples/cobyla
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DPRIMA_DIR=$PWD/../../../install/lib/cmake/prima/
cmake --build build --target install
./install/bin/cobyla_example
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zaikunzhang/tmp/prima/c/examples/cobyla/build
[ 50%] Building C object CMakeFiles/cobyla_example.dir/cobyla_example.c.o
[100%] Linking C executable cobyla_example
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(cobyla.f90.o): in function `__cobyla_mod_MOD_cobyla':
cobyla.f90:(.text+0x2d96): undefined reference to `_gfortran_shape_4'
/usr/bin/ld: cobyla.f90:(.text+0x2e35): undefined reference to `_gfortran_reshape_r8'
/usr/bin/ld: cobyla.f90:(.text+0x4948): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: cobyla.f90:(.text+0x498e): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: cobyla.f90:(.text+0x4f73): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x4fa1): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x4fc9): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x61fd): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x625b): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6a68): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6a80): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6a9c): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6ab4): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6ad0): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6aec): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6b08): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6b20): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6b3c): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6b52): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6b6a): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6b86): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6ba2): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6bbe): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6bda): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6bf2): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6c0e): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: cobyla.f90:(.text+0x6c2a): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(cobylb.f90.o): in function `__cobylb_mod_MOD_cobylb':
cobylb.f90:(.text+0x17a4): undefined reference to `_gfortran_minval_r8'
/usr/bin/ld: cobylb.f90:(.text+0x1ab7): undefined reference to `_gfortran_maxval_r8'
/usr/bin/ld: cobylb.f90:(.text+0x2a90): undefined reference to `_gfortran_spread'
/usr/bin/ld: cobylb.f90:(.text+0x3b4f): undefined reference to `_gfortran_spread'
/usr/bin/ld: cobylb.f90:(.text+0x489c): undefined reference to `_gfortran_minval_r8'
/usr/bin/ld: cobylb.f90:(.text+0x4d40): undefined reference to `_gfortran_maxval_r8'
/usr/bin/ld: cobylb.f90:(.text+0x9218): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobylb.f90:(.text+0x927d): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobylb.f90:(.text+0x929a): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobylb.f90:(.text+0x92f7): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: cobylb.f90:(.text+0x93e2): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o): in function `__geometry_cobyla_mod_MOD_geostep':
geometry.f90:(.text+0x72a): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x1a41): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: geometry.f90:(.text+0x1a59): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o): in function `__geometry_cobyla_mod_MOD_setdrop_tr':
geometry.f90:(.text+0x22c8): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x2b43): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(initialize.f90.o): in function `__initialize_cobyla_mod_MOD_initxfc':
initialize.f90:(.text+0x2fba): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(trustregion.f90.o): in function `__trustregion_cobyla_mod_MOD_trstlp_sub.constprop.0':
trustregion.f90:(.text+0x2f9a): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: trustregion.f90:(.text+0x4f8d): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: trustregion.f90:(.text+0x504b): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: trustregion.f90:(.text+0x5241): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(trustregion.f90.o):trustregion.f90:(.text+0x525e): more undefined references to `_gfortran_os_error_at' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(trustregion.f90.o): in function `__trustregion_cobyla_mod_MOD_trstlp':
trustregion.f90:(.text+0x5875): undefined reference to `_gfortran_reshape_r8'
/usr/bin/ld: trustregion.f90:(.text+0x6283): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(update.f90.o): in function `__update_cobyla_mod_MOD_updatepole':
update.f90:(.text+0xc05): undefined reference to `_gfortran_spread'
/usr/bin/ld: update.f90:(.text+0x1daf): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(update.f90.o): in function `__update_cobyla_mod_MOD_updatexfc':
update.f90:(.text+0x3ee7): undefined reference to `_gfortran_spread'
/usr/bin/ld: update.f90:(.text+0x4c12): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(bobyqa.f90.o): in function `__bobyqa_mod_MOD_bobyqa':
bobyqa.f90:(.text+0x840): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: bobyqa.f90:(.text+0x886): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: bobyqa.f90:(.text+0x1b4e): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: bobyqa.f90:(.text+0x1be8): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: bobyqa.f90:(.text+0x1c2e): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: bobyqa.f90:(.text+0x1e48): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(bobyqb.f90.o): in function `__bobyqb_mod_MOD_bobyqb':
bobyqb.f90:(.text+0x2c54): undefined reference to `_gfortran_spread'
/usr/bin/ld: bobyqb.f90:(.text+0x4e7e): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o): in function `__geometry_bobyqa_mod_MOD_geostep':
geometry.f90:(.text+0x118f): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x1f20): undefined reference to `lround'
/usr/bin/ld: geometry.f90:(.text+0x2570): undefined reference to `lround'
/usr/bin/ld: geometry.f90:(.text+0x273b): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x2a5f): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x2e7e): undefined reference to `_gfortran_maxloc1_4_r8'
/usr/bin/ld: geometry.f90:(.text+0x417b): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o): in function `__geometry_bobyqa_mod_MOD_setdrop_tr':
geometry.f90:(.text+0x76b7): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x7e7f): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x8050): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x8210): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(trustregion.f90.o): in function `__trustregion_bobyqa_mod_MOD_trsbox':
trustregion.f90:(.text+0x2a6f): undefined reference to `lround'
/usr/bin/ld: trustregion.f90:(.text+0x6bd9): undefined reference to `lround'
/usr/bin/ld: trustregion.f90:(.text+0x74e9): undefined reference to `lround'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(rescue.f90.o): in function `__rescue_mod_MOD_rescue':
rescue.f90:(.text+0xc0a): undefined reference to `_gfortran_spread'
/usr/bin/ld: rescue.f90:(.text+0x2807): undefined reference to `_gfortran_spread'
/usr/bin/ld: rescue.f90:(.text+0x2938): undefined reference to `log10f'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(lincoa.f90.o): in function `__lincoa_mod_MOD_lincoa':
lincoa.f90:(.text+0x354b): undefined reference to `_gfortran_shape_4'
/usr/bin/ld: lincoa.f90:(.text+0x35e7): undefined reference to `_gfortran_reshape_r8'
/usr/bin/ld: lincoa.f90:(.text+0x43da): undefined reference to `_gfortran_spread'
/usr/bin/ld: lincoa.f90:(.text+0x53b5): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x583d): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: lincoa.f90:(.text+0x5883): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: lincoa.f90:(.text+0x67aa): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x7017): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x7033): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x704f): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x706b): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x7087): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(lincoa.f90.o):lincoa.f90:(.text+0x70a3): more undefined references to `_gfortran_runtime_error_at' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(lincoa.f90.o): in function `__lincoa_mod_MOD_lincoa':
lincoa.f90:(.text+0x70f3): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x710b): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x7123): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x713f): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x7157): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x7173): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x718b): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x71a3): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x71bb): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x71d7): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x71f3): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x720f): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x722b): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincoa.f90:(.text+0x7247): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(newuoa.f90.o):newuoa.f90:(.text+0xcef): more undefined references to `_gfortran_runtime_error_at' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(newuoa.f90.o): in function `__newuoa_mod_MOD_newuoa':
newuoa.f90:(.text+0xde7): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: newuoa.f90:(.text+0xe2d): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: newuoa.f90:(.text+0xfce): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(uobyqa.f90.o): in function `__uobyqa_mod_MOD_uobyqa':
uobyqa.f90:(.text+0xcca): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: uobyqa.f90:(.text+0xdc7): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: uobyqa.f90:(.text+0xe0d): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: uobyqa.f90:(.text+0xfae): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_vec2smat':
linalg.f90:(.text+0x6a7): undefined reference to `lroundf'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_linspace_i':
linalg.f90:(.text+0x109b): undefined reference to `lround'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_trueloc':
linalg.f90:(.text+0x1d59): undefined reference to `_gfortran_pack'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_sort_i1':
linalg.f90:(.text+0x317a): undefined reference to `_gfortran_compare_string'
/usr/bin/ld: linalg.f90:(.text+0x328a): undefined reference to `_gfortran_compare_string'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_sort_i2':
linalg.f90:(.text+0x34b1): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: linalg.f90:(.text+0x34cf): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_named_norm_mat':
linalg.f90:(.text+0x401b): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: linalg.f90:(.text+0x4043): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: linalg.f90:(.text+0x4152): undefined reference to `_gfortran_select_string'
/usr/bin/ld: linalg.f90:(.text+0x41aa): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: linalg.f90:(.text+0x41cf): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: linalg.f90:(.text+0x4246): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: linalg.f90:(.text+0x42c2): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: linalg.f90:(.text+0x4728): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_p_norm':
linalg.f90:(.text+0x4aa7): undefined reference to `pow'
/usr/bin/ld: linalg.f90:(.text+0x4e0c): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_named_norm_vec':
linalg.f90:(.text+0x4fce): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: linalg.f90:(.text+0x4ff6): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: linalg.f90:(.text+0x50d3): undefined reference to `_gfortran_select_string'
/usr/bin/ld: linalg.f90:(.text+0x52b4): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: linalg.f90:(.text+0x52d4): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: linalg.f90:(.text+0x5343): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: linalg.f90:(.text+0x53ad): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: linalg.f90:(.text+0x5563): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_planerot':
linalg.f90:(.text+0x5f6b): undefined reference to `_gfortran_reshape_r8'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_diag':
linalg.f90:(.text+0x6c40): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: linalg.f90:(.text+0x6c55): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_lsqr_rdiag':
linalg.f90:(.text+0xeee3): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(linalg.f90.o): in function `__linalg_mod_MOD_p_norm':
linalg.f90:(.text+0x4af4): undefined reference to `pow'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(string.f90.o): in function `__string_mod_MOD_strip':
string.f90:(.text+0x2e9): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: string.f90:(.text+0x2fc): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: string.f90:(.text+0x330): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(string.f90.o): in function `__string_mod_MOD_int2str':
string.f90:(.text+0x40d): undefined reference to `_gfortran_st_write'
/usr/bin/ld: string.f90:(.text+0x41d): undefined reference to `_gfortran_transfer_integer_write'
/usr/bin/ld: string.f90:(.text+0x42b): undefined reference to `_gfortran_st_write_done'
/usr/bin/ld: string.f90:(.text+0x43b): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: string.f90:(.text+0x452): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(string.f90.o): in function `__string_mod_MOD_real2str_scalar':
string.f90:(.text+0x610): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: string.f90:(.text+0x6bc): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: string.f90:(.text+0x713): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: string.f90:(.text+0x7a0): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: string.f90:(.text+0x809): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(string.f90.o):string.f90:(.text+0x8a4): more undefined references to `_gfortran_concat_string' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(string.f90.o): in function `__string_mod_MOD_real2str_scalar':
string.f90:(.text+0x9c0): undefined reference to `_gfortran_st_write'
/usr/bin/ld: string.f90:(.text+0x9d0): undefined reference to `_gfortran_transfer_real_write'
/usr/bin/ld: string.f90:(.text+0x9d8): undefined reference to `_gfortran_st_write_done'
/usr/bin/ld: string.f90:(.text+0x9e5): undefined reference to `_gfortran_string_len_trim'
/usr/bin/ld: string.f90:(.text+0xad2): undefined reference to `_gfortran_st_write'
/usr/bin/ld: string.f90:(.text+0xae2): undefined reference to `_gfortran_transfer_real_write'
/usr/bin/ld: string.f90:(.text+0xaea): undefined reference to `_gfortran_st_write_done'
/usr/bin/ld: string.f90:(.text+0xafa): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: string.f90:(.text+0xb17): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(preproc.f90.o): in function `__preproc_mod_MOD_preproc':
preproc.f90:(.text+0x2bb): undefined reference to `_gfortran_compare_string'
/usr/bin/ld: preproc.f90:(.text+0x345): undefined reference to `_gfortran_select_string'
/usr/bin/ld: preproc.f90:(.text+0x432): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x460): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x4ed): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x5e8): undefined reference to `_gfortran_compare_string'
/usr/bin/ld: preproc.f90:(.text+0x60e): undefined reference to `_gfortran_compare_string'
/usr/bin/ld: preproc.f90:(.text+0x70f): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x799): undefined reference to `_gfortran_compare_string'
/usr/bin/ld: preproc.f90:(.text+0x7b8): undefined reference to `_gfortran_compare_string'
/usr/bin/ld: preproc.f90:(.text+0x8b0): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x9e1): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0xb13): undefined reference to `_gfortran_compare_string'
/usr/bin/ld: preproc.f90:(.text+0xd05): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0xd53): undefined reference to `_gfortran_compare_string'
/usr/bin/ld: preproc.f90:(.text+0xe15): undefined reference to `_gfortran_select_string'
/usr/bin/ld: preproc.f90:(.text+0xf32): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0xf82): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x1065): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x10ec): undefined reference to `_gfortran_compare_string'
/usr/bin/ld: preproc.f90:(.text+0x130a): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x1341): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x1385): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x1451): undefined reference to `_gfortran_compare_string'
/usr/bin/ld: preproc.f90:(.text+0x14eb): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x15e5): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x2203): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x2249): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: preproc.f90:(.text+0x2292): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(preproc.f90.o):preproc.f90:(.text+0x2485): more undefined references to `_gfortran_concat_string' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(preproc.f90.o): in function `__preproc_mod_MOD_preproc':
preproc.f90:(.text+0x3a33): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: preproc.f90:(.text+0x3a4b): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(powalg.f90.o): in function `__powalg_mod_MOD_errh':
powalg.f90:(.text+0x2902): undefined reference to `_gfortran_maxval_r8'
/usr/bin/ld: powalg.f90:(.text+0x2a09): undefined reference to `_gfortran_minval_r8'
/usr/bin/ld: powalg.f90:(.text+0x2c02): undefined reference to `_gfortran_maxval_r8'
/usr/bin/ld: powalg.f90:(.text+0x2d1d): undefined reference to `_gfortran_minval_r8'
/usr/bin/ld: powalg.f90:(.text+0x3abd): undefined reference to `_gfortran_minval_r8'
/usr/bin/ld: powalg.f90:(.text+0x3cfa): undefined reference to `_gfortran_minval_r8'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(powalg.f90.o): in function `__powalg_mod_MOD_calvlag_lfqint':
powalg.f90:(.text+0x6d08): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: powalg.f90:(.text+0x6d20): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(powalg.f90.o): in function `__powalg_mod_MOD_errquad':
powalg.f90:(.text+0xcfe3): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(history.f90.o): in function `__history_mod_MOD_rangehist':
history.f90:(.text+0xa31): undefined reference to `_gfortran_shape_4'
/usr/bin/ld: history.f90:(.text+0xac6): undefined reference to `_gfortran_reshape_r8'
/usr/bin/ld: history.f90:(.text+0xeff): undefined reference to `_gfortran_shape_4'
/usr/bin/ld: history.f90:(.text+0xf94): undefined reference to `_gfortran_reshape_r8'
/usr/bin/ld: history.f90:(.text+0x1401): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: history.f90:(.text+0x1419): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: history.f90:(.text+0x1431): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o): in function `__message_mod_MOD_fmsg':
message.f90:(.text+0x17f): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x1b2): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x237): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x2ff): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x345): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o):message.f90:(.text+0x38b): more undefined references to `_gfortran_concat_string' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o): in function `__message_mod_MOD_fmsg':
message.f90:(.text+0xa47): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: message.f90:(.text+0xa76): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: message.f90:(.text+0xaee): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0xbd3): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0xc19): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0xc5f): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0xce9): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o):message.f90:(.text+0xd8c): more undefined references to `_gfortran_concat_string' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o): in function `__message_mod_MOD_fmsg':
message.f90:(.text+0x10bd): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o): in function `__message_mod_MOD_cpenmsg':
message.f90:(.text+0x1196): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x1263): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: message.f90:(.text+0x1280): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: message.f90:(.text+0x12f6): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x13f6): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o): in function `__message_mod_MOD_rhomsg':
message.f90:(.text+0x15f2): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x1642): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x1692): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o):message.f90:(.text+0x172d): more undefined references to `_gfortran_concat_string' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o): in function `__message_mod_MOD_rhomsg':
message.f90:(.text+0x2107): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: message.f90:(.text+0x2136): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: message.f90:(.text+0x21ae): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x228d): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x22d3): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x2319): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x239f): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o):message.f90:(.text+0x2440): more undefined references to `_gfortran_concat_string' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o): in function `__message_mod_MOD_rhomsg':
message.f90:(.text+0x2a4d): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o): in function `__message_mod_MOD_retmsg':
message.f90:(.text+0x2c10): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: message.f90:(.text+0x2c35): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: message.f90:(.text+0x2ca9): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x2da2): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x2dd5): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x2e05): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: message.f90:(.text+0x2e2d): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: message.f90:(.text+0x2ea6): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x3012): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x30de): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x3124): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: message.f90:(.text+0x316a): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o):message.f90:(.text+0x31f4): more undefined references to `_gfortran_concat_string' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(message.f90.o): in function `__message_mod_MOD_retmsg':
message.f90:(.text+0x410d): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(fprint.f90.o): in function `__fprint_mod_MOD_fprint':
fprint.f90:(.text+0xdb): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: fprint.f90:(.text+0x16d): undefined reference to `_gfortran_select_string'
/usr/bin/ld: fprint.f90:(.text+0x1f8): undefined reference to `_gfortran_st_inquire'
/usr/bin/ld: fprint.f90:(.text+0x2d7): undefined reference to `_gfortran_st_open'
/usr/bin/ld: fprint.f90:(.text+0x311): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: fprint.f90:(.text+0x3c8): undefined reference to `_gfortran_string_index'
/usr/bin/ld: fprint.f90:(.text+0x449): undefined reference to `_gfortran_st_write'
/usr/bin/ld: fprint.f90:(.text+0x46e): undefined reference to `_gfortran_transfer_character_write'
/usr/bin/ld: fprint.f90:(.text+0x476): undefined reference to `_gfortran_st_write_done'
/usr/bin/ld: fprint.f90:(.text+0x4b8): undefined reference to `_gfortran_string_index'
/usr/bin/ld: fprint.f90:(.text+0x4db): undefined reference to `_gfortran_string_len_trim'
/usr/bin/ld: fprint.f90:(.text+0x51a): undefined reference to `_gfortran_st_close'
/usr/bin/ld: fprint.f90:(.text+0x5bf): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: fprint.f90:(.text+0x5ff): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: fprint.f90:(.text+0x698): undefined reference to `_gfortran_st_write'
/usr/bin/ld: fprint.f90:(.text+0x6a6): undefined reference to `_gfortran_transfer_character_write'
/usr/bin/ld: fprint.f90:(.text+0x6ae): undefined reference to `_gfortran_st_write_done'
/usr/bin/ld: fprint.f90:(.text+0x7ca): undefined reference to `_gfortran_st_open'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(debug.F90.o): in function `__debug_mod_MOD_warning':
debug.F90:(.text+0x63): undefined reference to `_gfortran_st_write'
/usr/bin/ld: debug.F90:(.text+0x85): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: debug.F90:(.text+0x9a): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: debug.F90:(.text+0xdc): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: debug.F90:(.text+0x128): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: debug.F90:(.text+0x154): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: debug.F90:(.text+0x169): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: debug.F90:(.text+0x1ae): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: debug.F90:(.text+0x20d): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: debug.F90:(.text+0x223): undefined reference to `_gfortran_transfer_character_write'
/usr/bin/ld: debug.F90:(.text+0x233): undefined reference to `_gfortran_st_write_done'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(debug.F90.o): in function `__debug_mod_MOD_errstop':
debug.F90:(.text+0x2c8): undefined reference to `_gfortran_st_write'
/usr/bin/ld: debug.F90:(.text+0x2ea): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: debug.F90:(.text+0x2ff): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: debug.F90:(.text+0x341): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: debug.F90:(.text+0x38b): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: debug.F90:(.text+0x3b7): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: debug.F90:(.text+0x3cc): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: debug.F90:(.text+0x40e): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: debug.F90:(.text+0x468): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: debug.F90:(.text+0x47e): undefined reference to `_gfortran_transfer_character_write'
/usr/bin/ld: debug.F90:(.text+0x48e): undefined reference to `_gfortran_st_write_done'
/usr/bin/ld: debug.F90:(.text+0x4a1): undefined reference to `_gfortran_error_stop_numeric'
/usr/bin/ld: debug.F90:(.text+0x4af): undefined reference to `_gfortran_error_stop_string'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(debug.F90.o): in function `__debug_mod_MOD_validate':
debug.F90:(.text+0x518): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: debug.F90:(.text+0x52b): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: debug.F90:(.text+0x54d): undefined reference to `_gfortran_adjustl'
/usr/bin/ld: debug.F90:(.text+0x562): undefined reference to `_gfortran_string_trim'
/usr/bin/ld: debug.F90:(.text+0x5a1): undefined reference to `_gfortran_concat_string'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(memory.F90.o): in function `__memory_mod_MOD_alloc_character':
memory.F90:(.text+0x201): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(selectx.f90.o): in function `__selectx_mod_MOD_isbetter01':
selectx.f90:(.text+0x488): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(selectx.f90.o): in function `__selectx_mod_MOD_isbetter10':
selectx.f90:(.text+0x908): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(shiftbase.f90.o): in function `__shiftbase_mod_MOD_shiftbase_qint':
shiftbase.f90:(.text+0x3a7): undefined reference to `_gfortran_spread'
/usr/bin/ld: shiftbase.f90:(.text+0xa5e): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(shiftbase.f90.o): in function `__shiftbase_mod_MOD_shiftbase_lfqint':
shiftbase.f90:(.text+0x12ea): undefined reference to `_gfortran_spread'
/usr/bin/ld: shiftbase.f90:(.text+0x2ce2): undefined reference to `_gfortran_spread'
/usr/bin/ld: shiftbase.f90:(.text+0x31f2): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(lincob.f90.o):lincob.f90:(.text+0x518d): more undefined references to `_gfortran_spread' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(lincob.f90.o): in function `__lincob_mod_MOD_lincob':
lincob.f90:(.text+0xddb3): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincob.f90:(.text+0xddd6): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: lincob.f90:(.text+0xde0e): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincob.f90:(.text+0xde2b): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincob.f90:(.text+0xde48): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincob.f90:(.text+0xde70): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: lincob.f90:(.text+0xdea8): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(lincob.f90.o):lincob.f90:(.text+0xdf2b): more undefined references to `_gfortran_os_error_at' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(newuob.f90.o): in function `__newuob_mod_MOD_newuob':
newuob.f90:(.text+0x167b): undefined reference to `_gfortran_spread'
/usr/bin/ld: newuob.f90:(.text+0x2ebe): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(uobyqb.f90.o): in function `__uobyqb_mod_MOD_uobyqb':
uobyqb.f90:(.text+0x130e): undefined reference to `_gfortran_spread'
/usr/bin/ld: uobyqb.f90:(.text+0x239c): undefined reference to `_gfortran_spread'
/usr/bin/ld: uobyqb.f90:(.text+0x3cbf): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(initialize.f90.o): in function `__initialize_lincoa_mod_MOD_initxf':
initialize.f90:(.text+0x6bcd): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: initialize.f90:(.text+0x8160): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: initialize.f90:(.text+0x817c): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: initialize.f90:(.text+0x8198): undefined reference to `_gfortran_runtime_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(trustregion.f90.o): in function `__trustregion_lincoa_mod_MOD_trstep':
trustregion.f90:(.text+0x65c8): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o): in function `__geometry_lincoa_mod_MOD_geostep':
geometry.f90:(.text+0xc57): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x328f): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x4fe9): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: geometry.f90:(.text+0x5001): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: geometry.f90:(.text+0x5019): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o): in function `__geometry_lincoa_mod_MOD_setdrop_tr':
geometry.f90:(.text+0x5462): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x5c0e): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x5de3): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x5fb7): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(trustregion.f90.o): in function `__trustregion_newuoa_mod_MOD_circle_fun_trsapp':
trustregion.f90:(.text+0x2f): undefined reference to `sincos'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(trustregion.f90.o): in function `__trustregion_newuoa_mod_MOD_trsapp':
trustregion.f90:(.text+0x2b49): undefined reference to `sincos'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o): in function `__geometry_newuoa_mod_MOD_circle_fun_biglag':
geometry.f90:(.text+0x39): undefined reference to `sincos'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o): in function `__geometry_newuoa_mod_MOD_circle_fun_bigden':
geometry.f90:(.text+0x163): undefined reference to `_ZGVbN2v_cos'
/usr/bin/ld: geometry.f90:(.text+0x17c): undefined reference to `_ZGVbN2v_cos'
/usr/bin/ld: geometry.f90:(.text+0x1d0): undefined reference to `_ZGVbN2v_sin'
/usr/bin/ld: geometry.f90:(.text+0x1e8): undefined reference to `_ZGVbN2v_sin'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o): in function `__geometry_newuoa_mod_MOD_biglag.constprop.0':
geometry.f90:(.text+0x1f2c): undefined reference to `sincos'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o): in function `__geometry_newuoa_mod_MOD_geostep':
geometry.f90:(.text+0x562d): undefined reference to `cos'
/usr/bin/ld: geometry.f90:(.text+0x5643): undefined reference to `sin'
/usr/bin/ld: geometry.f90:(.text+0x58c5): undefined reference to `sincos'
/usr/bin/ld: geometry.f90:(.text+0x6b94): undefined reference to `sincos'
/usr/bin/ld: geometry.f90:(.text+0x6d28): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o): in function `__geometry_newuoa_mod_MOD_setdrop_tr':
geometry.f90:(.text+0x7cd5): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x84ce): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x86a3): undefined reference to `_gfortran_spread'
/usr/bin/ld: geometry.f90:(.text+0x885d): undefined reference to `_gfortran_spread'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(geometry.f90.o):geometry.f90:(.text+0x3df8): more undefined references to `_gfortran_spread' follow
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(trustregion.f90.o): in function `__trustregion_uobyqa_mod_MOD_trstep':
trustregion.f90:(.text+0x42af): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: trustregion.f90:(.text+0x442a): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: /home/zaikunzhang/tmp/prima/install/lib/libprimaf.a(getact.f90.o): in function `__getact_mod_MOD_getact':
getact.f90:(.text+0x43ab): undefined reference to `_gfortran_os_error_at'
/usr/bin/ld: getact.f90:(.text+0x43cd): undefined reference to `_gfortran_os_error_at'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/cobyla_example.dir/build.make:99: cobyla_example] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/cobyla_example.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
bash: ./install/bin/cobyla_example: No such file or directory

Creating a Python reference implementation

Hi all,

I've been discussing with @zaikunzhang about creating a Python reference implementation and now I'm making it official by creating this issue!

I think a Python reference implementation would be a great asset. @zaikunzhang mentioned readability several times in his initial post on the Fortran discourse, and indeed many references to the idea that the code should be as similar as possible to the mathematical presentation. I'd argue that Python is an even better language for this than Fortran, but the goal here is not to replace one with the other, both are necessary for separate reasons.

There's some questions about how to go about this. I think that as a starting point COBYLA is the best place since the current version of SciPy contains the old F77 COBYLA implementation so we could use that for a few tests as a bootstrapping with (not for long term, just to get started. Long term it should probably be tested against the modern Fortran implementation).

@zaikunzhang suggested using tools to automatically translate the Fortran code into Python. The idea is that automatic translation might be easier to verify, but I'm not so sure about this for two reasons. First of all, I'm not aware of the existence of tools to translate Fortran to Python. I've done some Googling and not found anything compelling (i.e. something that didn't look like someone's toy project from a few years ago). I figured the most likely path for such a translation would be via LFortran and LLVM, but no luck there either. Secondly, regardless of how the code is created, the verification checks should be the same regardless.

One other point I'd like to bring up for discussion (and I will summarize these at the end) is the use of language features. I think @zaikunzhang wants to limit these, but we're entering into vague territory here and additional detail would be welcome. For example, Python has a number of features that improve readability, like lambda expressions, list comprehensions, numpy's @ symbol for matmul, etc., most of which I think are either readily understandable or quickly understandable with a little documentation. There are some more complicated ones, like the yield expression, which I would avoid unless it was both very intuitive AND the alternative would be cumbersome. If one chooses to use fancy language features when there are non-cumbersome alternatives, well that's just showing off 🤓.

So to summarize, here are 3 points for discussion:

  1. Are there tools for translating Fortran to Python that I'm not aware of that could help?
  2. What does verification look like? Should we just find a way to add the Python implementation to (some of) the existing Fortran tests?
  3. Re: language features, how should we frame our thinking on them? Perhaps @zaikunzhang has an example of a Fortran language feature he has explicitly chosen not to use for sake of readability?

Looking forward to working on this with you all!

`npt` is missing from the C interface

Hi @jschueller Julien,

I noted just now that npt was not an input of the C interface. This is an important parameter, and it should be exposed to the user. The recommended value is 2n+1, which should be documented clearly and illustrated in the examples. Powell did mention that other values may provide excellent results in some situations.

npt exists only in NEWUOA, BOBYQA, and LINCOA (COBYLA essentially fixes npt=n+1, and UOBYQA fixes npt=(n+1)(n+2)/2, and hence they are not inputs):

! NPT
! Input, INTEGER(IK) scalar, default: 2N + 1.
! NPT is the number of interpolation conditions for each trust region model. Its value must be in
! the interval [N+2, (N+1)(N+2)/2].

! NPT
! Input, INTEGER(IK) scalar, default: 2N + 1.
! NPT is the number of interpolation conditions for each trust region model. Its value must be in
! the interval [N+2, (N+1)(N+2)/2]. Powell commented that "the value NPT = 2*N+1 being recommended
! for a start ... much larger values tend to be inefficient, because the amount of routine work of
! each iteration is of magnitude NPT**2, and because the achievement of adequate accuracy in some
! matrix calculations becomes more difficult. Some excellent numerical results have been found in
! the case NPT=N+6 even with more than 100 variables." And "choices that exceed 2*N+1 are not
! recommended" by Powell.

! NPT
! Input, INTEGER(IK) scalar, default: 2N + 1.
! NPT is the number of interpolation conditions for each trust region model. Its value must be in
! the interval [N+2, (N+1)(N+2)/2]. Typical choices of Powell were NPT=N+6 and NPT=2*N+1. Powell
! commented in his code that "larger values tend to be highly inefficient when the number of
! variables is substantial, due to the amount of work and extra difficulty of adjusting more
! points."

See also discussions at emmt/OptimPack#2 (comment) .

Thanks.

Zaikun

`ftarget` is missing from the C interface

Hi @jschueller ,

ftarget is an essential input from the user. I think it will be good to include it in the C interface.

If the user does not want to / cannot specify ftarget, then he/she should input -INFINITY, where INFINITY is the micro in math.h for representing infinity. I hope my understanding is correct and I hope INFINITY is standard C. It is a pity that C does not support optional arguments.

This was related to a previous comment from Tom on the Python interface, where the same comment applies, and we can default ftarget to $-\infty$ if there is no input from the user.

Thank you.

Zaikun

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.