S2kit MEX file for Matlab
April 8th, 2010 by chris
Fast Spherical Harmonic Transform Fast Spherical Harmonic Transform – Perform fast spherical harmonic transform and inverse transform using S2kit C code.
Fast Spherical Harmonic Transform – Perform fast spherical harmonic transform and inverse transform using S2kit C code. A MATLAB interface to S2kit, with routines for spherical harmonic decompositions of spherical data. Computes the fast spherical harmonic transform and its inverse. See README.MEX for more details. See Test.m and TestInv.m for example scripts. Requirements: MATLAB Release: R14SP1 on Linux. Probably works on later versions. Some users have reported success from Windows too.
This file was previously hosted at http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8427&objectType=FILE until Mathworks decided to delete all code licenced under the GPL from their site!
Download S2kit MEX source code package here.
[Optionally: download the original S2kit archive here.]
Chris,
I was interested in your MEX interface to S2Kit10 but unfortunately, when I followed your “Download S2kit MEX here” link I ended up with another copy of the original S2kit10 release from Peter Kostelec’s site on Dartmouth. Can you provide an alternate link to obtain your MEX interface? Many thanks!
Jerry Jorgensen
Sr. System Engineer
SAIC San Diego
I wish to install the MATLAB interface to S2kit. The readme files in the s2kit directory do not provide any information about that. Can anyone help? I did this about 3 years ago, but just can’t remember the steps.
I have a directory with mexs2kit working. I can compress in a tar and put on my dropbox/public. However, beware: I compiled it under matlab v.2007 but it doen’t work with recent releases. Is Chris listening? Could he find a patch?
Best,
Enrico
I saved the original files and they can be recovered in
http://www.fis.unipr.it/~enrico.onofri/MMF/matlab/
The problem now is that there is some detail which makes the code incompatible with recent versions of matlab. I can compile under R2007 but with R2008 on I get a crash with little diagnostic information. Can Chris possibly help? Enrico
Yes, Enrico is right. I’m using Matlab R2010, and I cannot compile it (mex …).
Any idea about how to solve this problem ?
Now, I can compile it, but not run it. I obtain a segmentation error.
Hi Chris,
any idea to solve the problem ?
Patrick
Hi Chris,
I try to run the command below (s2kit10 installed successfully) but it does not work (see warning below, related to gcc version). Do I need to downgrade to gcc.4.2 ? Other solution? Is this really the problem? I run MATLAB r2009b.
Many thanks, and happy new year.
mex -v FST_semi_fly_mex.c -Is2kit10 -Ls2kit10 -lfftw3 s2kit10/pmls.o s2kit10/cospmls.o s2kit10/seminaive.o s2kit10/csecond.o s2kit10/primitive.o s2kit10/makeweights.o s2kit10/naive_synthesis.o s2kit10/FST_semi_fly.o
-> mexopts.sh sourced from directory (DIR = $MATLAB/bin)
FILE = /usr/local/Matlab/bin/mexopts.sh
—————————————————————-
-> MATLAB = /usr/local/Matlab
-> CC = gcc
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/usr/local/Matlab/bin/glnxa64 -L/usr/local/Matlab/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/usr/local/Matlab/bin/glnxa64 -L/usr/local/Matlab/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> FC = g95
-> FC flags:
FFLAGS = -fexceptions -fPIC -fno-omit-frame-pointer
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/usr/local/Matlab/bin/glnxa64 -L/usr/local/Matlab/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = gcc
-> Link flags:
LDFLAGS = -pthread -shared -Wl,–version-script,/usr/local/Matlab/extern/lib/glnxa64/mexFunction.map -Wl,–no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexa64
arguments = -Ls2kit10 -lfftw3
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments = -Ls2kit10 -lfftw3
—————————————————————-
Warning: You are using gcc version “4.5.2-8ubuntu4)”. The earliest gcc version supported
with mex is “4.1″. The latest version tested for use with mex is “4.2″.
To download a different version of gcc, visit http://gcc.gnu.org
mex: FST_semi_fly_mex.c not a normal file or does not exist.
??? Error using ==> mex at 221
Unable to complete successfully.
Warning: You are using gcc version “4.5.2-8ubuntu4)”. The earliest gcc version supported
with mex is “4.1″. The latest version tested for use with mex is “4.2″.
To download a different version of gcc, visit http://gcc.gnu.org
-> gcc -c -Is2kit10 -I/usr/local/Matlab/extern/include -I/usr/local/Matlab/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O -DNDEBUG “FST_semi_fly_mex.c”
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.14′ not found (required by /usr/lib/libppl_c.so.2)
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11′ not found (required by /usr/lib/libppl_c.so.2)
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.14′ not found (required by /usr/lib/libppl.so.7)
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11′ not found (required by /usr/lib/libppl.so.7)
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11′ not found (required by /usr/lib/libgmpxx.so.4)
mex: compile of ‘ “FST_semi_fly_mex.c”‘ failed.
Dear Panos,
I’m afraid I haven’t used S2kit personally for several years now, so I don’t know the answer to your problem. However looking briefly at the error messages you have sent, it appears that mex is failing because it cannot find an appropriate version of the C++ standard library to match the version of GCC that you are now using. I expect you need to install another version of libstdc++ (you can keep several versions on your machine at once).
Best wishes,
Chris.