A motivation article for those who are trying to install Octave on Mac OS using homebrew
I needed to interpolate some scattered 2d data today with a bit more sophistication than just using octave’s polyfit. I found that Chirokov’s RBF implementation works great out of the box for me. Shepard was also very easily implemented but already pretty slow for my 100×100 grid with the ‘naïve’ canonical code.
Taking a look at the PCA and LDA (See also http://www.bytefish.de/blog/pca_lda_with_gnu_octave/, works out of the box), I discovered that I could to some pretty good guesses at a closed function form.
Remembering that there was an Octave Package called optim that contains a general fitting algorithm, I quickly decided to try that out.
In case someone wants to do the same – It’s straightforward but the optim toolbox only works with a current version of Octave.
Working on Mac OS, you need to build that yourself as the last ‘readily packaged’ version is really old.
I had already struggled with Aquaterm in the past, so I was aware this might take some time.
If you want to do the same, here’s a quick guide on the current pitfalls and fallacies.
I’m using homebrew as a manager. I’ve tried to add my experience to the Octave for Mac OS wiki page (http://wiki.octave.org/Octave_for_MacOS_X). That’s a good point to start.
- Install XCode via the Mac App Store.
- Once installed, install the Command Line Tools from XCode’s Apple Menu > Preferences > Downloads.
I had Homebrew and Git installed but nothing worked. I tried a lot and finally gave up and cleaned up the house:
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
ruby -e “$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)”
brew install git –with-brewed-curl
- Import the scientific computing packages, including Octave:
brew tap homebrew/science
brew update && brew upgrade brew install gfortran
brew install hdf5
didn’t. Copy hdf5.rb from https://raw.github.com/Homebrew/homebrew-science/master/hdf5.rb into /usr/local/Library/Formula. Currently as of Nov 13, 2013 you have to adjust the hdf5 version number to hdf5-1.8.12.tar.bz2 and remove the checksum line below.
Brew install hdf5
Went through then.
Brew install octave failed, so I did
brew tap –repair
brew install octave
Which stalled at the fltk download. I tried to download the file manually which also failed. Downloaded http://fltk.org/pub/fltk/1.3.2/fltk-1.3.2-source.tar.gz to /Library/Caches/Homebrew/fltk-1.3.2.tar.gz and resumed with brew install octave.
Building octave crashed because of outdated autotools.
I brew installed them both, after that “brew link automate”d them with –force and then symlinked them (e.g. /usr/local/bin/automake->/usr/local/bin/automake-1.14), for all autotool executabled.
Octave still didn’t start and gave me some library errors.
sudo cp /usr/X11/lib/libfontconfig.1.dylib /usr/lib/
sudo cp /usr/X11/lib/libfreetype.6.dylib /usr/lib/
Finally gave me a working octave
pkg install -forge general
pkg install -forge miscellaneous
pkg install -forge struct
pkg install -forge optim
went through smoothly.
Now googled up “Time for action – using leasqr” and, with the first hit,
scroll down to “Time for action – using leasqr”, things went through smoothly.
RDF Reference: Google for
Scattered Data Interpolation and Approximation using Radial Base Functions
by Alex Chirokov on Matlab Central