# Summer of Code - Getting Started

The following is distilled from the Projects page for the benefit of potential Summer of Code students. Although students are welcome to attempt any of the projects in that page or any of their own choosing, here we offer some suggestions on what good student projects might be.

## Contents

- 1 Your steps to apply
- 2 General Guidelines
- 3 Suggested projects
- 3.1 Numerical
- 3.1.1 Incomplete sparse factorizations ichol, ilu
- 3.1.2 General purpose Finite Element library
- 3.1.3 Improve logm, sqrtm, funm
- 3.1.4 Generalised eigenvalue problem
- 3.1.5 Various sparse matrix improvements
- 3.1.6 Implement solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D
- 3.1.7 Implement solver for 1D nonlinear boundary value problems
- 3.1.8 Geometric integrators for Hamiltonian Systems
- 3.1.9 Matlab-compatible ODE solvers in core-Octave

- 3.2 GUI
- 3.3 Graphics
- 3.4 Interpreter
- 3.5 Infrastructure
- 3.6 Octave-Forge packages

- 3.1 Numerical
- 4 HG Procedures for students and mentors

# Your steps to apply

If you like any of the projects described below these are the steps you need to follow to apply:

- Find out that you would like to work together with us this summer!
- Tell us about that and work on your project proposal. Do this together with us! Best place is your wiki user page, see below.
- Fill out our
application template. This is best done by**public****creating an account at this wiki**and copying the**template**from its page.

You really only need to copy and answer thepart there, there is no need to showcase everything else to everybody reading your user page!**public** - Fill out our
application template. This is best done by copying the**private****template**from its page and**adding the required information to your application at Google (melange)**or at**ESA**.

Only the organization admin and the possible mentors will see this data.

You can still edit it after submitting until the deadline! - Hang out in our IRC channel, ask questions, submit patches, show us that you are motivated and well-prepared. There sadly will be more applicants than we can mentor with high quality, so do ask for feedback on your public application to increase your odds!
- Start implementing your very own proposal! Code the summer away ;-)

# General Guidelines

Octave is mostly written in (sadly, mostly undocumented) C++ and its own scripting language (m-scripts), which includes (or should include) most of the Matlab language as a subset. We generally prefer a different Octave house style to the usual Matlab style for m-scripts, but it's primarily a superficial stylistic difference. Additionally, there are bits and pieces of Fortran, Perl, C, awk, and Unix shell scripts here and there. In addition to being familiar with C++ and/or Octave or Matlab's scripting languages, you should probably be familiar or learn about Octave's infrastructure:

- The GNU build system is used to build Octave. While you generally don't need to understand too much unless you actually want to change how Octave is built, you should be able to understand enough to get a general idea of how to build Octave. If you've ever done a
`configure && make && make install`series of commands, you have already used the GNU build system. - Mercurial (abbreviated hg) is the distributed version control system (DVCS) we use for managing our source code. You should have some basic understanding of how a DVCS works, but hg is pretty easy to pick up, especially if you already know a VCS like git or svn.
- You should also read the same contributing guidelines we have for everyone.
- We primarily use mailing lists for communication. You should follow basic mailing list etiquette. For us, this mostly means "do not top post".
- We also have the #octave IRC channel in Freenode. The atmosphere is more relaxed, and we may talk about things that are not at all related to Octave.
- Octave-Forge is a project closely related to Octave where packages reside. They are somewhat analogous to Matlab's toolboxes.
- In addition, you probably should know
**some**mathematics, engineering, or experimental science or something of the sort. If you've used Matlab before, you probably have already been exposed to the kinds of problems that Octave is used for.

# Suggested projects

The following projects are broadly grouped by category and probable skills required to tackle each. Remember to check Projects for more ideas if none of these suit you, and your own ideas are always welcome.

## Numerical

These projects involve implementing certain mathematical functions in Octave.

**Required skills**: You should understand quite a bit of mathematics. Words like "eigenvalue", "analytic", and "Taylor series" shouldn't scare you at all. There is probably little C++ experience required, and probably many of these problems can be solved with m-scripts.

**Difficulty**: Mid-to-hard depending how much mathematics you know and how well you can read numerical analysis journal articles.

**Potential mentor**: Carlo de Falco, Nir Krakauer, Fotios Kasolis, Luis Gustavo Lira

### Incomplete sparse factorizations ichol, ilu

Implement incomplete Cholesky and LU factorization for sparse matrices. These functions are available in Matlab as cholinc/ichol and luinc/ilu. Incomplete factorizations are useful as preconditioners for iterative solvers such as gmres and gmres or pcg. The classic book Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods has a chapter describing the ILU algorithm in detail, though the algorithm described there should be adapted to Octave's internal Sparse Matrix file format which is CCS rather than CRS. The implementation of ILU in Octave has been recently discussed in the maintainers list and initial implementations were posted in this thread. In another thread it was suggested to implement the ILU by interfacing Octave to ITSOL. Compared to other projects in this section this one might require more knowledge of C++.

### General purpose Finite Element library

Octave-Forge already has a set of packages for discretizing Partial Differential operators by Finite Elements and/or Finite Volumes, namely the bim package which relies on the msh package (which is in turn based on gmsh) for creating and managing 2D triangular and 3D tetrahedral meshes and on the fpl package for visualizing 2D results within Octave or exporting 2D or 3D results in a format compatible with Paraview or VisIT. These packages, though, offer only a limited choice of spatial discretization methods which are based on low degree polynomials and therefore have a low order of accuracy even for problems with extremely smooth solutions. The GeoPDEs project, on the other hand, offers a complete suite of functions for discretizing a wide range of differential operators related to important physical problems and uses basis functions of arbitrary polynomial degree that allow the construction of methods of high accuracy. These latter, though, are based on the IsoGeometric Analysis Method which, although very powerful and often better performing, is less widely known and adopted than the Finite Elements Method. The implementation of a general purpose library of Finite Elements seems therefore a valuable addition to Octave-Forge. Two possible interesting choices for implementing this package exist, the first consists of implementing the most common Finite Element spaces in the GeoPDEs framework, which is possible as IsoGeometric Analysis can be viewed as a superset of the Finite Element Method, the other is to construct Octave language bindings for the free software library FEniCS based on the existing C++ or Python interfaces.

### Improve logm, sqrtm, funm

The goal here is to implement some missing Matlab functions related to matrix functions like the matrix exponential. There is a general discussion of the problem.

### Generalised eigenvalue problem

Certain calling forms of the `eig` function are missing. The problem is to understand what those missing forms are and implement them.

### Various sparse matrix improvements

The implementation of sparse matrices in Octave needs several improvements. Any of these would be good. The paper by Bateman & Adler is good reading for understanding the sparse matrix implementation.

### Implement solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D

The project will deliver a solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D similar to Matlab's function `pdepe`. A good starting point is the method of lines for which you can find more details here and here, whereas an example implementation can be found here. In addition, this page provides some useful material.

### Implement solver for 1D nonlinear boundary value problems

The project will complete the implementation of the bvp4c solver that is already available in an initial version in the odepkg package by adding a proper error estimator and will implement a matlab-compatible version of the bvp5c solver. Details on the methods to be implemented can be found in this paper on bvp4c and this paper on bvp5c. Further details are available in this book.

### Geometric integrators for Hamiltonian Systems

| Geometric (AKA Symplectic) integrators are useful for multi-dimensional classical mechanics problems and for molecular dynamics simulations. The odepkg package has a number of solvers for ODE, DAE and DDE problems but none of them is currently specifically suited for second order problems in general and Hamiltonian systems in particular. Therefore a new package for geometric integrators would be a useful contribution. This could be created as new package or added as a set of new functions for odepkg. The function interface should be consistent throughout the package and should be modeled to follow that of other functions in odepkg (or that of DASPK and LSODE) but will need specific extensions to accommodate for specific options that only make sense for this specific class of solvers. An initial list of methods to be implemented includes (but is not limited to)

- Symplectic Euler methods, see here and | here
- Störmer-Verlet method, see here and | here
- Velocity Verlet method, see here and | here
- Symplectic partitioned Runge-Kutta methods, see here or here
- Spectral Variational Integrator methods, see here or here

For this latter there is an existing code which is already working but needs to be improved, posted on the patch tracker. Furthermore, methods to implement solutions of problems with rigid constraints should be implemented, e.g.

**Potential mentor:** Mattia Penati, Edie Miglio, Carlo de Falco

### Matlab-compatible ODE solvers in core-Octave

- Adapt "odeset" and "odeget" from the odepkg package so that the list of supported options is more Matlab-compatible, in the sense that all option names that are supported by Matlab should be available. On the other hand, Matlab returns an error if an option which is not in the list of known options is passed to "odeset", but we would rather make this a warning in order to allow for special extensions, for example for symplectic integrators.
- Adapt the interface of "ode45" in odepkg to be completely Matlab compatible, fix its code and documentation style and move it to Octave-core.
- Build Matlab compatible versions of "ode15s" and "ode15i". jwe has prototype implementations [1] of these built as wrappers to "dassl" and "daspk". An initial approach could be to just improve these wrappers, but eventually it would be better to have wrappers for "IDA" from the sundials library.
- Implement Matlab compatible versions of "deval".

**Potential mentor:** Sebastian Schöps, Carlo de Falco

## GUI

Octave is currently working on a new native GUI. It is written in Qt, but it is still not ready for production. There are various ways in which it could be improved.

**Required skills**: C++ and Qt. Whatever tools you want to use to write Qt code are fine, but Qt Creator is a popular choice nowadays.

**Difficulty**: Mostly medium, depending if you've had Qt or GUI development experience before.

**Potential mentor**: Jordi Gutiérrez Hermoso, Michael Goffioul, Torsten

### Finish the Octave GUI

The GUI is currently on its own branch in hg. It is not stable enough and its design is still in flux. It is in a very alpha stage and needs to be turned into a real usable product. At the moment, it consists of the basic building blocks (terminal window, editor, variable browser, history, file browser) that are put together into a main interface. The GUI uses the Qt library. Among the things to improve are:

- improve integration with octave: variable browser/editor, debugger, profiler...
- define and implement an option/preferences dialog
- improve additional components like the documentation browser

### Implement a Qt widget for manipulating plots

Octave has had for some time a native OpenGL plotter. The plotter requires some user interaction for manipulating the plots, and it's been using fltk for quite some time. We want to replace this with Qt, so it fits better with the overall GUI look-and-feel and is easier to extend in the future.

QtHandles is a current work in progress integrating the octave OpenGL renderer plus good support for GUI elements (uicontrol, uimenu, uitoolbar...). This project may initially consists of integrating the existing QtHandles code base into Octave. Then if time permits, further improvements can be made to QtHandles.

### Create a better (G)UI for the profiler

During GSoC 2011, Daniel Kraft successfully implemented a profiler for Octave. It needs a better interface and a way to generate reports. This may be done with Qt, but not necessarily, and HTML reports might also be good.

### Create a graphical design tool for tuning closed loop control system (control pkg)

When tuning a SISO feedback system it is very helpful to be able to grab a pole or a zero and move them by dragging them with the mouse. As they are moving the software must update all the plotted lines. There should be the ability to display various graphs rlocuse, bode, step, impulse etc. and have them all change dynamically as the mouse is moving. The parameters of the compensator must be displayed and updated. Potential mentor: Doug Stewart

## Graphics

Octave has a new native OpenGL plotter (currently via fltk, but we want to move away from that). There are several possible projects involved with it.

**Required skills**: C++ and OpenGL. General understanding of computer graphics.

**Difficulty**: Medium, depending on your previous understanding of the topic.

**Potential mentor**: Michael Goffioul

### Lighting

Implement transparency and lighting in OpenGL backend(s). A basic implementation is available in JHandles. This needs to be ported/re-implement/re-engineered/optimized in the C++ OpenGL renderer of Octave.

### Object selection in OpenGL renderer

This project is about the implementation of a selection method of graphics elements within the OpenGL renderer [2]

### Non-OpenGL renderer

Besides the original gnuplot backend, Octave also contains an OpenGL-based renderer for advanced and more powerful 3D plots. However, OpenGL is not perfectly suited for 2D-only plots where other methods could result in better graphics. The purpose of this project is to implement an alternate graphics renderer for 2D only plots (although 3D is definitely not the focus, extending the new graphics renderer to support basic 3D features should also be taken into account). There is no particular toolkit/library that must be used, but natural candidates are:

- Qt: the GUI is currently written in Qt and work is also in progress to provide a Qt/OpenGL based backend [3]
- Cairo: this library is widely used and known to provides high-quality graphics with support for PS/PDF/SVG output.

### TeX/LaTeX markup

Text objects in plots (like titles, labels, texts...) in the OpenGL renderer only support plain text mode without any formatting possibility. Support for TeX and/or LaTeX formatting needs to be added.

- The TeX formatting support actually only consists of a very limited subset of the TeX language. This can be implemented directly in C++ into Octave by extending the existing text engine, avoiding to add a dependency on a full TeX system. Essentially, support for Greek letters, super/sub-scripts, and several mathematical symbols needs to be supported. For example,

\alpha \approx \beta_0 + \gamma^\chi

- Would be rendered as,

- α ≈ β
_{0}+ γ^{χ}

- This is analogous to how special characters may be included in a wiki using html.

α ≈ β<sub>0</sub> + γ<sup>χ</sup>

- The text object's
`extent`

for the rendered result needs to be calculated and the text placed the location specified by the text object's`position`

property. An itemized list of a text objects properties can be found here.

- On the other hand, the LaTeX formatting support is expected to provide full LaTeX capabilities. This will require to use an external LaTeX system to produce text graphics in some format (to be specified) that is then integrated into Octave plots.

- The matplotlib project has already done this in Python and might be used as an example of how to do this in Octave. Mediawiki has also also done something similar.

## Interpreter

The interpreter is written in C++, undocumented. There are many possible projects associated with it.

**Required skills**: *Very good* C and C++ knowledge, possibly also understanding of GNU bison and flex. Understanding how compilers and interpreters are made plus being able to understand how to use a profiler and a debugger will probably be essential skills.

**Difficulty**: Mid hard to very hard. Some of the biggest problems will probably be the interpreter.

**Potential mentors**: John W. Eaton, Jordi Gutiérrez Hermoso, Max Brister.

### Improve JIT compiling

Octave's interpreter is *very* slow on some loops. Last year, thanks to Max Brister's work, an initial implement of a just-in-time compiler (JITC) in LLVM for GSoC 2012. This project consists in understanding Max's current implementation and extending it so that functions and exponents (e.g. 2^z) compile with the JITC. This requires knowledge of compilers, C++, LLVM, and the Octave or Matlab languages. A capable student who demonstrates the ability to acquire this knowledge quickly may also be considered. Max himself will mentor this project. Here is Max's OctConf 2012 presentation about his current implementation.

### Improve memory management

From profiling the interpreter, it appears that a lot of time is spending allocating and deallocating memory. A better memory management algorithm might provide some improvement.

### Implement classdef classes

Matlab has two kinds of classes: old style @classes and new style classdef. Octave has only fully implemented the old style. There is partial support for new classes in our classdef branch. There is irregular work here, and classdef is a very complicated thing to fully implement. A successful project would be to implement enough of classdef for most basic usages. Familiarity with Matlab's current classdef support would be a huge plus. Michael Goffioul and jwe can mentor this.

## Infrastructure

There are several projects closely related to Octave but not exactly core Octave that could be worked on. They are mostly infrastructure around Octave, stuff that would help a lot.

**Required skills**: Various. See below.

**Difficulty**: Various. See below.

**Potential mentor**: Jordi Gutiérrez Hermoso, Carlo de Falco

### Finish the Agora website

In 2009, the Mathworks decided to restrict the terms of use Matlab Central, a place dedicated to Matlab collaboration. The Mathworks forbade copyleft licenses and using the "free" code found in Matlab central on anything other than Mathworks products (e.g. forbidding from using it on Octave, even if the authors of the code wanted to allow this). Thus Octave users have no place to centrally, quickly, and conveniently share Octave code. See the FAQ for more details.

In response to this, a website started to form, Agora Octave.

This should be relatively easy webdev in Python using Django.

Things to be considered when working on this:

- discussion of Agora during OctConf2012
- Scipy Central - a website with the same objective as Agora for Scipy. Their code is released under a BSD license. Might be useful to reuse some parts.

Most of the basic functionality of Agora is already in, but there are many ways in which it could be improved, such as implementing comment threads, giving it an email interface, or a ReSTful API which could be used from Octave for package management.

### Improve binary packaging

We would like to be able to easily generate binary packages for Windows and Mac OS X. Right now, it's difficult and tedious to do so. Any way to help us do this in a faster way would be appreciated. Required knowledge is understanding how building binaries in Windows and Mac OS X works. Our current approach to fixing this is to cross-compile from a GNU system using MXE or GUB.

**Skills Required**: Knowledge of GNU build systems, Makefiles, configure files, chasing library dependencies, how to use a compiler. If you choose to work on GUB, Python will be required. No m-scripting or C++ necessary, beyond understanding the C++ compilation model.

**Difficulty**: Medium to easy. You need to understand how build systems work and how to fix packages when they don't build.

**Possible mentors**: John W. Eaton or Jordi Gutiérrez Hermoso

### Installation of packages

We would like to enhance the management of Octave-forge packages from within Octave environment. Currently there is a working (but rather monolithic) function that is used to do the job. The work would be to improve the way Octave interacts with the package server. Since the functionality is already sketched by the current function, the most important skill is software design.

**Minimum requirements**: Ability to read and write Octave code. Minimal FTP/HTTP knowledge.

**Difficulty**: Easy

## Octave-Forge packages

### Rewrite symbolic package

Octave's current symbolic package for symbolic computation is outdated, fragile and limited in its capabilities. The new symbolic package should offer better Matlab compatibility, for example handling of symbolic matrices. Like the current symbolic package, the new package could use the proven GiNaC library for symbolic computations.

The work would be to integrate GiNaC by using Octave's objects and classes. This can be done in C++ in a way similar to Michele Martone's new sparsersb package.

This idea has not been selected by any SoC student yet, if you want to see it happen before next SoC you can offer a bounty here.

**Required skills**: C++. Ability to understand Octave and GiNaC API documentation.

**Difficulty**: medium.

**Potential mentor**: Lukas Reichlin

### Improvements to n-dimensional image processing

The image package has partial functionality for n-dimensional images. These images do exist in practice for example in medical imaging where slices from scans are assembled to form anatomical 3d images, or even exposures taken over time on different wavelengths can result in 5d images. All of the base functions should be modified so that they can handle n-dimensional images, and corresponding Matlab functions such as `bwconncomp`

or n-dimensional version of `bwdist`

should be implemented. In addition,
the core functions `imwrite`

and `imread`

need to be adjusted to deal with this type images (usually multipage TIFF).

**Required skills**: Mostly m-file scripting, perhaps some C++. Familiarity with common CS algorithms would be useful.

**Difficulty**: medium.

**Potential mentor**: Jordi Gutiérrez Hermoso

### Interface to Electronic Circuit Simulator

Qucs is a C++ based circuit simulation package. This project aims to create an interface to the Qucs algorithms to allow the transient, i.e. time series, simulation of circuits in Octave within a larger ODE system simulation, and possibly make other analysis types available directly from Octave. The C++ interface would be based on handle class syntax currently in development in the `classdef`

branch of the repository. This method has already been successfully tested on other projects, and examples of this type of interface are available (e.g. here and here).

**Required skills**: C++ and m-file scripting. Familiarity with new classdef syntax would be useful. May require some modification/adaptation of the Qucs sources. Familiarity with the Octave ODE solvers useful but not essential.

**Difficulty**: medium.

**Potential mentor**: Richard Crozier

**Main Goals**

- Create an Octave circuit class which can load and parse a Qucs circuit netlist
- Create class methods with functionality similar to the
`trsolver`

C++ class methods in Qucs, i.e with the ability to call the DC solution code, and transient solution code at each time step. - Create a method of accessing the current circuit solution values in Octave at each time step.

**Bonus Goals**

- Create new circuit elements which allow Octave to apply voltages and currents during a circuit simulation.

### Fix audio processing

Audio processing is currently almost completely broken in Octave. It currently only works with Linux's Open Sound System, which most Linux installations don't use anymore. We therefore need a modern, cross-platform way to play and record audio. This could be part of the Octave-Forge audio package, but the core audio functions themselves are also lacking. We need this to work across OSes, so an external audio library should be used. Portaudio or rtaudio seem like a mature possibility. The core `play`

and `record`

functions should be fixed to use an external audio library, and in addition, the `audiorecorder`

and `audioplayer`

classes should be implemented.

**Required skills**: C++ and probably at least a superficial understanding of signal or audio processing.

**Difficulty**: Medium, depending on the abilities of the student.

**Possible mentors**: Pantxo Diribarne, Mike Miller

### Color management functions in image package

The goal is to implement these functions:

iccread iccwrite makecform applycform

These functions are useful for color management, in particular for converting data (especially images) between color spaces. ICC profiles are essentially used to store look-up tables or matrix transforms (or both) that define the conversions. For example, to convert an CMYK image to sRGB, you would load a "print" ICC profile that defines the conversion from CMYK to L*a*b* (the CIE color space that is supposed to match the human visual system), then load another profile that defines the conversion from L*a*b* to sRGB (there is a standard profile for this conversion (IEC 61966-2-1), which is why Matlab has a built-in conversion from sRGB to L*a*b*). To do the above conversions in Matlab, you would use the following code:

```
cmykImage = double(imread('cmyk-image-filename.tif'));
iccProfile = iccread('icc-profile-filename.icc');
labImage = applycform(cmykImage, makecform('clut', iccProfile, 'AToB3'));
rgbImage = applycform(labImage, makecform('lab2srgb'));
```

The `'AToB3'`

selects one of the color transforms (look-up tables) contained in the profile. This one is "Absolute Colorimetric." More details on ICC profiles may be obtained from the ICC spec.

Knowledge of ICC profiles (at least knowledge of their application) would be a prerequisite. Since littlecms implements all the necessary functions for reading, writing, and applying profiles, it would be primarily a matter of integrating this library into Octave (assuming that is the preferred implementation -- one could certainly read the ICC files directly, but why reinvent that particular wheel).

**Required skills**: C++ programming, some knowledge of ICC profiles desirable.

**Difficulty**: Easy.

**Possible Mentor**: Patrick Noffke <patrick.noffke@gmail.com>

### High Precision Arithmetic Computation

The Linear Algebra Fortran libraries used by Octave make use of of single (32 bits) and double (64 bits) precision floating point numbers. Many operations are stopped when matrices condition number goes below 1e-16: such matrices are considered as ill-conditionned. There are cases where this is not enough, for instance simulations implying chemical concentrations covering the range 10^4 up to 10^34. There are a number of ways to increase the numerical resolution, like f.i. make use of 128 bits quadruple precision numbers available in GFortran. A simpler option is to build an interface over Gnu MPL arbitrary precision library, which is used internally by gcc and should be available on any platform where gcc runs. Such approach has been made available for MatLab under the name mptoolbox and is licensed under a BSD license. The author kindly provided a copy of the latest version and agreed to have it ported under Octave and re-distributed under GPL v3.0

The architecture consists of an Octave class interface implementing "mp" (multi-precision) objects. Arithmetic operations are forwarded to MPL using MEX files. This is totally transparent to the end user, except when displaying numbers. This implementation needs to be ported and tested under Octave.

**Required skills**: Octave classes and object programming. C for understanding the MEX glue code.

**Difficulty**: medium.

**Potential mentor**: Pascal Dupuis

# HG Procedures for students and mentors

This page describes the procedures students are expected to use to publicly display their progress in a public mercurial repo during their work.

This page describes what mentors should do to review their work.