view OctConf2013/what-is-octave.tex @ 8:50abddcc3409 default tip

Presentation delivered by cdf at OctConf 2013.
author Carlo de Falco <cdf@users.sourceforge.net>
date Mon, 22 Jul 2013 21:54:27 +0200
parents FEMTEC2013/what-is-octave.tex@60233b0075a9
children
line wrap: on
line source

\documentclass[10pt]{beamer}


\usetheme{Octave}
\usepackage{thumbpdf}
\usepackage{wasysym}
\usepackage{ucs}
\usepackage[utf8]{inputenc}
\usepackage{pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps,pgfshade}
\usepackage{verbatim}
\usepackage{listings}
\usepackage{attachfile}
\lstset{
	language=C++,
	keywordstyle=\bfseries\ttfamily\color[rgb]{0,0,1},
	identifierstyle=\ttfamily,
	commentstyle=\color[rgb]{0.133,0.545,0.133},
	stringstyle=\ttfamily\color[rgb]{0.627,0.126,0.941},
	showstringspaces=false,
	basicstyle=\scriptsize,
	numberstyle=\tiny,
	numbers=left,
	stepnumber=1,
	numbersep=10pt,
	tabsize=2,
	breaklines=true,
	prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
	breakatwhitespace=false,
	aboveskip={1.5\baselineskip},
        columns=fixed,
        upquote=true,
        extendedchars=true,
}

%\pdfinfo
%{
%  /Title       (What is Octave?)
%  /Creator     (TeX)
%  /Author      (Jordi Guti\'errez Hermoso)
%}


\title{GNU Octave\\ A free high-level tool for Scientific Computing}
\author[cdf, jgh]{{\bf Carlo de Falco}, Jordi Guti\'errez Hermoso}
\date{June 24, 2013 - OctConf - MOX - Politecnico di Milano}
\begin{document}

\frame[plain]{\titlepage}

\section*{}
\begin{frame}
  \frametitle{Outline}
  \tableofcontents[section=2]
\end{frame}

\AtBeginSection[]
{\frame<handout:0>{\frametitle{Outline}\tableofcontents[currentsection]}}

\AtBeginSubsection[]
{\frame<handout:0>{\frametitle{Outline}\tableofcontents[sectionstyle=show/hide,subsectionstyle=show/shaded/hide]}}

\newcommand<>{\highlighton}[1]{%
\alt#2{\structure{#1}}{{#1}}}

\newcommand{\icon}[1]{\pgfimage[height=1em]{#1}}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%%%%%%%%%% Content starts here %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 

\section{What is Octave?}
\subsection{Definition}
\begin{frame}
  \frametitle{Definitions}
  \begin{block}{What is Octave?}
		{\it ``A \underline{free}
		numerical environment mostly compatible with \sc{Matlab}''} \\[3mm]
        {{``free'' = ``libero'' $\neq$ ``gratis''}}
    \end{block}
    \begin{block} {What is compatibility?}
    A point of much debate \ldots
    \begin{itemize} 
      \item If it works in
      {\sc{Matlab}}, it should work in Octave. 
      \item If it breaks it is considered a bug.
      \item If it works in Octave, it can break in {\sc{Matlab}}.
    \end{itemize}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{Lines of code}
  The stuff Octave is made of...
  \pause
  \begin{block}{Core}
    \begin{itemize}
      \item About 600,000 lines of C++
      \item About 100,000 lines of m-scripts
      \item About 50,000 lines of Fortran
    \end{itemize}
  \end{block}
  \pause
  \begin{block}{Octave-Forge}
    \begin{itemize}
      \item About 200,000 lines of C++
      \item About 330,000 lines of m-scripts
      \item About 50,000 lines of Fortran
      \item Java?
    \end{itemize}
  \end{block}
\end{frame}


\begin{frame}
  \frametitle{Features}
  \begin{block}{Current features}
    \begin{itemize}
      \item N-d arrays, linear algebra, sparse matrices
      \item Nonlinear equations
      \item Partial/Ordinary/Algebraic Differential Equations, 
      \item Image processing, statistics, special functions
      \item OOP ({\it old style})
      \item Package manager
      \item Many more...
    \end{itemize}
  \end{block}

  \begin{block}{Features in development}
    \begin{itemize}
	  \item GUI
      \item JIT compiling
      \item classdef OOP
      %\item Least squares spectral analysis
    \end{itemize}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{What does it look like}
  \begin{itemize}
    \only<1>{\item Primarily a CLI interface
    \begin{figure}
    \begin{center}
    \includegraphics[height=.7\textheight]{screenshot}
    \caption{CLI screenshot}\end{center}
    \end{figure}}
    \pause
    \item Most requested feature: GUI! 
    \pause
    \only<2->{\begin{figure}
    \begin{center}
    \includegraphics[height=.7\textheight]{gui_screenshot}
   \caption{Qt based GUI Will ship with next release (4.0, expected 2013)}
    \end{center}
    \end{figure}}
  \end{itemize}
\end{frame}


\subsection{History}

\begin{frame}
  \frametitle{In the beginning... }

  
  \begin{itemize}
    \item Companion software for chemical reactor textbook by James B. Rawlings  
    and John G. Ekerdt
    \item John W. Eaton (hereafter, jwe) started coding in 1993
  \end{itemize}
  \pause

  \begin{block}{Rawlings said...}
    \begin{quote}
      \center Why don't you call it ``Octave''?
    \end{quote}
  \end{block}
  
  \begin{itemize}
  \item Octave refers to Octave Levenspiel, nothing to do with music ...
  \end{itemize}

\end{frame}

\begin{frame}
  \frametitle{jwe is a lone wolf...}

  jwe works almost completely alone for first four or five years.

  \pause
  
  \begin{block}{In the very beginning...}
  \begin{itemize}    
    \item No mailing lists
    \item No widespread announcements
    \item No VCS (these were dark times)
  \end{itemize}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{Contributions slowly trickle in}
  \begin{block}{Timeline}
    \begin{itemize}
      \item[1989] Planning stages
      \item[1992] Development begins
      \item[1993] First public announcement
      \item[1994] Version 1.0
      \item[1996] Version 2.0
      \item[1998] Version 2.1 development
      \item[2004] Version 2.9 in preparation for 3.0 release
      \item[2007] Version 3.0 major upgrade
      \item[2010] Version 3.2.4, last before using hg
      \item[2011] Version 3.4.0
      \item[2012] Version 3.6.4
      \item[2013] 20th birthday! (and Version 4.0 Hopefully!)
    \end{itemize}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{Contributions slowly trickle in}
  \begin{block}{Milestones}
  \begin{itemize}
    \item[1994] Most of the current basic functionality already in.
    (Much was written during its first two years!)
    \pause
    \item[1995] Structs, {\sc{Matlab}}-style plot() command.
    \item[1998] Original sparse matrix implementation
    \item[2001] Octave-Forge's first commit
    \item[2006] MEX interface in core
    \item[2007] Implementation of handle graphics, full support for sparse matrices
    \item[2009] OpenGL plotting
    \item[2010] -forge option for pkg.m
    	\item[2011] Profiler
    \item[2012] Nested functions
	\pause	
    \item[2013] GUI, Java, 64bit indexing
  \end{itemize}
  \end{block}
\end{frame}


\subsection{Community dynamics}

\begin{frame}
  \frametitle{Web resources}
  \begin{block}{Web pages}
    \begin{itemize}
      \item \href{http://www.octave.org/}{Octave website}
      \item \href{http://octave.sf.net/}{Octave-Forge website}
      \item \href{http://wiki.octave.org/}{Octave wiki}
    \end{itemize}
  \end{block}

  \begin{block}{Users communication}
    \begin{itemize}
      \item \href{https://mailman.cae.wisc.edu/listinfo/help-octave}{Octave users mailing list}
      \item \href{https://mailman.cae.wisc.edu/listinfo/octave-maintainers}{Octave maintainers mailing list}
      \item \href{http://webchat.freenode.net/?channels=octave&uio=MT1mYWxzZSYyPXRydWUmMTI9dHJ1ZQda}
      {\#octave channel in Freenode}
      \item \href{http://savannah.gnu.org/bugs/?group=octave}{Savannah bug tracker}
    \end{itemize}
  \end{block}
  \pause
  \begin{block}{Developers collaboration}
    \begin{itemize}
      \item \href{http://hg.savannah.gnu.org/hgweb/octave/shortlog}{Octave Mercurial repository}
      \item \href{http://sourceforge.net/p/octave/code}{Octave-Forge Subversion (+ Mercurial) repository}
    \end{itemize}
  \end{block}
\end{frame}

\begin{frame}
  \frametitle{Social structure}
  \begin{itemize}
    \item Like all free projects, every user is a potential developer.
    \item 16 current Core developers (with write access to repo)
    \only<1>{\begin{figure}
       \centering
       \includegraphics[width=.5\linewidth]{Core-Developers} 
    \end{figure}}
    \only<2->{\item 29 currently registered 'Forge developers}
    \only<2>{\begin{figure}
       \centering
       \includegraphics[width=.6\linewidth]{Forge-developers} 
    \end{figure}}
    \only<3->{\item 305 total contributors over all time\\}
    {\only<3>{\includegraphics[width=.8\linewidth]{contribs1}}
     \only<4>{\includegraphics[width=.8\linewidth]{contribs2}}}
    \only<5->{\item How many users? Thousands? Millions?}
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{From user to developer}
  This is a FAQ
  \pause
  \begin{block}{How can I contribute?}
    \begin{itemize}
      \item Code (obviously)
      \item Money (pay-what-you-need)
      \item Documentation (especially examples)
      \item Wiki maintenance
      \item Help in the mailing list
      \item Bug reporting
    \end{itemize}
  \end{block}
  \pause
  Stick around this conference if you want to learn more about how to get involved!
\end{frame}

\begin{frame}
  \frametitle{Student projects}
  \begin{block}{Google Summer of Code }
    \begin{itemize}
    \item GSoC 2011
    \begin{itemize}
    \item Daniel Kraft, Profiler
    \end{itemize}
    \item GSoC 2012
    \begin{itemize}
    \item Jacob Dawid, Qt GUI; Max Brister, JIT; Ben Lewis, LSSA
    \end{itemize}    
    \item GSoC 2013
    \begin{itemize}
    \item 9 Slots this year!
    \item JIT, Sparse Matrix Factorizations, FEM, Agora, Binary Packaging, Audio
    \end{itemize}
    \end{itemize}
  \end{block}
  \begin{block}{European Space Agency's Summer of Code in Space}
    \begin{itemize}
    \item SOCIS 2012
    \begin{itemize}
    \item Wendy Liu, Agora Octave; Andrius Sutas, Instrument-Control
    \end{itemize}
    \item SOCIS 2013
    \begin{itemize}
    \item Students apply!
    \end{itemize}
    \end{itemize}
  \end{block}
  \pause
 % Stick around this conference if you want to learn more about how to get involved!
\end{frame}

\section{Octave and ...}
\subsection{Octave and Octave-Forge}

\begin{frame}[fragile]{Octave-Forge}
\begin{block}{Octave-Forge}
\href{http://octave.sf.net}{Octave Forge} Is a place for concurrently developing and distributing 
extension packages for Octave.
\end{block}
\begin{itemize}
\item Each package has a \emph{maintainer} responsible for updating and releasing new versions of the package
\item Some packages are maintained by \emph{The Community}
\item Installation via an integrated \emph{package manager}
\end{itemize}
\end{frame}

\begin{frame}[fragile]{PKG}
\begin{lstlisting}[keywordstyle=]
>> pkg install -forge miscellaneous
For information about changes from previous versions of the miscellaneous package, run: news ("miscellaneous").
>> pkg list
Package Name         | Version | Installation directory
---------------------+---------+-----------------------
                bim  |   1.1.1 | ~/octave/bim-1.1.1
                fpl  |   1.3.3 | ~/octave/fpl-1.3.3
            general  |   1.3.1 | ~/octave/general-1.3.1
           geometry  |   1.6.0 | ~/octave/geometry-1.6.0
      miscellaneous  |   1.2.0 | ~/octave/miscellaneous-1.2.0
>> pkg load miscellaneous
>> pkg list
Package Name         | Version | Installation directory
---------------------+---------+-----------------------
                bim  |   1.1.1 | ~/octave/bim-1.1.1
                fpl  |   1.3.3 | ~/octave/fpl-1.3.3
            general  |   1.3.1 | ~/octave/general-1.3.1
           geometry  |   1.6.0 | ~/octave/geometry-1.6.0
      miscellaneous *|   1.2.0 | ~/octave/miscellaneous-1.2.0
\end{lstlisting}
\end{frame}

\begin{frame}[fragile]{PKG}
\begin{lstlisting}[keywordstyle=]
>> pkg describe bim -verbose
---
Package name:
	bim
Version:
	1.1.1
Short description:
	Package for solving Diffusion Advection Reaction (DAR) Partial Differential Equations
Status:
	Not loaded
---
Provides:
Matrix assembly
	bim1a_advection_diffusion
	bim1a_advection_upwind
	bim2a_advection_diffusion
...
Pre-processing and Post-processing computations
	bim2c_mesh_properties
...
>> 
\end{lstlisting}
\end{frame}


\subsection{Octave and Matlab}

\begin{frame}[fragile]
\frametitle{How is Octave different from Matlab?}
\scriptsize
\begin{itemize}
\item Nested Functions
\item Differences in core syntax
\only<2>{\begin{itemize}
\item \scriptsize Some limitations on the use of function handles. 
\item \scriptsize Some limitations of variable argument lists on the LHS of an expression.
\item \scriptsize Matlab classdef object oriented programming is not yet supported.
\end{itemize}}
\item Just-In-Time compiler
\item Compiler
\item Graphic handles
\item GUI functions
\item Simulink
\item MEX-Files
\item Block comments
\item Profiler
\item Short-circuit $\&$ and $|$ operators
\item Solvers for singular, under- and over-determined matrices
\item Octave extensions
\only<3>{\scriptsize\begin{itemize}
  \item \scriptsize Octave comments can start with \#
  \item \scriptsize Indexing can be applied to all objects in Octave, {\it e.g.} $sin(x)(1:10)$
  \item \scriptsize Octave has the operators $++$, $--$, $-=$, $+=$, $*=$, \ldots
  \item \scriptsize Character strings in Octave can be denoted with double or single quotes.
\end{itemize}}
\end{itemize}
\end{frame}


\begin{frame}[fragile]{Broadcasting}
\begin{itemize}
\item Since 3.6.0, Octave automatically broadcasts arrays when using elementwise binary operators. 
\item Corresponding array dimensions must either be equal or, one of them must be 1. 
\item In case all dimensions are equal, ordinary element-by-element arithmetic takes place.
\item When one of the dimensions is 1, the array with that singleton dimension gets copied along 
that dimension until it matches the dimension of the other array. 
\end{itemize}

\end{frame}

\begin{frame}[fragile]{Broadcasting}
\scriptsize
\begin{lstlisting}[keywordstyle=]
     x = [1 2 3; 4 5 6; 7 8 9];     
     y = [10 20 30];     
     x + y
         11   22   33
         14   25   36
         17   28   39
\end{lstlisting}
\begin{itemize}
\item Without broadcasting, x + y would be an error because dimensions do not agree.
\item With broadcasting it is as if the following operation were performed
\end{itemize}
\scriptsize
\begin{lstlisting}[keywordstyle=]
     x = [1 2 3;4 5 6;7 8 9];
     y = [10 20 30; 10 20 30; 10 20 30];
     x + y
         11   22   33
         14   25   36
         17   28   39
\end{lstlisting}
\href{http://wiki.octave.org/FAQ#How_is_Octave_different_from_Matlab.3F}{Other notable differences with Matlab, listed in the wiki}
\end{frame}
\subsection{Octave and C++}

\begin{frame}[fragile]{dld-functions}
Implement an Octave interpreter function in C++ 
\vspace*{-4mm}
\only<1>{\lstinputlisting[language=C++,linerange=1-15,firstnumber=1]{./examples/dld.cc}}
\only<2>{\lstinputlisting[language=C++,linerange=16-30,firstnumber=last]{./examples/dld.cc}}
\only<3>{\lstinputlisting[keywordstyle=]{./examples/dld_run.txt}}
\vspace*{-4mm}
\attachfile[icon=Paperclip]{./examples/dld.cc}{source code of the example}
\end{frame}

\begin{frame}[fragile]{liboctave}
Use Octave's Matrix/Array Classes in a C++ application 
\vspace*{-4mm}
\only<1>{\lstinputlisting[language=C++]{./examples/standalone.cc}}
\only<2>{\lstinputlisting[keywordstyle=]{./examples/standalone_run.txt}}
\vspace*{-4mm}
\attachfile[icon=Paperclip]{./examples/standalone.cc}{source code of the example}
\end{frame}

\begin{frame}[fragile]{Embedding Octave}
You can embed the Octave interpreter in your C++ application 
\only<1>{\lstinputlisting[language=C++,linerange=1-17,firstnumber=1]{./examples/embedded.cc}}
\only<2>{\lstinputlisting[language=C++,linerange=18-29,firstnumber=last]{./examples/embedded.cc}}
\pause
\attachfile[icon=Paperclip]{./examples/embedded.cc}{source code of the example}
\end{frame}

\begin{frame}[fragile]{An advanced example}
\scriptsize
Add a new class to the Octave interpreter and work around Octave's pass-by-value semantics\\
%
\scriptsize
\begin{lstlisting}[language=C++]
class myobject : public octave_base_value
{
 private:
  DECLARE_OCTAVE_ALLOCATOR;
  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;
};

DEFINE_OCTAVE_ALLOCATOR(myobject);
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(myobject,"myobject","myobject");
\end{lstlisting}
%
\scriptsize
\begin{lstlisting}[language=C++]
oid load_myobject_type ()
{
  myobject::register_type ();
  myobject_type_loaded = true;
  mlock ();
  std::cout << "myobject_type_loaded" << std::endl;
}
\end{lstlisting}
%
\attachfile[icon=Paperclip]{./examples/myobject.cc}{source code of the example (.cc)}
\attachfile[icon=Paperclip]{./examples/myobject.h}{source code of the example (.h)}
\end{frame}


\subsection{Octave and Parallel Computing}

\begin{frame}[fragile]{parcellfun and pararrayfun}
\scriptsize
Parcellfun is distributed in the package ``general'' it implements 
parallelization via {\tt fork ()} and {\tt pipe ()} 
\vspace*{-2mm}
\only<1>{\lstinputlisting[language=Octave,linerange=34-51,firstnumber=1]{./examples/parcellfun_example.m}}
\only<2>{\lstinputlisting[language=Octave,linerange=61-76,firstnumber=1]{./examples/parcellfun_example.m}}
%\vspace*{-4mm}
\attachfile[icon=Paperclip]{./examples/parcellfun_example.m}{source code of the example}
\end{frame}

\begin{frame}[fragile]{openmpi\_ext}
The package {\tt openmpi\_ext} provides wrappers for the main MPI functions in {\tt openmpi}

%\vspace*{-4mm}
\only<1>{\includegraphics[width=.9\linewidth]{openmpi_ext}}
\only<2>{\scalebox{.8}{\lstinputlisting[language=Octave,firstnumber=1]{./examples/Pi.m}}}
\only<3>{\scalebox{.8}{\lstinputlisting[language=Octave,firstnumber=1]{./examples/Pi_run.txt}}}
%\vspace*{-4mm}

\attachfile[icon=Paperclip]{./examples/parcellfun_example.m}{source code of the example}
\end{frame}

%\section{PDEs and Octave}

\subsection{PDEs in Octave-Forge}
\begin{frame}[fragile]{Some interesting packages}
\only<1>{\includegraphics[width=.9\linewidth]{bim}}
\only<2>{\includegraphics[width=.9\linewidth]{msh}}
\only<3>{\includegraphics[width=.9\linewidth]{fpl}}
\href{http://wiki.octave.org/Bim_package}{usage examples in the wiki}
\end{frame}

%\subsection{GeoPDEs - IGA in Octave}

%\begin{frame}
%\begin{center}
%\includegraphics[width=.95\linewidth]{OctConf2013-700x214}
%\end{center}
%\begin{itemize}
%\item MOX - Politecnico di Milano 24-26 June 2013
%\item Register now!
%\end{itemize}
%\end{frame}

\begin{frame}
\frametitle{How to get Octave}
\begin{itemize}
\item Source on www.octave.org
\item Binaries on octave.sourceforge.net
\item Through package managers
\item In NCLab
%\item I'll be available to help with installation.
\end{itemize}

\end{frame}


%
%\subsection{Octave and LifeV}
%\frame{}
%
%

\end{document}