Code Monkey home page Code Monkey logo

gravity's Introduction

License Github Actions Code Coverage download

Chat on Slack

Mathematical Modeling for Optimization and Machine Learning

Citing

The original paper was presentend at the Machine Learning Open Source Software Workshop at NeurIPS 2018, a longer version of the paper can be downloaded here.

Bibtex ref: @article{Gravity, title={Gravity: A Mathematical Modeling Language for Optimization and Machine Learning}, author={Hassan Hijazi and Guanglei Wang and Carleton Coffrin}, journal={Machine Learning Open Source Software Workshop at NeurIPS 2018}, year={2018}, note = {Available at \url{www.gravityopt.com}.}, publisher={The Thirty-second Annual Conference on Neural Information Processing Systems (NeurIPS)} }

Getting Started

First, you will need to install an IDE, I recommend to choose among the following:

Visual Studio Clion Xcode Eclipse

Then, follow the instructions presented in INSTALL.md.

After building, the Gravity library can be found under Gravity/lib, and the executables (from Gravity/examples) can be found under Gravity/bin/Release

The model below was implemented in Xcode:

cover-example

Some Numerical Results:

Performance Profile on ACOPF

The first figure below is a performance profile illustrating percentage of instances solved as a function of time. The figure compares Gravity, JuMP and AMPL's NL interface (used by AMPL and Pyomo) on all standard instances found in the PGLIB benchmark library.

Performance Profile on ACOPF

The figure below compares model build time between Gravity and JuMP on the PGLIB benchmarks.

Model Build Time on ACOPF


Performance Profile on Inverse Ising Model

Performance Profile on Inverse Ising

License

Gravity is licensed under the BSD 3-Clause License. Please see the LICENSE file for details.

Contributors

See the list of contributors here

gravity's People

Contributors

guanglei1wang avatar guangleiwang13 avatar hhijazi avatar mertcanyetkin avatar smithagopinath avatar svigerske 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gravity's Issues

LNK2001 Error "Unresolved External Symbol" using Visual Studio 2019 on Windows 10

I successfully installed Gravity and all the test executables in the release folder can run without bug. However, when I try to write code using Visual Studio 2019, it gave many LNK2001 errors (Screenshot of code and error attached below). I have add the include folder and lib folder to the correct place in the project property settings, similar to the tutorial for Gurobi. What should I do to fix these errors? Thanks

Screenshot 2022-12-17 145617

link error when issuing make

Hi,
I am trying to install Gravity on Linux. Following the instructions in INSTALL.md, when I issue the last command make -j4 I found some linking error during the make process.
[ 77%] Linking CXX executable ../../bin/Release/acuc /lib/../lib64/crt1.o: In function '_start':
(.text+0x20): undefined reference to 'main'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/acuc.dir/build.make:162: ../bin/Release/acuc] Error 1
make[1]: *** [CMakeFiles/Makefile2:487: examples/CMakeFiles/acuc.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
The compiler version is GCC 7.3.1 and the CMake version is 3.13. In the cmake configuration, two solvers (Gurobi and Ipopt) are enabled successfully. Could you please look into this error? Thank you very much.

Fails to find clp: Could NOT find CLP (missing: UTILS_LIBRARY CLP_LIBRARY CLP_INCLUDE_DIR)

Looking for CLP in  folder
CMake Error at /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
  Could NOT find CLP (missing: UTILS_LIBRARY CLP_LIBRARY CLP_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindCLP.cmake:19 (find_package_handle_standard_args)
  CMakeLists.txt:115 (find_package)

clp is installed:

$ pkg info | grep -i clp
coin-or-Clp-1.17.3_4           Linear Programming Solver
$ pkg-config --cflags --libs clp
-I/usr/local/include/coin -I/usr/local/include/coin/ThirdParty -DCOIN_USE_MUMPS_MPI_H -L/usr/local/lib -lClpSolver -lClp /usr/local/lib/libCoinUtils.so -lcoinasl -ldl -lcoinmumps -lblas -L/usr/local/lib/gcc10 -L/usr/local/bin -L/usr/local/lib/gcc10/gcc/x86_64-portbld-freebsd12.2/10.2.0 -L/usr/local/lib/gcc10/gcc/x86_64-portbld-freebsd12.2/10.2.0/../../../../../x86_64-portbld-freebsd12.2/lib -L/usr/local/lib/gcc10/gcc/x86_64-portbld-freebsd12.2/10.2.0/../../.. -lgfortran -lm -lssp_nonshared -lquadmath -lcoinmetis 

OS: FreeBSD 12.2

Gravity for windows

I tried installing Gravity for Windows 10 and I am facing issues as it cannot find some library functions, can you help me with that?

Possible Bug

The following short program fails with: libc++abi.dylib: terminating with uncaught exception of type std::invalid_argument: No derivatives stored!.

Background: I've implemented OPF for unbalanced networks but was getting this crash. I was able to still cause the error with the greatly simplified program below. It may be possible to further reduce its complexity.

#define USE_IPOPT

#include <iostream>

#include <gravity/model.h>
#include <gravity/solver.h>
#include <SgtCore/Common.h>

int main()
{
    using namespace gravity;
    using namespace std;

    Model<> mod;

    var<double> t1("t1", -1.0, 1.0); mod.add_var(t1); t1.initialize_all(0.0);
    var<double> t2("t2", -1.0, 1.0); mod.add_var(t2); t2.initialize_all(0.0);
    var<double> p("p", -1.0, 1.0); mod.add_var(p); p.initialize_all(0.0);

    Constraint<double> c1("c1");
    c1 += p - cos(t1 - t2);
    c1 == 0.0;
    mod.add_constraint(c1);
   
    Constraint<double> c2("c2");
    c2 += p - sin(t1 - t2);
    c2 == 0.0;
    mod.add_constraint(c2);
    
    mod.min(p);

    mod.print();

    solver<> s(mod, ipopt);
    s.run();
    
    mod.print();
}

Only installs the armadillo library and headers

Is Gravity a new version of the Armadillo project?

Installed files

include/armadillo_bits/xvec_htrans_bones.hpp
include/armadillo_bits/xvec_htrans_meat.hpp
include/armadillo_bits/ ... more armadillo headers ...
lib/libarmadillo.so
lib/libarmadillo.so.8
lib/libarmadillo.so.8.100.0
libdata/pkgconfig/armadillo.pc
share/Armadillo/CMake/ArmadilloConfig.cmake
share/Armadillo/CMake/ArmadilloConfigVersion.cmake
share/Armadillo/CMake/ArmadilloLibraryDepends-%%CMAKE_BUILD_TYPE%%.cmake

installation with Mosek

Hi,
Just trying to install Gravity with Mosek, get the following error message:
src/CMakeFiles/gravity.dir/build.make:158: recipe for target
'src/CMakeFiles/gravity.dir/MosekProgram.cpp.o' failed
make[2]: *** [src/CMakeFiles/gravity.dir/MosekProgram.cpp.o] Error 1
CMakeFiles/Makefile2:179: recipe for target 'src/CMakeFiles/gravity.dir/all' failed
make[1]: *** [src/CMakeFiles/gravity.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Some errors reported by the compiler are of the following form:
/home/zhangshixuanus/Gravity/Gravity/src/MosekProgram.cpp: In member function ‘void MosekProgram::set_mosek_objective()’: /home/zhangshixuanus/Gravity/Gravity/src/MosekProgram.cpp:828:81: error: ‘poly_eval’ was not declared in this scope monty::rc_ptr< ::mosek::fusion::Expression > expr= fusion::Expr::constTerm(poly_eval(_model->_obj.get_cst())); // expr is a pointer to the Expression. ^~~~~~~~~ /home/zhangshixuanus/Gravity/Gravity/src/MosekProgram.cpp:828:81: note: suggested alternative: ‘poly_h’ monty::rc_ptr< ::mosek::fusion::Expression > expr= fusion::Expr::constTerm(poly_eval(_model->_obj.get_cst())); // expr is a pointer to the Expression. ^~~~~~~~~ poly_h /home/zhangshixuanus/Gravity/Gravity/src/MosekProgram.cpp:857:70: error: ‘class gravity::param_’ has no member named ‘get_nb_instances’; did you mean ‘get_id_inst’? auto coefs = new_array_ptr<double,1>((it1.second._p->get_nb_instances())); ^~~~~~~~~~~~~~~~ get_id_inst /home/zhangshixuanus/Gravity/Gravity/src/MosekProgram.cpp:858:50: error: ‘class gravity::param_’ has no member named ‘get_nb_instances’; did you mean ‘get_id_inst’? for (int j = 0; j<it1.second._p->get_nb_instances(); j++) { ^~~~~~~~~~~~~~~~ get_id_inst /home/zhangshixuanus/Gravity/Gravity/src/MosekProgram.cpp:878:70: error: ‘class gravity::param_’ has no member named ‘get_nb_instances’; did you mean ‘get_id_inst’? auto coefs = new_array_ptr<double,1>((it1.second._p->get_nb_instances())); ^~~~~~~~~~~~~~~~ get_id_inst /home/zhangshixuanus/Gravity/Gravity/src/MosekProgram.cpp:879:50: error: ‘class gravity::param_’ has no member named ‘get_nb_instances’; did you mean ‘get_id_inst’? for (int j = 0; j<it1.second._p->get_nb_instances(); j++) { ^~~~~~~~~~~~~~~~ get_id_inst /home/zhangshixuanus/Gravity/Gravity/src/MosekProgram.cpp:887:61: error: ‘class gravity::param_’ has no member named ‘get_sdpid’; did you mean ‘get_dim’? pair<size_t, size_t> pair = it1.second._p->get_sdpid(); ^~~~~~~~~ get_dim
Could you please look into this error? Thank you very much.

Conflicts with OpenCV

On Ubuntu 22.04, I tried to include both Gravity and OpenCV in my project as

#include <gravity/solver.h>
#include <opencv2/opencv.hpp>

But make gave a bunch of errors beginning with:

/home/test/Gravity/include/gravity/types.h:39:13: error: expected identifier before numeric constant
   39 | #define EPS 0.00001
      |             ^~~~~~~
/home/test/Gravity/include/gravity/types.h:39:13: error: expected ‘}’ before numeric constant
In file included from /usr/local/include/opencv4/opencv2/core.hpp:57,
                 from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
                 from /home/test/Gravity/examples/gravity_test.cpp:10:
/usr/local/include/opencv4/opencv2/core/types.hpp:889:5: note: to match this ‘{’
  889 |     {
      |     ^
In file included from /home/test/Gravity/include/gravity/utils.h:16,
                 from /home/test/Gravity/include/gravity/constant.h:20,
                 from /home/test/Gravity/include/gravity/param.h:20,
                 from /home/test/Gravity/include/gravity/var.h:12,
                 from /home/test/Gravity/include/gravity/poly.h:12,
                 from /home/test/Gravity/include/gravity/expr.h:12,
                 from /home/test/Gravity/include/gravity/func.h:13,
                 from /home/test/Gravity/include/gravity/constraint.h:13,
                 from /home/test/Gravity/include/gravity/model.h:16,
                 from /home/test/Gravity/include/gravity/solver.h:14,
                 from /home/test/Gravity/examples/gravity_test.cpp:2:
/home/test/Gravity/include/gravity/types.h:39:13: error: expected unqualified-id before numeric constant
   39 | #define EPS 0.00001
      |             ^~~~~~~
In file included from /usr/local/include/opencv4/opencv2/core.hpp:57,
                 from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
                 from /home/test/Gravity/examples/gravity_test.cpp:10:
/usr/local/include/opencv4/opencv2/core/types.hpp:896:19: error: expected constructor, destructor, or type conversion before ‘;’ token
  896 |     TermCriteria();
      |                   ^
/usr/local/include/opencv4/opencv2/core/types.hpp:902:57: error: expected constructor, destructor, or type conversion before ‘;’ token
  902 |     TermCriteria(int type, int maxCount, double epsilon);
      |                                                         ^
/usr/local/include/opencv4/opencv2/core/types.hpp:904:27: error: non-member function ‘bool cv::isValid()’ cannot have cv-qualifier
  904 |     inline bool isValid() const
      |                           ^~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp: In function ‘bool cv::isValid()’:
/usr/local/include/opencv4/opencv2/core/types.hpp:906:31: error: ‘type’ was not declared in this scope; did you mean ‘wctype’?
  906 |         const bool isCount = (type & COUNT) && maxCount > 0;
      |                               ^~~~
      |                               wctype
/usr/local/include/opencv4/opencv2/core/types.hpp:906:38: error: ‘COUNT’ was not declared in this scope
  906 |         const bool isCount = (type & COUNT) && maxCount > 0;
      |                                      ^~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:906:48: error: ‘maxCount’ was not declared in this scope
  906 |         const bool isCount = (type & COUNT) && maxCount > 0;
      |                                                ^~~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:907:53: error: ‘epsilon’ was not declared in this scope
  907 |         const bool isEps = (type & EPS) && !cvIsNaN(epsilon);
      |                                                     ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp: At global scope:
/usr/local/include/opencv4/opencv2/core/types.hpp:985:18: error: ‘DataType’ is not a class template
  985 | template<> class DataType<Moments>
      |                  ^~~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:986:1: error: explicit specialization of non-template ‘DataType’
  986 | {
      | ^
/usr/local/include/opencv4/opencv2/core/types.hpp:994:27: error: ‘DataType’ is not a template
  994 |            fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8)
      |                           ^~~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:994:51: error: incomplete type ‘DataType’ used in nested name specifier
  994 |            fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8)
      |                                                   ^~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1001:13: error: ‘Vec’ does not name a type
 1001 |     typedef Vec<channel_type, channels> vec_type;
      |             ^~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1006:8: error: ‘Depth’ is not a class template
 1006 | struct Depth< Moments > { enum { value = Depth<double>::value }; };
      |        ^~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1006:25: error: explicit specialization of non-template ‘traits::Dept
’
 1006 | struct Depth< Moments > { enum { value = Depth<double>::value }; };
      |                         ^
/usr/local/include/opencv4/opencv2/core/types.hpp:1006:42: error: ‘traits::Depth’ is not a template
 1006 | struct Depth< Moments > { enum { value = Depth<double>::value }; };
      |                                          ^~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1006:57: error: incomplete type ‘traits::Depth’ used in nested name specifier
 1006 | struct Depth< Moments > { enum { value = Depth<double>::value }; };
      |                                                         ^~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1008:8: error: ‘Type’ is not a class template
 1008 | struct Type< Moments > { enum { value = CV_MAKETYPE(Depth<double>::value, (int)(sizeof(Moments)/sizeof(double))) }; };
      |        ^~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1008:24: error: explicit specialization of non-template ‘traits::Type’
 1008 | struct Type< Moments > { enum { value = CV_MAKETYPE(Depth<double>::value, (int)(sizeof(Moments)/sizeof(double))) }; };
      |                        ^
In file included from /usr/local/include/opencv4/opencv2/core/cvdef.h:190,
                 from /usr/local/include/opencv4/opencv2/core.hpp:52,
                 from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
                 from /home/test/Gravity/examples/gravity_test.cpp:10:
/usr/local/include/opencv4/opencv2/core/types.hpp:1008:41: error: ‘traits::Depth’ is not a template
 1008 | struct Type< Moments > { enum { value = CV_MAKETYPE(Depth<double>::value, (int)(sizeof(Moments)/sizeof(double))) }; };
      |                                         ^~~~~~~~~~~
In file included from /usr/local/include/opencv4/opencv2/core.hpp:57,
                 from /usr/local/include/opencv4/opencv2/opencv.hpp:52,
                 from /home/test/Gravity/examples/gravity_test.cpp:10:
/usr/local/include/opencv4/opencv2/core/types.hpp:1022:1: error: ‘Complex’ does not name a type
 1022 | Complex<_Tp>::Complex()
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1026:1: error: ‘Complex’ does not name a type
 1026 | Complex<_Tp>::Complex( _Tp _re, _Tp _im )
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1030:1: error: ‘Complex’ does not name a type
 1030 | Complex<_Tp>::operator Complex<T2>() const
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1036:1: error: ‘Complex’ does not name a type
 1036 | Complex<_Tp> Complex<_Tp>::conj() const
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1043:25: error: ‘Complex’ does not name a type
 1043 | bool operator == (const Complex<_Tp>& a, const Complex<_Tp>& b)
      |                         ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1043:32: error: expected ‘,’ or ‘...’ before ‘<’ token
 1043 | bool operator == (const Complex<_Tp>& a, const Complex<_Tp>& b)
      |                                ^
/usr/local/include/opencv4/opencv2/core/types.hpp:1043:6: error: ‘bool operator==(int)’ must have an argument of class or enumerated type
 1043 | bool operator == (const Complex<_Tp>& a, const Complex<_Tp>& b)
      |      ^~~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1049:25: error: ‘Complex’ does not name a type
 1049 | bool operator != (const Complex<_Tp>& a, const Complex<_Tp>& b)
      |                         ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1049:32: error: expected ‘,’ or ‘...’ before ‘<’ token
 1049 | bool operator != (const Complex<_Tp>& a, const Complex<_Tp>& b)
      |                                ^
/usr/local/include/opencv4/opencv2/core/types.hpp:1049:6: error: ‘bool operator!=(int)’ must have an argument of class or enumerated type
 1049 | bool operator != (const Complex<_Tp>& a, const Complex<_Tp>& b)
      |      ^~~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1055:1: error: ‘Complex’ does not name a type
 1055 | Complex<_Tp> operator + (const Complex<_Tp>& a, const Complex<_Tp>& b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1061:1: error: ‘Complex’ does not name a type
 1061 | Complex<_Tp>& operator += (Complex<_Tp>& a, const Complex<_Tp>& b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1068:1: error: ‘Complex’ does not name a type
 1068 | Complex<_Tp> operator - (const Complex<_Tp>& a, const Complex<_Tp>& b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1074:1: error: ‘Complex’ does not name a type
 1074 | Complex<_Tp>& operator -= (Complex<_Tp>& a, const Complex<_Tp>& b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1081:1: error: ‘Complex’ does not name a type
 1081 | Complex<_Tp> operator - (const Complex<_Tp>& a)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1087:1: error: ‘Complex’ does not name a type
 1087 | Complex<_Tp> operator * (const Complex<_Tp>& a, const Complex<_Tp>& b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1093:1: error: ‘Complex’ does not name a type
 1093 | Complex<_Tp> operator * (const Complex<_Tp>& a, _Tp b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1099:1: error: ‘Complex’ does not name a type
 1099 | Complex<_Tp> operator * (_Tp b, const Complex<_Tp>& a)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1105:1: error: ‘Complex’ does not name a type
 1105 | Complex<_Tp> operator + (const Complex<_Tp>& a, _Tp b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1111:1: error: ‘Complex’ does not name a type
 1111 | Complex<_Tp> operator - (const Complex<_Tp>& a, _Tp b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1115:1: error: ‘Complex’ does not name a type
 1115 | Complex<_Tp> operator + (_Tp b, const Complex<_Tp>& a)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1121:1: error: ‘Complex’ does not name a type
 1121 | Complex<_Tp> operator - (_Tp b, const Complex<_Tp>& a)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1127:1: error: ‘Complex’ does not name a type
 1127 | Complex<_Tp>& operator += (Complex<_Tp>& a, _Tp b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1133:1: error: ‘Complex’ does not name a type
 1133 | Complex<_Tp>& operator -= (Complex<_Tp>& a, _Tp b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1139:1: error: ‘Complex’ does not name a type
 1139 | Complex<_Tp>& operator *= (Complex<_Tp>& a, _Tp b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1145:18: error: ‘Complex’ does not name a type
 1145 | double abs(const Complex<_Tp>& a)
      |                  ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1145:25: error: expected ‘,’ or ‘...’ before ‘<’ token
 1145 | double abs(const Complex<_Tp>& a)
      |                         ^
/usr/local/include/opencv4/opencv2/core/types.hpp: In function ‘double abs(int)’:
/usr/local/include/opencv4/opencv2/core/types.hpp:1147:31: error: ‘a’ was not declared in this scope
 1147 |     return std::sqrt( (double)a.re*a.re + (double)a.im*a.im);
      |                               ^
/usr/local/include/opencv4/opencv2/core/types.hpp: At global scope:
/usr/local/include/opencv4/opencv2/core/types.hpp:1151:1: error: ‘Complex’ does not name a type
 1151 | Complex<_Tp> operator / (const Complex<_Tp>& a, const Complex<_Tp>& b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1159:1: error: ‘Complex’ does not name a type
 1159 | Complex<_Tp>& operator /= (Complex<_Tp>& a, const Complex<_Tp>& b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1166:1: error: ‘Complex’ does not name a type
 1166 | Complex<_Tp> operator / (const Complex<_Tp>& a, _Tp b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1173:1: error: ‘Complex’ does not name a type
 1173 | Complex<_Tp> operator / (_Tp b, const Complex<_Tp>& a)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1179:1: error: ‘Complex’ does not name a type
 1179 | Complex<_Tp> operator /= (const Complex<_Tp>& a, _Tp b)
      | ^~~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1190:1: error: ‘Point_’ does not name a type
 1190 | Point_<_Tp>::Point_()
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1194:1: error: ‘Point_’ does not name a type
 1194 | Point_<_Tp>::Point_(_Tp _x, _Tp _y)
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1204:1: error: ‘Point_’ does not name a type
 1204 | Point_<_Tp>::Point_(const Size_<_Tp>& sz)
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1208:1: error: ‘Point_’ does not name a type
 1208 | Point_<_Tp>::Point_(const Vec<_Tp,2>& v)
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1221:1: error: ‘Point_’ does not name a type
 1221 | Point_<_Tp>::operator Point_<_Tp2>() const
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1227:1: error: ‘Point_’ does not name a type
 1227 | Point_<_Tp>::operator Vec<_Tp, 2>() const
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1233:11: error: expected initializer before ‘<’ token
 1233 | _Tp Point_<_Tp>::dot(const Point_& pt) const
      |           ^
/usr/local/include/opencv4/opencv2/core/types.hpp:1239:14: error: expected initializer before ‘<’ token
 1239 | double Point_<_Tp>::ddot(const Point_& pt) const
      |              ^
/usr/local/include/opencv4/opencv2/core/types.hpp:1245:14: error: expected initializer before ‘<’ token
 1245 | double Point_<_Tp>::cross(const Point_& pt) const
      |              ^
/usr/local/include/opencv4/opencv2/core/types.hpp:1251:7: error: expected initializer before ‘<’ token
 1251 | Point_<_Tp>::inside( const Rect_<_Tp>& r ) const
      |       ^
/usr/local/include/opencv4/opencv2/core/types.hpp:1258:1: error: ‘Point_’ does not name a type
 1258 | Point_<_Tp>& operator += (Point_<_Tp>& a, const Point_<_Tp>& b)
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1266:1: error: ‘Point_’ does not name a type
 1266 | Point_<_Tp>& operator -= (Point_<_Tp>& a, const Point_<_Tp>& b)
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1274:1: error: ‘Point_’ does not name a type
 1274 | Point_<_Tp>& operator *= (Point_<_Tp>& a, int b)
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1282:1: error: ‘Point_’ does not name a type
 1282 | Point_<_Tp>& operator *= (Point_<_Tp>& a, float b)
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1290:1: error: ‘Point_’ does not name a type
 1290 | Point_<_Tp>& operator *= (Point_<_Tp>& a, double b)
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1298:1: error: ‘Point_’ does not name a type
 1298 | Point_<_Tp>& operator /= (Point_<_Tp>& a, int b)
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1306:1: error: ‘Point_’ does not name a type
 1306 | Point_<_Tp>& operator /= (Point_<_Tp>& a, float b)
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1314:1: error: ‘Point_’ does not name a type
 1314 | Point_<_Tp>& operator /= (Point_<_Tp>& a, double b)
      | ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1322:19: error: ‘Point_’ does not name a type
 1322 | double norm(const Point_<_Tp>& pt)
      |                   ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1322:25: error: expected ‘,’ or ‘...’ before ‘<’ token
 1322 | double norm(const Point_<_Tp>& pt)
      |                         ^
/usr/local/include/opencv4/opencv2/core/types.hpp: In function ‘double norm(int)’:
/usr/local/include/opencv4/opencv2/core/types.hpp:1324:30: error: ‘pt’ was not declared in this scope
 1324 |     return std::sqrt((double)pt.x*pt.x + (double)pt.y*pt.y);
      |                              ^~
/usr/local/include/opencv4/opencv2/core/types.hpp: At global scope:
/usr/local/include/opencv4/opencv2/core/types.hpp:1328:25: error: ‘Point_’ does not name a type
 1328 | bool operator == (const Point_<_Tp>& a, const Point_<_Tp>& b)
      |                         ^~~~~~
/usr/local/include/opencv4/opencv2/core/types.hpp:1328:31: error: expected ‘,’ or ‘...’ before ‘<’ token
 1328 | bool operator == (const Point_<_Tp>& a, const Point_<_Tp>& b)
      |

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.