⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compilecode.m

📁 关于有直接稀疏PCA的方法
💻 M
字号:
% Script to compile mex file using MATLAB interface

% Run this first if you haven't done so already, choosing gcc if available.
% mex -setup

% The code also needs a precompiled version of arpack
% Warning: because of a duplicate definition of second.f in ARPACK and LAPACK, 
% you should link with ARPACK's version of LAPACK. Using vendor versions of BLAS 
% is OK and significantly improves performance.

% On windows and linux, you should adjust the paths below to reflect 
% On the mac: install ARPACK through macports and the settings below should be fine.

% WARNING FOR WINDOWS: must modify which libraries to use in case{'mexw32'}
% below.  Matlab R2008a has separate lapack and blas lib files (libmwlapack.lib and libmwblas.lib), while
% earlier versions combine them in one file (libmwlapack.lib)
% Uncomment the corresponding line to use with older versions of MATLAB
switch mexext
    case {'mexmaci'} % Macintosh paths the VecLib framework
        % Arpack is available through MACPORTS.
        arpackpath='/opt/local/lib/libarpack.a';
        blaspath='/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib';
        gfortranpath='/opt/local/lib/gcc42/libgfortran.a';
    case {'mexw32'} % Win32 MATLAB after 7.
        arpackpath='C:\Documents and Settings\rluss\Desktop\MatlabArpack\libmwarpack.lib'; 
        lapackpath=[matlabroot,'\extern\lib\win32\microsoft\libmwlapack.lib'];
        blaspath=[matlabroot,'\extern\lib\win32\microsoft\libmwblas.lib'];
    case {'mexglx'} % Macintosh paths the VecLib framework
        % Arpack is available through MACPORTS.
        arpackpath='/usr/lib/libarpack.so.2';
        blaspath='';
        gfortranpath='';

end

% Test for mex extension to determine matlab version and platform
switch mexext
    case {'mexw32'} % Win32 MATLAB after 7.1
        files='sparse_rank_one_mex.c sparsesvd.c sparsegeneig.c sparsesvd_partialeig.c sparsesvd_partialeig_matlab.c utils.c';
%         libs=strcat(['''',arpackpath,'''',' ','''',lapackpath,'''']); % for Matlab version R2007b and earlier
        libs=strcat(['''',arpackpath,'''',' ','''',blaspath,'''',' ','''',lapackpath,'''']); % for Matlab version R2008a and later
        switches='-v -O -DWIN32';
        eval(['mex ',switches,' ',files,' ',libs]);
    case {'mexmaci'}% Macintosh using the Accelerate framework
        files='sparse_rank_one_mex.c sparsesvd.c sparsegeneig.c sparsesvd_partialeig.c sparsesvd_partialeig_matlab.c utils.c';
        switches='-v -O -Dmac';
        libs=strcat([arpackpath,'  ',blaspath,'  ',gfortranpath]);
        eval(['mex ',switches,' ',files,' ',libs]);
    case {'mexglx'} % Linux 
        files='sparse_rank_one_mex.c sparsesvd.c sparsegeneig.c sparsesvd_partialeig.c sparsesvd_partialeig_matlab.c utils.c';
        switches='-f ./LINUXmexopts.sh -v -O -Dlinuxp';
        libs=strcat([arpackpath,'  ',blaspath,'  ',gfortranpath]);
        eval(['mex ',switches,' ',files,' ','''',libs,'''']);
end
disp(' ......................... Done Compiling Source .........................')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -