MATLAB Answers

Loading C files in matlab with mex

19 views (last 30 days)
Valentin Lange
Valentin Lange on 20 Oct 2020
Edited: Valentin Lange on 21 Oct 2020
Hello everybody,
I want to use the ilupack toolbox for MATLAB, to create ILUT preconditioners with level of fill. As I have no real experience with coding C++, I am having trouble to install it.
I am following the getting started guide on this page, but am struggling on the first step: "After compiling the mex interface drivers from the ILUPACK directory,... ". I found out that to use C++ files in matlab, I have to use the mex function. I did the mex setup and also managed to add the include files into the commmand. The ilupack folder is inside my working directory and I tried
mex ./ilupack/matlab/DGNLilupackinit.c -I./ilupack/include/
but now I am getting the error
Error using mex
Bibliothek "DGNLilupackinit.lib" und Objekt "DGNLilupackinit.exp" werden
erstellt.
DGNLilupackinit.obj : error LNK2019: Verweis auf nicht aufgel”stes externes Symbol
"DGNLAMGinit" in Funktion "mexFunction".
DGNLilupackinit.mexw64 : fatal error LNK1120: 1 nicht aufgel”ste Externe
In english:
Error using mex
Bibliothek "DGNLilupackinit.lib" and Object "DGNLilupackinit.exp" are being created.
DGNLilupackinit.obj : error LNK2019: Reference to to unresolved external symbol
"DGNLAMGinit" in Function "mexFunction".
DGNLilupackinit.mexw64 : fatal error LNK1120: 1 unresolved external
What steps am I missing? Also there are multiple *.c files in the matlab folder. How do I mex those efficiently without typing each one?
Unfortunately the realm of C++ programm is quite hard to get into for people unfamiliar with the concepts. Especially because there are rarely videos or tutorial on these kind of special situations.
I hope you can help me.

  0 Comments

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 20 Oct 2020
I'm not familiar with that package but I'm curious if the ilu function in MATLAB would be suitable for your needs?

  1 Comment

Valentin Lange
Valentin Lange on 20 Oct 2020
Hello Steven. Unfortunately the built in ilu function does not support the ILU(k) variant with level of fill.

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by