osqp / osqp

The Operator Splitting QP Solver
https://osqp.org
Apache License 2.0
1.7k stars 357 forks source link

print csc matrix #224

Closed LucosidE closed 4 years ago

LucosidE commented 4 years ago

Hello,

I think I am doing something wrong, I am trying to set up a QP in C++. Since my matrices are large it would be great to be able to print them out.

However

csc *P = csc_matrix(n,n,P_nnz,P_x,P_i,P_p);
print_csc_matrix(P,"P");

Results in undefined reference toprint_csc_matrix'`

goulart-paul commented 4 years ago

We don't compile the print utilities by default since they are intended for debugging. Try compiling with both the DDEBUG and PRINTING options enabled.

LucosidE commented 4 years ago

Got it, thank you.

hallfjonas commented 3 years ago

Hello,

I am currently getting the same error. However, since I am a bit new to building with cmake, I am unsure whether I am compiling correctly. I compiled with DDEBUG and DPRINTING flags. Here is what I did (starting in directory osqp/buld):

$ cmake -DDEBUG=ON -DPRINTING=ON -G "Unix Makefiles" .. $ cmake --build . $ cmake --build . --target install

I noticed that changing the DDEBUG flag didn't modify its setting:

-- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- We are on a Linux system -- Embedded is OFF -- Printing is ON -- Profiling is ON -- User interrupt is ON -- Floats are OFF -- Long integers (64bit) are ON -- Code coverage is OFF -- MKL Pardiso: ON -- Floats are OFF -- Long integers (64bit) are ON -- Configuring done -- Generating done

So I also tried to compile with -DCMAKE_BUILD_TYPE=Debug, which did enable the debug flag. But still I got the error message:

undefined reference to `print_csc_matrix'

Any hints on what I am doing wrong?

(By the way, the same holds for csc_to_dns)

tinducvo commented 1 year ago

I believe this is a bug. You can change the build type to define DEBUG inside osqp_configure.h:

cmake -G "Unix Makefiles" .. \
                -DCMAKE_BUILD_TYPE="Debug" \

But, DEBUG is misspelled inside "utils.c": #ifdef DDEBUG