1 参考
1 https://blog.csdn.net/sinat_36047561/article/details/107915747
2 https://blog.csdn.net/songjinmiao/article/details/50601680
2 安装环境
安装环境与参考1中相同
win10
Matlab2016b
VS2017
spams-matlab-v2.6
3 步骤
1 下载
2 mex -setup C++
3 编辑compile.m
a) 按下图修改
图片来源于:https://blog.csdn.net/songjinmiao/article/details/50601680
b) 无须修改153-208行之间的内容, 设置运行路径也可,如下图。
c)
有如下错误
按下图更改compile中的276行
将 blas_link='-lmwblas -lmwlapack'; 改为 blas_link='-Lmwblas -Lmwlapack';即可
d) 若有以下错误
错误使用 mex
In file included from ./prox/fista.h:24,
from ./dictLearn/dicts.h:36,
from D:\Program
Files\MATLAB\R2016b\toolbox\spams-matlab-v2.6-2017-02-27\spams-matlab-v2.6\dictLearn\mex\mexStructTrainDL.cpp:37:
./prox/project.h: In instantiation of 'void GraphPath<T,
Int>::init_graph(const GraphPathStruct<T>&) [with T = double; Int
= long long int]':
./prox/fista.h:2195:17: required from 'FISTA::GraphPathL0<T>::GraphPathL0(const
FISTA::ParamReg<T>&) [with T = double]'
./prox/fista.h:3399:39: required from 'FISTA::Regularizer<T>*
FISTA::setRegularizerVectors(const FISTA::ParamFISTA<T>&, const GraphStruct<T>*,
const TreeStruct<T>*, const GraphPathStruct<T>*) [with T = double]'
./dictLearn/dicts.h:934:51: required from 'void Trainer<T>::train_fista(const
Data<T>&, const ParamDictLearn<T>&, const GraphStruct<T>*, const TreeStruct<T>*)
[with T = double]'
D:\Program
Files\MATLAB\R2016b\toolbox\spams-matlab-v2.6-2017-02-27\spams-matlab-v2.6\dictLearn\mex\mexStructTrainDL.cpp:268:7:
required from 'void callFunction(mxArray**, const mxArray**, int, int) [with T =
double; mxArray = mxArray_tag]'
D:\Program
Files\MATLAB\R2016b\toolbox\spams-matlab-v2.6-2017-02-27\spams-matlab-v2.6\dictLearn\mex\mexStructTrainDL.cpp:311:50:
required from here
./prox/project.h:3157:25: error: '_finite' was not declared in this scope; did you
mean '_finitef'?
3157 | num_arcs[i]= isinf(graph.start_weights[i]) ? 2 : 3;
./prox/project.h:3160:28: error: '_finite' was not declared in this scope; did you
mean '_finitef'?
3160 | num_arcs[i+_n]= isinf(graph.stop_weights[i]) ? 2 : 3;
./prox/project.h:3191:17: error: '_finite' was not declared in this scope; did you
mean '_finitef'?
3191 | if (!isinf(graph.start_weights[i])) {
./prox/project.h:3199:17: error: '_finite' was not declared in this scope; did you
mean '_finitef'?
3199 | if (!isinf(graph.stop_weights[i])) {
则更改文件夹 .\linalg中misc.h中的
#define isnan _isnan
#define isinf !_finite
改为
#define isnan _isnanf
#define isinf !_finitef
本人在安装过程中没有碰到其他错误。