amaas/stanford_dl_ex

'lbfgsAddC' undefined

ChihChengLiang opened this issue · 4 comments

when running octave ex1a_linreg.m get the following error

error: 'lbfgsAddC' undefined near line 21 column 3
error: called from:
error:   /home/~~~~/stanford_dl_ex/common/minFunc_2012/minFunc/lbfgsAdd.m at line 21, column 3
error:   /home/~~~~/stanford_dl_ex/common/minFunc_2012/minFunc/minFunc.m at line 571, column 50
error:   /home/~~~~/stanford_dl_ex/ex1/ex1a_linreg.m at line 47, column 7

solve it with modifying ex1a_linreg.m line 46 to

options = struct('MaxIter', 200,'useMex',0);

or compile the files using common/minFunc_2012/mexAll.m

I had to change mexAll.m to compile without error on Octave 3.8.1 on OS X:

mexAll.m >>>>>>>>>>>>
% minFunc
fprintf('Compiling minFunc files...\n');
mex -o minFunc/compiled/mcholC.mex minFunc/mex/mcholC.c
mex -o minFunc/compiled/lbfgsC.mex minFunc/mex/lbfgsC.c
mex -o minFunc/compiled/lbfgsAddC.mex minFunc/mex/lbfgsAddC.c
mex -o minFunc/compiled/lbfgsProdC.mex minFunc/mex/lbfgsProdC.c

cx0 commented

Mark Schmidt wrote:

You get the error "??? Undefined function or method 'lbfgsAddC'". This occurs if Matlab can't find the mex file for your operating system. If this occurs, you can either: (i) set 'options.useMex' to 0, or (ii) compile the mex file for your operating system by running the mexAll function. If you end up compiling a file in minFunc for your operating system, please send it to me and I will add to the distribution.

Though, modifying mexAll as to compile all relevant files (lbgfs*.c) solved the issue for me.

@nicsurpatanu i modify mexAll.m as you did, however when run run mexAll cmd in the octave-cli ,i got a err message like folllows
error_pic
and the mexAll.m is as follow

  1 % minFunc
  2 fprintf('Compiling minFunc files...\n');
  3 mex -o minFunc/compiled minFunc/mex/mcholC.c
  4 mex -o minFunc/compiled minFunc/mex/lbfgsC.c
  5 mex -o minFunc/compiled minFunc/mex/lbfgsAddC.c
  6 mex -o minFunc/compiled minFunc/mex/lbfgsProdC.c
  7```

@osoylemez how to compile all relevant files?