SPAMS Matlab 安装

1 参考

https://blog.csdn.net/sinat_36047561/article/details/107915747

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

本人在安装过程中没有碰到其他错误。
 

  • 15
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 18
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 18
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值